annoying beep

Started by pguild, March 17, 2022, 07:50:37 AM

Previous topic - Next topic

pguild

How do I turn off the beep that happens automatically with a pause command as in PAUSE("CONTINUE?","CLICK OK TO CONTINUE")

td

The "beep" is more or less something controlled by the OS. You do have several alternatives to using the "Pause" function. You could roll your own by creating a WIL Dialog, use the DllCall function to make a call to the Win32 API function "MessageBox" with parameters of your choice, or use the Box functions to create one. There are several examples of the latter in the Tech Database. Finally, you could use the WILX extender's "xMessageBox" function to configure a message box that does not "beep". The "beep" is caused by the  MB_ICONEXCLAMATION  style on many systems so don't bitwise "or" (|) the number 48 with other style parameter values.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

A rough example of using DllCall to display a message box:

Code (winbatch) Select

strMsgTitle = "MessageBox test"
strMsgText = "Are you having fun?"
MB_OKCANCEL = 1
nResult = DllCall (DirWindows (1):"User32.dll", long :"MessageBoxA", long:DllHwnd (""), lpstr:strMsgText, lpstr:strMsgTitle, long:MB_OKCANCEL)
exit
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

pguild

Thanks. i rolled my own with the dialog editor and it works great.