Results 1 to 8 of 8

Thread: Using Timers in DLLs....

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416

    Using Timers in DLLs....

    When my DLL is attached, I want to set a Timer.... Since there is no window handle, I'm using TimerProc and not processing WM_TIMER messages. Only problem is... MSDN states that.... "When you specify a TimerProc callback function, the default window procedure calls the callback function when it processes WM_TIMER. Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc instead of processing WM_TIMER."

    How can I dispatch messages in a DLL?! .... There must be some other way...

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    I'm thinking the only way I can do this is by creating a window and using that to process the WM_TIMER message...

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    Ok, nevermind.... It seems to be working fine without creating a window and specifying the window handle as NULL. Dunno why the MSDN said what it said.... since it works without using DispatchMessage API....

  4. #4
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    You only have to DispatchMessage() if you specify a window handle, but dont process WM_TIMER messages.

    Z.

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I usually use the timers as a callback (i.e. it just calls one of your functions directly, without the overhead of a window procedure).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    Ya park, thats what I've been doing since forever. And thats what I'm doing in my DLL. But it was just strange how the MSDN stated that you must dispatch messages whether you use a callback or not.. Which I found odd. And apparently that statement is incorrect.. Or typed wrong.

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Or maybe it's just filling up your process's message queue

    Strange, I never seemed to have any problems by not handling WM_TIMER...although the dubious stability of my computer could have either been that or Windows 98...

    I stopped using SetTimer when I noticed it was decidedly inaccurate...timeSetEvent is a lot better, and doesn't do things to the message queue.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    Hmmm, I think I might start using timeSetEvent now... Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width