Click here to Skip to main content
15,905,563 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionConverto long to char [] Pin
shpid3r15-Jul-09 2:01
shpid3r15-Jul-09 2:01 
AnswerRe: Converto long to char [] Pin
Chris Losinger15-Jul-09 2:03
professionalChris Losinger15-Jul-09 2:03 
AnswerRe: Converto long to char [] Pin
«_Superman_»15-Jul-09 2:10
professional«_Superman_»15-Jul-09 2:10 
AnswerRe: Converto long to char [] Pin
Cedric Moonen15-Jul-09 2:11
Cedric Moonen15-Jul-09 2:11 
GeneralRe: Converto long to char [] Pin
shpid3r15-Jul-09 2:20
shpid3r15-Jul-09 2:20 
GeneralRe: Converto long to char [] Pin
Stuart Dootson15-Jul-09 4:16
professionalStuart Dootson15-Jul-09 4:16 
QuestionToolbar problem Pin
Rakesh515-Jul-09 1:34
Rakesh515-Jul-09 1:34 
QuestionCOM Object Released But DLL Still In Memory Pin
Crazy Joe Devola15-Jul-09 0:41
Crazy Joe Devola15-Jul-09 0:41 
Hi,

I have a program that uses a COM object. At somepoint I try to release the object. After I do the release process, I can see using Process Explorer that the ActiveX DLL is still in memory.

My code is below. Am I doing something wrong? Why is the DLL still in memory?
ComReleaseTest.DLL is a test VB ActiveX DLL I wrote to debug this problem. It does nothing - all it has is one test sub which I am not even calling.

<br />
#include "stdafx.h"<br />
<br />
#import "..\ProductTree\winpos\drv32\ComReleaseTest.dll" no_namespace<br />
<br />
_CComReleaseTestPtr m_Srv;<br />
<br />
int Close();<br />
void ReleaseObject();<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
	HRESULT hResult;<br />
<br />
	try<br />
	{	<br />
		if ( TRUE )<br />
		{<br />
			hResult = CoInitialize( NULL );<br />
<br />
			if ( hResult != S_OK )<br />
			{<br />
				return 1;<br />
			}<br />
		}<br />
<br />
		HRESULT hr = m_Srv.CreateInstance(__uuidof( CComReleaseTest ), NULL, CLSCTX_ALL);<br />
		if (FAILED(hr))<br />
			_com_issue_error(hr);<br />
    }<br />
	catch(_com_error& e)<br />
	{<br />
		return (1);<br />
    }<br />
<br />
	Close();<br />
<br />
	return (0);<br />
<br />
}<br />
<br />
int Close()<br />
{<br />
	long Result = 0;<br />
<br />
	if ( m_Srv != NULL )<br />
    {<br />
		TRY<br />
		{<br />
			ReleaseObject();<br />
		}<br />
		CATCH_ALL(e)<br />
		{<br />
			TCHAR sError[255];<br />
			e->GetErrorMessage(sError,255);<br />
		}<br />
		END_CATCH_ALL<br />
	}<br />
<br />
	return ( (short)Result );<br />
}<br />
<br />
<br />
<br />
void ReleaseObject()<br />
{<br />
<br />
	// Disconnect from VB ActiveX<br />
	try<br />
	{<br />
		m_Srv.Release();<br />
	}<br />
	catch(_com_error& e)<br />
	{<br />
	   //<br />
	}<br />
<br />
	free(m_Srv);<br />
	m_Srv.Detach();<br />
	<br />
<br />
	m_Srv = NULL;<br />
<br />
}<br />
<br />
<br />


The reason I am trying to track this is that I have anotehr program that at somepoint calls an InstallShield 5.5 setup. This setup.exe hangs at 99% and I found that if my program does not call a certain ActiveX then there is no problem with the setup.exe. So I am trying to release that ActiveX before calling setup.exe, but the COM DLL just stays in memory!
AnswerRe: COM Object Released But DLL Still In Memory Pin
Stuart Dootson15-Jul-09 0:49
professionalStuart Dootson15-Jul-09 0:49 
GeneralRe: COM Object Released But DLL Still In Memory Pin
Crazy Joe Devola15-Jul-09 0:55
Crazy Joe Devola15-Jul-09 0:55 
Questionadding an item into control panel context menu Pin
emmmatty114-Jul-09 22:56
emmmatty114-Jul-09 22:56 
AnswerRe: adding an item into control panel context menu Pin
«_Superman_»15-Jul-09 2:04
professional«_Superman_»15-Jul-09 2:04 
Questionunicode equivalent of Readfile() function.. Pin
Rakesh514-Jul-09 22:42
Rakesh514-Jul-09 22:42 
AnswerRe: unicode equivalent of Readfile() function.. Pin
Naveen14-Jul-09 22:55
Naveen14-Jul-09 22:55 
QuestionRe: unicode equivalent of Readfile() function.. Pin
Rajesh R Subramanian14-Jul-09 22:57
professionalRajesh R Subramanian14-Jul-09 22:57 
AnswerRe: unicode equivalent of Readfile() function.. Pin
Rakesh514-Jul-09 23:36
Rakesh514-Jul-09 23:36 
QuestionRe: unicode equivalent of Readfile() function.. [modified] Pin
Rajesh R Subramanian14-Jul-09 23:52
professionalRajesh R Subramanian14-Jul-09 23:52 
AnswerRe: unicode equivalent of Readfile() function.. Pin
CPallini14-Jul-09 23:09
mveCPallini14-Jul-09 23:09 
AnswerRe: unicode equivalent of Readfile() function.. Pin
Nishad S15-Jul-09 0:38
Nishad S15-Jul-09 0:38 
Questionwhat is IWshRuntimeLibrary? Pin
V K 214-Jul-09 22:03
V K 214-Jul-09 22:03 
AnswerRe: what is IWshRuntimeLibrary? Pin
CPallini14-Jul-09 22:13
mveCPallini14-Jul-09 22:13 
Questiontoolbar controls Pin
Member 59031014-Jul-09 21:29
Member 59031014-Jul-09 21:29 
AnswerRe: toolbar controls Pin
_AnsHUMAN_ 14-Jul-09 21:38
_AnsHUMAN_ 14-Jul-09 21:38 
AnswerRe: toolbar controls Pin
Stuart Dootson14-Jul-09 21:45
professionalStuart Dootson14-Jul-09 21:45 
GeneralRe: toolbar controls Pin
Member 59031014-Jul-09 23:58
Member 59031014-Jul-09 23:58 

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.