MinnisotaFreezing
Programmer
Hello, I'm strying to use CString with my windows programming, specifically
CString myString = "This is a test";
{CODE}
SendMessage (hwndLstBox, LB_ADDSTRING, 1, (LPARAM) myString);
Doesn't work, can't convert from CString to long.
Am I using it wrong, or whats the point in using CString if I can't pass it to windows procedures?
An LPARAM is a 32 bit value, and a CString can be substituted for LPCTSTR, which is a 32 bit pointer. Isn't a 32 bit pointer a value? Yes, it is pointing to something else, but that pointer has a value, and it occupies 32 bits. I understand it doesn't work, I don't know exactly why.
I guess the bottom line is, is there a way I can pass CStrings to windows procedures like SendMessage?
CString myString = "This is a test";
{CODE}
SendMessage (hwndLstBox, LB_ADDSTRING, 1, (LPARAM) myString);
Doesn't work, can't convert from CString to long.
Am I using it wrong, or whats the point in using CString if I can't pass it to windows procedures?
An LPARAM is a 32 bit value, and a CString can be substituted for LPCTSTR, which is a 32 bit pointer. Isn't a 32 bit pointer a value? Yes, it is pointing to something else, but that pointer has a value, and it occupies 32 bits. I understand it doesn't work, I don't know exactly why.
I guess the bottom line is, is there a way I can pass CStrings to windows procedures like SendMessage?