要知道类名必须要知道句柄才可以所以需要两个api函数
声明findwindow和getclassname这两个代码
然后加个timer控件,打开任务管理器(取他的句柄)。
加入以下代码
Private Declare Function GetClassName Lib “user32” Alias “GetClassNameA” (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function FindWindow Lib “user32” Alias “FindWindowA” (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Timer1_Timer()
Dim sClassName As String * 100
NewhWnd = FindWindow(vbNullString, “Windows 任务管理器”)
SSMhWnd = GetClassName(NewhWnd, sClassName, 100)
MsgBox sClassName
End Sub
然后就可以看到类名了