设置窗口所有控件可用
来源:互联网 发布:河南淘宝运营招聘 编辑:程序博客网 时间:2024/06/04 18:19
;
; control button enabler -- enables all controls on target window
; credits to "SmOke_N" for _WinGetCtrlInfo()
; settings dialogs etc.. are children
#include <GuiConstants.au3>
;;;#include <Constants.au3>
#include <GuiListBox.au3>
; just to get a window
Run("calc.exe")
Sleep(1000); towait for program to start - or else its not in the list
;
;
;
#Region ### START Koda GUI section ###
$GUI = GUICreate("Enabler", 400, 400, 136, 185)
$List = GUICtrlCreateList("", 10, 10, 380, 300)
$enable_button = GUICtrlCreateButton("enable", 10, 320, 40, 25, 0)
#EndRegion ### START Koda GUI section ###
GUISetState(@SW_SHOW)
; get names of running programs
$var = WinList()
For $i = 1 To $var[0][0]
; Only display visble windows that have a title
If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then
;MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1]);
_GUICtrlListBox_AddString($List, $var[$i][0])
EndIf
Next
; ------------------------ loop ------------------------
While 1
$msg = GUIGetMsg() ;
If $msg = $GUI_EVENT_CLOSE Then
ExitLoop ; Exit
ElseIf $msg = $enable_button Then
; get info from list and enable
$windowtitle = GUICtrlRead($List)
MsgBox(0, "Details", $windowtitle);
_enable_all_on_window_title($windowtitle)
EndIf
WEnd
;
; get only visible dialogs
;
Func IsVisible($handle)
If BitAND(WinGetState($handle), 2) Then
Return 1
Else
Return 0
EndIf
EndFunc ;==>IsVisible
;
; enable all control on given window
;
Func _enable_all_on_window_title($title)
local $Array = _WinGetCtrlInfo($title)
local $sOne = '[0][0] = ' & $Array[0][0] & @CR, $sTwo
For $iCC = 1 To $Array[0][0]
; $sOne &= '[' & $iCC & '][0] = ' & $Array[$iCC][0] & @CR
; $sTwo &= '[' & $iCC & '][1] = ' & $Array[$iCC][1] & @CR
$rc = ControlCommand($title, "", $Array[$iCC][0], "IsEnabled", "")
If $rc == 0 Then
MsgBox(64, "ret ", $rc) ; for DEBUG just to follow which button it enables
$rc = ControlEnable($title, "", $Array[$iCC][0])
EndIf
Next
; MsgBox(64, 'WinInfo', StringTrimRight($sOne, 1) & @CR & StringTrimRight($sTwo, 1))
EndFunc ;==>_enable_all_on_window_title
; by smoke_n
;
Func _WinGetCtrlInfo($hWin)
If IsString($hWin) Then $hWin = WinGetHandle($hWin)
Local $sClassList = WinGetClassList($hWin), $iAdd = 1, $aDLL, $sHold
Local $aSplitClass = StringSplit(StringTrimRight($sClassList, 1), @LF), $aReturn[1][2]
For $iCount = $aSplitClass[0] To 1 Step -1
Local $nCount = 0
While 1
$nCount += 1
If ControlGetHandle($hWin, '', $aSplitClass[$iCount] & $nCount) = '' Then ExitLoop
If Not StringInStr(Chr(1) & $sHold, Chr(1) & $aSplitClass[$iCount] & $nCount & Chr(1)) Then
$sHold &= $aSplitClass[$iCount] & $nCount & Chr(1)
$iAdd += 1
ReDim $aReturn[$iAdd][2]
$aReturn[$iAdd - 1][0] = $aSplitClass[$iCount] & $nCount
$aDLL = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', _
ControlGetHandle($hWin, '', $aSplitClass[$iCount] & $nCount))
If @error = 0 Then
$aReturn[$iAdd - 1][1] = $aDLL[0] ; control ID
Else
$aReturn[$iAdd - 1][1] = ''
EndIf
EndIf
WEnd
Next
$aReturn[0][0] = $iAdd - 1
Return $aReturn
EndFunc ;==>_WinGetCtrlInfo
Exit ;---
- 设置窗口所有控件可用
- swing 批量设置所有窗口控件的字体特征
- js 设置控件是否可用
- 显示并可用当前窗口的所有子窗口
- EnableWindow(): 使某个控件或窗口可用
- EnableWindow(): 使某个控件或窗口可用
- Qt无边框窗口, 设置最小化后, 再还原,所有子控件不刷新
- 设置页面所有控件只读。
- 清除窗口内所有控件值
- 获得窗口(对话框)中的所有控件
- VB:所有控件自适应窗口大小
- MFC 所有控件随窗口大小自适应
- MFC 所有控件随窗口大小自适应
- MFC 所有控件随窗口大小自适应
- jquery设置控件是否可用,是否可见
- 窗口、CListCtrl控件、Edit控件设置背景图片
- 为所有子窗口设置同种字体
- Safari合并所有窗口的快捷键设置
- 无意义-wd2
- 算法复杂度的计算
- 淘宝的功能点算法VS公司增删改查传
- 小花店问题
- 站外分享 源代码
- 设置窗口所有控件可用
- 模拟类似linux:find . -name "*.*"
- .net网站应用程序中,获得当前的用户名方法
- 3dMAX 导出插件
- 将字符串变成浮点数或整型的函数
- 今天心情不错
- c# 调用Surfer软件,添加引用的方法
- (转)Linux服务器性能评估与优化
- 学习,类的特性心得!