Instead of "Yes", "No" etc default MessageBox buttons we can set a simple windows hook and change their text
Code: Select all
Global hHook.l
Procedure.l HookProc(lMsg.l, wParam.l, lParam.l)
If lMsg = #HCBT_ACTIVATE
SetWindowText_ (GetDlgItem_(wParam, #IDYES), "Male")
SetWindowText_ (GetDlgItem_(wParam, #IDNO), "Female")
UnhookWindowsHookEx_ (hHook)
EndIf
EndProcedure
;Have to call this is we havent already created a window
InitCommonControls_()
hHook = SetWindowsHookEx_(#WH_CBT, @HookProc(), GetModuleHandle_(0), GetCurrentThreadId_())
MsgReply.l = MessageBox_(#HWND_DESKTOP, "What is your gender?", "Custom Msgbox", #MB_YESNO + #MB_ICONINFORMATION)
Select MsgReply
Case #IDYES
MessageRequester("Result", "You clicked Male")
Case #IDNO
MessageRequester("Result", "You clicked Female")
EndSelect
Another example using ABORTRETRYIGNORE for 3 buttons (you can also use YESNOCANCEL but caveat of that is the "X" Close button is enabled and clicking that is the same as clicking Cancel)
Code: Select all
Global hHook.l
Procedure.l HookProc(lMsg.l, wParam.l, lParam.l)
If lMsg = #HCBT_ACTIVATE
SetWindowText_ (GetDlgItem_(wParam, #IDABORT), "Male")
SetWindowText_ (GetDlgItem_(wParam, #IDRETRY), "Female")
SetWindowText_ (GetDlgItem_(wParam, #IDIGNORE), "Other")
UnhookWindowsHookEx_ (hHook)
EndIf
EndProcedure
;Have to call this is we havent already created a window
InitCommonControls_()
hHook = SetWindowsHookEx_(#WH_CBT, @HookProc(), GetModuleHandle_(0), GetCurrentThreadId_())
MsgReply.l = MessageBox_(#HWND_DESKTOP, "What is your gender?", "Custom Msgbox", #MB_ABORTRETRYIGNORE + #MB_ICONINFORMATION)
Select MsgReply
Case #IDABORT
MessageRequester("Result", "You clicked Male")
Case #IDRETRY
MessageRequester("Result", "You clicked Female")
Case #IDIGNORE
MessageRequester("Result", "You clicked Other")
EndSelect