Na sajtu
http://allapi.mentalis.org/apilist/apilist.php, koji sam vec jednom dao pise:
GetForegroundWindow
The GetForegroundWindow function returns the handle of the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.VB4-32,5,6
Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As Long
VB.NET
System.Windows.Forms.Form.ActiveForm
Operating Systems Supported
Requires Windows NT 3.1 or later; Requires Windows 95 or later
Library
User32
Return Values
The return value is the handle of the foreground window.
Examples
- Window Draw
Related Functions
- GetActiveWindow
Code:Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Form_Activate()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail:
[email protected]
Dim Ret As Long
Do
'Get the handle of the foreground window
Ret = GetForegroundWindow()
'Get the foreground window's device context
Ret = GetDC(Ret)
'draw an ellipse
Ellipse Ret, 0, 0, 200, 200
DoEvents
Loop
End Sub