NI LabVIEW,CVI,数据采集等产品讨论区

取消
显示结果 
搜索替代 
您的意思是: 

如何获取窗体中某控件的句柄?

现打算使用Labview按如下步骤控制外部程序中的按钮:
1.使用findwindow API获取控件所在窗体的句柄值。----------已OK。
 
2.获取所需控制的控件的句柄值?-------
   在网上查找过,有人说用getwindow函数,或者enumchildwindows函数,也有人说用findwindowEx函数。有没哪位高人做过,能否详细告知所用函数及参数设置?
 
3.使用sendmessage控制控件,我打算的是在labview里控制button控件,消息该如何发?
0 项奖励
1 条消息(共 5 条)
12,178 次查看


sunnyermao 写:
现打算使用Labview按如下步骤控制外部程序中的按钮:
1.使用findwindow API获取控件所在窗体的句柄值。----------已OK。
 
2.获取所需控制的控件的句柄值?-------
   在网上查找过,有人说用getwindow函数,或者enumchildwindows函数,也有人说用findwindowEx函数。有没哪位高人做过,能否详细告知所用函数及参数设置?
 
3.使用sendmessage控制控件,我打算的是在labview里控制button控件,消息该如何发?


控件不是WINDOWS标准子窗口形式,无法取得HANDLE,也就无法用SENDMESSAGE或者POSTMESSAGE,可以通过控件的REFERENCE,利用VALUE(SIGNAL)来模拟SENDMESSAGE功能.
陈树学
QQ:276509891 .
EMAIL:CSXCS_366@126.COM
qq群:78561268 80754347 37591940
http://labview.weebly.com/
新书《LabVIEW实用工具详解》已经发售,敬请关注。
0 项奖励
2 条消息(共 5 条)
12,169 次查看
已经用findwindowEx得到按钮控件的句柄,请教下一步,如何利用sendmessage or postmessage?来发送消息,以控制按钮控件的up down动作。
请高手指教消息的内容及参数的设置……
0 项奖励
3 条消息(共 5 条)
12,162 次查看
过去在论坛上讨论过多次,答案是"NO",至于SENDMESSAGE的参数设置,MSDN有详细说明.
> Is it possible to get the window handle of a LabVIEW control? I know
> how to get the window handle of the VI (using FindWindowA in
> user32.dll) but I cannot figure out how to obtain a handle to an
> individual control, such as a string control or indicator. Any
> suggestions?

You can't find the way to do it, because the LV controls are windowless.
You don't mention what it is you want it for, but many of the same
actions are possible using property nodes or the event structure. You
can also use ActiveX controls instead. Most of them are windowed, and
that will give you the HWND that you are looking for.

所以,您取得的子窗口句柄不一定是正确的.
陈树学
QQ:276509891 .
EMAIL:CSXCS_366@126.COM
qq群:78561268 80754347 37591940
http://labview.weebly.com/
新书《LabVIEW实用工具详解》已经发售,敬请关注。
0 项奖励
4 条消息(共 5 条)
12,154 次查看

嗯,很抱歉,是我一开始没有描述清楚,我要控制的是外部程序内的控件,外部程序并非LABVIEW程序,而是VC VB etc.

网上看到人家有用VB,DELPHI写的程序,最后就是用sendmessage来控制按钮控件的,但讲的都很含糊。

我现在要用Labview来调用user32.dll,通过引用不同的函数来实现控制外部程序内的按钮控件。

0 项奖励
5 条消息(共 5 条)
12,148 次查看