What can we do in C#.net with a given window handle?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, friends,

What can we do in C#.net with a given window handle? For example, can we
activate or close this window? How? Any reference papers?

Thanks a lot.
 
Andrew said:
What can we do in C#.net with a given window handle? For example, can we
activate or close this window? How? Any reference papers?

Anything you could do in Win32 you can do in C#. It may require some Win32
calls, but really there are no limits.

What are you trying to accomplish?
 
Hello Andrew,

A> For example, can we activate or close this window? How? Any reference
papers?

You need to get the handle, which is represented in IntPrt structure, and
use it as the standard HANDLE in all Win32 api methods called via p/invoke.

Start from this sample http://pinvoke.net/default.aspx/coredll/SendMessage.html



---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangel
 
Thanks, Chris,

Well, some of them includes:

If I have an array of IntPtr, can we tell whick IntPtr is for a Word app,
which IntPtr is for Excel app, which IntPtr is for user app, etc.

Moreover, if we can tell, then, can we use IntPtr to interact with the app?
For example, find out document file name opened in a Word app, or instruct a
Word app to Save or Open a file utilizing this Word app's IntPtr?

If yes, how? Any reference papers? Thanks again.
 
Back
Top