buymeapc Posted May 23, 2012 Share Posted May 23, 2012 I'm trying to put together a gui to be able to drag an item from one listview into another. I've found some very nice examples on the forum. However, I'm having a bit of an issue. When I drag an item from either of the listview controls to the other, artifacts appear from the child gui that appears when dragging. The funny thing is that the artifacts only appear when dragging upward! There's got to be something I'm missing here.I've been looking at the code from both of these links to try to figure something out.For the example of what I'm talking about, the code from JonnyThunder from the top link with the fancy drag gui from ReFran in the bottom link is below. They did some really great work and my combining the code is just lacking something that I can't figure out. I've attached a pic of what I'm witnessing.How can I eliminate these artifacts? Here's the code that I'm working with:expandcollapse popup; Includes first! Must must must! #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Misc.au3> ; Switch on the 'onEvent' notifications Opt("GUIOnEventMode", 1) Opt("PixelCoordMode", 2) ; Generate the GUI! Ahoy there. Global $gw = 16 Global $gh = 16 Global $Startx, $Starty, $Endx, $Endy, $aM_Mask, $aMask, $nc Global $MainForm, $list_source, $list_target, $drag_gui $MainForm = GUICreate(" TEST! ", 517, 178) ; Source list box $list_source = GUICtrlCreateListView("Title|Details", 13, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) ; Target list box $list_target = GUICtrlCreateListView("Title|Details", 261, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) ; Populate box with some test stuff For $x = 1 To 6 GUICtrlCreateListViewItem( _makeJunkName() & "|" & _makeJunkName(), $list_source) Next GUISetState(@SW_SHOW, $MainForm) ; Handle GUI events GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_dragHandler") GUISetOnEvent($GUI_EVENT_CLOSE, "_formEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "_formEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "_formEvents") $position = WinGetPos($MainForm) $client = WinGetClientSize($MainForm) $light_border = ($position[2] - $client[0]) / 2 $thick_border = $position[3] - $client[1] - $light_border $x_coord = $position[0] + $light_border $y_coord = $position[1] + $thick_border $drag_gui = GUICreate("Drag", $gw, $gh, $x_coord, $y_coord, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST), $MainForm) $cursor_icon = GUICtrlCreateIcon("Shell32.dll", -147, 0, 0, 16, 16) GUISetState(@SW_SHOW, $drag_gui) setTrans() GUISetState(@SW_HIDE, $drag_gui) ; Main program loop While 1 ; Don't really do much in here at all... Sleep(10) WEnd ; Create a junk name for testing Func _makeJunkName() Local $labelout = '' For $i = 1 To 10 $labelout &= Chr(Random(65, 90, 1)) Next Return $labelout EndFunc ;==>_makeJunkName ; Function to handle drag and drop Func _dragHandler() ; Define some stuff Local $source, $desc Local $cinfo = GUIGetCursorInfo(WinGetHandle($MainForm)) Local $direction = 0 ; Check we are dragging from one or the other boxes If $cinfo[4] = $list_source Or $cinfo[4] = $list_target Then ; Are we moving from source to destination If $cinfo[4] = $list_source Then $direction = 1 EndIf ; Or are we moving from destination to source If $cinfo[4] = $list_target Then $direction = 2 EndIf ; Doublecheck we're pressing mouse button If _IsPressed(1) Then If $direction = 1 Then $selecteditems = _GUICtrlListView_GetSelectedCount($list_source) $idx = _GUICtrlListView_GetSelectedIndices($list_source, False) $item_txt = _GUICtrlListView_GetItemText($list_source, Int($idx)) Else $selecteditems = _GUICtrlListView_GetSelectedCount($list_target) $idx = _GUICtrlListView_GetSelectedIndices($list_target, False) $item_txt = _GUICtrlListView_GetItemText($list_target, Int($idx)) EndIf ; Check we actually have selected an item If $selecteditems >= 1 Then ; Wait for keypress! _WinAPI_ShowCursor(False) GUISetState(@SW_SHOW, $drag_gui) While _IsPressed(1) chase($item_txt) WEnd GUISetState(@SW_HIDE, $drag_gui) _WinAPI_ShowCursor(True) ToolTip("") ; Get new position Local $newcinfo = GUIGetCursorInfo(WinGetHandle($MainForm)) ; If we were moving from source to destination and we ARE in the destination box If $direction = 1 And $newcinfo[4] = $list_target Then ConsoleWrite("Moved " & $selecteditems & " items from source to destination" & @CRLF) _GUICtrlListView_CopyItems(GUICtrlGetHandle($list_source), $list_target, 1) EndIf ; If we are moving from destination to source and we ARE in source box If $direction = 2 And $newcinfo[4] = $list_source Then ConsoleWrite("Moved " & $selecteditems & " items from destination to source" & @CRLF) _GUICtrlListView_CopyItems(GUICtrlGetHandle($list_target), $list_source, 1) EndIf EndIf EndIf EndIf EndFunc ;==>_dragHandler ; Function to handle other form events Func _formEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit EndSelect EndFunc ;==>_formEvents Func chase($moving_txt) $mp = MouseGetPos() WinMove($drag_gui, "", $mp[0] + 1, $mp[1] + 0) ToolTip($moving_txt, $mp[0] + 18, $mp[1]) EndFunc ;==>chase Func setTrans() $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) $rct = DllStructCreate("int;int;int;inr", $aM_Mask[0]) $TestCol = PixelGetColor(0, 0) $Startx = -1 $Starty = -1 $Endx = 0 $Endy = 0 For $i = 0 To $gw For $j = 0 To $gh If PixelGetColor($i, $j) = $TestCol And $j < $gh Then If $Startx = -1 Then $Startx = $i $Starty = $j $Endx = $i $Endy = $j Else $Endx = $i $Endy = $j EndIf Else If $Startx <> -1 Then addRegion() $Startx = -1 $Starty = -1 EndIf Next Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $drag_gui, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion() $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $Startx, "long", $Starty, "long", $Endx + 1, "long", $Endy + 1) $nc += 1 DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegionArtifacts.bmp Link to comment Share on other sites More sharing options...
buymeapc Posted May 25, 2012 Author Share Posted May 25, 2012 *shameless bump* Link to comment Share on other sites More sharing options...
someone Posted May 25, 2012 Share Posted May 25, 2012 If this helps, the culprit line is the WinMove line in your chase function. Comment it out, and all is well. I'll keep looking into it and see if I can track down why... Just as a friendly suggestion, I'm having trouble reading your code. Line breaks and tabbing help While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
buymeapc Posted May 25, 2012 Author Share Posted May 25, 2012 (edited) Just as a friendly suggestion, I'm having trouble reading your code. Line breaks and tabbing help Sorry about that! I'm very diligent in tabbing my code in SciTE, but for some reason, when I paste it into the forum, it loses all the tabs. Thanks for the suggestion! I'll try that out Edit: Ok, now I'm looking for a different method to moving the hidden GUI around since just the tooltip is displayed. Edited May 25, 2012 by buymeapc Link to comment Share on other sites More sharing options...
someone Posted May 25, 2012 Share Posted May 25, 2012 No worries, hope I didn't come off as a pain. When you figure it out, definitely post back the solution. I'll let you know if I get anywhere. While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
buymeapc Posted May 25, 2012 Author Share Posted May 25, 2012 Not at all! It actually bothers me when the tabs don't come out properly, so I certainly know where you're coming from. I'm still trying on my end. I'll definitely post here if I figure something out. The weird thing is that the treeview example link that I posted (the second link from the first post) displays no artifacts when dragging and I just can't figure out why mine does. Is it that it's a treeview and not a listview? I appreciate the help, by the way! Link to comment Share on other sites More sharing options...
someone Posted May 26, 2012 Share Posted May 26, 2012 (edited) Well only to complicate matters further, I setup Autoit at home to try something out, and running on Win 7 64 bit with both the newest production and beta, I do not get the artifacting problem at all! The other weird tihng I get is the 'drag' arrow appears at the top of the GUI window for about 5 seconds before dissapearing on its own. I'll have to go back to my work machines and see if I can isolate anything...maybe my home machine is a one-off. EDIT: Tested this out on my Win 7 32 work machine... and no artifacting, but same problem as described above with the drag GUI appearing. Seems this is exploiting something in Win XP. From here, what I'm doing and my suggestion is to strip out everything possible to make the smallest reproducer possible, and switch to only _guictrllistview and not the internal GuiCtrlCreateListView. Hopefully we can narrow down what is to blame. Edited May 26, 2012 by someone While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
someone Posted May 26, 2012 Share Posted May 26, 2012 Well I'm going to have to leave this for the weekend, but I have made some progress. The *fix* would seem to be a combination of converting everything to _guictrllistview (and in turn changing the register messages) and putting in _WinAPI_UpdateWindow in the chase function. I tried putting just the _WinAPI_UpdateWindow in your original code and it does nothing. Also, to reiterate I do NOT get this problem with Win 7, 32 or 64, only in XP. The good news is I don't see any negative from using the code that works in XP on Win 7. The code posted is not in a fully working state. There are a couple bugs, most notably the icon does not appear, and the text of what you are moving doesn't appear. I changed the tooltip to a splashtext, which fixed the flickering, but for some reason the text isn't populating into the window. I'm probably overlooking something stupid. I'm sure I've introduced another bug or two into the mix. Working.au3 Hopefully fixing those bugs are easy, please post back if you are able to. It will be a good couple days before I'm able to check in probably. Also, I'm by no means a great coder, but as a piece of advise every single time I've started something with the internal GUICtrlCreateListView functions I've come to wish I just bit the bullet and used the _guictrllistview functions. The internal funcs make a lot of it easier, but I always get tripped up in something I just can't do. Its hard to go backwards and redo a script but it isn't that much of a pain to start out that way. Just my 2 cents. While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
buymeapc Posted May 30, 2012 Author Share Posted May 30, 2012 It works fine on Win7, huh? Interesting. I do agree with you that the fix may lie in the usage of _GUICtrlListView functions as opposed to GUICtrlCreateListView, though. I've been fiddling with your sample from the above post. I'm not entirely too sure if the splash window can move and display text at the same time. Every example that I see shows that function as a static window. I noticed a couple of bugs that you mentioned. One being that if you drag/drop an item onto the same listview it came from, it'll drop the item to the opposite listview. Fixed that. So, Here's a slightly modified version of the code you posted and it does not create the trail marks, which is great! However, I could not seem to get the splashtext to display the text no matter what I tried. Also, the weirdest thing is I commented out the following line on line 56: GUISetState(@SW_HIDE, $drag_gui) If you drag an item slowly, you'll see the icon disappear little by little. It's the weirdest thing! If you uncomment this line, however, the icon won't show at all. Check it out expandcollapse popup; Includes first! Must must must! #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Misc.au3> #include <SendMessage.au3> ; Switch on the 'onEvent' notifications Opt("GUIOnEventMode", 1) Opt("PixelCoordMode", 2) ; Generate the GUI! Ahoy there. Global $gw = 16 Global $gh = 16 Global $Startx, $Starty, $Endx, $Endy, $aM_Mask, $aMask, $nc Global $MainForm, $list_source, $list_target, $drag_gui, $hSplash $MainForm = GUICreate(" TEST! ", 517, 178) ; Source list box $list_source = _GUICtrlListView_Create($MainForm, "Title|Details", 13, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) _GUICtrlListView_SetExtendedListViewStyle($list_source, $LVS_EX_FULLROWSELECT) ; Target list box $list_target = _GUICtrlListView_Create($MainForm, "Title|Details", 261, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) _GUICtrlListView_SetExtendedListViewStyle($list_target, $LVS_EX_FULLROWSELECT) ; Populate box with some test stuff For $i = 0 To 4 $item = _GUICtrlListView_AddItem($list_source, _makeJunkName()) _GUICtrlListView_AddSubItem($list_source, $item, _makeJunkName(), 1) Next GUISetState(@SW_SHOW, $MainForm) ; Handle GUI events GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetOnEvent($GUI_EVENT_CLOSE, "_formEvents") ;~ $drag_gui = GUICreate("Drag", $gw, $gh, 0, 0, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST), $MainForm) ;~ $cursor_icon = GUICtrlCreateIcon("Shell32.dll", -147, 0, 0, 16, 16) ;~ GUISetState(@SW_HIDE, $drag_gui) $position = WinGetPos($MainForm) $client = WinGetClientSize($MainForm) $light_border = ($position[2] - $client[0]) / 2 $thick_border = $position[3] - $client[1] - $light_border $x_coord = $position[0] + $light_border $y_coord = $position[1] + $thick_border $drag_gui = GUICreate("Drag", $gw, $gh, $x_coord, $y_coord, BitOR($WS_CLIPCHILDREN, $WS_CLIPSIBLINGS, $WS_POPUP), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST), $MainForm) $cursor_icon = GUICtrlCreateIcon("Shell32.dll", -147, 0, 0, 16, 16) GUISetState(@SW_SHOW, $drag_gui) setTrans() ;GUISetState(@SW_HIDE, $drag_gui);<<<<<<< Try enabling and disabling this! See the fun happen ; Main program loop While 1 ; Don't really do much in here at all... Sleep(10) WEnd ; Function to handle other form events Func chase() $mp = MouseGetPos() _WinAPI_UpdateWindow($MainForm) WinMove($drag_gui, "", $mp[0] + 1, $mp[1] + 0) ;ToolTip($moving_txt, $mp[0] + 18, $mp[1]) WinMove($hSplash, "", $mp[0] + 18, $mp[1]) EndFunc ;==>chase Func _formEvents() Exit EndFunc ;==>_formEvents ; Create a junk name for testing Func _makeJunkName() Local $labelout = '' For $i = 1 To 10 $labelout &= Chr(Random(65, 90, 1)) Next Return $labelout EndFunc ;==>_makeJunkName Func setTrans() $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) $rct = DllStructCreate("int;int;int;inr", $aM_Mask[0]) $TestCol = PixelGetColor(0, 0) $Startx = -1 $Starty = -1 $Endx = 0 $Endy = 0 For $i = 0 To $gw For $j = 0 To $gh If PixelGetColor($i, $j) = $TestCol And $j < $gh Then If $Startx = -1 Then $Startx = $i $Starty = $j $Endx = $i $Endy = $j Else $Endx = $i $Endy = $j EndIf Else If $Startx <> -1 Then addRegion() $Startx = -1 $Starty = -1 EndIf Next Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $drag_gui, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion() $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $Startx, "long", $Starty, "long", $Endx + 1, "long", $Endy + 1) $nc += 1 DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegion Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo, $item_txt $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") $hWndListView = $hWndFrom If Not IsHWnd($hWndFrom) Then $hWndListView = GUICtrlGetHandle($hWndFrom) Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_BEGINDRAG ; A drag-and-drop operation involving the left mouse button is being initiated $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) If $hWndFrom = $list_source Then $direction = 1 ElseIf $hWndFrom = $list_target Then ; Or are we moving from destination to source $direction = 2 Else MsgBox(0, "", "bad") EndIf $aidx = _GUICtrlListView_GetSelectedIndices($hWndFrom, True) $iselecteditems = $aidx[0] ;retrieve all item text, not just first item For $i = 1 To $aidx[0] $item_txt &= _GUICtrlListView_GetItemText($hWndFrom, $aidx[$i]) & @CRLF Next _WinAPI_ShowCursor(False) GUISetState(@SW_SHOW, $drag_gui) ;$atemp = _GUICtrlListBox_GetItemRect($cinfo[4], Int($idx)) $atemp = _GUICtrlListView_ApproximateViewRect($hWndFrom, $iselecteditems) $hSplash = SplashTextOn("title", $item_txt, $atemp[0], $atemp[1] + 20, -1, -1, 1, "", 8) ;MsgBox(0, "", $item_txt) While _IsPressed(1) chase() WEnd GUISetState(@SW_HIDE, $drag_gui) _WinAPI_ShowCursor(True) SplashOff() ; Get new position ;~ Local $newcinfo = GUIGetCursorInfo(WinGetHandle($MainForm));<--- Had to disable this since we're using handles and not id's anymore $flag = False If $hWndFrom = $list_source Then Local $newcinfo = _GUICtrlListView_HitTest($list_target) Else Local $newcinfo = _GUICtrlListView_HitTest($list_source) EndIf For $t = 1 To 5 If $newcinfo[$t] = True Then ConsoleWrite([email="$t&@CRLF"]$t&@CRLF[/email]) $flag = True ExitLoop EndIf Next ; If we were moving from source to destination and we ARE in the destination box ;~ If $direction = 1 And $newcinfo[4] = GUICtrlGetHandle($list_target) Then If $direction = 1 And $flag Then ConsoleWrite("Moved " & $iselecteditems & " items from source to destination" & @CRLF) _GUICtrlListView_CopyItems($list_source, $list_target, 1) EndIf ; If we are moving from destination to source and we ARE in source box If $direction = 2 And $flag Then ConsoleWrite("Moved " & $iselecteditems & " items from destination to source" & @CRLF) _GUICtrlListView_CopyItems($list_target, $list_source, 1) EndIf _DebugPrint("$LVN_BEGINDRAG" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param")) ;_dragHandler($hWndFrom) ; No return value Case $LVN_BEGINRDRAG ; A drag-and-drop operation involving the right mouse button is being initiated $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) _DebugPrint("$LVN_BEGINRDRAG" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param")) ; No return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint I really appreciate your help! Link to comment Share on other sites More sharing options...
someone Posted May 30, 2012 Share Posted May 30, 2012 (edited) Just a quick reply, and I'll take a look at the code when I can, but the splash screen CAN display text like you can...at least I'm fairly sure . If you go back to your original code and supplement in the splashtext it worked, even with multiple list entries being dragged. I'l take a look at the rest of the code later. I really hope we get this working the way we want...its a cool piece of code. EDIT: I think I have it... have to piece it back together. Will post tomorrow morning. Edited May 30, 2012 by someone While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
someone Posted May 31, 2012 Share Posted May 31, 2012 As promised... I had to go back to my 'working.au3' rather then the code you posted, it was just easier for me to read. The attached is my code with the fixes. FullyWorking.au3 However, if you want to make your code work all you need to do is; Add _WinAPI_UpdateWindow($drag_gui) to the chase func Uncomment line 47, the guisetstate line with your comments at the end Add Sleep(1) directly below the SplashTextOn line A few explanations... In the code, you need GUISetState(@SW_SHOW, $drag_gui) setTrans() GUISetState(@SW_HIDE, $drag_gui) or else setTrans() doesn't work properly. Seems it can't set the transparency with a hidden GUI, so you have to show it, set the trans, and hide again (an educated guess, could be wrong). I don't know enough about the GDI calls to be of help there. Also, setTrans does not work properly on Win 7 (at least with my limited tested). The updatewindow($drag_gui) line prevents the drag cursor from being eaten. I can remove both the updatewindow lines and it works in Win 7, so I'm not sure if using updatewindow for the main GUI adds the bug of it 'eating' the drag gui, or what. Now the hard one... the Sleep(1). I can only make a guess here, that the window just didn't have enough time to create and add the text before entering the While loop. I played around with it and a sleep of 1 seems to work perfectly, but in reality I would up it to 5 or so. I can't imagine something that small being detectable by a user, and since I don't know why a sleep of 1 works, it would probably be a good idea to pad it a little. Let me know how it works out for you. If you can update the GDI calls for Win 7 I would like to have that, but its not a big deal. Not sure if you are able to test against a Win 7 machine. While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Belini Posted May 31, 2012 Share Posted May 31, 2012 Congratulations for the work, would be even better if you can use the left and right arrows to change the list as well. My Codes: Â Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 Â 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Â Â Link to comment Share on other sites More sharing options...
someone Posted May 31, 2012 Share Posted May 31, 2012 (edited) That is something I can do... here is what you would have to do, from my code. Add a button and onevent for the button; GUICtrlCreateButton("add", 200, 155, 50, 20) GUICtrlSetOnEvent(-1, "addpressed") and the function for it is a very simple Func addpressed() _GUICtrlListView_CopyItems($list_source, $list_target, 1) EndFunc There's multiple ways to do that, and obviously that only moves from left to right, not the reverse, but you get the idea. EDIT: OOOOH or am I an idiot and you mean the arrow keys, not buttons? Sorry low on caffeine today. But is follows the same principles whether working with a button or hotkey (hint, GUISetAccelerators) Edited May 31, 2012 by someone While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Belini Posted May 31, 2012 Share Posted May 31, 2012 (edited) I still had not looked at your code, I made the change and was as I suggested. expandcollapse popup; Includes first! Must must must! #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Misc.au3> #include <SendMessage.au3> ; Switch on the 'onEvent' notifications Opt("GUIOnEventMode", 1) Opt("PixelCoordMode", 2) ; Generate the GUI! Ahoy there. Global $gw = 16 Global $gh = 16 Global $Startx, $Starty, $Endx, $Endy, $aM_Mask, $aMask, $nc Global $MainForm, $list_source, $list_target, $drag_gui, $hSplash $MainForm = GUICreate(" TEST! ", 517, 178) ; Source list box $list_source = _GUICtrlListView_Create($MainForm, "Title|Details", 13, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) ; Target list box $list_target = _GUICtrlListView_Create($MainForm, "Title|Details", 261, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) ; Populate box with some test stuff $text = GUICtrlCreateLabel("Use the arrows to add or remove items from the list.", 100, 159, 330, 30) GUICtrlSetBkColor($text, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($text,11) HotKeySet("{right}", "add") HotKeySet("{left}", "remove") Func add() _GUICtrlListView_CopyItems ($list_source , $list_target, 1) EndFunc Func remove() _GUICtrlListView_CopyItems ($list_target , $list_source, 1) EndFunc For $i = 0 To 4 $item = _GUICtrlListView_AddItem($list_source, _makeJunkName()) _GUICtrlListView_AddSubItem($list_source, $item, _makeJunkName(), 1) Next ; Handle GUI events GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetOnEvent($GUI_EVENT_CLOSE, "_formEvents") $drag_gui = GUICreate("Drag", $gw, $gh, 300, 300, BitOR($WS_CLIPCHILDREN, $WS_CLIPSIBLINGS, $WS_POPUP), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST), $MainForm) $cursor_icon = GUICtrlCreateIcon("Shell32.dll", -147, 0, 0, 16, 16) GUISetState(@SW_SHOW, $drag_gui) setTrans() GUISetState(@SW_HIDE, $drag_gui) GUISetState(@SW_SHOW, $MainForm) ; Main program loop While 1 Sleep(10) WEnd ; Function to handle other form events Func chase() $mp = MouseGetPos() _WinAPI_UpdateWindow($MainForm) _WinAPI_UpdateWindow($drag_gui) WinMove($drag_gui, "", $mp[0] + 0, $mp[1] + 0) ;ToolTip($moving_txt, $mp[0] + 18, $mp[1]) WinMove($hSplash, "", $mp[0] + 28, $mp[1] + 0) EndFunc ;==>chase Func _formEvents() Exit EndFunc ;==>_formEvents Func setTrans() $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) $rct = DllStructCreate("int;int;int;inr", $aM_Mask[0]) $TestCol = PixelGetColor(0, 0) $Startx = -1 $Starty = -1 $Endx = 0 $Endy = 0 For $i = 0 To $gw For $j = 0 To $gh If PixelGetColor($i, $j) = $TestCol And $j < $gh Then If $Startx = -1 Then $Startx = $i $Starty = $j $Endx = $i $Endy = $j Else $Endx = $i $Endy = $j EndIf Else If $Startx <> -1 Then addRegion() $Startx = -1 $Starty = -1 EndIf Next Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $drag_gui, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion() $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $Startx, "long", $Starty, "long", $Endx + 1, "long", $Endy + 1) $nc += 1 DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegion ; Create a junk name for testing Func _makeJunkName() Local $labelout = '' For $i = 1 To 10 $labelout &= Chr(Random(65, 90, 1)) Next Return $labelout EndFunc ;==>_makeJunkName Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo, $item_txt $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") $hWndListView = $hWndFrom If Not IsHWnd($hWndFrom) Then $hWndListView = GUICtrlGetHandle($hWndFrom) Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_BEGINDRAG ; A drag-and-drop operation involving the left mouse button is being initiated $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) If $hWndFrom = $list_source Then $direction = 1 ElseIf $hWndFrom = $list_target Then ; Or are we moving from destination to source $direction = 2 Else MsgBox(0, "", "bad") EndIf $aidx = _GUICtrlListView_GetSelectedIndices($hWndFrom, True) $iselecteditems = $aidx[0] ;retrieve all item text, not just first item For $i = 1 To $aidx[0] $item_txt &= _GUICtrlListView_GetItemText($hWndFrom, $aidx[$i]) & @CRLF Next $item_txt = StringStripWS($item_txt, 1+2) _WinAPI_ShowCursor(False) ;$atemp = _GUICtrlListBox_GetItemRect($cinfo[4], Int($idx)) $atemp = _GUICtrlListView_ApproximateViewRect($hWndFrom, $iselecteditems) $hSplash = SplashTextOn("", $item_txt, $atemp[0] - 10, $atemp[1] - 5, -1, -1, 1+32, "", 12) Sleep(5) ;MsgBox(0, "", $item_txt) GUISetState(@SW_SHOW, $drag_gui) While _IsPressed(1) chase() WEnd GUISetState(@SW_HIDE, $drag_gui) _WinAPI_ShowCursor(True) SplashOff() ; Get new position Local $newcinfo = GUIGetCursorInfo(WinGetHandle($MainForm)) ; If we were moving from source to destination and we ARE in the destination box If $direction = 1 And $newcinfo[4] = GUICtrlGetHandle($list_target) Then ConsoleWrite("Moved " & $iselecteditems & " items from source to destination" & @CRLF) _GUICtrlListView_CopyItems($list_source, $list_target, 1) EndIf ; If we are moving from destination to source and we ARE in source box If $direction = 2 And $newcinfo[4] = GUICtrlGetHandle($list_source) Then ConsoleWrite("Moved " & $iselecteditems & " items from destination to source" & @CRLF) _GUICtrlListView_CopyItems($list_target, $list_source, 1) EndIf _DebugPrint("$LVN_BEGINDRAG" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param")) ;_dragHandler($hWndFrom) ; No return value Case $LVN_BEGINRDRAG ; A drag-and-drop operation involving the right mouse button is being initiated $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) _DebugPrint("$LVN_BEGINRDRAG" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param")) ; No return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint Edited May 31, 2012 by Belini My Codes: Â Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 Â 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Â Â Link to comment Share on other sites More sharing options...
someone Posted May 31, 2012 Share Posted May 31, 2012 Not to nitpick, but I would suggest changing the hotkeyset to GUISetAccelerators. If you highlight an item, go into a completely different window, and hit an arrow, it will still copy the items. Using hotkeyset will also completely block the use of the arrow keys as normal buttons (this can be coded around, but would still change it to GUISetAccelerators). While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Belini Posted May 31, 2012 Share Posted May 31, 2012 (edited) I have not learned how to use the command GUISetAcceleratorsEDITED: I made another wayexpandcollapse popup; Includes first! Must must must! #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Misc.au3> #include <SendMessage.au3> ; Switch on the 'onEvent' notifications Opt("GUIOnEventMode", 1) Opt("PixelCoordMode", 2) ; Generate the GUI! Ahoy there. Global $gw = 16 Global $gh = 16 Global $Startx, $Starty, $Endx, $Endy, $aM_Mask, $aMask, $nc Global $MainForm, $list_source, $list_target, $drag_gui, $hSplash local $arrows = 0, $hDLL = DllOpen("user32.dll") AdlibRegister("arrows", 5) $MainForm = GUICreate(" TEST! ", 517, 178) ; Source list box $list_source = _GUICtrlListView_Create($MainForm, "Title|Details", 13, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) ; Target list box $list_target = _GUICtrlListView_Create($MainForm, "Title|Details", 261, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) ; Populate box with some test stuff $text = GUICtrlCreateLabel("Use the arrows to add or remove items from the list.", 100, 159, 330, 30) GUICtrlSetBkColor($text, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($text,11) func arrows() while 1 If _IsPressed("25", $hDLL) Then $arrows = 1 If _IsPressed("27", $hDLL) Then $arrows = 2 if not _IsPressed("25", $hDLL) and not _IsPressed("27", $hDLL) then ExitLoop wend if $arrows = 1 then _GUICtrlListView_CopyItems ($list_target , $list_source, 1) if $arrows = 2 then _GUICtrlListView_CopyItems ($list_source , $list_target, 1) $arrows = 0 EndFunc For $i = 0 To 4 $item = _GUICtrlListView_AddItem($list_source, _makeJunkName()) _GUICtrlListView_AddSubItem($list_source, $item, _makeJunkName(), 1) Next ; Handle GUI events GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetOnEvent($GUI_EVENT_CLOSE, "_formEvents") $drag_gui = GUICreate("Drag", $gw, $gh, 300, 300, BitOR($WS_CLIPCHILDREN, $WS_CLIPSIBLINGS, $WS_POPUP), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST), $MainForm) $cursor_icon = GUICtrlCreateIcon("Shell32.dll", -147, 0, 0, 16, 16) GUISetState(@SW_SHOW, $drag_gui) setTrans() GUISetState(@SW_HIDE, $drag_gui) GUISetState(@SW_SHOW, $MainForm) ; Main program loop While 1 Sleep(10) WEnd ; Function to handle other form events Func chase() $mp = MouseGetPos() _WinAPI_UpdateWindow($MainForm) _WinAPI_UpdateWindow($drag_gui) WinMove($drag_gui, "", $mp[0] + 0, $mp[1] + 0) ;ToolTip($moving_txt, $mp[0] + 18, $mp[1]) WinMove($hSplash, "", $mp[0] + 28, $mp[1] + 0) EndFunc ;==>chase Func _formEvents() Exit EndFunc ;==>_formEvents Func setTrans() $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) $rct = DllStructCreate("int;int;int;inr", $aM_Mask[0]) $TestCol = PixelGetColor(0, 0) $Startx = -1 $Starty = -1 $Endx = 0 $Endy = 0 For $i = 0 To $gw For $j = 0 To $gh If PixelGetColor($i, $j) = $TestCol And $j < $gh Then If $Startx = -1 Then $Startx = $i $Starty = $j $Endx = $i $Endy = $j Else $Endx = $i $Endy = $j EndIf Else If $Startx <> -1 Then addRegion() $Startx = -1 $Starty = -1 EndIf Next Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $drag_gui, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion() $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $Startx, "long", $Starty, "long", $Endx + 1, "long", $Endy + 1) $nc += 1 DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegion ; Create a junk name for testing Func _makeJunkName() Local $labelout = '' For $i = 1 To 10 $labelout &= Chr(Random(65, 90, 1)) Next Return $labelout EndFunc ;==>_makeJunkName Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo, $item_txt $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") $hWndListView = $hWndFrom If Not IsHWnd($hWndFrom) Then $hWndListView = GUICtrlGetHandle($hWndFrom) Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_BEGINDRAG ; A drag-and-drop operation involving the left mouse button is being initiated $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) If $hWndFrom = $list_source Then $direction = 1 ElseIf $hWndFrom = $list_target Then ; Or are we moving from destination to source $direction = 2 Else MsgBox(0, "", "bad") EndIf $aidx = _GUICtrlListView_GetSelectedIndices($hWndFrom, True) $iselecteditems = $aidx[0] ;retrieve all item text, not just first item For $i = 1 To $aidx[0] $item_txt &= _GUICtrlListView_GetItemText($hWndFrom, $aidx[$i]) & @CRLF Next $item_txt = StringStripWS($item_txt, 1+2) _WinAPI_ShowCursor(False) ;$atemp = _GUICtrlListBox_GetItemRect($cinfo[4], Int($idx)) $atemp = _GUICtrlListView_ApproximateViewRect($hWndFrom, $iselecteditems) $hSplash = SplashTextOn("", $item_txt, $atemp[0] - 10, $atemp[1] - 5, -1, -1, 1+32, "", 12) Sleep(5) ;MsgBox(0, "", $item_txt) GUISetState(@SW_SHOW, $drag_gui) While _IsPressed(1) chase() WEnd GUISetState(@SW_HIDE, $drag_gui) _WinAPI_ShowCursor(True) SplashOff() ; Get new position Local $newcinfo = GUIGetCursorInfo(WinGetHandle($MainForm)) ; If we were moving from source to destination and we ARE in the destination box If $direction = 1 And $newcinfo[4] = GUICtrlGetHandle($list_target) Then ConsoleWrite("Moved " & $iselecteditems & " items from source to destination" & @CRLF) _GUICtrlListView_CopyItems($list_source, $list_target, 1) EndIf ; If we are moving from destination to source and we ARE in source box If $direction = 2 And $newcinfo[4] = GUICtrlGetHandle($list_source) Then ConsoleWrite("Moved " & $iselecteditems & " items from destination to source" & @CRLF) _GUICtrlListView_CopyItems($list_target, $list_source, 1) EndIf _DebugPrint("$LVN_BEGINDRAG" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param")) ;_dragHandler($hWndFrom) ; No return value Case $LVN_BEGINRDRAG ; A drag-and-drop operation involving the right mouse button is being initiated $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) _DebugPrint("$LVN_BEGINRDRAG" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param")) ; No return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint Edited May 31, 2012 by Belini My Codes: Â Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 Â 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Â Â Link to comment Share on other sites More sharing options...
buymeapc Posted May 31, 2012 Author Share Posted May 31, 2012 Fantastic work!! Thanks so much for the help on this! I really like the way this looks and works. I'll be ultimately using this as a file copy utility to drag a file name from one side (folder source) to the other side (folder destination) and this is perfect. Thanks again for the help!! Link to comment Share on other sites More sharing options...
someone Posted May 31, 2012 Share Posted May 31, 2012 @Belini, this is what I mean by GUISetAccelerators... (put up by GUICreate) $left = GUICtrlCreateDummy() GUICtrlSetOnEvent($left, "leftpressed") $right = GUICtrlCreateDummy() GUICtrlSetOnEvent($right, "rightpressed") Dim $aHotkey[2][2] = [["{LEFT}", $left],["{RIGHT}", $right]] GUISetAccelerators($aHotkey) Then somewhere put your funcs... Func leftpressed() ;MsgBox(0, "", "left pressed") _GUICtrlListView_CopyItems($list_target, $list_source, 1) EndFunc Func rightpressed() ;MsgBox(0, "", "right pressed") _GUICtrlListView_CopyItems($list_source, $list_target, 1) EndFunc Much cleaner that way. While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Belini Posted May 31, 2012 Share Posted May 31, 2012 Now I understand, thanks for explaining My Codes: Â Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 Â 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Â Â Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now