Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetTopWindow
Message
 
 
To
01/08/2000 00:51:59
General information
Forum:
Visual Basic
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00399125
Message ID:
00399475
Views:
33
First off, GetTopWindow only returns child window handles, not parents. This might be able to be used in an MDI application (not sure, haven't tested).

Second, as Joe suggested, use the GetForegroundWindow function. As long as the function is called in or after the Activet of the form, then the foreground window and the form window handle should be the same.

HTH.

>Public Declare Function GetTopWindow Lib "user32" (ByVal hWnd As Long) As Long
>
>For Click Event of form write this code:
>Private Sub Form_Click()
> Dim n As Long
> n = GetTopWindow(0) 'or n=GetToWindow(GetDesktopWindow())
> if n<>me.hwnd then
> msgbox "!="
> else
> msgbox "="
> end if
>End Sub
>
>while when i click on form n<>me.hwnd?
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform