Page 1 of 1

[Solved] Newbie here.About flags for MessageRequester

Posted: Mon Jun 07, 2010 10:37 am
by LovePurabasic
Hi to all Purebasic Community.
Firstly i want to say i`m new here.And if i open this topic in wrong place please forgive me for that.
Yesterday i started to learn Purebasic and i liked it.
Generally few months ago i started to learn Autoitscript and i liked it too.(And now still learning too.I like Its GUI)
So, i have question about Purebasic.
How i can define timeout for MessageRequester

Code: Select all

MessageRequester()
and also i want use flag[] for messagebox.
For example in Autoit it is so simple like this:

Code: Select all

MsgBox(64,"TEST","TEST",10)
;64 here is flag
;10 here is timeout for MessageBox and eq 10 seconds
Image
And for 48=flag
Image
I searched Purebasic help file and i cannot find what i want to figure it out.Becouse i think help file out Purebasic written so simple and it has no some additional infos and it needs to Purely help file.
Am i right?Or i misunderstand something?

Thanks in advance.
P.S And sorry for my English.It is not my native so, please forgive me for that too ;)

Re: Newbie here.Question About flags for MessageRequester

Posted: Mon Jun 07, 2010 10:49 am
by Nituvious
LovePurabasic wrote:Hi to all Purebasic Community.
Firstly i want to say i`m new here.And if i open this topic in wrong place please forgive me for that.
Yesterday i started to learn Purebasic and i liked it.
Generally few months ago i started to learn Autoitscript and i liked it too.(And now still learning too.I like Its GUI)
So, i have question about Purebasic.
How i can define timeout for MessageRequester

Code: Select all

MessageRequester()
and also i want use flag[] for messagebox.
For example in Autoit it is so simple like this:

Code: Select all

MsgBox(64,"TEST","TEST",10)
;64 here is flag
;10 here is timeout for MessageBox and eq 10 seconds
Image
And for 48=flag
Image
I searched Purebasic help file and i cannot find what i want to figure it out.Becouse i think help file out Purebasic written so simple and it has no some additional infos and it needs to Purely help file.
Am i right?Or i misunderstand something?

Thanks in advance.
P.S And sorry for my English.It is not my native so, please forgive me for that too ;)
Hello, hope this helps!

Code: Select all

MessageRequester("My Title","My awesome message box!",#MB_OKCANCEL|#MB_ICONWARNING)
You can find a list of constants from: http://msdn.microsoft.com/en-us/library ... S.85).aspx

Re: Newbie here.Question About flags for MessageRequester

Posted: Mon Jun 07, 2010 10:54 am
by LovePurabasic
Hello, hope this helps!

Code: Select all

MessageRequester("My Title","My awesome message box!",#MB_OKCANCEL|#MB_ICONWARNING)
You can find a list of constants from: http://msdn.microsoft.com/en-us/library ... S.85).aspx

Yes! Thank you very-very much Nituvious
EDIT:
BTW how to figure out timeout for

Code: Select all

MessageRequester
Thanks again.

Re: Newbie here.Question About flags for MessageRequester

Posted: Mon Jun 07, 2010 11:08 am
by Josh
there is no timout. timouts for messageboxes are not a windowsstandard. thats script-schnickschnack and is mostly used if scripts running on a server without an operator

Re: Newbie here.Question About flags for MessageRequester

Posted: Mon Jun 07, 2010 11:14 am
by LovePurabasic
Josh wrote:there is no timout. timouts for messageboxes are not a windowsstandard. thats script-schnickschnack and is mostly used if scripts running on a server without an operator
Hmm.Ok. Thanks to you too Josh.

Re: Newbie here.Question About flags for MessageRequester

Posted: Mon Jun 07, 2010 12:03 pm
by Nituvious
LovePurabasic wrote: BTW how to figure out timeout for

Code: Select all

MessageRequester
Thanks again.
Here you go, I hope this works for you!

Code: Select all

Global Title.s,Timeout,hWnd
Global *Timer=AllocateMemory(255)
Prototype ProtoFindWindow(Class.l,Title.s)
Prototype ProtoSendMessage(Window,Message,ParamL,ParamR)
Declare MsgTimeout(*x)

Procedure MsgBox(Title.s,Body.s,Timeout,Flags)
	PokeI(*Timer,Timeout)
	CreateThread(@MsgTimeout(),Timer)
	MessageRequester(Title.s,Body.s,Flags)
EndProcedure

Procedure MsgTimeout(*x)
	For x = 0 To PeekI(*Timer)
		Delay(1000)
	Next
	If OpenLibrary(0,"User32.dll") = 0
		Debug "Library error"
	Else
		FindAWindow.ProtoFindWindow = GetFunction(0, "FindWindowA")
		SendAMessage.ProtoSendMessage = GetFunction(0, "SendMessageA")
		hWnd = FindAWindow(0,Title.s)
		SendAMessage(hWnd,#WM_CLOSE,0,0)
		CloseLibrary(0)
		End
	EndIf
EndProcedure



MsgBox("My Title","My awesome timed message box!",5,#MB_OKCANCEL|#MB_ICONERROR)