有一个软件在关闭时会出现“正在压缩数据库...请等待xxxxxxxxx”(xx代表其他字符,里面还有换行)
我用Spy++获取他的窗体:标题文本为空, 窗体类名:#32770(固定的), 窗口句柄:6047C(这个是会变的)
获取里文字的时候 窗口句柄: B0538(这个获取每次都不一样)窗口类名:Edit,标题文本就是开头说的“正在压缩数据库...请等待xxxxxxxxx”Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long
我知道用以上函数可以获取到窗体,可这个窗体没有标题,我需要怎么编程才能得知这个窗口有没有出现,以此判断软件正在关闭
我用Spy++获取他的窗体:标题文本为空, 窗体类名:#32770(固定的), 窗口句柄:6047C(这个是会变的)
获取里文字的时候 窗口句柄: B0538(这个获取每次都不一样)窗口类名:Edit,标题文本就是开头说的“正在压缩数据库...请等待xxxxxxxxx”Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long
我知道用以上函数可以获取到窗体,可这个窗体没有标题,我需要怎么编程才能得知这个窗口有没有出现,以此判断软件正在关闭
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPrivate Sub Command1_Click()
iHwnd = FindWindow("#32770", vbNullString)
If iHwnd <> 0 Then
MsgBox "存在"
Else
MsgBox "不存在"End If
End Sub
一直提示存在 其实都没开,是这样书写吗?还是"#32770"这种类型的窗口有可能只不一个,所以才 一直提示存在
D:\A\B\库存\1.txt你只要知道了窗体结构,所有窗体列出来然后比较哪个标题是空的,再比较里面的文字就好了
The system registers the system classes for all processes to use. Any process can use a system class at any time. Because the system registers these classes, a process cannot destroy them. Each Win32-based application receives its own copy of the system classes. All 16-bit Windows-based applications in the same VDM share system classes, just as they do on 16-bit Windows. The following table describes the system classes: Class Description
Button The class for a button.
ComboBox The class for a combo box.
ComboLBox The class for the list box contained in a combo box.
DDEMLEvent Windows NT: The class for DDEML events.
Edit The class for an edit control.
ListBox The class for a list box.
MDIClient The class for an MDI client window.
Message Windows NT 5.0 and later: The class for a message-only window.
ScrollBar The class for a scroll bar.
Static The class for a static control.
#32768 The class for a menu.
#32769 The class for the desktop window.
#32770 The class for a dialog box.
#32771 The class for the task switch window.
#32772 Windows NT: The class for icon titles.
2.如果特征不符合,则用GetNextWindow取得下一个窗口(此函数可以循环调用可以返回每一个窗口)