Re: Win32Lib; Timed events
- Posted by CChris <christian.cuvier at agric?lture.g?uv.fr> May 19, 2008
- 707 views
ZNorQ wrote: > > CChris wrote: > > > > ZNorQ wrote: > > > > > > CChris wrote: > > > > > > > > ZNorQ wrote: > > > > > > > > > > CChris wrote: > > > > > > > > > > > > I said "any control will do". 0 is not an actual control id, not > > > > > > even a > > valid</font></i> > > > > > > handle for Windows. It is a special value which is treated, somewhat > consistently,</font></i> > > > > > > as if refeerring to the desktop window. But it actually doesn't. > > > > > > > > > > > > CChris > > > > > > > > > > Ah, ok. But how would i go about then when I'm creating a program that > > > > > doesn't > > > > > pop-up a window. I know I can use WinMain(0, Normal), but how do I use > > > > > the > > timer</font></i> > > > > > in this case? > > > > > > > > > > Purpose of the code; Run in the background and run various code in > > > > > intervals. > > > > > > > > > > Kenneth/ZNorQ > > > > > > > > CreateEx a main window that is not visible and has the WS_EX_NOACTIVATE > > > > extended > > > > style (so it won't show in the toolbar). Then > > > > WinMain(the_window,Minimized). > > > > This is probably close to what you want. > > > > A cleaner way woul be to support message only windows, but it would work > > > > on > > > > Win2K only, and currently requires low level API to create it. I'll > > > > think about > > > > it. > > > > > > > > CChris > > > > > > I just tried something else before I saw your answer; (VERY abbreviated) > > > > > > mywin= createEx(window, etc...) > > > setTimer(mywin, 1, 1000) > > > setHandler(mywin, etc...) > > > WinMain(0,Normal) > > > > > > And it *seems* to work! I'll have a go at your version as well. > > > > > > As for "message only windows", I'm not that fluent in WinAPI coding to > > > even > > > remotely understand what your are talking about.. :) > > > > > > Thanks for the input, CChris. > > > > > > ZNorQ > > > > Other Windows developers had needed a window that would just take and > > dispatch > > messages, and nothing else (no switching to it, no taskbar button, no > > rectagle > > on screen, no nothing). > > > > You can always do this by defining the event loop of the window > > accordingly.That's > > how it was done under Win9x. A good recipe for bugs. You can do that using > > win32lib's > > setDefaultProcessing(). > > > > So, in Win2K and onwards, there is a special sort of window with such a > > minimalistic > > functionality, which is called "message only window". win32lib cannot > > currently > > createEx() it, but the Windows API sure can (if curious, google for > > HWND_MESSAGE > > and check links to MSDN in the result). > > > > > > CChris > > Ok, but my solution for now is creating a dummy window that the timer is > 'linked' > to, and just never use it in the WinMain() procedure. It seems to work > perfectly > for me now. > > Would there be any reason this is a bad idea, in this situation? > > ZNorQ It is not, as long as your application is concerned. Now you may have an extra button on the taskbar, and a dummy window listed when you press Alt-Tab. If they don't bother you, that's fine indeed. CChris