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?

Recommended Answers

All 2 Replies

Show what you are doing. There are too many factors here to say without seeing your code.

                    SendMessageW(Screen.ListBox, LB_GETTEXT,0,(LPARAM)listBoxStr);


                    callamount = callamount + 1;

                    if (called == false)

                        called = true;

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

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

                        toolData.SelectedModelPath = entities[currententity].GetEntryValue("(MPath)", 1);

                        currententity = currententity + 1;

                        delete [] cstr;


                    if (callamount == 3)
                        called = false;


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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.