Post by metro on Mar 31, 2018 5:54:36 GMT -5
query from fox
xx Confirm statement with 3 buttons or more
« Thread started on: Feb 13th, 2017, 12:07pm »
Hi all.
I am wondering how it is possible to create a confirm statement with 3 buttons/options (or more) like LB displays when we attempt to end it without we save current changes.
Thanks a lot to all for any help and bye.
fox
xx Confirm statement with 3 buttons or more
« Thread started on: Feb 13th, 2017, 12:07pm »
Hi all.
I am wondering how it is possible to create a confirm statement with 3 buttons/options (or more) like LB displays when we attempt to end it without we save current changes.
Thanks a lot to all for any help and bye.
fox
'Custom Message Boxes using API calls
mbflags = _MB_ABORTRETRYIGNORE or _MB_ICONSTOP
'This variable holds the flags. These are the buttons
'and the icon. If no icon is specified, then there
'won't be an icon. The icon does not have to match
'the buttons. Therefore, I could replace the
'_MB_ICONSTOP with _MB_ICONINFORMATION to get a weird
'looking message box.
'Some _MB_ codes:
'Buttons:
'_MB_ABORTRETRYIGNORE
'_MB_YESNO
'_MB_OKCANCEL
'_MB_YESNOCANCEL
'_MB_OK
'_MB_RETRYCANCEL
'Icons:
'_MB_ICONINFORMATION
'_MB_ICONEXCLAMATION
'_MB_ICONQUESTION
'_MB_ICONSTOP
'0 'No icon
calldll #user32, "MessageBeep", _MB_ICONSTOP as long, beepResult as boolean
'^^Replace _MB_ICONSTOP with whatever flag you want the sound to be.^^
calldll #user32, "MessageBoxA", _
0 as long, _ 'Always 0. Sorry, I don't know why.
"FATAL ERROR!" as ptr, _ 'The message. Cannot be broken up with vars or characters. If you need this, then make a variable with the message, and then use the variable in the API call.
"ERROR!" as ptr, _ 'The title. Same rules as the message ^.
mbflags as long, _ 'The flags. Remember? Way up there!
mbResult as long 'The result var, which permits you to find out which button was pressed.
IF mbResult = 3 then print "Aborted!"
end
'mbResult CODES: 1=ok 2=cancel 3=abort 4=retry 5=ignore 6=yes 7=no
'^ These codes tell you what the contents of the mbResult var mean. For example,
'1 would mean the user clicked OK.
'--------------------------------------------------------------------------------'
'Fancy About Box
'Thanks to Alyce Watson, Newsletter #140, for this code.
szApp$="About MyProg # MyProg v BETA"
cr$ = chr$(13) 'carriage return
szOtherStuff$ = cr$ + "Created by and Copyright ";chr$(169);" F. F. Quisenberry" + cr$
hIcon=0 'This is if you want to specify an icon. View Newsletter #140 for info.
hWnd=0 'This can indicate a parent window, thhe windows handle of which can
'be found with HWND()
calldll #shell32, "ShellAboutA",_
hWnd as ulong,_
szApp$ as ptr,_
szOtherStuff$ as ptr,_
hIcon as ulong,_
ret as long