Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. timer does not start

timer does not start

Scheduled Pinned Locked Moved C / C++ / MFC
c++
8 Posts 5 Posters 18 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    etechX2
    wrote on last edited by
    #1

    Hi, in my MFC DLL, pMyDLLCWnd is pointer to a class driver from CWnd. When CDialog is linked to DLL, timer starts. When console is linked to DLL, same timer does not start. pMyDLLCWnd->Settimer(ID,t,NULL) DLL has wm_timer message handler.

    V 1 Richard Andrew x64R 3 Replies Last reply
    0
    • E etechX2

      Hi, in my MFC DLL, pMyDLLCWnd is pointer to a class driver from CWnd. When CDialog is linked to DLL, timer starts. When console is linked to DLL, same timer does not start. pMyDLLCWnd->Settimer(ID,t,NULL) DLL has wm_timer message handler.

      V Offline
      V Offline
      Victor Nijegorodov
      wrote on last edited by
      #2

      Where do you create the window the pMyDLLCWnd points to: in a DLL or where?

      E 1 Reply Last reply
      0
      • E etechX2

        Hi, in my MFC DLL, pMyDLLCWnd is pointer to a class driver from CWnd. When CDialog is linked to DLL, timer starts. When console is linked to DLL, same timer does not start. pMyDLLCWnd->Settimer(ID,t,NULL) DLL has wm_timer message handler.

        1 Offline
        1 Offline
        11917640 Member
        wrote on last edited by
        #3

        Does your console application have message loop? If not, add it to handle Windows messages:

        MSG msg;
        while(GetMessage(&msg, NULL, 0, 0))
        {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
        }

        1 Reply Last reply
        0
        • V Victor Nijegorodov

          Where do you create the window the pMyDLLCWnd points to: in a DLL or where?

          E Offline
          E Offline
          etechX2
          wrote on last edited by
          #4

          in the DLL.

          1 Reply Last reply
          0
          • E etechX2

            Hi, in my MFC DLL, pMyDLLCWnd is pointer to a class driver from CWnd. When CDialog is linked to DLL, timer starts. When console is linked to DLL, same timer does not start. pMyDLLCWnd->Settimer(ID,t,NULL) DLL has wm_timer message handler.

            Richard Andrew x64R Offline
            Richard Andrew x64R Offline
            Richard Andrew x64
            wrote on last edited by
            #5

            Could it be that you're using a timer that is based upon window messages, and there are no window messages in a console application?

            The difficult we do right away... ...the impossible takes slightly longer.

            E 1 Reply Last reply
            0
            • Richard Andrew x64R Richard Andrew x64

              Could it be that you're using a timer that is based upon window messages, and there are no window messages in a console application?

              The difficult we do right away... ...the impossible takes slightly longer.

              E Offline
              E Offline
              etechX2
              wrote on last edited by
              #6

              in DLL: pMyDLLCWnd is pointer to a DLL class derived from CWnd. pMyDLLCWnd->SetTimer(..) There are windows message handler WM_TIMER in DLL. In console there are no windows?. So, create a dummy window in console, pass its handle to the DLL?.Or, create a GetMessage while loop?. I have not tried this since I changed the design but like to try it.

              J Richard Andrew x64R 2 Replies Last reply
              0
              • E etechX2

                in DLL: pMyDLLCWnd is pointer to a DLL class derived from CWnd. pMyDLLCWnd->SetTimer(..) There are windows message handler WM_TIMER in DLL. In console there are no windows?. So, create a dummy window in console, pass its handle to the DLL?.Or, create a GetMessage while loop?. I have not tried this since I changed the design but like to try it.

                J Offline
                J Offline
                jeron1
                wrote on last edited by
                #7

                Can that message handler in the DLL be set up to call a function of yours?

                "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

                1 Reply Last reply
                0
                • E etechX2

                  in DLL: pMyDLLCWnd is pointer to a DLL class derived from CWnd. pMyDLLCWnd->SetTimer(..) There are windows message handler WM_TIMER in DLL. In console there are no windows?. So, create a dummy window in console, pass its handle to the DLL?.Or, create a GetMessage while loop?. I have not tried this since I changed the design but like to try it.

                  Richard Andrew x64R Offline
                  Richard Andrew x64R Offline
                  Richard Andrew x64
                  wrote on last edited by
                  #8

                  I'm sorry, my answer was a quick guess. That's why I put a question mark after it. Truth is I'm not sure.

                  The difficult we do right away... ...the impossible takes slightly longer.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups