Posting windows messages in .net. How?

  • Thread starter Thread starter Claire
  • Start date Start date
C

Claire

I know there must be answers to this in Google but my search strings bring
back everything except what I need.
How do I post messages, (equivalent to PostMessage) to the handle of a main
window in c/f .net m/s visual c#? I need to send it a WM_CLOSE message.
(OpenNetCFs Process object doesn't appear to work properly)
A piece of code would be very useful please.
Also, how do I get the handle of a main window of another application in
..net too please?

thank you
(why did .net get called ".net"? Putting ".net" in a search engine never
seems to result in a decent number of relevant results)
 
OpenNETCF has all the Windows message based APIs covered that you'll need.
See OpenNETCF.Win32.Win32Window which has PostMessage and SendMessage
wrappers.
www.opennetcf.org/sdf/

There is a known bug in the Process.Kill method in the current version which
has been fixed in the code and for the next release. However you should
always treat killing a process as the last resort and try to close the app
cleanly with a message first.

Peter
 
And as an answer to your last question, yes ".NET" is a very awkward term
for searching, however you should have more luck with "dotnet" or "netcf"

Peter
 
Back
Top