Click to See Complete Forum and Search --> : how to use Item Method of shellwindows object in plain c


MouseKe
November 15th, 2003, 10:36 AM
when run at "hr= pIe->lpVtbl->Item(pIe,v,&fFolder)", hr=80070057.and i can't get the correct result.



This is my simply source code:

#include <windows.h>
#include "Exdisp.h"

IDispatch **fFolder;
VARIANT v;
HRESULT hr;
IShellWindows *pIe=NULL;
long *nCount;

main()
{
hr=CoInitialize(NULL);
hr=CoCreateInstance(&CLSID_ShellWindows,
NULL,
CLSCTX_SERVER,
&IID_IShellWindows,
(LPVOID FAR*)&pIe);

hr=pIe->lpVtbl->get_Count(pIe,&nCount);


//nCount=0;
//v.uiVal=nCount;
hr= pIe->lpVtbl->Item(pIe,v,&fFolder);

pIe->lpVtbl->Release(pIe);
CoUninitialize();
}





when run at "hr= pIe->lpVtbl->Item(pIe,v,&fFolder)", hr=80070057.and i can't get the correct result.


In exdsip.h ,I found Item look like it:


/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Item )(
IShellWindows __RPC_FAR * This,
/* [optional][in] */ VARIANT index,
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *Folder);


so I changed 1 place:


hr= pIe->lpVtbl->Item(pIe,v,Folder);//remove the "&"

but the error message is same as:

First-chance exception in ggg.exe (RPCRT4.DLL): 0x000006F4: (no name).
First-chance exception in ggg.exe (RPCRT4.DLL): 0x80020008: (no name).

hr=8007064f;
hr=80020008;


Maybe I should use " #import "mshtml.dll" and #import"shdocvw.dll"exclude("tagREADYSTATE")",
but in plain c ,i can't use #import .

how can I get the correct result of Folder in plain c .Please

vc6.0,win98,ie 5.0

dasanyang
November 16th, 2003, 09:12 AM
nobody can deal with this problem here.there no wiser man.

Marc G
November 16th, 2003, 10:54 AM
Can you explain a bit what you are trying to do? Perhaps there's an easier solution.