Les Snippets

Connexion

MessageBox Temporaire

Niveau requis pour utiliser/comprendre cette source : 1 ( Débutant )
Créé le 27/07/2010 16:25:06 et initié par cirec [Liste]
Date de mise à jour : 31/07/2010 18:03:16
Vue : 3392
Catégorie(s) : API, Système
Langages dispo pour ce code :
- Delphi 5



Langage : Delphi 5
Date ajout : 27/07/2010
Posté par cirec [Liste]
DateMAJ : 31/07/2010
const 
  MB_TIMEDOUT       = $7D00; 
 
function MessageBoxTimeOut(hWnd: HWND; lpText: PChar; lpCaption: PChar; uType: 
  UINT; wLanguageId: WORD; dwMilliseconds: DWORD): Integer; stdcallexternal 
  user32 name 'MessageBoxTimeoutA'; 
 
implementation 
 
 
procedure TForm1.Button1Click(Sender: TObject); 
var 
  BoxResult : Integer; 
  BoxFlags  : Integer; 
begin 
  BoxFlags := MB_YESNO or MB_SETFOREGROUND or MB_SYSTEMMODAL or 
    MB_ICONINFORMATION; 
  BoxResult := MessageBoxTimeout(Application.Handle, 
                 'Ce message se fermera au bout de 5 secondes.', 
                 'Teste', BoxFlags, 05000); 
  case BoxResult of 
    IDYES: 
      ShowMessage('Oui'); 
    IDNO: 
      ShowMessage('Non'); 
    MB_TIMEDOUT: 
      ShowMessage('Temps écoulé'); 
  end; 
end; 

Remarque :
http://delphi.about.com/od/adptips2004/a/bltip1004_5.htm
http://edn.embarcadero.com/article/32736