1. win32lib: manipulating vWinMainState
- Posted by Alexander Toresson <toressonodakra at swipnet.se> Jul 26, 2004
- 594 views
I had a problem with the windows version of the debugger, though I forgot it, so it got released anyway. What that include file needs is to have a window open without having called WinMain(). I found out that what is needed is a way to make vWinMainState = kStarted. I made a hack into my win32lib.ew and made vWinMainState global, and that's why I forgot it. Maybe vWinMainState should be global, or vWinMainState should be set to kStarted in openWindow() Regards, Alexander Toresson Shhh! Be vewy quiet! I'm hunting wuntime ewwows!
2. Re: win32lib: manipulating vWinMainState
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jul 26, 2004
- 537 views
On Mon, 26 Jul 2004 04:32:47 -0700, Alexander Toresson <guest at RapidEuphoria.com> wrote: >I had a problem with the windows version of the debugger, though I forgot >it, so it got released anyway. What that include file needs is to have a >window open without having called WinMain(). I found out that what is >needed is a way to make vWinMainState = kStarted. I made a hack into my >win32lib.ew and made vWinMainState global, and that's why I forgot it. >Maybe vWinMainState should be global, or vWinMainState should be set to >kStarted in openWindow() I noticed that, but did not comment on it. In asmdebugwin.ew I made main global, and commented out the two lines openWindow(main, Normal) vWinMainState = kStarted (at the time I didn't notice the second use within CallBack()) In demo.exw I added WinMain(main, Normal) before the asm_cleanup() call. It wasn't quite right, but fairly close (displays from line 3). BTW, what is the sequence states for? Pete
3. Re: win32lib: manipulating vWinMainState
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 26, 2004
- 536 views
Alexander Toresson wrote: > > I had a problem with the windows version of the debugger, though I forgot > it, so it got released anyway. What that include file needs is to have a > window open without having called WinMain(). I found out that what is > needed is a way to make vWinMainState = kStarted. I made a hack into my > win32lib.ew and made vWinMainState global, and that's why I forgot it. > Maybe vWinMainState should be global, or vWinMainState should be set to > kStarted in openWindow() I will not be making vWinMainState global. However, I am interested in making things better/useful so what is the problem you were trying to solve by making this global? Maybe I can do it another way. -- Derek Parnell Melbourne, Australia
4. Re: win32lib: manipulating vWinMainState
- Posted by Alexander Toresson <toressonodakra at swipnet.se> Aug 01, 2004
- 520 views
Derek Parnell wrote: > I will not be making vWinMainState global. However, I am interested > in making things better/useful so what is the problem you were trying > to solve by making this global? Maybe I can do it another way. The problem is that the include file should have and control a window, without interrupting the main program. Using the openWindow() procedure works perfect when WinMain() has been called, though the .ew's window is "immune" to events if not. The problem is that vWinMainState is set to kNotStarted. A solution would be to set vWinMainState to kStarted in openWindow(), but maybe that would interfere with the main program if it calls WinMain()? Regards, Alexander Toresson Shhh! Be vewy quiet! I'm hunting wuntime ewwows! PS. Delay caused by holiday. DS
5. Re: win32lib: manipulating vWinMainState
- Posted by Alexander Toresson <toressonodakra at swipnet.se> Aug 01, 2004
- 518 views
Pete Lomax wrote: > In asmdebugwin.ew I made main global, and commented out the two lines > openWindow(main, Normal) > vWinMainState = kStarted > (at the time I didn't notice the second use within CallBack()) > In demo.exw I added WinMain(main, Normal) before the asm_cleanup() > call. It wasn't quite right, but fairly close (displays from line 3). > > BTW, what is the sequence states for? The sequence states stores the on/off states for tracing an asm routine. If the corresponding state of a routine is 0, it won't be traced. If the window is closed, the state of the current routine will be set to 0. The problem is that, if there are more than one asm routine, the program will continue on the next, and the window will have to be opened one more time. I do not actually know why your hack worked. The asm routine is already called when you call WinMain(). Regards, Alexander Toresson Shhh! Be vewy quiet! I'm hunting wuntime ewwows! PS. Delay caused by holiday. DS
6. Re: win32lib: manipulating vWinMainState
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 02, 2004
- 511 views
Alexander Toresson wrote: > > Derek Parnell wrote: > > I will not be making vWinMainState global. However, I am interested > > in making things better/useful so what is the problem you were trying > > to solve by making this global? Maybe I can do it another way. > > The problem is that the include file should have and control a window, > without interrupting the main program. Using the openWindow() procedure > works perfect when WinMain() has been called, though the .ew's window is > "immune" to events if not. The problem is that vWinMainState is set to > kNotStarted. > A solution would be to set vWinMainState to kStarted in openWindow(), > but maybe that would interfere with the main program if it calls > WinMain()? > I don't understand the problem. Here is a couple of files that show what I think you are trying to do, and they work fine here, so I guess I don't really understand what you are trying to acheive. <---File: trace.ew---> constant TraceWin = create(Window, "Tracer", 0, 0, 0, 300, 300,0) openWindow(TraceWin, Normal) procedure traceEvent(integer self, integer event, sequence parms) if event = w32HMouse then setText(self, sprintf("Mouse %d", parms[1])) elsif event = w32HPaint then setText(self, sprintf("paint %d %d %d %d ", parms)) end if end procedure setHandler(TraceWin, {w32HPaint, w32HMouse}, routine_id("traceEvent")) <---end of file---> <---File: test.exw---> without warning include win32lib.ew include trace.ew constant PrimeWindow = create(Window, "Prime Window", 0, 200,100, 400, 400, 0) WinMain(PrimeWindow, Normal) <---end of file---> When I run the test program, the trace window opens and receives events. -- Derek Parnell Melbourne, Australia
7. Re: win32lib: manipulating vWinMainState
- Posted by "Wolf" <wolfritz at king.igs.net> Aug 02, 2004
- 507 views
I'll take a wild guess. Alex is trying to access some win32lib procedures or functions *before* calling WinMain() , and this isn't allowed any more, for some ? reason. In the old-days, you could still access almost any API functionality thru win32lib *without* even having a window. > > I will not be making vWinMainState global. However, I am interested > > > the .ew's window is "immune" to events if not. The problem is that > > > vWinMainState is set to > > > kNotStarted. > I don't understand the problem.
8. Re: win32lib: manipulating vWinMainState
- Posted by Alexander Toresson <toressonodakra at swipnet.se> Aug 02, 2004
- 498 views
Derek Parnell wrote: > > Alexander Toresson wrote: > > > > The problem is that the include file should have and control a window, > > without interrupting the main program. Using the openWindow() procedure > > works perfect when WinMain() has been called, though the .ew's window is > > "immune" to events if not. The problem is that vWinMainState is set to > > kNotStarted. > > > > I don't understand the problem. Here is a couple of files that show what > I think you are trying to do, and they work fine here, so I guess I don't > really understand what you are trying to acheive. > snip > > <---File: test.exw---> > without warning > include win32lib.ew > include trace.ew > constant PrimeWindow = create(Window, "Prime Window", 0, 200,100, 400, 400, 0) > > WinMain(PrimeWindow, Normal) > <---end of file---> > > > When I run the test program, the trace window opens and receives events. It receives events because you call WinMain(). What I meant is that the tracer should run even when WinMain() is never called, by polling doEvents(). To see the problem, simply replace:
WinMain(PrimeWindow, Normal)
with:
openWindow(PrimeWindow, Normal) while isVisible(PrimeWindow) do doEvents(0) end while
None of the windows should answer to any event, because vWinMainState is set to kNotStarted. Regards, Alexander Toresson Shhh! Be vewy quiet! I'm hunting wuntime ewwows!
9. Re: win32lib: manipulating vWinMainState
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 03, 2004
- 509 views
Alexander Toresson wrote: > [snip] > It receives events because you call WinMain(). What I meant is that the > tracer should run even when WinMain() is never called, by polling > doEvents(). Thanks, now I see what you are trying to do. Fortunately, its easily done. In your 'included' file, when you want the application to stop running, call ... quitWindow(Screen) And start the main program running by using ... WinMain(0, 0) For example.. <---tracer.ew---> constant TraceWin = create(Window, "Tracer", 0, 0, 0, 300, 300,0) openWindow(TraceWin, Normal) procedure traceClose(integer self, integer event, sequence parms) quitWindow(Screen) end procedure setHandler(TraceWin, w32HClose, routine_id("traceClose")) <---end of file---> <---test.exw---> without warning include win32lib.ew include other.ew WinMain(0, 0) <---end of file---> -- Derek Parnell Melbourne, Australia
10. Re: win32lib: manipulating vWinMainState
- Posted by Alexander Toresson <toressonodakra at swipnet.se> Aug 13, 2004
- 539 views
Derek Parnell wrote: <snip> > <---test.exw---> > without warning > include win32lib.ew > include other.ew > WinMain(0, 0) > <---end of file---> Hmm. My example wasn't good enough. I'll try to explain again. This method would work perfectly when the main program uses win32lib and calls WinMain(). But, I want it to work without the main program using win32lib, for example with an opengl library. The tracer should of course run in the background, and therefore it cannot call WinMain(). That would stop the main program. The problem is that vWinMainState hasn't been set to kStarted if I haven't called WinMain(), and therefore my window don't receive events. Maybe vWinMainState should be set to kStarted in openWindow()? Regards, Alexander Toresson Shhh! Be vewy quiet! I'm hunting wuntime ewwows!
11. Re: win32lib: manipulating vWinMainState
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 13, 2004
- 524 views
Alexander Toresson wrote: > > Derek Parnell wrote: > <snip> > > <---test.exw---> > > without warning > > include win32lib.ew > > include other.ew > > WinMain(0, 0) > > <---end of file---> > > Hmm. My example wasn't good enough. I'll try to explain again. > This method would work perfectly when the main program uses win32lib > and calls WinMain(). But, I want it to work without the main program > using win32lib, for example with an opengl library. Why do you need win32lib then? > The tracer should of course run in the background, and therefore > it cannot call WinMain(). That would stop the main program. So as I understand it now, the situation is this... One has a Windows program, not necessarily using Win32lib, and one wants to use your tracer library - which DOES use Win32lib. The main program will use its own Windows message loop and your tracer stuff will use Win32lib's Windows message loop. I don't know how to code a Windows program that uses multiple Windows message loops. I don't see how you can run two GetMsg(), TranslateMsg(), DispatchMsg() loops? Maybe someone else can help us here. > The problem > is that vWinMainState hasn't been set to kStarted if I haven't called > WinMain(), and therefore my window don't receive events. Calling WinMain(0,0) is equivalent to ... vWinMainState = kStarted call_proc(r_eventLoop, {vELUserData}) releaseAllResources(0) > Maybe vWinMainState should be set to kStarted in openWindow()? Maybe you can modify your copy of Win32lib to do that. -- Derek Parnell Melbourne, Australia