Click here to Skip to main content
15,911,132 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalstring initialization problem Pin
ChiYung17-Jul-02 8:07
ChiYung17-Jul-02 8:07 
GeneralRe: string initialization problem Pin
Joaquín M López Muñoz17-Jul-02 8:16
Joaquín M López Muñoz17-Jul-02 8:16 
GeneralRe: string initialization problem Pin
Nathan Blomquist17-Jul-02 8:17
Nathan Blomquist17-Jul-02 8:17 
GeneralRe: string initialization problem Pin
jmkhael17-Jul-02 10:25
jmkhael17-Jul-02 10:25 
GeneralRe: string initialization problem Pin
Michael Dunn17-Jul-02 16:49
sitebuilderMichael Dunn17-Jul-02 16:49 
GeneralRe: string initialization problem Pin
Anonymous18-Jul-02 1:37
Anonymous18-Jul-02 1:37 
GeneralNT Service networking Pin
Greven17-Jul-02 8:01
Greven17-Jul-02 8:01 
GeneralRe: NT Service networking Pin
Daniel Lohmann17-Jul-02 14:09
Daniel Lohmann17-Jul-02 14:09 
To write your very first service is always a bit of hard work. However, it is not that difficult as it looks like:

1) To really work with a service you need some kind of inter-process-communication (IPC). IPC is the way to communicate with your service. Sockets are one example for IPC, I usually prefer NamedPipes or RPC (because they integrate well into the NT security modell), but one may also use shared memory, sockets, NetBIOS and so on.

2) Even if possible I recommend not using MFC in a service. For things like CString or CArray it is you can use the ATL/WTL classes that provide a compatible interface. Or use STL. Especially CSocket is a no-no. It is integreated to much into "windowing applications".

3) To control a service a CPL or MMC snap-in is a really good solution. You can monitor the registry as you suggested, but you could also inform the service about changes via a Win32 event object, IPC or a user defined service control code. The last one is elegant because you don't need an own watcher thread.

4) Debugging a service is a bit hard, because it is not possible to run it directly under the debugger. However, you could connect your debugger later on to the service (via task manager). To debug service startup code a hardcoded breakpoint works best.

// some code
_asm int 3 // Program will break here
// some more code

If the code reaches the hardcoded breakpoint, the usual "unhandled exception" dialog box will appear and give you the chance to attach the debugger.

Hope that helps for the moment Smile | :)


--

Daniel Lohmann

http://www.losoft.de/
GeneralRe: NT Service networking Pin
Greven17-Jul-02 14:52
Greven17-Jul-02 14:52 
GeneralRe: NT Service networking Pin
Daniel Lohmann17-Jul-02 21:02
Daniel Lohmann17-Jul-02 21:02 
Generaldisable keys in word document Pin
Srini Kella17-Jul-02 7:38
Srini Kella17-Jul-02 7:38 
GeneralRe: disable keys in word document Pin
Nick Parker17-Jul-02 8:13
protectorNick Parker17-Jul-02 8:13 
Generalmodifymenu question -about adding item Pin
ns17-Jul-02 6:37
ns17-Jul-02 6:37 
GeneralRe: modifymenu question -about adding item Pin
Roger Allen17-Jul-02 6:43
Roger Allen17-Jul-02 6:43 
GeneralRe: modifymenu question -about adding item Pin
ns17-Jul-02 8:26
ns17-Jul-02 8:26 
GeneralRe: modifymenu question -about adding item Pin
Roger Allen17-Jul-02 8:49
Roger Allen17-Jul-02 8:49 
GeneralRe: WoW! A new file to explore..... Pin
ns17-Jul-02 8:57
ns17-Jul-02 8:57 
GeneralRe: WoW! A new file to explore..... Pin
Shog917-Jul-02 11:13
sitebuilderShog917-Jul-02 11:13 
GeneralRe: WoW! A new file to explore..... Pin
Roger Allen18-Jul-02 0:11
Roger Allen18-Jul-02 0:11 
GeneralRe: WoW! A new file to explore..... Pin
ns18-Jul-02 1:22
ns18-Jul-02 1:22 
GeneralOutlook GUI!!! Pin
tongc17-Jul-02 6:02
tongc17-Jul-02 6:02 
GeneralRe: Outlook GUI!!! Pin
benjymous17-Jul-02 6:19
benjymous17-Jul-02 6:19 
GeneralRe: Outlook GUI!!! Pin
tongc17-Jul-02 7:11
tongc17-Jul-02 7:11 
Questionwho handles ID_FILE_OPEN? Pin
ns17-Jul-02 5:48
ns17-Jul-02 5:48 
AnswerRe: who handles ID_FILE_OPEN? Pin
Roger Allen17-Jul-02 5:56
Roger Allen17-Jul-02 5:56 

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.