G
Guest
I just realized i had been posting under a managed newsgroup account that had
expired. hopefully this one works better and gets me a response from
Microsoft..
I have an MFC app that i'm trying to send messages to using the SendMessage
API through a C# application
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
expired. hopefully this one works better and gets me a response from
Microsoft..
I have an MFC app that i'm trying to send messages to using the SendMessage
API through a C# application
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