在没有注册的情况下使用COM dll(Manifest文件的帮助) [英] Using COM dll without registration (Help of Manifest file)

查看:78
本文介绍了在没有注册的情况下使用COM dll(Manifest文件的帮助)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想在没有注册的情况下使用com dll。

我按照链接中提到的步骤进行操作 http://msdn.microsoft.com/en-us/library/ms973913.aspx [ ^ ]



但是如果执行了CreateInstance()行,我会收到访问冲突错误

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;
}





我确定GUID正在从清单文件中读取。这是通过在sxstrace.exe的帮助下进行跟踪来确认的。



请帮助我为什么我得到了崩溃并需要一些帮助这个



提前致谢

Durga



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

推荐答案

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



变量 ptr 需要初始化为某个对象才能调用其中一个方法。



使用 CoLoadLibrary 功能 [ ^ ]。


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


这篇关于在没有注册的情况下使用COM dll(Manifest文件的帮助)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