dingless requester

Just starting out? Need help? Post your questions and find answers here.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

dingless requester

Post by netmaestro »

Anybody know how to do this?
Last edited by netmaestro on Tue Feb 21, 2006 7:24 pm, edited 2 times in total.
BERESHEIT
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: dingless requester

Post by traumatic »

What is a dingless requester?
Good programmers don't comment their code. It was hard to write, should be hard to read.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

A messagerequester that does not play the system asterisk sound when it displays. A silent one.
Last edited by netmaestro on Tue Feb 21, 2006 7:25 pm, edited 2 times in total.
BERESHEIT
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

The ding is in the user's preferences. You should respect the user's preferences. Personally I've turned it off because I think it's really annoying, but that doesn't mean everyone thinks that, and that's the reason we have preferences which the application shouldn't interfere with.

Start -> Settings -> Control Panel -> Sounds and Sound Devices -> Sounds -> *turn off whatever you want to turn off*
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

Ah I see! Systemsounds are the first thing I turn off whenever I install an
OS, that's why I couldn't even remember there was a "ding".. ;) Thx.

There is a registry entry that you could try changing (and re-creating the
original entry afterwards) but I don't know if this needs a reboot nor do
I know the supported OS'...

There's "Beep" and "ExtendedSound" in "HKEY­_CURRENT_USER\Control Panel\Sound".
Set both of them to "No".
Good programmers don't comment their code. It was hard to write, should be hard to read.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: dingless requester

Post by PB »

There's code here to mute the system volume, so mute, show the requester,
and unmute again? :) No other programmatic way around it.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: dingless requester

Post by netmaestro »

Perhaps, but you're waving a red flag at a bull saying it isn't possible...
Last edited by netmaestro on Tue Feb 21, 2006 7:25 pm, edited 2 times in total.
BERESHEIT
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

create a small window and put some buttons on it... no ding...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Yes, I may have to do that. It's just more work than a one-line requester that has a flag I can set so it doesn't ding.
Last edited by netmaestro on Tue Feb 21, 2006 7:26 pm, edited 2 times in total.
BERESHEIT
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

You might find something useful in this idea I picked up and modified from the forum, original writers in the code.

Maybe you could modifiy it for your use.

Code: Select all

; SplashMessage - by TerryHough - May 28, 2004

