I asked this a few days ago and never got a response. Hopefully someone can
help me now as i'm giving more information
I have an MFC app that i'm trying to send messages to using the SendMessage
API.
Here is the signature and the first line of code for the function that
receives this message in the MFC application:
LRESULT CMainFrame::OnLoadVidAnaly( WPARAM wParam, LPARAM lParam )
{
CString strConfig = (LPCTSTR) wParam;
...
return 1;
}
I've tried all kinds of ways of declaring the extern function to make this
call... they all result in different (and all incorrect) results.
For the first parameter i've tried using a StringBuilder, a string or an
IntPtr. Using StringBuilder, i end up with strConfig being = "". Using a
string, i end up with strConfig being = a bunch of garbage. If i use an
IntPtr and use some of the marshalling functions (StringToBSTR,
StringToHGlobalAuto, etc) that first line of the function throws an
exception.
Can you help me figure out whats going on and how to appropriately call this
SendMessage call?
Thanks in advance,
-Tim