Click here to Skip to main content
15,915,795 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Template class pointer instantiation Pin
Michael Dunn18-Mar-02 10:26
sitebuilderMichael Dunn18-Mar-02 10:26 
GeneralRe: Template class pointer instantiation Pin
Tomasz Sowinski18-Mar-02 10:34
Tomasz Sowinski18-Mar-02 10:34 
GeneralTHANKS!!! Pin
18-Mar-02 10:58
suss18-Mar-02 10:58 
GeneralRe: Template class pointer instantiation Pin
Christian Graus18-Mar-02 10:16
protectorChristian Graus18-Mar-02 10:16 
GeneralATL 7.0 & NT Service. Pin
Carl18-Mar-02 9:31
Carl18-Mar-02 9:31 
GeneralRe: ATL 7.0 & NT Service. Pin
Tomasz Sowinski18-Mar-02 9:44
Tomasz Sowinski18-Mar-02 9:44 
GeneralRe: ATL 7.0 & NT Service. Pin
Carl18-Mar-02 9:50
Carl18-Mar-02 9:50 
GeneralRe: ATL 7.0 & NT Service. Pin
C-J Berg19-Mar-02 1:39
C-J Berg19-Mar-02 1:39 
First, a service is a normal Windows 32 program, and as such it has at least a system message queue (even if it doesn't use it). Each thread may also have a thread specific message queue, but the creation is deferred until it's really needed (e.g., a User or GDI function is called). The old SetTimer function makes use of window messages (it was normally used for background processing purposes back in the 16-bit days), even if you specify a callback. Because of this reason, one must get and dispatch messages when it's used.

Basically, all you need to do is to implement a Get-or-Peek/DispatchMessage-loop somewhere in your ServiceMain (or a function called from it). This is what makes the wheel go round. MFC and other framework libraries have a message loop buried way down in their private code, so you don't see it often these days, but it's still integral to Windows.

However, if the only WM-based function you're going to be using is SetTimer, there is a better solution: Waitable Timers. A waitable timer is a kernel object that can be waited on using the WaitForXObject(s) set of functions (cf. CreateWaitableTimer API), and it can be set to an absolute or relative due time. This way you can combine it with waiting on other events such as a Quit event, which is a good service design.
GeneralRe: ATL 7.0 & NT Service. Pin
Carl19-Mar-02 2:10
Carl19-Mar-02 2:10 
GeneralAntialiased XP icons Pin
18-Mar-02 9:17
suss18-Mar-02 9:17 
GeneralRe: Antialiased XP icons Pin
Jon Sagara18-Mar-02 9:31
Jon Sagara18-Mar-02 9:31 
GeneralRe: Antialiased XP icons Pin
Derek Lakin18-Mar-02 11:02
Derek Lakin18-Mar-02 11:02 
GeneralRe: Antialiased XP icons Pin
Shog918-Mar-02 10:58
sitebuilderShog918-Mar-02 10:58 
GeneralPopup menus don't disappear Pin
18-Mar-02 9:05
suss18-Mar-02 9:05 
GeneralRe: Popup menus don't disappear Pin
Michael Dunn18-Mar-02 10:27
sitebuilderMichael Dunn18-Mar-02 10:27 
GeneralAssert madness Pin
Todd Smith18-Mar-02 8:34
Todd Smith18-Mar-02 8:34 
GeneralRe: Assert madness Pin
Tomasz Sowinski18-Mar-02 8:53
Tomasz Sowinski18-Mar-02 8:53 
GeneralRe: Assert madness Pin
Todd Smith18-Mar-02 9:30
Todd Smith18-Mar-02 9:30 
GeneralRe: Assert madness Pin
Tomasz Sowinski18-Mar-02 9:55
Tomasz Sowinski18-Mar-02 9:55 
Generaltemplate class on CWinThread Pin
18-Mar-02 8:30
suss18-Mar-02 8:30 
GeneralRe: template class on CWinThread Pin
Tomasz Sowinski18-Mar-02 8:49
Tomasz Sowinski18-Mar-02 8:49 
QuestionHow to use WM_WTSSESSION_CHANGE? Pin
WookMaster18-Mar-02 7:11
WookMaster18-Mar-02 7:11 
AnswerRe: How to use WM_WTSSESSION_CHANGE? Pin
Tomasz Sowinski18-Mar-02 7:18
Tomasz Sowinski18-Mar-02 7:18 
GeneralRe: How to use WM_WTSSESSION_CHANGE? Pin
WookMaster18-Mar-02 7:27
WookMaster18-Mar-02 7:27 
GeneralRe: How to use WM_WTSSESSION_CHANGE? Pin
Tomasz Sowinski18-Mar-02 7:29
Tomasz Sowinski18-Mar-02 7:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.