sme
Joined: 19 Oct 2009 Posts: 7 Location: Berlin
|
Posted: Mon Jul 26, 2010 11:16 am Post subject: Getting all Strings from SourceList |
|
|
Hi there,
I'm using the C++ Wrapper Classes and get into trouble with the OLE stuff from MFC.
I want all strings from a source list. Here is the code I've got so far:
| Code: |
// get the source list here
CPslSourceList src( _srcLists->Item( index_var ) );
// count words for iterating
VARIANT text_type;
text_type.vt = VT_EMPTY;
long nWords = src.get_StringCount(text_type); // this works fine
VARIANT index;
index.vt = VT_I4;
for(long i = 0; i<nWords; ++i) {
index.intVal = i;
LPDISPATCH result = src.get_String(index, text_type);
DISPID dispid;
EXCEPINFO ExceptionInfo;
/*
Here is the Problem, I dont know the proper Property to get the right ID
*/
char *sText = "Text";
OLECHAR *sOleText=new OLECHAR[strlen(sText)+1];
mbstowcs(sOleText,sText,strlen(sText)+1);
// CRASH
result->GetIDsOfNames(IID_NULL, &sOleText, 1, LOCALE_USER_DEFAULT, &dispid);
VARIANT bstr;
result->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, NULL, &bstr, &ExceptionInfo, NULL);
}
|
As I wrote in my comments, I dont know how to handle the LPDISPATCH to receive the String Value.
Anyone who can help?
Stefan |
|