How can I handle windows message within my .net program?

  • Thread starter Thread starter Xnostaw
  • Start date Start date
X

Xnostaw

Hi all,

I have a native program app1 written in vc6 and a .net one named app2
written by c#.

I need to handle the custmize windows message sent from the app1 to app2.But
I dont known how to process all these wm_xxx mixtured with the event model.

Mind anyone will be useful and valuable.
 
I need to handle the custmize windows message sent from the app1 to app2.But
I dont known how to process all these wm_xxx mixtured with the event model.

Override the WndProc method of your form.



Mattias
 
Hello,

few weeks before I have solved the same problem about the static import of
the native Win-API functions (GetWindowThreadProcessId,
RegisterWindowMessages and PostMessage) about the DllImport-Attribute.

For receiving of messages I have used follow items in my receiving Form
class:


[System.Security.Permissions.PermissionSet(System.Security.Permissions.Secur
ityAction.Demand, Name="FullTrust")]
protected override void WndProc(ref Message m)
{
const int const_WM_APP=0x8000;
if(m.Msg==const_WM_APP+1) {
//do something
}

base.WndProc(ref m);
}

All the best,
Hubert
 
Back
Top