Click to See Complete Forum and Search --> : OLE and NT Service


Novice
April 27th, 1999, 04:14 AM
Hi
I have written an console application that requires the use of MAPI and OLE. After testing my program, I feel that instead of a console application, I should have changed it to a NT service instead. So I got the code CNTService.cpp, .h and relevant files and start to change my original program. Now I am stuck as OLE does not work as desired. I know that there is nothing wrong with my code, as a console application, its working. My question is, is there any speical considerations when using OLE and even MAPI in a NT Service. If yes, what are the things to note.

jaylauriano
May 6th, 1999, 02:09 PM
You aren't alone with this problem. I'm trying to use ODBC from within an NT Service and have run into the same problem. My program works fine as a console but fails as a service. I suspect it has something to do with the initialization of the OLE libraries from within a service. AfxWinInit() might play a role here but I don't know. Just have to keep sifting through the **** Microsoft calls documentation.


Freedom is knowing you can burn all your software without losing a minute's sleep.

jpw20
July 8th, 2005, 04:29 AM
In case anyone comes across this post while searching (as I did), this might be useful. You may find that you have to explicitly initialise COM security when running as a service, but not when running as an application. The following code may help:


CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT,
RPC_C_IMP_LEVEL_IDENTIFY, NULL, 0, NULL);