0

Hi I got a problem with converting from LPARAM to std::string.
What I do is getting the selected object from a Listbox, the example I found on how to do this is to convert the object to LPARAM.
Now I want to convert this LPARAM to std::string and I've tried three different ways, can't remember which three.
But havent fully worked. How can I do it?

2
Contributors
2
Replies
10
Views
3 Years
Discussion Span
Last Post by ceelos1974
0
case ID_LISTBOX:
                    SendMessageW(Screen.ListBox, LB_GETTEXT,0,(LPARAM)listBoxStr);

                    print("called");

                    callamount = callamount + 1;

                    if (called == false)
                    {

                        called = true;

                        std::string filepath = "../objects/";
                        std::string filename = LPCTSTRTOstring((LPCTSTR)listBoxStr);
                        std::string fullfilepath = filepath + filename;
                        print_str(fullfilepath);

                        char *cstr = new char[fullfilepath.length() + 1];
                        strcpy(cstr, fullfilepath.c_str());

                        entities[currententity].EnableEditing(true);
                        entities[currententity].OpenEntity(cstr);
                        toolData.SelectedModelPath = entities[currententity].GetEntryValue("(MPath)", 1);
                        print(toolData.SelectedModelPath);

                        currententity = currententity + 1;

                        delete [] cstr;

                    }

                    if (callamount == 3)
                        called = false;

                break;

this works 99% but it comes with an error once I close the program

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.