Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / December 2003

Tip: Looking for answers? Try searching our database.

How to find which window the mouse is in

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ed White - 10 Dec 2003 02:30 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.