Jump to content
Sign in to follow this  
buymeapc

ListView Artifacts While Dragging

Recommended Posts

buymeapc

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:

; 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   ;==>addRegion

Artifacts.bmp

Share this post


Link to post
Share on other sites
someone

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

Share this post


Link to post
Share on other sites
buymeapc

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 by buymeapc

Share this post


Link to post
Share on other sites
someone

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

Share this post


Link to post
Share on other sites
buymeapc

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!

Share this post


Link to post
Share on other sites
someone

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.

post-17201-0-60362800-1337991902_thumb.j

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 by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites
someone

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

Share this post


Link to post
Share on other sites
buymeapc

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 ;)

; 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!

Share this post


Link to post
Share on other sites
someone

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 by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites
someone

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

Share this post


Link to post
Share on other sites
Belini

Congratulations for the work, would be even better if you can use the left and right arrows to change the list as well.

Posted Image

Share this post


Link to post
Share on other sites
someone

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 by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites
Belini

I still had not looked at your code, I made the change and was as I suggested.

; 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 by Belini

Share this post


Link to post
Share on other sites
someone

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

Share this post


Link to post
Share on other sites
Belini

I have not learned how to use the command GUISetAccelerators

EDITED: I made another way

; 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 by Belini

Share this post


Link to post
Share on other sites
buymeapc

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!! ;)

Share this post


Link to post
Share on other sites
someone

@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

Share this post


