Office中国论坛/Access中国论坛

标题: 关于FindWindow语句的问题(向控件发送值) [打印本页]

作者: diablo0583    时间: 2004-9-17 18:00
标题: 关于FindWindow语句的问题(向控件发送值)
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应用程序的窗口。






作者: stanleypan    时间: 2004-9-18 00:44
请参考:EXCEL VBA窗体中计算器的调用!http://www.office-cn.net/forum.php?mod=viewthread&tid=17819




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3