|
-
May 19th, 2005, 08:28 AM
#1
COM exe registration problem......
Hi everibody, I've the following problem, I'm trying to register on my machine a COM exe with the following command C:\myComSrv.exe /RegServer, I've noticed in Task Manager that myComSrv start but unfortunately the instance still alive since I kill it manually.
Can someone suggest me a way to understand this strange behaviour?
Thank you everybody in advance
-
May 19th, 2005, 09:54 AM
#2
Re: COM exe registration problem......
The call to register your server should be in your _tWinMain function (in myComSrv.cpp). The code should look like this:
Code:
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance,
{
//......
BOOL bRun = TRUE;
LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
while (lpszToken != NULL)
{
if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
{
_Module.UpdateRegistryFromResource(IDR_myComSrv, FALSE);
nRet = _Module.UnregisterServer(TRUE);
bRun = FALSE;
break;
}
if (lstrcmpi(lpszToken, _T("RegServer"))==0)
{
_Module.UpdateRegistryFromResource(IDR_myComSrv, TRUE);
nRet = _Module.RegisterServer(TRUE);
bRun = FALSE;
break;
}
lpszToken = FindOneOf(lpszToken, szTokens);
}
if (bRun)
{
_Module.StartMonitor();
//......
}
_Module.Term();
CoUninitialize();
return nRet;
}
I would guess the bRun is not being set to FALSE, so your RegServer code is not called. Place a breakpoint in this code and run the exe from the debugger. In your Project Settings->Debug set the program arguments to /RegServer (it might be as simple as the / in /RegServer).
-
May 19th, 2005, 10:24 AM
#3
Re: COM exe registration problem......
Thank you but unfortunately bRun is FALSE, I've noticed my application exit from _tWinMain but in task manager the instance still alive
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|