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. Mobile Development
  3. Mobile
  4. Can a windowless dll have a message loop?

Can a windowless dll have a message loop?

Scheduled Pinned Locked Moved Mobile
databasequestion
3 Posts 2 Posters 2 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.
  • R Offline
    R Offline
    RuchikaDhingra
    wrote on last edited by
    #1

    I am running Windows CE. I want to trigger a function every 30 minutes. I understand that this can be done by using timers. But a timer object needs DispatchMessage() function for TimerProc() to get called. Is it possible to provide a message loop in a windowless DLL? If yes, where should the message loop be defined? (I tried providing a message loop in the DLL but the DLL started showing strange behavior. Is it at all possible?) Windows ce does not support Timer Queues or Waitable timers. Is there any other option? Any suggestions would be highly appreciated. Thanks, Ruchika

    J 1 Reply Last reply
    0
    • R RuchikaDhingra

      I am running Windows CE. I want to trigger a function every 30 minutes. I understand that this can be done by using timers. But a timer object needs DispatchMessage() function for TimerProc() to get called. Is it possible to provide a message loop in a windowless DLL? If yes, where should the message loop be defined? (I tried providing a message loop in the DLL but the DLL started showing strange behavior. Is it at all possible?) Windows ce does not support Timer Queues or Waitable timers. Is there any other option? Any suggestions would be highly appreciated. Thanks, Ruchika

      J Offline
      J Offline
      Joao Paulo Figueira
      wrote on last edited by
      #2

      Another option would be to use a thread. Worker threads do not need a message loop and you can control their timing with equal (if not greater) accuracy. The code would look something like this:

      BOOL bLoop = TRUE;

      while(bLoop)
      {
      Sleep(30*60*1000); // 30 minutes in milliseconds

      //
      // Do your stuff here. Do not forget to set bLoop to
      // FALSE when you want the loop terminated.
      //
      

      }

      Please note that this code might not be the best for battery saving purposes.

      R 1 Reply Last reply
      0
      • J Joao Paulo Figueira

        Another option would be to use a thread. Worker threads do not need a message loop and you can control their timing with equal (if not greater) accuracy. The code would look something like this:

        BOOL bLoop = TRUE;

        while(bLoop)
        {
        Sleep(30*60*1000); // 30 minutes in milliseconds

        //
        // Do your stuff here. Do not forget to set bLoop to
        // FALSE when you want the loop terminated.
        //
        

        }

        Please note that this code might not be the best for battery saving purposes.

        R Offline
        R Offline
        RuchikaDhingra
        wrote on last edited by
        #3

        Thank you so much for the suggestion. I am leaning more towards not adding a background thread mainly becz I already have three threads in my module. So, I am thinking of modifying one of the threads that I have to wait for RETRANSMIT_TIME, do the job and again wait. Ruchika

        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