Posting and Handling Custom Messages (WM_USER type)

  • Thread starter Thread starter Brian Reed
  • Start date Start date
B

Brian Reed

I would like to handle custom messages in my windows form/application. In
ATL, I derived from CWindowImpl and added message handlers to my message
map. In VB Code requires me to hook into the WinProc to handle messages.
How can I achieve the same thing in C#? Do I have to hook into the WinProc,
or can I just add message handlers?
 
You may want to take a look at Control.BeginInvoke(). It can take the
place of many of the things you would usually use custom messages for;
essentially it's a PostMessage(WM_USER) with a delegate carried along.

If you do need to use custom messages instead, then you need to override
WndProc() to catch them.
 

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

Back
Top