Page 1 of 2

windows & gadgets without Repeat : Until

Posted: Wed Aug 25, 2010 11:33 am
by cybergeek
just wondering if i could openwindow or add a gadget and keep it displayed without using a Loop of repeat until ?

Re: windows & gadgets without Repeat : Until

Posted: Wed Aug 25, 2010 11:45 am
by Trond
Yes, you can use While .. Wend. :)

What do you need this for?

Re: windows & gadgets without Repeat : Until

Posted: Wed Aug 25, 2010 11:53 am
by Little John
Trond wrote:Yes, you can use While .. Wend. :)
:lol:

Re: windows & gadgets without Repeat : Until

Posted: Wed Aug 25, 2010 12:30 pm
by cybergeek
without any kin of loop

Re: windows & gadgets without Repeat : Until

Posted: Wed Aug 25, 2010 12:37 pm
by TomS
Delay()
Note that the user has no chance of interacting with the window or the gadgets. And he can't close the window. :roll:
Trond wrote:What do you need this for?

Re: windows & gadgets without Repeat : Until

Posted: Wed Aug 25, 2010 12:41 pm
by cybergeek
TomS wrote:Delay()
Note that the user has no chance of interacting with the window or the gadgets. And he can't close the window. :roll:
then there is no use

Re: windows & gadgets without Repeat : Until

Posted: Wed Aug 25, 2010 12:48 pm
by gnozal
cybergeek wrote:without any kin of loop
Windows is about events, so you need an event loop.

Re: windows & gadgets without Repeat : Until

Posted: Thu Aug 26, 2010 5:02 am
by Rescator
Yeah, any GUI program (on any platform/OS) has at the very least a main (or outer) loop.

Maybe if you told us what you are trying to do we could help, but asking for how to make a GUI program without looping makes no sense at all.

What exactly are you trying to do that makes you think you can not use any form of looping?

(PS! A program without any looping would end almost immediately as well)

Re: windows & gadgets without Repeat : Until

Posted: Thu Aug 26, 2010 9:41 am
by AndyMK
WaitWindowEvent(Timeout) without the timeout value is what you might be looking for. It only does a loop when an event happens, no need for a delay() in the loop unless the windows activity is happening thousands of times per second in which case you can use 1 as a timeout value and it would be like doing a Delay(1).

Re: windows & gadgets without Repeat : Until

Posted: Thu Aug 26, 2010 3:26 pm
by cybergeek
i create a complex dialog or control in PB to use with another application and embed it in a dll but when that app calls the dll the loop haults the execution!

Re: windows & gadgets without Repeat : Until

Posted: Thu Aug 26, 2010 3:57 pm
by Trond
cybergeek wrote:i create a complex dialog or control in PB to use with another application and embed it in a dll but when that app calls the dll the loop haults the execution!
Either call the dll in a thread, or have a function in the dll which contains everything inside the loop (use WindowEvent()), then have a loop in the main application, and call the function in the dll several times every second.

Re: windows & gadgets without Repeat : Until

Posted: Thu Aug 26, 2010 4:47 pm
by cybergeek
the application is in another language

Re: windows & gadgets without Repeat : Until

Posted: Thu Aug 26, 2010 5:16 pm
by Trond
cybergeek wrote:the application is in another language
So run the window in a thread in the dll.

Re: windows & gadgets without Repeat : Until

Posted: Thu Aug 26, 2010 5:20 pm
by srod
If by 'halting execution' you are referring to non-GUI matters, then yes, such a dll will of course halt execution and then Trond's suggestions are the way to go. If, on the other hand, the host is running a GUI of it's own and this appears to freeze, then there is a problem with the host if the dll is running a PB event-loop.

A host written in PB which runs a GUI and which then loads a dll such as the one you are working with will potentially throw up certain problems due to the nature of PB's message retrieval mechanisms. You would generally be safer employing an API message retrieval loop within the dll in such cases.

Re: windows & gadgets without Repeat : Until

Posted: Fri Aug 27, 2010 9:49 am
by cybergeek
here is an example that halt a program in Autohotkey

http://www.autohotkey.net/~mohdumar/testdll.zip