Click here to Skip to main content
11,574,473 members (57,814 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ COM
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
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 28-Jan-13 4:33am
Edited 28-Jan-13 4:42am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

	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[^].
  Permalink  
v2

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

  Print Answers RSS


Advertise | Privacy | Mobile
Web03 | 2.8.150624.2 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100