如何实现
用自己的程序控制另一个程序具备刷新(类似于按F5那样产生的效果)的功能?那个程序有一个快捷键f5是刷新的。 如何实现如何实现阿!!!!!!!!!还有
http://community.csdn.net/Expert/topic/3221/3221750.xml?temp=.1629755
有没有更好的方法阿?
我用的是
将所有的内容提取,晒选小节的值,在将所有的内容写回去,又慢又麻烦。
拜托诸位了。
用自己的程序控制另一个程序具备刷新(类似于按F5那样产生的效果)的功能?那个程序有一个快捷键f5是刷新的。 如何实现如何实现阿!!!!!!!!!还有
http://community.csdn.net/Expert/topic/3221/3221750.xml?temp=.1629755
有没有更好的方法阿?
我用的是
将所有的内容提取,晒选小节的值,在将所有的内容写回去,又慢又麻烦。
拜托诸位了。
窗体:一个listbox
窗体代码:
Option Explicit
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) 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 Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9
Dim mhwnd() As LongPrivate Sub Form_Load()
Dim MyStr As String
Dim i As Long
Dim test_hwnd As Long
i = 0
test_hwnd = FindWindowEx(0, 0, "IEFrame", vbNullString)
Do While test_hwnd <> 0
ReDim Preserve mhwnd(i)
mhwnd(i) = test_hwnd
MyStr = String(100, Chr$(0))
GetWindowText test_hwnd, MyStr, 100
MyStr = Left$(MyStr, InStr(MyStr, Chr$(0)) - 1)
List1.AddItem CStr(test_hwnd) + "-----" + MyStr
test_hwnd = FindWindowEx(0, test_hwnd, "IEFrame", vbNullString)
i = i + 1
Loop
End SubPrivate Sub List1_Click() '刷新指定的ie窗口
Dim whwnd As Long
whwnd = mhwnd(List1.ListIndex)
ShowWindow whwnd, SW_RESTORE
SendKeys "{F5}"
End Sub
Option Explicit
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) 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 Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Const SW_RESTORE = 9
Dim mhwnd() As LongPrivate Sub Form_Load()
Dim MyStr As String
Dim i As Long
Dim test_hwnd As Long
i = 0
test_hwnd = FindWindowEx(0, 0, "TAdminForm", vbNullString)
Do While test_hwnd <> 0
ReDim Preserve mhwnd(i)
mhwnd(i) = test_hwnd
MyStr = String(100, Chr$(0))
GetWindowText test_hwnd, MyStr, 100
MyStr = Left$(MyStr, InStr(MyStr, Chr$(0)) - 1)
List1.AddItem CStr(test_hwnd) + "-----" + MyStr
test_hwnd = FindWindowEx(0, test_hwnd, "TAdminForm", vbNullString)
i = i + 1
Loop
End SubPrivate Sub List1_Click() '刷新指定的serv-U窗口
Dim whwnd As Long
whwnd = mhwnd(List1.ListIndex)
SetForegroundWindow whwnd
ShowWindow whwnd, SW_RESTORE
SendKeys "{F5}"
End Sub
rainstormmaster
最终结决
Public Function S_servU() '/向目标窗体发送刷新消息
Dim test_hwnd As Long
test_hwnd = FindWindowEx(0, 0, "TAdminForm", vbNullString)
SetForegroundWindow test_hwnd
ShowWindow test_hwnd, SW_RESTORE
SendKeys "%VZ"
SendKeys "{F5}"
End Function