viewpoint-particle

Author Topic: annoying beep  (Read 197 times)

pguild

  • Newbie
  • *
  • Posts: 47
  • The dog is always right!
    • MasteryLearning
annoying beep
« on: March 17, 2022, 07:50:37 am »
How do I turn off the beep that happens automatically with a pause command as in PAUSE("CONTINUE?","CLICK OK TO CONTINUE")

td

  • Tech Support
  • *****
  • Posts: 4094
    • WinBatch
Re: annoying beep
« Reply #1 on: March 17, 2022, 09:31:15 am »
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

  • Tech Support
  • *****
  • Posts: 4094
    • WinBatch
Re: annoying beep
« Reply #2 on: March 17, 2022, 09:53:46 am »
A rough example of using DllCall to display a message box:

Code: Winbatch
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

  • Newbie
  • *
  • Posts: 47
  • The dog is always right!
    • MasteryLearning
Re: annoying beep
« Reply #3 on: March 17, 2022, 10:19:42 am »
Thanks. i rolled my own with the dialog editor and it works great.