Click here to Skip to main content
12,630,410 members (30,697 online)
Rate this:
 
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 5:33am
Updated 28-Jan-13 5: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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161205.3 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2016
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