[Solved] Newbie here.About flags for MessageRequester

Just starting out? Need help? Post your questions and find answers here.
LovePurabasic
New User
New User
Posts: 3
Joined: Sun Jun 06, 2010 9:25 pm

[Solved] Newbie here.About flags for MessageRequester

Post 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 ;)
Last edited by LovePurabasic on Mon Jun 07, 2010 11:15 am, edited 1 time in total.
Nituvious
Addict
Addict
Posts: 1029
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

Re: Newbie here.Question About flags for MessageRequester

Post 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
▓▓▓▓▓▒▒▒▒▒░░░░░
LovePurabasic
New User
New User
Posts: 3
Joined: Sun Jun 06, 2010 9:25 pm

Re: Newbie here.Question About flags for MessageRequester

Post 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.
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Newbie here.Question About flags for MessageRequester

Post 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
sorry for my bad english
LovePurabasic
New User
New User
Posts: 3
Joined: Sun Jun 06, 2010 9:25 pm

Re: Newbie here.Question About flags for MessageRequester

Post 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.
Nituvious
Addict
Addict
Posts: 1029
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

Re: Newbie here.Question About flags for MessageRequester

Post 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)
▓▓▓▓▓▒▒▒▒▒░░░░░
Post Reply