Re: Timer not working in WinCE Service
- From: "<ctacke/>" <ctacke[at]opennetcf[dot]com>
- Date: Tue, 2 Oct 2007 00:51:55 -0500
Why do you have a message pump?? You have no windows. You have no
messages. Create a loop with a Sleep of WaitForSingleObject call like Paul
suggested. Asking for help is not terribly useful if you're not going to
listen to the advice given.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
"Rahul P. Shukla" <RahulPShukla@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:290034F3-5357-4881-8F75-D2F852C57F5F@xxxxxxxxxxxxxxxx
here is my message loop code ....
DWORD MyThread(void * f_pMainObj)
{
MSG msg; // message structure
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg); // translates virtual-key codes
DispatchMessage(&msg); // dispatches message to window
}
return 0;
}
// and Timerproc
void CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
{
// Doing some file logging here, to know that control has reached here
return 0;
}
I just want to know that, why timers are not working in case of Service,
but
same DLL is working when not using as service !!!!!!
any clue ..???
- Rahul
"<ctacke/>" wrote:
Show us yopur loop code. The issue must be in your code since a driver
an
an app are not terribly different under CE.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
"Rahul P. Shukla" <RahulPShukla@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:2BEFA1C7-4DFB-4484-B0D5-0D6CE5D02E51@xxxxxxxxxxxxxxxx
Hello Paul,
I used a simple thread to complete my task. But for timers, as u said
there
is no message loop, So I created a simple thread which was having
message
loop to dispatch the messages. But it was not working too.
Now the same code (with timer and without any message loop) for a
simple
DLL
was working but whenever I was registering the same DLL as service, the
code
stops working. I wornder, what is the issue here.
-Rahul
"Paul G. Tobey [eMVP]" wrote:
SetTimer() uses, if I recall correctly, the application event loop to
notify
the clients that the timer has fired. Since you're in a driver and
there
is
no message loop, that's not going to work. You'll need to use
something
different. That might be a multimedia timer, if your OS has that, a
simple
WaitForSingleObject() with a timeout equal to 2000, etc.
Paul T.
"Rahul P. Shukla" <RahulPShukla@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:725011ED-2316-41E7-9D26-5469B6F6938F@xxxxxxxxxxxxxxxx
I am using SetTimer(NULL, NULL, 2000, (TIMERPROC) TimerProc) inside
xxx_Init,
but it seems control is not going my TimerProc.
My Timerproc is as:
void CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD
dwTime)
What may be the reason that timeer is not working.
-Rahul
"Paul G. Tobey [eMVP]" wrote:
"Timer"? What call are you using?
Paul T.
"Rahul P. Shukla" <RahulPShukla@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:2B7CCCA4-59D4-4653-ACBE-00C41E919276@xxxxxxxxxxxxxxxx
Hi,
I am creating a Win32 service for my WinCE 4.2 based device using
eVC++. I
am using timer in that but its not working. But when I run the
same
DLL
no
as
service, it executes fine ....
What may be the problem that time is not working in service?
Please let me know if U have any idea...
Thanks,
Rahul
.
- Follow-Ups:
- Re: Timer not working in WinCE Service
- From: Rahul P. Shukla
- Re: Timer not working in WinCE Service
- References:
- Re: Timer not working in WinCE Service
- From: Rahul P. Shukla
- Re: Timer not working in WinCE Service
- From: <ctacke/>
- Re: Timer not working in WinCE Service
- From: Rahul P. Shukla
- Re: Timer not working in WinCE Service
- Prev by Date: Re: Timer not working in WinCE Service
- Next by Date: Re: Question for MODULES section in the .bib file
- Previous by thread: Re: Timer not working in WinCE Service
- Next by thread: Re: Timer not working in WinCE Service
- Index(es):
Relevant Pages
|