hwnd 是窗口句柄,系统分配的一个ID号,对操作系统来说就是这个窗口的唯一标识,通过它就可以操作WIN窗口了,labview VI的前面板无疑是一个WINDOWS窗口,那如何获得这个窗口句柄那. 有两种方法: 1.利用API FindWindow函数,通过窗口标题,来查找前面板的窗口句柄.
2.利用LABVIEW未公开的私有属性节点
ADVANTECH和ADLINK运动控制卡、数据采集卡和数字I/O卡
获得了HWND,可以说获得了控制前面板的钥匙,举几个例子: 1.读取窗口标题和设置窗口标题 Public Declare Func tion GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
2.如何使窗口的最大最小化按纽失效 Public Const GWL_STYLE = (-16)
Public Const WS_MAXIMIZE = &H1000000
Public Const WS_MAXIMIZEBOX = &H10000
Public Const WS_MINIMIZE = &H20000000
Public Const WS_MINIMIZEBOX = &H20000
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
|