UnderwareDESIGN

PlayBASIC => Resources => Source Codes => Topic started by: empty on June 12, 2004, 10:59:01 AM

Title: MessageBox Library
Post by: empty on June 12, 2004, 10:59:01 AM
[pbcode]
;---------------------------------------------------------------------


// FLAGS
Constant MB_ABORTRETRYIGNORE   = 2   // The message Box contains three Push buttons: Abort, Retry, And Ignore.
Constant MB_OK      = 0   // The message Box contains one Push button: OK. This is the default.
Constant MB_OKCANCEL    = 1   // The message Box contains two Push buttons: OK And Cancel.
Constant MB_RETRYCANCEL     = 5   // The message Box contains two Push buttons: Retry And Cancel.
Constant MB_YESNO       = 4   // The message Box contains two Push buttons: Yes And No.
Constant MB_YESNOCANCEL     = 3   // The message Box contains three Push buttons: Yes, No, And Cancel.

Constant MB_ICONWARNING     = 48  // An exclamation-Point icon appears in the message box.
Constant MB_ICONINFORMATION   = 64  // An icon consisting of a lowercase letter i in a Circle appears in the message box.
Constant MB_ICONQUESTION  = 32  // A question-mark icon appears in the message box.
Constant MB_ICONSTOP    = 16  // A stop-sign icon appears in the message box.

Constant MB_DEFBUTTON1     = 0   // The first button is the Default button. MB_DEFBUTTON1 is the Default unless MB_DEFBUTTON2, MB_DEFBUTTON3, Or MB_DEFBUTTON4 is specified.
Constant MB_DEFBUTTON2     = 256 // The second button is the Default button.
Constant MB_DEFBUTTON3     = 512 // The third button is the Default button.
Constant MB_DEFBUTTON4     = 768 // The fourth button is the Default button.

// RESULT
Constant IDABORT       = 3   // Abort button was selected.
Constant IDCANCEL       = 2   // Cancel button was selected.
Constant IDIGNORE       = 5   // Ignore button was selected.
Constant IDNO      = 7   // No button was selected.
Constant IDOK      = 1   // OK button was selected.
Constant IDRETRY       = 4   // Retry button was selected.
Constant IDYES      = 6   // Yes button was selected.

   
Function MessageBox(Caption$, Text$, Flags)
   MsgDLL = GetFreeDll()
   LoadDll "user32.dll",MsgDLL
   result = CallDll(MsgDLL,"MessageBoxA",0,Text$,Caption$,Flags+8192)
   DeleteDLL MsgDLL
EndFunction result
   



// DEMO --------------------------------------------------------------------------------
click = MessageBox("Test","Hello World",MB_YESNOCANCEL+MB_ICONQUESTION+MB_DEFBUTTON3)
Select Click
   Case IDYES: Print "YES!"
   Case IDNO:  Print "NO!"
   Case IDCANCEL: Print "CANCEL!"
EndSelect
Sync
WaitKey
END
// END DEMO --------------------------------------------------------------------------------
[/pbcode]



Related To:

      - [plink] Windows File Dialogs Library (http://www.underwaredesign.com/forums/index.php?topic=4207.0)[/plink]

      - [plink]PlayDialogs Library (http://www.underwaredesign.com/forums/index.php?topic=4188.0)[/plink]