Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.183 Beiträge
 
Delphi 12 Athens
 
#7

AW: Problem mit MessageboxTimeout

  Alt 10. Apr 2012, 10:13
noch kürzer
Delphi-Quellcode:
const LibLang = {$IFDEF UNICODE}'W'{$ELSE}'A'{$ENDIF}; // wenn man das öfters mal braucht

function MessageBoxTimeOut(hWnd: HWND; lpText, lpCaption: PChar;
  uType: UINT; wLanguageId: WORD; dwMilliseconds: DWORD): Integer; stdcall;
  external user32 name 'MessageBoxTimeout' + LibLang;
function MessageBoxTimeOutA(hWnd: HWND; lpText, lpCaption: PAnsiChar;
  uType: UINT; wLanguageId: WORD; dwMilliseconds: DWORD): Integer; stdcall;
  external user32;
function MessageBoxTimeOutW(hWnd: HWND; lpText, lpCaption: PWideChar;
  uType: UINT; wLanguageId: WORD; dwMilliseconds: DWORD): Integer; stdcall;
  external user32;
Man kann es sogar verpascalen. (wenn man weiß wie die Strings intern arbeiten)
Delphi-Quellcode:
function MessageBoxTimeOut(OwnerWindow: HWND; const Text, Caption: string;
  MType: LongWord; LanguageID: Word; Milliseconds: LongWord): Integer; stdcall;
  external user32 name 'MessageBoxTimeout' + LibLang;
function MessageBoxTimeOutA(OwnerWindow: HWND; const Text, Caption: AnsiString;
  MType: LongWord; LanguageID: Word; Milliseconds: LongWord): Integer; stdcall;
  external user32;
function MessageBoxTimeOutW(OwnerWindow: HWND; const Text, Caption: {$IFDEF UNICODE}UnicodeString{$ELSE}WideString{$ENDIF};
  MType: LongWord; LanguageID: Word; Milliseconds: LongWord): Integer; stdcall;
  external user32;
Zitat:
Nein, der Compiler weißt sie nicht auf das Problem hin
Du hast dann bestimmt sowas erwischt:

PChar und dann ein ...A
http://delphi.about.com/od/adptips20...ltip1004_5.htm
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests

Geändert von himitsu (10. Apr 2012 um 11:14 Uhr)
  Mit Zitat antworten Zitat