23 posts in this topic
I came here with maybe too specific questions about uncommon things, but as people says, I don't lose anything trying to asking here
There's long time that I have a little "experimental" idea: Use windows desktop and it icon system like old videogame consoles (where "sprites" are used to draw things on screen, can be manipulated/animated to make interesting things happen). Some of that inspiration came from another experiments from demoscene.
Researching the possibilities of doing something like that (maybe not so intense) I found that the Windows Desktop uses a GuiListView to show and arrange icons (and of course, AutoIt provides UDF's for that ). So, I'm used that UDF to create dummy icons (not putting files on Desktop, just modifiying the "GUI layer" of desktop for put non-working icons), setting custom values like coordinates, name and Icon (from a list of loaded icons in the GuiListView). As you can see in next image works well in Windows XP... even in Windows 95 (that's not the case from Windows Vista to 10, but I already posted another question here about that... anyways, for now I'm working that with a isolated XP machine... sigh).
Another video doing an animation with that:
How I make that custom icons? Here:
$hWnd = ControlGetHandle("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") $newItem = _GUICtrlListView_AddItem ( $hWnd, "TEST", 32 ) ; with an icon of index 32 _GUICtrlListView_SetItemPosition ( $hWnd, $newItem, 300, 300 ) ; set some example property. Put in X=300 Y=300 Okay, so the next phase was changing the icons with custom ones. And here starts the issues. As AutoIT help says, icons from GuiListView came from a loaded GUIImageList, which, seeing past images I conclude that it's already preloaded with some sort of most used icons (something like an icon cache?). But If I modify it (or create another GUIImageList and then put into the GuiListView) the icons became corrupted and replaced with blank ones. (can be reverted deleting IconCache.db, just like when windows shows wrong icons in desktop).
How I change icons? Here
$hImage = _GUIImageList_Create(48, 48, 5) ; create an image list for 48x48 icons $newIcon = _GUIImageList_AddIcon($imageList, @SystemDir & "\shell32.dll", 110) ; just adding a new icon in the image list _GUICtrlListView_SetImageList($hWnd, $hImage, 0) ; $hwnd is the desktop hwnd Another option as workaround for setting icons was getting the desktop GUIImageList, and modifiyng it directly. I otbtain a GUIImageList handle, but ... without any images inside! (That's strange beacuse, when I set desktop item icons without altering the GUIImageList, it applies correctly). And finally if I try to add new ones, it returns -1 with @error setted.
How I'm trying to get desktop GUIImageList? Here.
$imageList = _GUICtrlListView_GetImageList ( $hWnd, 0 ) MsgBox(0,_GUIImageList_GetImageCount ( $imageList ), $imageList) ; getting image count and GUIImageList handle $newIcon = _GUIImageList_AddIcon($imageList, @SystemDir & "\shell32.dll", 110) ; adding icons without success So, what is the question? There's something wrong I'm doing while trying to set the new icon set on desktop? Or desktop icons work in different way than the rest of the GuiListView's? Or there's something really stupid that I can't saw before that corrupts the icons?
Also... if there's not known solution for that, do you have some idea for doing a workaround for that? Or another crazy idea? (Maybe putting real files instead dummy icons could be a solution ... a very slow one). Or even maybe (maybe not, I sure about that xD) do you want to help with this "experiment".
Thanks in advance, have a good day
i am working on a translation app. There are a couple of regular input fields with text that the user is supposed to change to a new language.
I want to change the color of the input field as soon as the user leaves the input field. Is there a way to do that?
I know how to do this with a button, but i don't know how i can work with focus. Has any of you done something like this before?
iam not able to "activate" (the blue border of the edit control should be displayed) the created input control when clicking on a listview item. All i want is, when the edit control is created, it's active (blue border displayed) and you can directly write in it (cursor at the end), but i can't get it work. Can someone help?
#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <Misc.au3> Global $Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work Global $bChanged = False, $hDLL = DllOpen("user32.dll") Global $aClick_Info Global $hListView, $hTmp_Edit Global $GUI, $hImage $GUI = GUICreate("(UDF Created) ListView Create", 400, 300) $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Load images $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16)) _GUICtrlListView_SetImageList($hListView, $hImage, 1) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100) ; Add items _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2) _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1) _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button Local $iIndex, $iSubItem, $sTmp_Text, $aRect, $aPos $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $iIndex = DllStructGetData($tInfo, "Index") $iSubItem = DllStructGetData($tInfo, "SubItem") ; make sure user clicks on the listview & only the activate If $iIndex <> -1 And Not $bChanged Then $bChanged = True Local $iTimer = TimerInit() Local $iCounter = 1 Local $DOUBLE_CLICK_TIME_DELTA = 1200 While 1 If _IsPressed("01", $hDLL) Then $iCounter+=1 ConsoleWrite("_IsPressed - clicked." & @CRLF) ; Wait until key is released. While _IsPressed("01", $hDLL) WEnd ConsoleWrite("counter: " & $iCounter & " timer: " & TimerDiff($iTimer) & @CRLF) EndIf If $iCounter = 2 And TimerDiff($iTimer) < $DOUBLE_CLICK_TIME_DELTA Then ConsoleWrite("yes." & @CRLF) ExitLoop EndIf If TimerDiff($iTimer) > $DOUBLE_CLICK_TIME_DELTA Then ConsoleWrite("over." & @CRLF) $bChanged = False Return 1 EndIf WEnd GUICtrlDelete($hTmp_Edit) $aClick_Info = $iIndex $aClick_Info = $iSubItem ;~ GUISetAccelerators($aAccelKeys) $sTmp_Text = _GUICtrlListView_GetItemText($hWndListView, $iIndex, $iSubItem) ConsoleWrite("item: " & $iIndex & " subitem: " & $iSubItem & " text: " & $sTmp_Text & @CRLF) If $iSubItem = 0 Then $aRect = _GUICtrlListView_GetItemRect($hWndListView, $iIndex, 2) Else $aRect = _GUICtrlListView_GetSubItemRect($hWndListView, $iIndex, $iSubItem) EndIf $aPos = ControlGetPos("", "", $hWndListView) ConsoleWrite("Information :" & StringFormat("Item 2 Rectangle : [%d, %d, %d, %d]", $aRect+ $aPos, $aRect+ $aPos, $aRect, $aRect) & @CRLF) $hTmp_Edit = GUICtrlCreateEdit($sTmp_Text, $aRect + $aPos, $aRect + $aPos, $aRect - $aRect, $aRect - $aRect, 0) GUICtrlSetState($hTmp_Edit, $GUI_FOCUS+$GUI_SHOW+$Gui_ontop) _GUICtrlEdit_SetSel(GUICtrlGetHandle($hTmp_Edit), 2, 15) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
How can i make function _ExplorerGetSelectedItems get selecteds items on the Desktop?
Func _ExplorerGetSelectedItems($sCabinetWClass="[CLASS:CabinetWClass]") Local $Ret = "" Local $aIndexes, $sSelected, $sSelected_Path Local $hSearch, $sCurrentFile $sSelected_Path = ControlGetText($sCabinetWClass, "", "Edit1") ConsoleWrite($sSelected_Path&@CRLF) $aIndexes = StringSplit(ControlListView($sCabinetWClass, "", "SysListView321", "GetSelected", 1), "|") If $aIndexes = 1 And ($aIndexes == "" Or $aIndexes = 0) Then Return SetError(1, 0, 0) For $i = 1 To $aIndexes $sSelected = ControlListView($sCabinetWClass, "", "SysListView321", "GetText", $aIndexes[$i]) $sCurrentFile = StringRegExpReplace($sSelected_Path, "\\+$", "") & "\" & $sSelected If Not FileExists($sCurrentFile) Then ;Search the extension for file... $hSearch = FileFindFirstFile($sCurrentFile & ".*") If $hSearch <> -1 Then $sSelected = FileFindNextFile($hSearch) FileClose($hSearch) EndIf EndIf ;Check if item is a directory If StringInStr(FileGetAttrib($sCurrentFile), "D") > 0 Then $sSelected = "*"&$sSelected $Ret = $Ret&$sSelected&Chr(10) Sleep(1) Next Return $Ret EndFunc
As the title states, is there a way to detect which inputbox is "selected"
if IsSelectedForWritingEtc($MyInputBox) then xxxx
i was searching some without success, all my results were like how to read or and write to a inputbox.