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

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.
 
M

Mattias Sjögren

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
 
H

Hubert Hermanutz

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top