//--> Css-WebTasarim.Tr.Gg Yarışması

Delphi Dersleri

Application Messagebox Kullanimi

Ekleyen: esentepeli
3. Dersi

Application.Messagebox Kullanımını işleyelim. Kütüphane: Forms Orjinal Function:

function TApplication.MessageBox(const Text, Caption: PChar; Flags: Longint): Integer;
var
ActiveWindow, TaskActiveWindow: HWnd;
WindowList: Pointer;
MBMonitor, AppMonitor: HMonitor;
MonInfo: TMonitorInfo;
Rect: TRect;
FocusState: TFocusState;
begin
ActiveWindow := ActiveFormHandle;
if ActiveWindow = 0 then
TaskActiveWindow := Handle
else
TaskActiveWindow := ActiveWindow;
MBMonitor := MonitorFromWindow(ActiveWindow, MONITOR_DEFAULTTONEAREST);
AppMonitor := MonitorFromWindow(Handle, MONITOR_DEFAULTTONEAREST);
if MBMonitor <> AppMonitor then
begin
MonInfo.cbSize := Sizeof(TMonitorInfo);
GetMonitorInfo(MBMonitor, @MonInfo);
GetWindowRect(Handle, Rect);
SetWindowPos(Handle, 0,
MonInfo.rcMonitor.Left + ((MonInfo.rcMonitor.Right - MonInfo.rcMonitor.Left) div 2),
MonInfo.rcMonitor.Top + ((MonInfo.rcMonitor.Bottom - MonInfo.rcMonitor.Top) div 2),
0, 0, SWP_NOACTIVATE or SWP_NOREDRAW or SWP_NOSIZE or SWP_NOZORDER);
end;
WindowList := DisableTaskWindows(ActiveWindow);
FocusState := SaveFocusState;
if UseRightToLeftReading then Flags := Flags or MB_RTLREADING;
try
Result := Windows.MessageBox(TaskActiveWindow, Text, Caption, Flags);
finally
if MBMonitor <> AppMonitor then
SetWindowPos(Handle, 0,
Rect.Left + ((Rect.Right - Rect.Left) div 2),
Rect.Top + ((Rect.Bottom - Rect.Top) div 2),
0, 0, SWP_NOACTIVATE or SWP_NOREDRAW or SWP_NOSIZE or SWP_NOZORDER);
EnableTaskWindows(WindowList);
SetActiveWindow(ActiveWindow);
RestoreFocusState(FocusState);
end;
end;

 

Parametreleri [Buttonlar]

-> MB_OK => Tamam
-> MB_OKCANCEL => Tamam - İptal
-> MB_ABORTRETRYIGNORE => Bitir - Tekrar Dene - Yoksay
-> MB_YESNOCANCEL => Evet - Hayır - İptal
-> MB_YESNO => Evet - Hayır
-> MB_RETRYCANCEL => Tekar Dene - iptal


Parametreleri [Iconlar]
Delphi 2007'deki sıraya göre arkadaşlar, Delphi 7'de sanırım daha azdı

MB_ICONHAND
Önizleme:


MB_ICONQUESTION
Önizleme:


MB_ICONEXCLAMATION
Önizleme:


MB_ICONASTERISK
Önizleme:


Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol