Leaderboard
Popular Content
Showing content with the highest reputation on 10/23/2011 in all areas
-
WM_Notify and WM_Command
Nothing2Lose reacted to Yashied for a topic
WM_NOTIFY came with Windows 95. Before Windows 95, there was only WM_COMMAND that retained for compatibility. Almost all new controls uses WM_NOTIFY.1 point -
WM_Notify and WM_Command
Nothing2Lose reacted to Melba23 for a topic
Nothing2Lose, I suggest starting here and clicking on the various links as you go - see you again in a couple of years. Basically different messages are sent by different controls in repsonse to different events. The trick is to know which one you need and how to intercept it. M231 point -
czardas, You mean something like this then: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <WinAPI.au3> Global $iItems = 3 ; Number of items in list Global $aLabelID[$iItems][2] ; ControlIDs & handles of labels ; Data and colour state of labels Global $aData[$iItems] = ["Item 1 and a long tail", "Item 2 and a longer tail", "Item 3 and an even longer tail"] $hGUI = GUICreate("Test", 500, 500, 100, 100) $hEdit = GUICtrlCreateEdit("", 10, 10, 80, 35, $ES_READONLY) $hSplit = GUICtrlCreateButton("6", 89, 10, 21, 35) GUICtrlSetFont(-1, 10, 400, 0, "Webdings") $hButton = GUICtrlCreateButton("Test", 10, 70, 80, 30) GUISetState() $hGUI_Child = GUICreate("Child", 200, 200, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) ; Create "list" For $i = 0 To $iItems - 1 $aLabelID[$i][0] = GUICtrlCreateLabel($aData[$i], 10, 10 + ($i * 40), 100, 40) $aLabelID[$i][1] = GUICtrlGetHandle(-1) Next GUISetState(@SW_HIDE) WinMove($hGUI_Child, "", 114, 167) $iLast_Hilite = 0 While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $hSplit GUISetState(@SW_SHOW, $hGUI_Child) Case $aLabelID[0][0] To $aLabelID[$iItems - 1][0] GUICtrlSetData($hEdit, GUICtrlRead($iMsg)) GUISetState(@SW_HIDE, $hGUI_Child) EndSwitch ; Get highlighting If BitAnd(WinGetState($hGUI_Child, ""), 2) Then If @AutoItX64 Then $tPoint = DllStructCreate("int X;int Y") DllStructSetData ( $tPoint, "X", MouseGetPos(0)) DllStructSetData ( $tPoint, "Y", MouseGetPos(1)) $tPoint64 = DllStructCreate("int64", DllStructGetPtr($tPoint)) $aHwnd = DllCall("user32.dll", "hwnd", "WindowFromPoint", "int64", DllStructGetData($tPoint64, 1)) Else $aHwnd = DllCall("user32.dll", "hwnd", "WindowFromPoint", "uint", MouseGetPos(0), "uint", MouseGetPos(1)) EndIf For $i = 0 To $iItems - 1 If $aLabelID[$i][1] = $aHwnd[0] And $aLabelID[$i][0] <> $iLast_Hilite Then GUICtrlSetBkColor($iLast_Hilite, 0xFEFEFE) GUICtrlSetBkColor($aLabelID[$i][0], 0xCCCCFF) $iLast_Hilite = $aLabelID[$i][0] EndIf Next EndIf WEnd Can you tell I am bored this morning? M231 point
-
Chimaera, Quite a lot in my opinion: adding a udf at the bottom of your script: You have a single #include line in each script rather then the entire UDF - saves a lot of space and makes the script easier to manipulate in SciTE. calling it from the working folder: You have a single #include file that you can call with the same syntax as the standard #include files rather than many copies of the UDF spread all over the place. In both cases updating the UDF would be a nightmare - with a single copy on the system updating is easy. And keeping your personal and dowmloaded UDFs in a user-defined folder outside the normal installation path means you are very unlikely to lose them. M231 point
-
mikejp56, The Adding UDFs to AutoIt and SciTE tutorial in the Wiki tells you how best to store and use downloaded UDFs. M231 point
-
Special Note: This is an official beta release but it is not digitally signed. Only Jon has the certificate used for digital signatures and the last time I checked I was not Jon. 3.3.7.20 (22nd October, 2011 (Beta) The following changes are script breaking changes: ObjCreateInterface() now has documentation. Test it out! Report any bugs, questions, et cetera so we can get it finalized. Report issues here. Download here.1 point
-
telmob, I do not believe a multiline combo is possible. Does this work-a-round help at all? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIMenu.au3> Global Enum $id_1 = 1000, $id_2, $id_3 Global $sItem_1 = "Item 1 and a long tail" Global $sItem_2 = "Item 2 and a long tail" Global $sItem_3 = "Item 3 and a long tail" $hGUI = GUICreate("Test", 500, 500) $hEdit = GUICtrlCreateEdit("", 10, 10, 60, 35, $ES_READONLY) $hSplit = GUICtrlCreateButton("6", 69, 10, 20, 35) GUICtrlSetFont(-1, 10, 400, 0, "Webdings") GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hSplit ; Show the menu for a left click on the button _Menu() EndSwitch WEnd Func _Menu() ; Move mouse to correct place $iOldOpt = Opt("MouseCoordMode", 2) MouseMove(10, 45, 0) Opt("MouseCoordMode", $iOldOpt) ; Show menu $hMenu = _GUICtrlMenu_CreatePopup(24) _GUICtrlMenu_InsertMenuItem($hMenu, 0, $sItem_1, $id_1) _GUICtrlMenu_InsertMenuItem($hMenu, 1, $sItem_2, $id_2) _GUICtrlMenu_InsertMenuItem($hMenu, 3, $sItem_3, $id_3) _GUICtrlMenu_TrackPopupMenu($hMenu, $hGUI) _GUICtrlMenu_DestroyMenu($hMenu) EndFunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $wParam Case $id_1 GUICtrlSetData($hEdit, $sItem_1) Case $id_2 GUICtrlSetData($hEdit, $sItem_2) Case $id_3 GUICtrlSetData($hEdit, $sItem_3) EndSwitch EndFunc ;==>WM_COMMAND Or perhaps this one which is considerably simpler: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIMenu.au3> #Include <GuiComboBox.au3> Global $sItem_1 = "Item 1 and a long tail" Global $sItem_2 = "Item 2 and a long tail" Global $sItem_3 = "Item 3 and a long tail" $hGUI = GUICreate("Test", 500, 500) $hEdit = GUICtrlCreateEdit("", 10, 10, 60, 35, $ES_READONLY) $hSplit = GUICtrlCreateButton("6", 69, 10, 21, 35) GUICtrlSetFont(-1, 10, 400, 0, "Webdings") $hCombo = GUICtrlCreateCombo("", 10, 25, 80, 20, BitOr($GUI_SS_DEFAULT_COMBO, $WS_CLIPSIBLINGS)) GUICtrlSetData(-1, $sItem_1 & "|" & $sItem_2 & "|" &$sItem_3) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hSplit _GUICtrlComboBox_ShowDropDown ($hCombo, True) Case $hCombo GUICtrlSetData($hEdit, GUICtrlRead($hCombo)) EndSwitch WEnd M23 Edit: Added second example.1 point
-
1. Try _FileSearch_example 2. Try $fol = '*' 3. Check the error after the function _FolderSearch $folpath=_FolderSearch('F:\M\',$fol, True,15) MsgBox(0, 'Message', @error) 4. Check that the folder names are in the file search.txt 5. Check the simplified method $folpath=_FolderSearch('F:\M\', 'Pictures_Not-Vacation_Sea-(2001)-Me', True,15) MsgBox(0, 'Message', @error)1 point
-
Since I'm feeling generous... #Region _WebComposeURL() ; =================================================================== ; _WebComposeURL($sURL, $sLogin = "", $sPass = "", $sParams = "") ; ; Builds a valid URL from the four component parts. ; Parameters: ; $sURL - IN - The URL use. ; $sLogin - IN/OPTIONAL - The login to send with the URL. ; $sPass - IN/OPTIONAL - The password to send with the URL (Requires a login name). ; $sParams - IN/OPTIONAL - Optional parameters to send with the page. ; Returns: ; A valid URI-encoded URL. ; =================================================================== Func _WebComposeURL($sURL, $sLogin = "", $sPass = "", $sParams = "") Local Const $aURIValidChars[256] = _ [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,1,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0, _ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, _ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] Local $sFullURL Local $nPos = StringInStr($sURL, "://") If Not $nPos Then $sFullURL = "http://" Else $sFullURL = StringLeft($sURL, $nPos+2) $sURL = StringTrimLeft($sURL, $nPos+2) EndIf If $sLogin And StringLeft($sURL, StringLen($sLogin)) <> $sLogin Then $sFullURL &= $sLogin If $sPass Then $sFullURL &= ":" & $sPass $sFullURL &= "@" EndIf For $i = 1 To StringLen($sURL) Local $c = StringMid($sURL, $i, 1) If Number($aURIValidChars[Asc($c)]) Then $sFullURL &= $c Else $sFullURL &= StringFormat("%%%02X", Asc($c)) EndIf Next If $sParams Then $sFullURL &= "?" For $i = 1 To StringLen($sParams) Local $c = StringMid($sParams, $i, 1) If $c = " " Then $c = "+" If Number($aURIValidChars[Asc($c)]) Then $sFullURL &= $c Else $sFullURL &= StringFormat("%%%02X", Asc($c)) EndIf Next EndIf Return $sFullURL EndFunc; _WebComposeURL() #EndRegion _WebComposeURL()1 point