Link to post
Share on other sites
Belini

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • Skysnake
      By Skysnake
      I am tracking this topic by @LarsJ.  It is very advanced and overkill for what I am currently trying to do.
       
      Problem is this.
      Listview contains columns, one of which is right aligned and gets populated by float values, such as 123.99.  Some do not have decimals ie 124.00 and on sort gets truncated to 124.  Its obviously still the same value, but the display has reset.
      ; line below is for list VIEW ;..................................0.........1......2............ $cListView = GUICtrlCreateListView("CUSTOMER|AMOUNT|DESCRIPTION", 8, 152, 764, 279) GUICtrlSetBkColor($cListView, $GUI_BKCOLOR_LV_ALTERNATE) ; alternate between the listview background color and the listview item background color GUICtrlSetBkColor($cListView, $LVStdClr) ; Set the background color for the listview _GUICtrlListView_SetColumnWidth($cListView, 0, 120) ; -- the client name _GUICtrlListView_SetColumnWidth($cListView, 1, 90) ;-- the amount _GUICtrlListView_JustifyColumn($cListView, 1, 1) ; 1 - Text is right aligned _GUICtrlListView_SetColumnWidth($cListView, 2, 200) ; the description What I am looking for is something native and simple like a 
          _GUICtrlListView_SetColumnFormat($cListView, 1, "%.2f") ;  1 - column is stringformatted to "%.2f"
      So that after each sort it will appear as it was in the original rendering.
      Is there something like this? I have not been able to find a simple solution.

      Thanks.
      Skysnake
    • Ambient
      By Ambient
      I have tried several way sto get this to work to no avail. Any help would be appreciated. #include <ListViewConstants.au3> #include <GuiListView.au3> #include "GuiListViewEx.au3" $idItem = GUICtrlCreateListViewItem($r & " | " & $c & $adoRs.Fields("TransactionAmount").value & " | " & $Timestamp & " | " & _StringProper($adoRs.Fields("Tillid").value) & @CRLF & @CRLF & "Card Number : " & $cardnum & " " , $idListView) ConsoleWrite( "IDITEM" & $idItem) If STRINGLEFT($adoRs.Fields("TransactionAmount").value,1)= "-" Then Consolewrite(" String is Negative" & @CRLF) ;Drops in Here as expected ;GUICtrlSetColor(-1, $COLOR_RED) ; Colour line if item is negative this didn' work $TxC= _GUICtrlListView_SetTextColor($hListView, $CLR_RED) ; I also tried $TxC= _GUICtrlListView_SetTextColor(-1, 0xFF0000) CONSOLEWRITE("TEXTCOLOUR RETURNED " & $TxC & @crlf) ; This is returning True ELSE Consolewrite(" String is NOT Negative" & @CRLF) EndIf  
    • Bilgus
      By Bilgus
      Example of Subclassing listviews using setwindowSubclass in order to intercept WM_KEYUP events
      Also pops context menu on  Shift + F10
      #include <Misc.au3> #include <ListViewConstants.au3> #include <GUIConstants.au3> #include <GuiMenu.au3> #include <WinAPIShellEx.au3> Global $g_hCB, $g_pCB, $g_ahProc[2][2] ;Stores the Data for subclassing listview Global $g_LVKEYUP = 0xFE00, $g_LVKEYDN = 0xFD00 ;Our Own Custom messages (Key Up/Dn) Global $g_iDummyData Global $g_hGui = GUICreate("test") Global $g_hList1 = GUICtrlCreateListView("#|x|y", 5, 24, 161, 70, $LVS_SHOWSELALWAYS Or $LVS_SINGLESEL) GUICtrlCreateListViewItem("text", $g_hList1) Global $g_hList1_LVN = GUICtrlCreateDummy() ;Recieves Messages from the callback Global $g_hContext1 = GUICtrlCreateContextMenu($g_hList1) GUICtrlCreateMenuItem("1", $g_hContext1) GUICtrlCreateMenuItem("2", $g_hContext1) Global $g_hList2 = GUICtrlCreateListView("#|x|y", 5, 100, 161, 70, $LVS_SHOWSELALWAYS Or $LVS_SINGLESEL) GUICtrlCreateListViewItem("text", $g_hList2) Global $g_hList2_LVN = GUICtrlCreateDummy() ;Recieves Messages from the callback Global $g_hContext2 = GUICtrlCreateContextMenu($g_hList2) GUICtrlCreateMenuItem("3", $g_hContext2) GUICtrlCreateMenuItem("4", $g_hContext2) GUISetState(@SW_SHOW) SubClassListView() ;Creates our subclass Func SubClassListView() OnAutoItExitRegister("Cleanup") ;to remove our subclass $g_hCB = DllCallbackRegister('_SubclassProc', 'lresult', 'hwnd;uint;wparam;lparam;uint_ptr;dword_ptr') $g_pCB = DllCallbackGetPtr($g_hCB) $g_ahProc[0][0] = $g_hList1 ;Add the Ids of the controls we'd like to subclass $g_ahProc[1][0] = $g_hList2 ;Set up the subclass _WinAPI_SetWindowSubclass ( $hWnd, $pSubclassProc, $idSubClass [, $pData = 0] ) $g_ahProc[0][1] = _WinAPI_SetWindowSubclass(GUICtrlGetHandle($g_ahProc[0][0]), $g_pCB, $g_ahProc[0][0], $g_hList1_LVN) $g_ahProc[1][1] = _WinAPI_SetWindowSubclass(GUICtrlGetHandle($g_ahProc[1][0]), $g_pCB, $g_ahProc[1][0], $g_hList2_LVN) EndFunc ;==>SubClassListView Func _SubclassProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData) #forceref $iID Local $iRtnMsg = 0 ;Events we'd like to intercept If $iMsg = $WM_KEYUP Or $iMsg = $WM_SYSKEYUP Then $iRtnMsg = $g_LVKEYUP ElseIf $iMsg = $WM_KEYDOWN Or $iMsg = $WM_SYSKEYDOWN Then $iRtnMsg = $g_LVKEYDN EndIf ;We Recieve the Id of the dummy through $pData and pass our RtnMsg to the dummy control If $iRtnMsg Then GUICtrlSendToDummy($pData, BitOR($iRtnMsg, $wParam)) ;Pass messages on to the default handler Return _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_SubclassProc Func Cleanup() For $i = 0 To UBound($g_ahProc) - 1 ;Remove Our Subclass' by setting it back to the original proc _WinAPI_RemoveWindowSubclass(GUICtrlGetHandle($g_ahProc[$i][0]), DllCallbackGetPtr($g_ahProc[$i][1]), $g_ahProc[$i][0]) Next DllCallbackFree($g_hCB) EndFunc ;==>Cleanup While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $g_hList1_LVN ;This is just a dummy it only recieves events ConsoleWrite("LV1 EVENT 0x" & Hex($g_iDummyData, 4) & @CRLF) $g_iDummyData = GUICtrlRead($g_hList1_LVN) ;Retrieve the code that was sent Switch BitAND($g_iDummyData, 0xFF00) ;Get the keyup/dn status Case $g_LVKEYDN If BitAND($g_iDummyData, 0x00FF) = 0x79 And (_IsPressed("A0") Or _IsPressed("A1")) Then ;Right/ Left Shift & F10 ShowMenu($g_hGui, $g_hList1, $g_hContext1) Else ConsoleWrite("Lv1 KeyDn Vk: 0x" & Hex(BitAND($g_iDummyData, 0x00FF), 2) & @CRLF) ;Get the Virtual keycode EndIf Case $g_LVKEYUP ConsoleWrite("Lv1 KeyUp Vk: 0x" & Hex(BitAND($g_iDummyData, 0x00FF), 2) & @CRLF) ;Get the Virtual keycode EndSwitch Case $g_hList2_LVN $g_iDummyData = GUICtrlRead($g_hList2_LVN) ;Retrieve the code that was sent ConsoleWrite("LV2 EVENT 0x" & Hex($g_iDummyData, 4) & @CRLF) Switch BitAND($g_iDummyData, 0xFF00) ;Get the keyup/dn status Case $g_LVKEYDN ConsoleWrite("Lv2 KeyDn Vk: 0x" & Hex(BitAND($g_iDummyData, 0x00FF), 2) & @CRLF) ;Get the Virtual keycode Case $g_LVKEYUP ConsoleWrite("Lv2 KeyUp Vk: 0x" & Hex(BitAND($g_iDummyData, 0x00FF), 2) & @CRLF) ;Get the Virtual keycode EndSwitch EndSwitch WEnd Func ShowMenu($hWnd, $idCtrl, $idContext) Local $aPos, $iX, $iY Local $hMenu = GUICtrlGetHandle($idContext) $aPos = ControlGetPos($hWnd, "", $idCtrl) $iX = $aPos[0] $iY = $aPos[1] + $aPos[3] ClientToScreen($hWnd, $iX, $iY) ; Show at the given coordinates (x, y) the popup menu (hMenu) which belongs to a given GUI window (hWnd) _GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd, $iX, $iY) EndFunc ;==>ShowMenu ; Convert the client (GUI) coordinates to screen (desktop) coordinates Func ClientToScreen($hWnd, ByRef $iX, ByRef $iY) Local $tPoint = DllStructCreate("int;int") DllStructSetData($tPoint, 1, $iX) DllStructSetData($tPoint, 2, $iY) DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "struct*", $tPoint) $iX = DllStructGetData($tPoint, 1) $iY = DllStructGetData($tPoint, 2) ; release Struct not really needed as it is a local $tPoint = 0 EndFunc ;==>ClientToScreen  
      Old Code Using setWindowLong
       
    • Bilgus
      By Bilgus
      Literally just a list of listview styles / extended styles and WS / WSEX styles prints them in the console by their name
      ;Debug ;Debug_GetLvMStyles($g_hListView) ;Debug_GetHDStyles($g_hListView) ;Debug_GetWSStyles($g_hListView) ;Debug_GetWSStyles($g_hWnd) ;;#include <ListViewConstants.au3> Func Debug_GetLvMStyles($hListView) Local $LVStyle = _WinAPI_GetWindowLong($hListView, -16) Local $LVExStyle = _GUICtrlListView_GetExtendedListViewStyle($hListView) Local $sLVSTYLES Local $sLVExSTYLES If @error Then ConsoleWrite(" Error Debug_GetLvMStyles Couldn't retrieve Styles") Return EndIf If BitAND($LVStyle, $LVS_ALIGNLEFT) Then $sLVSTYLES &= "$LVS_ALIGNLEFT, " If BitAND($LVStyle, $LVS_ALIGNMASK) Then $sLVSTYLES &= "$LVS_ALIGNMASK, " If BitAND($LVStyle, $LVS_ALIGNTOP) Then $sLVSTYLES &= "$LVS_ALIGNTOP, " If BitAND($LVStyle, $LVS_AUTOARRANGE) Then $sLVSTYLES &= "$LVS_AUTOARRANGE, " If BitAND($LVStyle, $LVS_DEFAULT) Then $sLVSTYLES &= "LVS_DEFAULT," If BitAND($LVStyle, $LVS_EDITLABELS) Then $sLVSTYLES &= "LVS_EDITLABELS, " If BitAND($LVStyle, $LVS_ICON) Then $sLVSTYLES &= "LVS_ICON, " If BitAND($LVStyle, $LVS_LIST) Then $sLVSTYLES &= "LVS_LIST, " If BitAND($LVStyle, $LVS_NOCOLUMNHEADER) Then $sLVSTYLES &= "LVS_NOCOLUMNHEADER, " If BitAND($LVStyle, $LVS_NOLABELWRAP) Then $sLVSTYLES &= "LVS_NOLABELWRAP, " If BitAND($LVStyle, $LVS_NOSCROLL) Then $sLVSTYLES &= "LVS_NOSCROLL, " If BitAND($LVStyle, $LVS_NOSORTHEADER) Then $sLVSTYLES &= "LVS_NOSORTHEADER, " If BitAND($LVStyle, $LVS_OWNERDATA) Then $sLVSTYLES &= "LVS_OWNERDATA, " If BitAND($LVStyle, $LVS_OWNERDRAWFIXED) Then $sLVSTYLES &= "LVS_OWNERDRAWFIXED, " If BitAND($LVStyle, $LVS_REPORT) Then $sLVSTYLES &= "LVS_REPORT, " If BitAND($LVStyle, $LVS_SHAREIMAGELISTS) Then $sLVSTYLES &= "LVS_SHAREIMAGELISTS, " If BitAND($LVStyle, $LVS_SHOWSELALWAYS) Then $sLVSTYLES &= "LVS_SHOWSELALWAYS, " If BitAND($LVStyle, $LVS_SINGLESEL) Then $sLVSTYLES &= "LVS_SINGLESEL, " If BitAND($LVStyle, $LVS_SMALLICON) Then $sLVSTYLES &= "LVS_SMALLICON, " If BitAND($LVStyle, $LVS_SORTASCENDING) Then $sLVSTYLES &= "LVS_SORTASCENDING, " If BitAND($LVStyle, $LVS_SORTDESCENDING) Then $sLVSTYLES &= "LVS_SORTDESCENDING, " If BitAND($LVStyle, $LVS_TYPEMASK) Then $sLVSTYLES &= "LVS_TYPEMASK, " If BitAND($LVStyle, $LVS_TYPESTYLEMASK) Then $sLVSTYLES &= "LVS_TYPESTYLEMASK, " If BitAND($LVExStyle, $LVS_EX_AUTOAUTOARRANGE) Then $sLVExSTYLES &= "$LVS_EX_AUTOARRANGE, " If BitAND($LVExStyle, $LVS_EX_AUTOCHECKSELECT) Then $sLVExSTYLES &= "$LVS_EX_AUTOCHECKSELECT, " If BitAND($LVExStyle, $LVS_EX_AUTOSIZECOLUMNS) Then $sLVExSTYLES &= "$LVS_EX_AUTOSIZECOLUMNS, " If BitAND($LVExStyle, $LVS_EX_BORDERSELECT) Then $sLVExSTYLES &= "$LVS_EX_BORDERSELECT, " If BitAND($LVExStyle, $LVS_EX_CHECKBOXES) Then $sLVExSTYLES &= "$LVS_EX_CHECKBOXES, " If BitAND($LVExStyle, $LVS_EX_COLUMNOVERFLOW) Then $sLVExSTYLES &= "$LVS_EX_COLUMNOVERFLOW, " If BitAND($LVExStyle, $LVS_EX_COLUMNSNAPPOINTS) Then $sLVExSTYLES &= "$LVS_EX_COLUMNSNAPPOINTS, " If BitAND($LVExStyle, $LVS_EX_DOUBLEBUFFER) Then $sLVExSTYLES &= "$LVS_EX_DOUBLEBUFFER, " If BitAND($LVExStyle, $LVS_EX_FLATSB) Then $sLVExSTYLES &= "$LVS_EX_FLATSB, " If BitAND($LVExStyle, $LVS_EX_FULLROWSELECT) Then $sLVExSTYLES &= "$LVS_EX_FULLROWSELECT, " If BitAND($LVExStyle, $LVS_EX_GRIDLINES) Then $sLVExSTYLES &= "$LVS_EX_GRIDLINES, " If BitAND($LVExStyle, $LVS_EX_HEADERDRAGDROP) Then $sLVExSTYLES &= "$LVS_EX_HEADERDRAGDROP, " If BitAND($LVExStyle, $LVS_EX_HEADERINALLVIEWS) Then $sLVExSTYLES &= "$LVS_EX_HEADERINALLVIEWS, " If BitAND($LVExStyle, $LVS_EX_HIDELABELS) Then $sLVExSTYLES &= "$LVS_EX_HIDELABELS, " If BitAND($LVExStyle, $LVS_EX_INFOTIP) Then $sLVExSTYLES &= "$LVS_EX_INFOTIP, " If BitAND($LVExStyle, $LVS_EX_JUSTIFYCOLUMNS) Then $sLVExSTYLES &= "$LVS_EX_JUSTIFYCOLUMNS, " If BitAND($LVExStyle, $LVS_EX_LABELTIP) Then $sLVExSTYLES &= "$LVS_EX_LABELTIP, " If BitAND($LVExStyle, $LVS_EX_MULTIWORKAREAS) Then $sLVExSTYLES &= "$LVS_EX_MULTIWORKAREAS, " If BitAND($LVExStyle, $LVS_EX_ONECLICKACTIVATE) Then $sLVExSTYLES &= "$LVS_EX_ONECLICKACTIVATE, " If BitAND($LVExStyle, $LVS_EX_REGIONAL) Then $sLVExSTYLES &= "$LVS_EX_REGIONAL, " If BitAND($LVExStyle, $LVS_EX_SIMPLESELECT) Then $sLVExSTYLES &= "$LVS_EX_SIMPLESELECT, " If BitAND($LVExStyle, $LVS_EX_SNAPTOGRID) Then $sLVExSTYLES &= "$LVS_EX_SNAPTOGRID, " If BitAND($LVExStyle, $LVS_EX_SUBITEMIMAGES) Then $sLVExSTYLES &= "$LVS_EX_SUBITEMIMAGES, " If BitAND($LVExStyle, $LVS_EX_TRACKSELECT) Then $sLVExSTYLES &= "$LVS_EX_TRACKSELECT, " If BitAND($LVExStyle, $LVS_EX_TRANSPARENTBKGND) Then $sLVExSTYLES &= "$LVS_EX_TRANSPARENTBACKGROUND, " If BitAND($LVExStyle, $LVS_EX_TRANSPARENTSHADOWTEXT) Then $sLVExSTYLES &= "$LVS_EX_TRANSPARENTTEXTSHADOW, " If BitAND($LVExStyle, $LVS_EX_TWOCLICKACTIVATE) Then $sLVExSTYLES &= "$LVS_EX_TWOCLICKACTIVATE, " If BitAND($LVExStyle, $LVS_EX_UNDERLINECOLD) Then $sLVExSTYLES &= "$LVS_EX_UNDERLINECOLD, " If BitAND($LVExStyle, $LVS_EX_UNDERLINEHOT) Then $sLVExSTYLES &= "$LVS_EX_UNDERLINEHOT, " ConsoleWrite("Lv Styles= " & $sLVSTYLES & @CRLF) ConsoleWrite("Lv Ex Styles= " & $sLVExSTYLES & @CRLF) EndFunc ;==>Debug_GetLvMStyles ;;#include <HeaderConstants.au3> Func Debug_GetHDStyles($hListView) Local $hHeader = _GUICtrlListView_GetHeader($hListView) Local $HDStyle = _WinAPI_GetWindowLong($hHeader, -16) Local $sHDSTYLES If @error Then ConsoleWrite(" Error Debug_GetHDStyles Couldn't retrieve Styles") Return EndIf If BitAND($HDStyle, $HDS_BUTTONS) Then $sHDSTYLES &= "$HDS_STYLES, " ;0x00000002 ; Each item in the control looks and behaves like a push button If BitAND($HDStyle, $HDS_CHECKBOXES) Then $sHDSTYLES &= "$HDS_CHECKBOXES, " ;0x00000400 ; Allows the placing of checkbo ;es on header items on Vista If BitAND($HDStyle, $HDS_DRAGDROP) Then $sHDSTYLES &= "$HDS_DRAGDROP, " ;0x00000040 ; Allows drag-and-drop reordering of header items If BitAND($HDStyle, $HDS_FILTERBAR) Then $sHDSTYLES &= "$HDS_FILTERBAR, " ;0x00000100 ; Include a filter bar as part of the standard header control If BitAND($HDStyle, $HDS_FLAT) Then $sHDSTYLES &= "$HDS_FLAT, " ;0x00000200 ; Control is drawn flat when XP is running in classic mode If BitAND($HDStyle, $HDS_FULLDRAG) Then $sHDSTYLES &= "$HDS_FULLDRAG, " ;0x00000080 ; Column contents are displayed while the user resizes a column If BitAND($HDStyle, $HDS_HIDDEN) Then $sHDSTYLES &= "$HDS_HIDDEN, " ;0x00000008 ; Indicates a header control that is intended to be hidden If BitAND($HDStyle, $HDS_HORZ) Then $sHDSTYLES &= "$HDS_HORZ, " ;0x00000000 ; Creates a header control with a horizontal orientation If BitAND($HDStyle, $HDS_HOTTRACK) Then $sHDSTYLES &= "$HDS_HOTTRACK, " ;0x00000004 ; Enables hot tracking If BitAND($HDStyle, $HDS_NOSIZING) Then $sHDSTYLES &= "$HDS_NOSIZING, " ;0x0800 ; The user cannot drag the divider on the header control on Vista If BitAND($HDStyle, $HDS_OVERFLOW) Then $sHDSTYLES &= "$HDS_OVERFLOW, " ;0x1000 ; A button is displayed when not all items can be displayed within the header control's rectangle on Vista If BitAND($HDStyle, $HDS_DEFAULT) Then $sHDSTYLES &= "$HDS_DEFAULT, " ;0x00000046 ; Default header style $HDS_DRAGDROP + $HDS_HOTTRACK + $HDS_BUTTONS ConsoleWrite("Header Styles= " & $sHDSTYLES & @CRLF) EndFunc ;==>Debug_GetHDStyles Func Debug_GetWSStyles($hWnd) ;#include <WindowsConstants.au3> Local $WSStyle = _WinAPI_GetWindowLong($hWnd, -16) Local $sWSSTYLES Local $WSEXStyle = _WinAPI_GetWindowLong($hWnd, -20) ;_GUICtrlListView_GetExtendedListViewStyle($hListView); Local $sWSEXSTYLES If @error Then ConsoleWrite(" Error Debug_GetWSStyles Couldn't retrieve Styles") Return EndIf If BitAND($WSStyle, $WS_OVERLAPPED) Then $sWSSTYLES &= "$WS_OVERLAPPED, " If BitAND($WSStyle, $WS_TILED) Then $sWSSTYLES &= "$WS_TILED, " If BitAND($WSStyle, $WS_MAXIMIZEBOX) Then $sWSSTYLES &= "$WS_MAXIMIZEBOX, " ;0x00010000 If BitAND($WSStyle, $WS_MINIMIZEBOX) Then $sWSSTYLES &= "$WS_MINIMIZEBOX, " ;0x00020000 If BitAND($WSStyle, $WS_TABSTOP) Then $sWSSTYLES &= "$WS_TABSTOP, " ;0x00010000 If BitAND($WSStyle, $WS_GROUP) Then $sWSSTYLES &= "$WS_GROUP, " ;0x00020000 If BitAND($WSStyle, $WS_SIZEBOX) Then $sWSSTYLES &= "$WS_SIZEBOX, " ;0x00040000 If BitAND($WSStyle, $WS_THICKFRAME) Then $sWSSTYLES &= "$WS_THICKFRAME, " If BitAND($WSStyle, $WS_SYSMENU) Then $sWSSTYLES &= "$WS_SYSMENU, " ;0x00080000 If BitAND($WSStyle, $WS_HSCROLL) Then $sWSSTYLES &= "$WS_HSCROLL, " ;0x00100000 If BitAND($WSStyle, $WS_VSCROLL) Then $sWSSTYLES &= "$WS_VSCROLL, " ;0x00200000 If BitAND($WSStyle, $WS_DLGFRAME) Then $sWSSTYLES &= "$WS_DLGFRAME, " ;0x00400000 If BitAND($WSStyle, $WS_BORDER) Then $sWSSTYLES &= "$WS_BORDER, " ;0x00800000 If BitAND($WSStyle, $WS_CAPTION) Then $sWSSTYLES &= "$WS_CAPTION, " ;0x00C00000 If BitAND($WSStyle, $WS_OVERLAPPEDWINDOW) Then $sWSSTYLES &= "$WS_OVERLAPPEDWINDOW, " If BitAND($WSStyle, $WS_TILEDWINDOW) Then $sWSSTYLES &= "$WS_TILEDWINDOW, " If BitAND($WSStyle, $WS_MAXIMIZE) Then $sWSSTYLES &= "$WS_MAXIMIZE, " ;0x01000000 If BitAND($WSStyle, $WS_CLIPCHILDREN) Then $sWSSTYLES &= "$WS_CLIPCHILDREN, " ;0x02000000 If BitAND($WSStyle, $WS_CLIPSIBLINGS) Then $sWSSTYLES &= "$WS_CLIPSIBLINGS, " ;0x04000000 If BitAND($WSStyle, $WS_DISABLED) Then $sWSSTYLES &= "$WS_DISABLED, " ;0x08000000 If BitAND($WSStyle, $WS_VISIBLE) Then $sWSSTYLES &= "$WS_VISIBLE, " ;0x10000000 If BitAND($WSStyle, $WS_MINIMIZE) Then $sWSSTYLES &= "$WS_MINIMIZE, " ;0x20000000 If BitAND($WSStyle, $WS_ICONIC) Then $sWSSTYLES &= "$WS_ICONIC, " If BitAND($WSStyle, $WS_CHILD) Then $sWSSTYLES &= "$WS_CHILD, " ;0x40000000 If BitAND($WSStyle, $WS_CHILDWINDOW) Then $sWSSTYLES &= "$WS_CHILDWINDOW, " If BitAND($WSStyle, $WS_POPUP) Then $sWSSTYLES &= "$WS_POPUP, " ;0x80000000 If BitAND($WSStyle, $WS_POPUPWINDOW) Then $sWSSTYLES &= "$WS_POPUPWINDOW, " ;0x80880000 If BitAND($WSEXStyle, $WS_EX_ACCEPTFILES) Then $sWSEXSTYLES &= "$WS_EX_ACCEPTFILES, " ;0x00000010 If BitAND($WSEXStyle, $WS_EX_APPWINDOW) Then $sWSEXSTYLES &= "$WS_EX_APPWINDOW, " ;0x00040000 If BitAND($WSEXStyle, $WS_EX_COMPOSITED) Then $sWSEXSTYLES &= "$WS_EX_COMPOSITED, " ;0x02000000 If BitAND($WSEXStyle, $WS_EX_CONTROLPARENT) Then $sWSEXSTYLES &= "$WS_EX_CONTROLPARENT, " ;0x10000 If BitAND($WSEXStyle, $WS_EX_CLIENTEDGE) Then $sWSEXSTYLES &= "$WS_EX_CLIENTEDGE, " ;0x00000200 If BitAND($WSEXStyle, $WS_EX_CONTEXTHELP) Then $sWSEXSTYLES &= "$WS_EX_CONTEXTHELP, " ;0x00000400 If BitAND($WSEXStyle, $WS_EX_DLGMODALFRAME) Then $sWSEXSTYLES &= "$WS_EX_DLGMODALFRAME, " ;0x00000001 If BitAND($WSEXStyle, $WS_EX_LAYERED) Then $sWSEXSTYLES &= "$WS_EX_LAYERED, " ;0x00080000 If BitAND($WSEXStyle, $WS_EX_LAYOUTRTL) Then $sWSEXSTYLES &= "$WS_EX_LAYOUTRTL, " ;0x400000 If BitAND($WSEXStyle, $WS_EX_LEFT) Then $sWSEXSTYLES &= "$WS_EX_LEFT, " ;0x00000000 If BitAND($WSEXStyle, $WS_EX_LEFTSCROLLBAR) Then $sWSEXSTYLES &= "$WS_EX_LEFTSCROLLBAR, " ;0x00004000 If BitAND($WSEXStyle, $WS_EX_LTRREADING) Then $sWSEXSTYLES &= "$WS_EX_LTRREADING, " ;0x00000000 If BitAND($WSEXStyle, $WS_EX_MDICHILD) Then $sWSEXSTYLES &= "$WS_EX_MDICHILD, " ;0x00000040 If BitAND($WSEXStyle, $WS_EX_NOACTIVATE) Then $sWSEXSTYLES &= "$WS_EX_NOACTIVATE, " ;0x08000000 If BitAND($WSEXStyle, $WS_EX_NOINHERITLAYOUT) Then $sWSEXSTYLES &= "$WS_EX_NOINHERITLAYOUT, " ;0x00100000 If BitAND($WSEXStyle, $WS_EX_NOPARENTNOTIFY) Then $sWSEXSTYLES &= "$WS_EX_NOPARENTNOTIFY, " ;0x00000004 If BitAND($WSEXStyle, $WS_EX_RIGHT) Then $sWSEXSTYLES &= "$WS_EX_RIGHT, " ;0x00001000 If BitAND($WSEXStyle, $WS_EX_RIGHTSCROLLBAR) Then $sWSEXSTYLES &= "$WS_EX_RIGHTSCROLLBAR, " ;0x00000000 If BitAND($WSEXStyle, $WS_EX_RTLREADING) Then $sWSEXSTYLES &= "$WS_EX_RTLREADING, " ;0x2000 If BitAND($WSEXStyle, $WS_EX_STATICEDGE) Then $sWSEXSTYLES &= "$WS_EX_STATICEDGE, " ;0x00020000 If BitAND($WSEXStyle, $WS_EX_TOOLWINDOW) Then $sWSEXSTYLES &= "$WS_EX_TOOLWINDOW, " ;0x00000080 If BitAND($WSEXStyle, $WS_EX_TOPMOST) Then $sWSEXSTYLES &= "$WS_EX_TOPMOST, " ;0x00000008 If BitAND($WSEXStyle, $WS_EX_TRANSPARENT) Then $sWSEXSTYLES &= "$WS_EX_TRANSPARENT, " ;0x00000020 If BitAND($WSEXStyle, $WS_EX_WINDOWEDGE) Then $sWSEXSTYLES &= "$WS_EX_WINDOWEDGE, " ;0x00000100 If BitAND($WSEXStyle, $WS_EX_OVERLAPPEDWINDOW) Then $sWSEXSTYLES &= "$WS_EX_OVERLAPPEDWINDOW, " If BitAND($WSEXStyle, $WS_EX_PALETTEWINDOW) Then $sWSEXSTYLES &= "$WS_EX_PALETTEWINDOW, " ConsoleWrite("WS Styles= " & $sWSSTYLES & @CRLF) ConsoleWrite("WS EX Styles= " & $sWSEXSTYLES & @CRLF) EndFunc ;==>Debug_GetWSStyles  
    • nacerbaaziz
      By nacerbaaziz

      Hello all
      I have a question please
      this  a question is about the context menu
      When i create a list box  Or combo box
      if i create a context menu for this list
      When i press the application key or the shortcut shift + f10
      the menu options is appear normally
      but When i create a List view
      if i create a context menu for this list
      When i press the application key or the shortcut shift + f10
      the menu options isn't appear
      But the right mouse button works normally
      I need a solution please because I deal with the screen readers users
      Unfortunately They can not use the mouse to navigate
      So I have to find a solution to activate keyboard shortcuts
      am waiting  for your help
×