Page 1 of 1

Message Requester

Posted: Fri Sep 01, 2006 6:44 pm
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:

Posted: Fri Sep 01, 2006 6:52 pm
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)

Posted: Fri Sep 01, 2006 7:48 pm
by SoulReaper
Sorry forgot to say this way there is no warning bell :) :lol:

Posted: Fri Sep 01, 2006 8:50 pm
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

Posted: Fri Sep 01, 2006 8:54 pm
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:

Posted: Fri Sep 01, 2006 9:23 pm
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.

Posted: Sat Sep 02, 2006 12:10 am
by PB
> I've got that muted anyways

Your example doesn't mute the MessageRequester here.

Posted: Sat Sep 02, 2006 12:34 am
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..

Posted: Sat Sep 02, 2006 12:36 am
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 :)

Posted: Sat Sep 02, 2006 12:37 am
by srod
The inclusion of the $80 to the flags removes the icon here!

Posted: Sat Sep 02, 2006 10:02 am
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.

Posted: Sat Sep 02, 2006 10:34 am
by thefool
srod wrote:The inclusion of the $80 to the flags removes the icon here!
damn :)

Posted: Sat Sep 02, 2006 1:02 pm
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: