Re: Interface method vs QueryInterface()
It works. Thank you.
I don't understand why:
1). With the interface I got by CoCreateInstanceEx, I can call the
interface method; but not QueryInterface method (for any interface)?
Why I have to start from IUnknown?
2). For each interface I have to set proxy blanket to query other
interface, but this time I don't have to start from IUnknown.
On Dec 15, 12:54 pm, "Alexander Nickolov" <agnicko...@mvps.org> wrote:
QI for IUnknown and set the proxy blanket on the returned
interface pointer.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnicko...@mvps.org
MVP VC FAQ:http://www.mvps.org/vcfaq
=====================================
"H Xia" <huayang....@gmail.com> wrote in messagenews:1166116286.444885.219680@79g2000cws.googlegroups.com...
What's difference between normal interface method and QueryInterface
method?
In client side, I created an instance by calling:
MULTI_QI qi = {&IID_ITestCP, NULL, S_OK};
HRESULT hResult = ::CoCreateInstanceEx( CLSID_TestCP
, NULL
, CLSCTX_LOCAL_SERVER |
CLSCTX_REMOTE_SERVER
, &serverInfo
, 1
, &qi
);
It created an instance and returned an interface from the instance.
Then I call the interface method after properly setting its Proxy
blanket, it succeeded. Then I go even further to query another
interface through the gotten interface, it failed.
hResult = pUnk->BlanketInfo();
//ok
hResult = pUnk->QueryInterface(IID_IConnectionPointContainer,
(void**)&pCPC); // access denied
My question is if the second call failed with access denied, why not
the first one?
Thanks in advance.