Re: Thread and Timer

Tech-Archive recommends: Speed Up your PC by fixing your registry



Joe you must be kidding, he needs a window in his UI thread just use timers?

::SetTimer works just fine in CWinThread. All you have to do is set a
ON_THREAD_MESSAGE(WM_TIMER,OnTimer) in your message map.

AliR.


"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:jvcit3hs7gfnce0ttl9vsliqmfbcc2pv4c@xxxxxxxxxx
Is it a UI thread? Is the timer associated with a window in the UI
thread? (You may have
to create an invisible top-level window to get this to work...)
joe

On Thu, 13 Mar 2008 02:42:20 -0700 (PDT), Stefano <posting@xxxxxxxxxx>
wrote:

On 12 Mar, 16:39, Joseph M. Newcomer <newco...@xxxxxxxxxxxx> wrote:

Why not do something very simple: ON_WM_TIMER()?


I tryed with ON_WM_TIMER but it's never called.



You do not need a g_iTmer, g_hWnd, or g_iMessage here, if this were a
handler for
WM_TIMER. Get rid of them. I can't even imagine why they are needed at
all, since they
coudl be member variables of the CWatchDog class.

Yes you are right. I copyed and paste the code from the the callback.
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm


.



Relevant Pages

  • Re: Child Window Creation
    ... painted until all posted messages have been pumped. ... but it was getting handled before the window painted. ... DDX_Control, and you post a message from within PreSubclassWindow, there ...
    (microsoft.public.vc.mfc)
  • Re: Child Window Creation
    ... your handler! ... painted until all posted messages have been pumped. ... but it was getting handled before the window painted. ...
    (microsoft.public.vc.mfc)
  • Re: Thread and Timer
    ... class CMyThread: public CWinThread ... CAsyncSocket creates a dummy window to handle callback notifications, ...
    (microsoft.public.vc.mfc)
  • Re: DISP_E_MEMBERNOTFOUND
    ... "Joseph M. Newcomer" wrote: ... I understand your solution of checking if the window is ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: why UI gets hangs
    ... window, so the window you are seeing is not actually the window. ... do ugly polling loops! ... to do it right it takes another semaphore that absolutely tells the ...
    (microsoft.public.vc.mfc)