Forum Index

Welcome to the SDL Passolo User Forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting all Strings from SourceList

 
Post new topic   Reply to topic     Forum Index -> SDL Passolo Object Model
View previous topic :: View next topic  
Author Message
sme



Joined: 19 Oct 2009
Posts: 7
Location: Berlin

PostPosted: Mon Jul 26, 2010 11:16 am    Post subject: Getting all Strings from SourceList Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
sme



Joined: 19 Oct 2009
Posts: 7
Location: Berlin

PostPosted: Mon Jul 26, 2010 12:07 pm    Post subject: Reply with quote

The get_String Method returns a null ptr. Anyway, the property problem is still there.
Back to top
View user's profile Send private message Visit poster's website
sme



Joined: 19 Oct 2009
Posts: 7
Location: Berlin

PostPosted: Mon Jul 26, 2010 1:36 pm    Post subject: Reply with quote

I finally solve the issue.

Code:

for(long i = 1; i<nWords; ++i) {
      index.intVal = i;
      LPDISPATCH result = src.get_String(index, text_type);
      CPslSourceString srcString(result);
      CString tmp = srcString.GetText();
   }
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> SDL Passolo Object Model All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group