Home All Groups Group Topic Archive Search About

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

Author
26 Apr 2007 9:42 PM
Andrew
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.

Author
26 Apr 2007 10:26 PM
Chris Mullins [MVP]
"Andrew" <And***@discussions.microsoft.com> wrote
> 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?

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins
Author
27 Apr 2007 4:46 PM
Andrew
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.

Show quote
"Chris Mullins [MVP]" wrote:

> "Andrew" <And***@discussions.microsoft.com> wrote
> > 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?
>
> --
> Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
> http://www.coversant.com/blogs/cmullins
>
>
>
Author
27 Apr 2007 1:33 PM
Michael Nemtsev
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) Michelangelo
Author
27 Apr 2007 4:46 PM
Andrew
I am reading them, thank you, Michael...

Show quote
"Michael Nemtsev" wrote:

> 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) Michelangelo
>
>
>

AddThis Social Bookmark Button