January 1, 2005

WinTask - GetActiveWindow

'
' GetActiveWindow
'
' Author: Joe Strazzere
'
'Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long
'dim namefen$(210)
'dim numinst(210)
'dim handlefen(210)
'dim fenflag$(210)

'p=GetWindowsList(namefen$(),numinst(),handlefen(),fenflag$())
'msgbox(Str$(p))
'i=0
'while i<p
'  if left$(namefen$(i),7) = "NOTEPAD" then
'     msgbox(str$(handlefen(i)),,"NOTEPAD'S HANDLE")
'  endif
'  i=i+1
'wend
'pause 3 seconds
a = External("user32","GetForegroundWindow")
msgbox(Str$(a),,"GetActiveWindow")
msgbox(GetWindowName$(a))