阅读:843回复:2
发现MSDN的一个错误!
以下摘自MSDN的Using the Active Desktop Object:
HRESULT hr; IActiveDesktop *pActiveDesktop; //Create an instance of the Active Desktop hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER, IID_IActiveDesktop, (void**)&pActiveDesktop); //Insert code to call the IActiveDesktop methods // Call the Release method pActiveDesktop->Release(); 其实pActiveDesktop根本就没有Release()方法! :D |
|
|
沙发#
发布于:2004-02-18 19:12
以下摘自MSDN的Using the Active Desktop Object: 非也。IActiveDesktop本身确实是没有Release()方法,但是它必须由IUnknown接口继承而来,而Release()方法就是IUnknown接口的函数。 |
|
板凳#
发布于:2004-02-19 12:30
确实如此!
看来我对COM实在太菜。 当时这段程序: COMPONENT compDesktopItem; int intCount; int intIndex = 0; //Create an instance of the Active Desktop hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,IID_IActiveDesktop, (void**)&pActiveDesktop); if(hr!=S_OK) { return false; } pActiveDesktop->GetDesktopItem(intIndex,&compDesktopItem,0); //???? /*compDesktopItem.dwSize = sizeof(COMPONENT); while(intIndex<=(intCount-1)) { //get the COMPONENT structure for the current desktop item pActiveDesktop->GetDesktopItem//???(intIndex, &compDesktopItem,0); //Insert code that processes the structure //Increment the index intIndex++; //Insert code to clean-up structure for next component } 为何在问号处出错呢??? :( |
|
|