|
-
Oct 7th, 2000, 01:57 PM
#1
I need to get the handle of an MDI form (child window) that has the focus. When I use the GetForeGroundWindow API, all it does is return the parent window's handle.
How do I get the handle of the active child window?
Thanks,
Jordan
-
Oct 7th, 2000, 02:21 PM
#2
Fanatic Member
If it's a form of your own app, then you can use this code:
Code:
Handle = MDIForm1.ActiveForm.hWnd
-
Oct 7th, 2000, 03:07 PM
#3
Sorry, I meant to say that its for another app.
I haven't found anything yet as to how to get the active child window in an external app.
Any Ideas?
-
Oct 7th, 2000, 04:36 PM
#4
Hyperactive Member
These APIs may be of use to you:
Declare Function GetParent Lib "user32" Alias "GetParent" (ByVal hwnd As Long) As Long
parameters:
· hWnd
Identifies the window whose parent window handle is to be retrieved.
Declare Function IsChild Lib "user32" Alias "IsChild" (ByVal hWndParent As Long, ByVal hwnd As Long) As Long
parameters:
· hWndParent
Identifies the parent window.
· hWnd
Identifies the window to be tested.
Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long
no parameters
Declare Function EnumChildWindows Lib "user32" Alias "EnumChildWindows" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
parameters:
· hWndParent
Identifies the parent window whose child windows are to be enumerated.
· lpEnumFunc
Points to an application-defined callback function. For more information about the callback function, see the EnumChildProc callback function.
· lParam
Specifies a 32-bit, application-defined value to be passed to the callback function.
See this link for more information on the EnumChildProc callback function.
[Edited by dsy5 on 10-07-2000 at 05:43 PM]
-
Oct 8th, 2000, 03:02 PM
#5
Thanks, but I tried GetActiveWindow and it still returns the handle of the Parent window when I need the handle of the active child window. :-\
Actually, if it helps any, all I really need to know is if the external child window doesn't have the focus. Still haven't been able to figure this one out.
-
Oct 8th, 2000, 03:40 PM
#6
-
Oct 9th, 2000, 09:53 AM
#7
Hyperactive Member
Could you post a small snippet of the routine to subclass; it could be useful to others(me, too!)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|