it would be difficult... for example in Delphi the class name of an edit box is originally TEdit.. and that's the best way for checking for editboxes... it is difficult..
..-=ViKtOr=-..
Main Topics
Browse All TopicsHow can I detect that my mouse is over a text box from another program?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Use the GetFocus API function, it returns a handle of the window (the textboxes are windows too) that has the focus.
This sample line code shows U how to use the function:
Private Declare Function GetFocus Lib "user32" () As Long
lblFocus = "Focus Window: " & Str$(GetFocus())
Then with this handle U can find out to which process it is associated, get the app name, etc.
hehehe... Mouse Over <> Focused Control
now the mouse is over the submit button but this edit window has got the focus because i'm typing in it :))
here is how to get the handle of control underneath the mouse...
type point
x as long
y as long
end type
....
dim h as long
dim pt as point
call GetCursorPos(pt)
h = WindowFromPoint(pt)
now "h" is a handle to the control underneath the mouse.. one way to check if it is an edit is to use this...
dim str as string * MAX_PATH-1
call GetClassName(h, str, MAX_PATH)
if UCase(str) = "EDIT" then MsgBox "The control underneath the mouse is an edit box control"
the classname is very important and most of the VC created programs would have that class name as identifier... but in Delphi for example that names is TEdit so this method would not work.. I've not tried in VB to see what the name is... some people create their own classes and change the name to whatever they want so it would be kind of difficult.. maybe there is some other identifier by which you'll be able to find that and I probably don't know of it, or can't think of it right now, but i doubt that...
..-=ViKtOr=-..
btw, GetClassName(), GetCursorPos() and WindowFromPoint() are Win API functions so you would have to declare them first before using them. Also, you will have to declare MAX_PATH which is a constant value. Use your API Viewer to find out what the declarations for the functions are and the constant value of MAX_PATH.
Good Luck!
..-=ViKtOr=-..
Maquiavelo, please read my previous comment dated Tuesday, August 03 1999 - 08:26PM PDT...
the focused control is not the same as the control under the mouse...(in most cases).. if i put the mouse over the focused control then that would be true, otherwise it isn't, so GetFocus() does not work in this case... I already told you how to get the handle of the control under the mouse...
..-=ViKtOr=-..
GREETINGS!
This question was awarded, but never cleared due to the JSP-500 errors of that time. It was "stuck" against userID -1 versus the intended expert whom you awarded. This corrects the problem and the expert will now receive these points; points verified.
Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them. If you are an EE Pro user, you can also choose Power Search to find all your open questions.
This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.
http://www.experts-exchang
http://www.experts-exchang
Thank you,
Moondancer
Moderator @ Experts Exchange
Business Accounts
Answer for Membership
by: phiroPosted on 1999-08-02 at 14:53:27ID: 1529070
Use the OLEDragOver event of the textbox