Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hi,

I want to use the com dll without doing the registration.
I followed the step as mentioned in the link http://msdn.microsoft.com/en-us/library/ms973913.aspx[^]

But i am getting "access violation" error if the line CreateInstance() is executed
C++
int _tmain(int argc, _TCHAR* argv[])
{
	CoInitializeEx(0, COINIT_APARTMENTTHREADED);

	IParameterDLLPtr ptr;
	CLSID iID = __uuidof(Sample);
	HRESULT hr = ptr.CreateInstance(__uuidof(Sample), NULL, CLSCTX_INPROC);
	if (SUCCEEDED(hr))
	{
          ptr.Release();
        }
CoUninitialize();
return 0;
}


I am sure the GUID is reading from the manifest file. This is confirmed by doing trace with the help of sxstrace.exe

Please help me why i am getting the crash and need some help on this

Thanks in advance
Durga
Posted
Updated 28-Jan-13 4:42am
v2

1 solution

C++
IParameterDLLPtr ptr;
CLSID iID = __uuidof(Sample);
HRESULT hr = ptr.CreateInstance(__uuidof(Sample), NULL, CLSCTX_INPROC);

The variable ptr needs to be initialised to some object before you can call one of its methods.

You can do this much more easily by using the CoLoadLibrary function[^].
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900