Hi All,
I am trying to initialize a timer within an ATL COM Service. I am having a little problem and I could use some help. This issue is about the CALLBACKS function.
I have wrapped the SetTimer and KillTimer around the Message loop like so:
// Start the timer before the message loop
UINT TimerId = ::SetTimer(NULL, ID_TIMER, 10000, TimerHit);
MSG msg;
while (GetMessage(&msg, 0, 0, 0))
DispatchMessage(&msg);
// Stop the timer after the message loop
::KillTimer(NULL, TimerId);
and I declared the CALLBACK like this:
void CALLBACK TimerHit(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
{
// Do some stuff
}
and I have this in the header file:
void CALLBACK TimerHit(HWND hwnd, UINT Msg, UINT idEvent, DWORD dwTime);
Other things in this app include ADO support. Other than that It is an off the self version of the ATL COM Wizard Service App. Some thing I did not understand was why I had to manually add the header file (SyncEmpS.h) for my main class (SyncEmpS.cpp) file.
When I compile I get the following:
Compiling...
SyncEmpS.cpp
C:\_Work\SyncEmpS\SyncEmpS.cpp(355) : error C2664: 'SetTimer' : cannot convert parameter 4 from 'void (struct HWND__ *,unsigned int,unsigned int,unsigned long)' to 'void (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,unsigned long)'
None of the functions with this name in scope match the target type
Error executing cl.exe.
SyncEmpS.exe - 1 error(s), 0 warning(s)
Your thoughts or help would be greatly appreciated.
Best Regards,
KC
I am trying to initialize a timer within an ATL COM Service. I am having a little problem and I could use some help. This issue is about the CALLBACKS function.
I have wrapped the SetTimer and KillTimer around the Message loop like so:
// Start the timer before the message loop
UINT TimerId = ::SetTimer(NULL, ID_TIMER, 10000, TimerHit);
MSG msg;
while (GetMessage(&msg, 0, 0, 0))
DispatchMessage(&msg);
// Stop the timer after the message loop
::KillTimer(NULL, TimerId);
and I declared the CALLBACK like this:
void CALLBACK TimerHit(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
{
// Do some stuff
}
and I have this in the header file:
void CALLBACK TimerHit(HWND hwnd, UINT Msg, UINT idEvent, DWORD dwTime);
Other things in this app include ADO support. Other than that It is an off the self version of the ATL COM Wizard Service App. Some thing I did not understand was why I had to manually add the header file (SyncEmpS.h) for my main class (SyncEmpS.cpp) file.
When I compile I get the following:
Compiling...
SyncEmpS.cpp
C:\_Work\SyncEmpS\SyncEmpS.cpp(355) : error C2664: 'SetTimer' : cannot convert parameter 4 from 'void (struct HWND__ *,unsigned int,unsigned int,unsigned long)' to 'void (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,unsigned long)'
None of the functions with this name in scope match the target type
Error executing cl.exe.
SyncEmpS.exe - 1 error(s), 0 warning(s)
Your thoughts or help would be greatly appreciated.
Best Regards,
KC