Procedure SplashMessage(timer)
  ; ---------------------------------------------------
  ; Display a timed Message Window
  ;
  ; The following code is based on an "ToolWindow" example by Vanleth and PB.
  ;
  ; This is used to create a pseudo MessageRequester that optionally
  ; times out and then disappears.  Since MessageRequester has no
  ; automatic removal option, this could be very useful.  If the time
  ; parameter is negative, it displays an Continue button and waits.
  ; Include text or graphics as desired.
  ;
  ; Useful for an About message display.
  ; ---------------------------------------------------
  ; Load an image
  CatchImage(1, ?EmbeddedImage)  ; catch the embedded image from memory
  ; ---------------------------------------------------
  #SM_WinID = 9888
  ; Create the window to display
  If OpenWindow(#SM_WinID,0,0,399,261,#PB_Window_WindowCentered|#PB_Window_Invisible,"Whatever title you want")
    CreateGadgetList(WindowID())              ; Create gadgets in the window.
    FontID.l = LoadFont(9889, "Arial", 18, #PB_Font_Bold) ; Load a font
    FontID.l = LoadFont(9890, "Arial", 12, #PB_Font_Bold) ; Load a font
    TextGadget (101,  1,  05, 399, 30, "Say Something", #PB_Text_Center)
    SetGadgetFont(101, UseFont(9889))            ; Set default font
    TextGadget (102,  46,  40, 300, 20, "Written by:  Billy Bob", #PB_Text_Center)
    SetGadgetFont(102, UseFont(9890))            ; Set default font
    TextGadget (104,  46,  74, 300, 20, "Powered by")
    ImageGadget(105,  46,  90,   1,  1, UseImage(1),#PB_Image_Border)
    ; (WinAPI)
    SetWindowLong_(WindowID(),#GWL_EXSTYLE,GetWindowLong_(WindowID(),#GWL_EXSTYLE)!#WS_EX_TOOLWINDOW)
    ResizeWindow(400, 262)
    ; (WinAPI)
    ShowWindow_(WindowID(),#SW_SHOW)
    If timer < 0
      #OK_Button = 110
      Result = ButtonGadget(#OK_Button, 160, 233, 80, 24, "Continue")
      Repeat
        Event = WaitWindowEvent()
        Select Event
        Case #PB_EventGadget
          Select EventGadgetID()
          Case #OK_Button
            Finished.b = 1
          EndSelect
        EndSelect
      Until Finished
    Else
      While WindowEvent():Wend  ; Give the window a chance to display
      Delay(timer)              ; Pause for a while before ending
    EndIf
    CloseWindow(#SM_WinID)
  EndIf
EndProcedure

SplashMessage(-4000)
End
; ---------------------------------------------------
EmbeddedImage: IncludeBinary "c:\purebasic\purebasic.bmp" ; Embed the image in pgm exe.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Code: Select all

; ************************************************ 
; Code:   Silent Message Box 
; Author: Sparkie 
; Date:   January 27, 2006 
; Updated September 9, 2009 for PB 4.x
; OS:     Windows only 
; ************************************************ 
#MB_USERICON = $80 
Procedure SilentMessage(caption$, message$, icon) 
  mbp.MSGBOXPARAMS 
  mbp\cbSize =SizeOf(MSGBOXPARAMS) 
  mbp\hwndOwner = WindowID(0) 
  mbp\hInstance = 0 
  mbp\lpszText = @message$ 
  mbp\lpszCaption = @caption$ 
  mbp\dwStyle = #MB_OK | #MB_USERICON 
  mbp\lpszIcon = icon 
  ;#IDI_APPLICATION  Default application icon. 
  ;#IDI_ASTERISK     Same as IDI_INFORMATION. 
  ;#IDI_ERROR        Hand-shaped icon. 
  ;#IDI_EXCLAMATION  Same as IDI_WARNING. 
  ;#IDI_HAND         Same as IDI_ERROR. 
  ;#IDI_QUESTION     Question mark icon. 
  ;#IDI_WARNING      Exclamation point icon. 
  ;#IDI_WINLOGO      Windows logo icon. Windows XP: Default application icon. 
  result = MessageBoxIndirect_(mbp) 
  ProcedureReturn result 
EndProcedure 
If OpenWindow(0, 100, 100, 300, 200, "Silent Message Box", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ButtonGadget(1, 10, 40, 280, 22, "Display silent message") 
  Repeat 
    event = WaitWindowEvent() 
    If event = #PB_Event_Gadget And EventGadget() = 1 
      SilentMessage("Shhhh....", "netmaestro needs silence!", #IDI_EXCLAMATION) 
    EndIf 
  Until event = #PB_Event_CloseWindow 
EndIf 
End
Last edited by Sparkie on Wed Sep 09, 2009 12:43 pm, edited 1 time in total.
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: dingless requester

Post by PB »

>> No other programmatic way around it.
> you are waving a red flag at a bull with that part

Hehe, I'm talking about the standard MessageBox API though. Sparkie's tip
doesn't count because it uses a different API call. ;)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

:evil: :P :)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

That's perfect, Sparkie! Just what I need.
Hehe, I'm talking about the standard MessageBox API though. Sparkie's tip
doesn't count because it uses a different API call.
Ok, I guess that'll be your little secret then. (That's from Lake Placid, an excellent movie imo)
Last edited by netmaestro on Tue Feb 21, 2006 7:30 pm, edited 4 times in total.
BERESHEIT
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Great tip though, Sparkie -- I've added it to my Snippets folder. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply