dingless requester
Posted: Fri Jan 27, 2006 9:22 pm
Anybody know how to do this?
http://www.purebasic.com
https://www.purebasic.fr/english/
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.
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
Ok, I guess that'll be your little secret then. (That's from Lake Placid, an excellent movie imo)Hehe, I'm talking about the standard MessageBox API though. Sparkie's tip
doesn't count because it uses a different API call.