In Visual Basic .Net, I am trying to figure out how to
get a reference to the open window that the mouse is in.
Suppose I select (highlight) text on a web page shown on
an Internet Explorer window, and then click on a toolbar
item in that window which runs my VB program, and the VB
program will copy the highlighted text to the clipboard.
I know how to use ShellWindows to loop through the
different open windows, but how can I determine which
window was the one the mouse was in when the VB
application was started?
I've tried using GetAcitveWindow in the API, but it
returns a 19-digit number. Is there a way to convert
this to the 6-digit HWND, or is there an alternative
solution?
Mattias Sj?gren - 10 Dec 2003 08:40 GMT
Ed,
>I've tried using GetAcitveWindow in the API, but it
>returns a 19-digit number. Is there a way to convert
>this to the 6-digit HWND, or is there an alternative
>solution?
HWNDs are not always 6 digits, and in fact you shouldn't have to care
about its value. If you get something as big as 19 digits, you're
probably incorrectly using a Long as the return type in your Declare
statement. Try changing it to IntPtr.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.