我需要访问ROT对象的帮助. -非常接近,现在只是链接器错误-帮助! [英] I need help accessing ROT object please. - So close, now just a linker error -Help!
本文介绍了我需要访问ROT对象的帮助. -非常接近,现在只是链接器错误-帮助!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一小段代码,注释讲述了这个故事.
遇到任何帮助,我们将不胜感激.
Hi,
Small bit of code, Comments tell the story.
Any help would be appreciated as I''m stuck.
void Cbcr_18_PCEQ_SS_control::SlaveCheckin(GUID SlaveGUID)
{
IUnknown *pUnk;
void** ppv;
HRESULT hr = GetActiveObject(SlaveGUID, NULL, (IUnknown**)&pUnk); // SlaveGUID is correct,
// hr = 0;
hr = pUnk->QueryInterface( IID_IUnknown, (void**)&ppv ); // hr = 0, ppv gets
// assigned value
ppv -> // IDE does not populate with choices as if it's invalid,
// or I don't understand what I'm doing.
// What to do here? The object has a static function I need to call.
推荐答案
好吧,它是一个void**
,当然它不会填充. IDE不会解释返回值.如果要让IDE填充一个指针,则必须告诉它它是哪种类型的指针.
例如,如果您具有:
Well, its avoid**
, of course its not going to get populated. IDEs will not interpret return values. If you want the IDE to populate a pointer, you have to tell it what type of pointer it is.
For example, if you have:
void *myClass;
...然后您实际上得到了一个有效的指针:
...and later on you actually get a valid pointer:
((CValidClass *)myClass)->Method();
或...
or...
CValidClass *ptrClass = (CValidClass *) myClass;
ptrClass->Method();
您已请求一个IUnknown
接口(确定要执行的操作?),以便可以安全地将ppv
强制转换为(IUnknown *)
并调用可用的接口方法(QueryInterface, AddRef, Release
).
You have requested aIUnknown
interface (are you sure is what you intended to do?) so you may safely castppv
to(IUnknown *)
and call the available interface methods (QueryInterface, AddRef, Release
).
在Albert的帮助下,我现在有了:
With the help of Albert, I now have:
HRESULT hr = GetActiveObject(SlaveGUID, NULL, (IUnknown**)&pUnk); // SlaveGUID is correct,
// hr = 0;
hr = pUnk->QueryInterface( IID_IClassFactory, (void**)&ppv ); // hr = 0, ppv gets
Cbcrshimcontrol *ptrClass = (Cbcrshimcontrol *) ppv; // address
ptrClass->MidiOutFromMaster((DWORD) 0x27); // IDE populating -> with methods including
//MidiOutFromMaster. Home free? Not so much.
// Now some unresolved externals. :-(
Creating library .\Debug/bcr_18_PCEQ_SS_control.lib and object .\Debug/bcr_18_PCEQ_SS_control.exp
bcr_18_PCEQ_SS_control.obj : error LNK2028: unresolved token (0A000316) "public: static void __cdecl Cbcrshimcontrol::MidiOutFromMaster(unsigned long)" (?MidiOutFromMaster@Cbcrshimcontrol@@
这篇关于我需要访问ROT对象的帮助. -非常接近,现在只是链接器错误-帮助!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文