(窗口程序进行数据处理,数据处理结束后,窗口还在,如何关闭该窗口,窗口程序是别人写的,我在vb中调用)
谢谢楼上几位兄弟了。
外部程序是用vc写的,程序运行结束后,有个static类的caption显示“程序运行结束,共处理数据XX条”
(开始时此static的标题为空)。
我的想法是,找出所有的static类,察看其标题直至其一为“程序运行结束,
共处理数据XX条”,时结束程序,现在关键是如何获取他的标题,而且XX还是个变值。
例如
'模板中声明
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public 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
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
'窗体的代码
Private Sub Command1_Click()
Dim name As String
Dim myad As Long
winHwnd = FindWindow(vbNullString, "音量控制") '系统调节音量的窗体
myad = 0
Do
myad = FindWindowEx(winHwnd, myad, "Static", vbNullString)
'SendMessage myad, 13, 10, name '13 &h0d WM_GETTEXT 此句为何不对?
List1.AddItem Hex(myad)
Loop While myad <> 0 'list中显示所有static的句柄,如何显示其标题呢?
End Sub
[此贴子已经被作者于2006-1-11 20:02:21编辑过]