Message Requester

For everything that's not in any way related to PureBasic. General chat etc...
SoulReaper
Enthusiast
Enthusiast
Posts: 372
Joined: Sun Apr 03, 2005 2:14 am
Location: England

Message Requester

Post by SoulReaper »

While I was looking around on the net I found a very good link on code project :) wish Pure Basics was more like this one...

http://www.codeproject.com/dialog/xmessagebox.asp

Hope thats of Interest :)

on a side note i am messing around with a little custom message box and i have a problem with it.

it appears on the taskbar when i dont want it to and i cant see a way around it, any help please... :lol:

Code: Select all

Procedure MessageBox(hwnd , Caption$, Text$, dwStyle, lpszIcon)
#MB_USERICON = $80 
Protected my_messagebox.MSGBOXPARAMS
If hwnd<>0
hwnd=WindowID(hwnd)
EndIf
my_messagebox\cbSize=SizeOf(MSGBOXPARAMS) 
my_messagebox\hwndOwner=hwnd ; change to windowID(#your window) if needed
my_messagebox\hInstance=0
my_messagebox\lpszText=@Text$
my_messagebox\lpszCaption=@Caption$ 
; lookup other dwStyles under SDK MessageBoxEx Function <<<---
my_messagebox\dwStyle=dwStyle
;{ more lpszIcon options 
;IDI_APPLICATION 
;IDI_ASTERISK 
;IDI_ERROR 
;IDI_EXCLAMATION 
;IDI_HAND 
;IDI_INFORMATION 
;IDI_QUESTION 
;IDI_WARNING 
;IDI_WINLOGO 
;}
my_messagebox\lpszIcon=lpszIcon
ProcedureReturn MessageBoxIndirect_(@my_messagebox)
EndProcedure

;PBMessageBoxQuit()
Result.b=MessageBox(0, "Exit Program","Exit Program Are You Sure ?            "+Chr(13), #MB_YESNO | #MB_USERICON | #MB_DEFBUTTON2, #IDI_EXCLAMATION)

If Result.b=#IDYES ; Yes or #IDNO for no...
Beep_(100,50)
EndIf

End

Thankyou in Advance :)
Regards
Kevin :wink:
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

What's the difference?

Code: Select all

MessageRequester("APPNAME", "Are you sure you want to exit the program?", #PB_MessageRequester_YesNo | #MB_DEFBUTTON2 | #MB_ICONWARNING)
SoulReaper
Enthusiast
Enthusiast
Posts: 372
Joined: Sun Apr 03, 2005 2:14 am
Location: England

Post by SoulReaper »

Sorry forgot to say this way there is no warning bell :) :lol:
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I've got that muted anyways...

Code: Select all

Result.l = MessageRequester("APPNAME", "Are you sure you want to exit the program?", #PB_MessageRequester_YesNo | #MB_DEFBUTTON2 | #MB_ICONWARNING)

If Result = #IDYES ; Yes or #IDNO for no...
  Beep_(100,50)
EndIf
SoulReaper
Enthusiast
Enthusiast
Posts: 372
Joined: Sun Apr 03, 2005 2:14 am
Location: England

Post by SoulReaper »

@Trond Sorryz :)

I did not think it could be done that easy thankyou :) :lol:

p.s.
What did you think of that link to Code Project...

Regards
Kevin :wink:
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

SoulReaper wrote: What did you think of that link to Code Project...
The only interresting thing was the "do not show me again" checkbox. That would have been handy to have natively in PB.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> I've got that muted anyways

Your example doesn't mute the MessageRequester here.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Code: Select all

Result.l = MessageRequester("APPNAME", "Are you sure you want to exit the program?", #PB_MessageRequester_YesNo | #MB_DEFBUTTON2 | #MB_ICONWARNING|$80)
that works. just add $80 as a flag..
SoulReaper
Enthusiast
Enthusiast
Posts: 372
Joined: Sun Apr 03, 2005 2:14 am
Location: England

Post by SoulReaper »

@TheFool

Thankyou for the Tip your a star :lol: :wink:

@Srod

Yes you are right no Icon here on win2000 sp4 here as well :?
Darn...

Regards
Kevin :)
Last edited by SoulReaper on Sat Sep 02, 2006 12:46 am, edited 2 times in total.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

The inclusion of the $80 to the flags removes the icon here!
I may look like a mule, but I'm not a complete ass.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

PB wrote:> I've got that muted anyways

Your example doesn't mute the MessageRequester here.
That was not about the MessageRequester, it was about the Beep_().

Edit: Well, he probably meant the MessageRequester. Anyways, I think that the programmer should respect the user's settings. If he has turned off the sound for that event in the control panel, no sound should play, and if he has specified a sound for that event, that sound should play.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

srod wrote:The inclusion of the $80 to the flags removes the icon here!
damn :)
SoulReaper
Enthusiast
Enthusiast
Posts: 372
Joined: Sun Apr 03, 2005 2:14 am
Location: England

Post by SoulReaper »

Thankyou to everyone for taking the time to talk on this post :)

I Guess I will leave the sound on as Trond said "its up to the User" :)


Regards
Kevin :wink:
Post Reply