|
API中有一个获得窗口句柄的语句:FindWindow
通过以下例子可以向窗口“caption of the window”发送单元格cells(1,1)的值:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Integer
Private Declare Function SetFocusAPI& Lib "user32" Alias "SetFocus" (ByVal hWnd As Long)
dim retval, sfocus as long
retval = FindWindow(vbnullstring,"caption of the window")
if retval <> 0 then
sfocus = SetFocusAPI(retval)
SendKeys cells(1,1)
end if
我想请问如果向这个窗口的一个控件(例如text1)发送单元格值应该怎么写,是否findwindow就不可以使用,应该用什么API,控件text1参数如下:
类:ThunderRT6TextBox
句柄:1245962(不定)
标题:Text1
请注意:此窗口非excel的一个窗体,而是一个其它windows应用程序的窗口。
|
|