Link to home
Start Free TrialLog in
Avatar of lapucca
lapucca

asked on

How do I add CB_SETITEMDATA to a comboBox with wstring variable as the LPARAM?

Also, is it correct and OK to put the declaration of the wstring in side of this loop?  Currently, with this code I'm getting the following error message from the compiler.
Error      1      error C2440: 'initializing' : cannot convert from 'std::wstring *' to 'std::basic_string<_Elem,_Traits,_Ax>'      c:\Projects\UnityExtProperty\CUserPage.Cpp      884



//while (loop condition is true)

                                    // Add the context cn attribute
                                    std::wstring wsGroup = new wstring;
                                    wsGroup = (colSearchColumnDN.pADsValues->CaseIgnoreString);
                                    SendMessage(hwndPrimGroup,CB_SETITEMDATA, index, (LPARAM)T2CW(wsGroup.c_str()));
                                    primaryGroups.push_back(wsGroup);
                                    padsSearchContainer->FreeColumn( &colSearchColumnDN );

//end while loop
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lapucca
lapucca

ASKER

The problem is that the vector doesn't like stroing pointers.  I had code before to store pointers to object of my class and the program would crash randomly.  And I also get memory uninitilize in Rational Purfiy.  Are you sure that it would store wstring*?  Isn't wstring already a pointer of wchar_t*?
This questions needs to be cross-referenced with your other question at http:/Q_21833678.html

I recommend that you close one of these questions, lapucca, and invite the experts from it to the other question.

We need to see what code you currently have that's causing you grief in the vector. It is hard to see what the state of play is. Please can you show us you current code with current error messages.