注册登陆后可查看附件和大图,以及购买相关内容
您需要 登录 才可以下载或查看,没有账号?注册会员
x
hwnd 是窗口句柄,系统分配的一个ID号,对操作系统来说就是这个窗口的唯一标识,通过它就可以操作WIN窗口了,LABVIEW VI的前面板无疑是一个WINDOWS窗口,那如何获得这个窗口句柄那.
有两种方法:
1.利用API FindWindow函数,通过窗口标题,来查找前面板的窗口句柄.
2.利用LABVIEW未公开的私有属性节点
获得了HWND,可以说获得了控制前面板的钥匙,举几个例子: 1.读取窗口标题和设置窗口标题 Public Declare Function 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
|