Jump to content

Search the Community

Showing results for tags 'desktop list'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I made a program for changing the desktop view to list, icon, details about 10 years ago in VB. When I switched to win 7 a few years ago It stopped working properly and by then I had lost the source. Last week I got to looking at the 'newer' versions of Autoit and realized it had the api capability to bring this program back to life. (BTW, I really like what auto it has evolved into) Here is my DeskViewChanger application it now saves icon positions Works in Xp and W7 Haven't tried 8 and I believe 10 has the functionality already In Win7: When you choose autorun and click a view it also adds an entry to desktop context menu if Run as Admin Should be able to run as limited for everything else though In WINXP: details view makes/saves a solid background to add to the backimage property. Otherwise,on refresh it makes background picture show through and is not redrawn properly No context menu for XP either couldn't justify jumping through hoops to support it Note: There is a warning when not compiled about side effects, when desktop scaling is on the Detail view is the wrong size This is only when Aero is enabled and goes away with an added manifest to the compiled exe. Thanks RFTC List view is actually small icons view as listview didn't work right. Icon positions are saved to an Ini file and if exist are restored upon setting that view The program must now be compiled in the proper architecture in order to use the save icon position feature. Although, the basic view change works with any arch. I used item count of the listview to check against Ini section names so might be a problem if you don't have unique desktop items Not sure since I used the subitem (shortcut type) in addition to the name as the section names should make every entry unique If not let me know. Ambiguous Icon Names could be a problem instead the icons are listed under the same section and therefore icons with the same name can get switched between themselves in this case add Item Type to the report view header and the script will use this to name icon position sections. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_Res_HiDpi=Y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;DVC-DESK VIEW CHANGE ;Bilgus ;Finds and changes desktop listview Icon, Report, List, Tile; Saves and restores Icon positions ;For Win XP-8 ;Changes Icon Size (Vista+) Opt("MustDeclareVars", 1) #include <SendMessage.au3> #include <GuiListView.au3> #include <GDIPlus.au3> #include <WinAPI.au3> ;-Menu Constants-GUIConstantsEx.au3 Global Const $GUI_CHECKED = 1, $GUI_UNCHECKED = 4, $GUI_ENABLE = 64, $GUI_DISABLE = 128 ;-MenuOption Global $GLOBAL_idOptionsAuto = 0 ;used in Script_Exit ;-Desktop Listview Global Const $GLOBAL_hListView = _DesktopLV_GetHandle(_WinAPI_GetDesktopWindow()) ;ControlGetHandle($hWnd, '', '[CLASS:SysListView32; INSTANCE:1]') If Not (Script_IsCompiled()) Then DllCall("User32.dll","bool","SetProcessDPIAware");Thanks RTFC If $GLOBAL_hListView = 0 Then MsgBox(0, @ScriptName & " ERROR", "SysListView32: No hListView ") Script_Exit() EndIf ;#CS ;Debug ;Debug_GetLvMStyles($GLOBAL_hListView) ;Debug_GetHDStyles($GLOBAL_hListView) ;Debug_GetWSStyles($GLOBAL_hListView) ;#CE If $CmdLine[0] > 1 Then If Script_CheckCmdLine($GLOBAL_hListView) Then _Menu_InitDisplayItems($GLOBAL_hListView, MouseGetPos(0), MouseGetPos(1)) ;menu display on current mouse position Else _Menu_InitDisplayItems($GLOBAL_hListView) ;menu centered over hidden Gui window EndIf Script_Exit() ;____________==>Main Func Create_SolidBG_BGR($iBGR) ;creates a solid color background (BGR) the size of the monitor for detail view in xp Local $iRGB = BitShift($iBGR, -16) $iRGB += BitAND($iBGR, 0xff00) $iRGB += BitShift($iBGR, 16) Local $iColor = BitAND($iRGB, 0xffffff) _GDIPlus_Startup() Local Const $sBgImagePath = @ScriptDir & "\ReportBg.jpg" ;create an empty bitmap Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0(@DesktopWidth, @DesktopHeight, $GDIP_PXF32ARGB) Local Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;create a context to the bitmap handle to do some GDI+ operations Local Const $iBgColor = 0xFF000000 + $iColor ;define background color -> ARGB _GDIPlus_GraphicsClear($hContext, $iBgColor) ;clear empty bitmap with new color ;save result as JPG (conversation is done automatically) FileDelete($sBgImagePath) _GDIPlus_ImageSaveToFile($hBitmap, $sBgImagePath) _GDIPlus_BitmapDispose($hBitmap) ;release bitmap _GDIPlus_GraphicsDispose($hContext) _GDIPlus_Shutdown() FileSetAttrib($sBgImagePath, "+ASH") ;Archive, System, Hidden Return $sBgImagePath EndFunc ;==>Create_SolidBG_BGR Func _Desktop_DefView_SetIconSz($hWnd, $iSize) ;$hwnd of DefView, $iSize 0-4 smallest to largest ;EXLARGEICONS=0, MEDICONS=1, LARGEICONS=2,SMALLICONS=3, SMALLESTICONS=4 ;Made this up from watching Window Messages (fires menu messages I think) ;(IFolderView2::SetViewModeAndIconSize. is probably how WE should be doing this) If @OSVersion = "WIN_XP" Then Return 0 ;Works on Windows 7/8, Sends icon size to defView based on ListView view If $iSize < 0 Or $iSize > 4 Or @OSVersion = "WIN_XP" Then Return 0 Local $aLvtoDv[5] = [4, 3, 1, 2, 0] ;Extra Large Icons = &H704D -28749<-----Index 0 ;Medium Icons = &H704E -28750; Large Icons = &H704F -28751; ;Small Icons = &H7050 -28752; Smallest Icons = &H7051 -28753 Local Const $WM_COMMAND = 0x111 Local $iMsg = $WM_COMMAND Local $wParam = 28749 + $aLvtoDv[Int($iSize)] ;FVM_?? Local Const $lParam = 0 _SendMessage($hWnd, $iMsg, $wParam, $lParam) If @error Then MsgBox(0, "_Desktop_DefView_SetIconSz", "_SendMessage Error: " & @error) Exit EndIf Return 1 EndFunc ;==>_Desktop_DefView_SetIconSz Func _DesktopLV_GetHandle($hWndParent) ;Grabs array of all windows, searches for the desktop syslistview Local $hRet = 0, $aWin = _WinAPI_EnumChildWindows($hWndParent, 0) ;_arraydisplay($aWin ) If Not (@error Or $aWin[0][0] = 0) Then For $i = $aWin[0][0] To 1 Step -1 If $aWin[$i][1] = "SysListView32" And _WinAPI_GetWindowLong($aWin[$i][0], $GWL_ID) = 1 Then ;'KaFu' ;ConsoleWrite(_WinAPI_GetClassName(_WinAPI_GetParent($aWin[$i][0]))) If StringInStr(_WinAPI_GetClassName(_WinAPI_GetParent($aWin[$i][0])), "SHELLDLL_DefView") > 0 Then ;SHELLDLL_DefView $hRet = $aWin[$i][0] ExitLoop EndIf EndIf Next EndIf If @error Then MsgBox(0, "_DesktopLV_GetHandle " & @error, "Error: " & _WinAPI_GetLastError() & " " & _WinAPI_GetLastErrorMessage()) Exit EndIf Return $hRet EndFunc ;==>_DesktopLV_GetHandle Func _DesktopLV_InitView($hListView, $iView, $iIconSz) ;Sets the Properties and window styles and ListviewExstyles for different views Local Const $HDS_BUTTONS = 0x00000002, $HDS_NOSIZING = 0x0800 Local Const $SB_VERT = 1, $SB_HORZ = 0 Local Const $COLOR_DESKTOP = 1, $CLR_NONE = 0xFFFFFFFF Local Const $iDetailsLvExStyle = BitOR($LVS_EX_AUTOSIZECOLUMNS, $LVS_EX_HEADERDRAGDROP) ;, $LVS_EX_FULLROWSELECT);$LVS_EX_HEADERDRAGDROP; Local $aWinClient, $sBgImagePath = "" Local $bgr_BkColor = _WinAPI_GetSysColor($COLOR_DESKTOP) Local $LVCurStyle = _WinAPI_GetWindowLong($hListView, $GWL_STYLE) Local $hHeader, $iHDCurStyle _Desktop_DefView_SetIconSz(_WinAPI_GetParent($hListView), $iIconSz) ;set icon size in vista+ using the parent def_View If $iView = $LV_VIEW_DETAILS Then $aWinClient = _GetWorkingArea() ;Set Details View to only primary desktop size If @OSVersion = "WIN_XP" Then $sBgImagePath = Create_SolidBG_BGR($bgr_BkColor) ; Create/Set the Background Image _GUICtrlListView_SetExtendedListViewStyle($hListView, $iDetailsLvExStyle, BitOR($iDetailsLvExStyle, $LVS_EX_FULLROWSELECT)) ;add DetailsEXstyle, remove fullrowsel _GUICtrlListView_SetBkColor($hListView, $bgr_BkColor) _WinAPI_SetWindowLong($hListView, $GWL_STYLE, BitOR($LVS_REPORT, BitAND($LVCurStyle, BitNOT($LVS_NOSCROLL)))) ;remove no scroll $hHeader = _GUICtrlListView_GetHeader($hListView) $iHDCurStyle = _WinAPI_GetWindowLong($hHeader, $GWL_STYLE) _WinAPI_SetWindowLong($hHeader, $GWL_STYLE, BitOR($HDS_BUTTONS, BitAND($iHDCurStyle, BitNOT($HDS_NOSIZING)))) ;add Header Buttons, remove no sizing _GUICtrlHeader_SetItemText($hHeader, 0, "") ;Get rid of Name For $i = 1 To _GUICtrlHeader_GetItemCount($hHeader) _GUICtrlListView_JustifyColumn($hListView, $i, 1) ;1=Text is right aligned ;If _GUICtrlHeader_GetItemText($hHeader, $i) = "Item Type" Then ;EndIf Next Else _GUICtrlListView_SetBkColor($hListView, $CLR_NONE) $aWinClient = _GetWinRect(_WinAPI_GetParent($hListView)) _GUICtrlListView_SetExtendedListViewStyle($hListView, 0, $iDetailsLvExStyle) ;Remove DetailsEXstyle _WinAPI_SetWindowLong($hListView, $GWL_STYLE, BitOR($LVS_NOSCROLL, BitAND($LVCurStyle, BitNOT($LVS_REPORT)))) ;Add No Scroll and remove report _GUIScrollBars_ShowScrollBar($hListView, $SB_VERT, False) ;remove scrollbar possibly added by details view EndIf _GUICtrlListView_SetBkImage($hListView, $sBgImagePath, 1) ;Tiled WinMove($hListView, "", -1, -1, $aWinClient[2], $aWinClient[3]) ;Fixed random off by 20 px error after report view (hopefully) WinMove($hListView, "", 0, 0, $aWinClient[2], $aWinClient[3]) EndFunc ;==>_DesktopLV_InitView Func DesktopLV_Item_RestorePos($hListView, $iView) ;Reads ini file and matches names then sets position of desktop icons Local Const $vDefault = "NA" Local $aSectionNames = [0] Local $aPos[2], $aItem Local $sItemsNotFound = "", $sItemsNew = "" Local $sIniFile = DesktopLV_Item_SavePos($hListView, $iView, False) Local $iCount = 0 If FileExists($sIniFile) Then $aSectionNames = IniReadSectionNames($sIniFile) For $i = 1 To $aSectionNames[0] ;Reset Count on any items that were ambiguous ;ConsoleWrite("R: " & IniRead($sIniFile, $aSectionNames[$i], "Ct", 0) & " : " & $aSectionNames[$i] & " ") IniWrite($sIniFile, $aSectionNames[$i], "Ct", 0) Next $aItem = _DesktopLV_Item_SaveRestoreSections($hListView) ;$aItem[$i] = $aTextItems[$i] & "-" & $aSubItems[$i] For $i = 1 To $aItem[0] $iCount = IniRead($sIniFile, $aItem[$i], "Ct", 0) + 1 $aPos[0] = IniRead($sIniFile, $aItem[$i], "X" & $iCount, $vDefault) $aPos[1] = IniRead($sIniFile, $aItem[$i], "Y" & $iCount, $vDefault) If $aPos[0] = $vDefault Or $aPos[1] = $vDefault Then $aPos[0] = IniRead($sIniFile, "DEFAULT", "X", $vDefault) $aPos[1] = IniRead($sIniFile, "DEFAULT", "Y", $vDefault) If Not ($aPos[0] = $vDefault) And Not ($aPos[1] = $vDefault) Then If $sItemsNew = "" Then $sItemsNew = "Placed in Default position, New items: " & @CRLF & $aItem[$i] Else $sItemsNew &= ", " & @CRLF & $aItem[$i] EndIf EndIf EndIf IniWrite($sIniFile, $aItem[$i], "Ct", $iCount) If Not ($aPos[0] = $vDefault) And Not ($aPos[1] = $vDefault) Then _GUICtrlListView_SetItemPosition($hListView, $i - 1, $aPos[0], $aPos[1]) Else ;No DEFAULT POS FOUND , New items just leave them where they sit but give user a message If $sItemsNotFound = "" Then $sItemsNotFound = "Make a Folder called DEFAULT to set a Position for unknown items." & _ @CRLF & "You may Delete The Default Folder after you Save positions twice(2x)" & _ @CRLF & "No Position found for new items: " & @CRLF & $aItem[$i] Else $sItemsNotFound &= ", " & @CRLF & $aItem[$i] EndIf EndIf Next If Not ($sItemsNotFound = "") Then ToolTip($sItemsNotFound, 0, 0) Sleep(5000) EndIf If Not ($sItemsNew = "") Then ToolTip($sItemsNew, 0, 0) Sleep(2000) EndIf EndIf EndFunc ;==>DesktopLV_Item_RestorePos Func _DesktopLV_Item_SaveRestoreSections($hListView) Local $iHeaderPos = 1, $hHeader = _GUICtrlListView_GetHeader($hListView) For $i = 1 To _GUICtrlHeader_GetItemCount($hHeader) ;prefer these if not there go with subitem 1 If _GUICtrlHeader_GetItemText($hHeader, $i) = "Size" Then $iHeaderPos = _GUICtrlHeader_GetItemOrder($hHeader, $i) If _GUICtrlHeader_GetItemText($hHeader, $i) = "Item Type" Then $iHeaderPos = _GUICtrlHeader_GetItemOrder($hHeader, $i) Next Local $aTextItems = _GUICtrl_ListView_GetItemsText_Array($hListView, 0) ;Names Local $aSubItems = _GUICtrl_ListView_GetItemsText_Array($hListView, $iHeaderPos) If Not ($aTextItems[0] = $aSubItems[0]) Then MsgBox(48, "An Error Occurred ", "Item and subitem count differs") Local $aItem[$aTextItems[0] + 1] $aItem[0] = $aTextItems[0] For $i = 1 To $aTextItems[0] If $aSubItems[$i] = "" Then $aItem[$i] = $aTextItems[$i] ;will have ambiguity with icon names Else $aItem[$i] = $aTextItems[$i] & " - " & StringRegExpReplace($aSubItems[$i], "[0123456789]", "") EndIf Next ;_ArrayDisplay($aItem) Return $aItem EndFunc ;==>_DesktopLV_Item_SaveRestoreSections Func DesktopLV_Item_SavePos($hListView, $iView, $bEnable = True) ;Writes ini file section = [ItemName - Subitem2] X= Y= position Local Const $vDefault = "NA" Local $iCount = 0 Local $iRetMsgBox = 0 Local $aSectionNames = [0] Local $sCompiledArch = "X86" If @AutoItX64 Then $sCompiledArch = "X64" Local $sIniFile = @ScriptDir & "\IconPos" & $sCompiledArch & "_" & $iView & "_" & @DesktopWidth & "x" & @DesktopHeight & ".ini" If $bEnable And Script_OsArch_is_CompiledArch() Then If FileExists($sIniFile) Then $iRetMsgBox = MsgBox(36, "Save Icon Positions", "Overwrite existing layout?") If $iRetMsgBox = 6 Then $iRetMsgBox = 0 Else $iRetMsgBox = MsgBox(35, "Delete Icon Positions", "Layout already exists, Delete?") Switch $iRetMsgBox Case 2 ;cancel ---> Flags: 1, 3, 5, 6 Case 6 ;Yes ---> Flags: 3, 4 FileDelete($sIniFile) Return $sIniFile Case 7 ;No ---> Flags: 3, 4 EndSwitch EndIf EndIf If $iRetMsgBox = 0 Then Local $aPos[2] $aPos[0] = IniRead($sIniFile, "DEFAULT", "X", $vDefault) ;Grab default position values if user configured them $aPos[1] = IniRead($sIniFile, "DEFAULT", "Y", $vDefault) If $aPos[0] = $vDefault Or $aPos[1] = $vDefault Then $aPos[0] = IniRead($sIniFile, "DEFAULT", "X1", $vDefault) ;Grab default position values if user has a folder named Default $aPos[1] = IniRead($sIniFile, "DEFAULT", "Y1", $vDefault) EndIf FileDelete($sIniFile) FileWrite($sIniFile, $sIniFile & @CRLF & "Icons Saved " & _ @HOUR & ":" & @MIN & "." & @SEC & " M" & @MON & "/D" & @MDAY & "/Y" & @YEAR) IniWrite($sIniFile, "DEFAULT", "X", $aPos[0]) IniWrite($sIniFile, "DEFAULT", "Y", $aPos[1]) ;Local $iCount = _GUICtrlListView_GetItemCount($hListView) Local $aItem = _DesktopLV_Item_SaveRestoreSections($hListView) For $i = 1 To $aItem[0] $aPos = _GUICtrlListView_GetItemPosition($hListView, $i - 1) $iCount = IniRead($sIniFile, $aItem[$i], "Ct", 0) + 1 IniWrite($sIniFile, $aItem[$i], "Ct", $iCount) IniWrite($sIniFile, $aItem[$i], "X" & $iCount, $aPos[0]) IniWrite($sIniFile, $aItem[$i], "Y" & $iCount, $aPos[1]) ConsoleWrite("S: " & IniRead($sIniFile, $aItem[$i], "Ct", 0) & " : " & $aItem & " ") Next $aSectionNames = IniReadSectionNames($sIniFile) $iCount = _GUICtrlListView_GetItemCount($hListView) If $iCount > 0 Then If $iCount > $aSectionNames[0] Then MsgBox(48, "An Error Occurred, Not All Names Are Unique", $aSectionNames[0] & " of " & $iCount & " Positions were unique" & _ @CRLF & "There could be some mismatch in order when restored" & _ @CRLF & "Try adding 'Item Type' to the report view") ;_ArrayDisplay($aSectionNames, "Desktop Items Found", "", 16) EndIf EndIf EndIf EndIf Return $sIniFile EndFunc ;==>DesktopLV_Item_SavePos Func DesktopLV_SetView($hListView, $iView, $IconSz = -1) ;LV_VIEW_ICON=0;LV_VIEW_DETAILS=1;LV_VIEW_SMALLICON=2;LV_VIEW_LIST=3;LV_VIEW_TILE=4; Local Const $SHCNE_ASSOCCHANGED = 0x8000000 Local Const $SHCNF_FLUSH = 0x00001000 ;-Made Up Constants- Local Enum $eDV_ICON_SMALL, $eDV_ICON_MEDSMALL, $eDV_ICON_MED, $eDV_ICON_LARGE, $eDV_ICON_EXLARGE If $iView < 0 Or $iView > 5 Then $iView = 0 _WinAPI_ShowWindow($hListView, @SW_HIDE) If $iView < 5 Then _GUICtrlListView_BeginUpdate($hListView) If $IconSz = -1 Then ;Use Default Icon Size Switch $iView Case $LV_VIEW_ICON _DesktopLV_InitView($hListView, $iView, $eDV_ICON_MEDSMALL) Case $LV_VIEW_DETAILS _DesktopLV_InitView($hListView, $iView, $eDV_ICON_SMALL) Case $LV_VIEW_SMALLICON _DesktopLV_InitView($hListView, $iView, $eDV_ICON_SMALL) Case $LV_VIEW_LIST _DesktopLV_InitView($hListView, $iView, $eDV_ICON_SMALL) Case $LV_VIEW_TILE _DesktopLV_InitView($hListView, $iView, $eDV_ICON_MED) EndSwitch Else ;User Selected Icon Size _DesktopLV_InitView($hListView, $iView, $IconSz) EndIf _GUI_Control_ListView_SetView($hListView, $iView) ;Send message to listview ;_GUICtrlListView_SetView($hListView,$iView);<HAS PARAMETERS MIXED UP _WinAPI_ShellChangeNotify($SHCNE_ASSOCCHANGED, $SHCNF_FLUSH) ;Refresh Icons _GUICtrlListView_EnsureVisible($hListView, 0) ;First Item Visible _GUICtrlListView_EndUpdate($hListView) ;ControlSend($hListView, "", 0, "{F5}") ; RefreshDesktop ;Locks icon positions not needed DesktopLV_Item_RestorePos($hListView, $iView) _WinAPI_ShowWindow($hListView, @SW_SHOW) EndIf EndFunc ;==>DesktopLV_SetView Func _GetWinRect($hWnd) Local $tRect = DllStructCreate($tagRECT) $tRect = _WinAPI_GetWindowRect($hWnd) If @error Then MsgBox(0, "_GetWinRect", "Error: " & _WinAPI_GetLastError() & " " & _WinAPI_GetLastErrorMessage()) Exit EndIf Return _Get_tRects_Array($tRect) EndFunc ;==>_GetWinRect Func _Get_tRects_Array($tRect) ;Returns [X,Y,W,H] If DllStructGetSize($tRect) = 16 Then Local $aArray[4] = [DllStructGetData($tRect, "Left"), DllStructGetData($tRect, "Top"), (DllStructGetData($tRect, "Right") - DllStructGetData($tRect, "Left")), (DllStructGetData($tRect, "Bottom") - DllStructGetData($tRect, "Top"))] Return $aArray EndIf EndFunc ;==>_Get_tRects_Array Func _GetWorkingArea() Local $SPI_GETWORKAREA = 48 Local $tRect = DllStructCreate($tagRECT) _WinAPI_SystemParametersInfo($SPI_GETWORKAREA, 0, $tRect) Return _Get_tRects_Array($tRect) EndFunc ;==>_GetWorkingArea Func _GUI_Control_ListView_SetView($hListView, $iView) ; The one under _GUICtrlListView_SetView has the params Mixed up If $iView < 0 Or $iView > 4 Then Return 0 Local $bRet If IsHWnd($hListView) Then $bRet = _SendMessage($hListView, $LVM_SETVIEW, $iView) <> -1 Else $bRet = GUICtrlSendMsg($hListView, $LVM_SETVIEW, $iView, 0) <> -1 EndIf ;EndIf If @error Then MsgBox(0, "LV_SetView", "_SendMessage Error: " & _WinAPI_GetLastError() & " " & _WinAPI_GetLastErrorMessage()) Exit EndIf Return $bRet EndFunc ;==>_GUI_Control_ListView_SetView Func _GuiCreate_Popup($Title, $iX = -1, $iY = -1, $iW = 0, $iH = 0) Local Const $WS_POPUP = 0x80000000 Local $Gui = GUICreate($Title, $iW, $iH, $iX, $iY, $WS_POPUP) Return $Gui EndFunc ;==>_GuiCreate_Popup Func _GUICtrl_ListView_GetItemsText_Array($hWnd, $iSubItem = 0) ; Author ........: Paul Campbell (PaulIA) ;Modified to grab Text of every item to an array 1 based, 0 holds count. Ex.[0=3][1=MyComputer][2=Recycle bin][3=My Stuff] ;Must be compiled to proper arch to work ;NOT the same as _GUICtrlListView_GetItemTextArray it works on a single item and returns all subitems ;This one works on all items and returns one subitem each Local $iCount = _GUICtrlListView_GetItemCount($hWnd) Local $aReturn[$iCount + 1] $aReturn[0] = $iCount Local $tBuffer, $bUnicode = _GUICtrlListView_GetUnicodeFormat($hWnd) If $bUnicode Then $tBuffer = DllStructCreate("wchar Text[4096]") Else $tBuffer = DllStructCreate("char Text[4096]") EndIf Local $pBuffer = DllStructGetPtr($tBuffer) Local $tItem = DllStructCreate($tagLVITEM) DllStructSetData($tItem, "SubItem", $iSubItem) DllStructSetData($tItem, "TextMax", 4096) If IsHWnd($hWnd) Then If _WinAPI_InProcess($hWnd, $__g_hLVLastWnd) Then DllStructSetData($tItem, "Text", $pBuffer) For $i = 1 To $iCount _SendMessage($hWnd, $LVM_GETITEMTEXTW, $i, $tItem, 0, "wparam", "struct*") $aReturn[$i] = DllStructGetData($tBuffer, "Text") DllStructSetData($tBuffer, "Text", "") Next Else Local $iItem = DllStructGetSize($tItem) Local $tMemMap, $pMemory = _MemInit($hWnd, $iItem + 4096, $tMemMap) Local $pText = $pMemory + $iItem DllStructSetData($tItem, "Text", $pText) For $i = 1 To $iCount _MemWrite($tMemMap, $tItem, $pMemory, $iItem) If $bUnicode Then _SendMessage($hWnd, $LVM_GETITEMTEXTW, $i - 1, $pMemory, 0, "wparam", "ptr") Else _SendMessage($hWnd, $LVM_GETITEMTEXTA, $i - 1, $pMemory, 0, "wparam", "ptr") EndIf _MemRead($tMemMap, $pText, $tBuffer, 4096) $aReturn[$i] = DllStructGetData($tBuffer, "Text") DllStructSetData($tBuffer, "Text", "") Next _MemFree($tMemMap) EndIf Else Local $pItem = DllStructGetPtr($tItem) DllStructSetData($tItem, "Text", $pBuffer) For $i = 1 To $iCount If $bUnicode Then GUICtrlSendMsg($hWnd, $LVM_GETITEMTEXTW, $i, $pItem) Else GUICtrlSendMsg($hWnd, $LVM_GETITEMTEXTA, $i, $pItem) EndIf $aReturn[$i] = DllStructGetData($tBuffer, "Text") DllStructSetData($tBuffer, "Text", "") Next EndIf Return $aReturn ;DllStructGetData($tBuffer, "Text") EndFunc ;==>_GUICtrl_ListView_GetItemsText_Array Func _GUIScrollBars_ShowScrollBar($hWnd, $iBar, $bShow = True) Local $aResult = DllCall("user32.dll", "bool", "ShowScrollBar", "hwnd", $hWnd, "int", $iBar, "bool", $bShow) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc ;==>_GUIScrollBars_ShowScrollBar Func _Menu_AutoStart($GLOBAL_idOptionsAuto, $aMenuOptViewStyle, $aMenuOptIconSize) ;Checks for autorun entry, saves currently selected view when checked If BitAND(GUICtrlRead($GLOBAL_idOptionsAuto), $GUI_CHECKED) Then GUICtrlSetState($GLOBAL_idOptionsAuto, $GUI_UNCHECKED) If Script_IsCompiled() Then Script_RunOnStartup(False, 0) Else ;GUICtrlSetState($GLOBAL_idOptionsAuto, $GUI_CHECKED) If Script_IsCompiled() Then _Menu_OptionChecked($aMenuOptViewStyle) GUICtrlSetState($GLOBAL_idOptionsAuto, $GUI_CHECKED) For $i = 0 To UBound($aMenuOptViewStyle, 1) - 1 If BitAND(GUICtrlRead($aMenuOptViewStyle[$i][2]), $GUI_CHECKED) Then Script_RunOnStartup(True, _Menu_OptionChecked($aMenuOptViewStyle) & " " & _Menu_OptionChecked($aMenuOptIconSize)) EndIf Next EndIf EndIf EndFunc ;==>_Menu_AutoStart Func _Menu_InitDisplayItems($hListView, $iX = -1, $iY = -1) Local $sView = _GUICtrlListView_GetView($hListView) ;msgbox(0,"",$sView) Local Const $GUI_EVENT_NONE = 0, $GUI_EVENT_CLOSE = -3, $GUI_EVENT_SECONDARYDOWN = -8, $GUI_EVENT_MOUSEMOVE = -11 Local $idOptionsView, $idOptionsSize ;[[Name, Value, Handle],[]] Local $aMenuOptViewStyle[5][3] = [["Icons", 0, ""], ["Report", 1, ""], ["List", 2, ""], ["Tile", 4, ""], ["Hide", 5, ""]] Local Const $iUB_aMenuOpt_ViewStyle = UBound($aMenuOptViewStyle, 1) - 1 Local $aMenuOptIconSize[6][3] = [["Small", 0, ""], ["MedSmall", 1, ""], ["Medium", 2, ""], ["Large", 3, ""], ["ExLarge", 4, ""], ["Default", -1, ""]] Local Const $iUB_aMenuOpt_IconSize = UBound($aMenuOptIconSize, 1) - 1 ;LV_VIEW_ICON=0;LV_VIEW_DETAILS=1;LV_VIEW_SMALLICON=2;LV_VIEW_LIST=3;LV_VIEW_TILE=4; Local Const $hGui = _GuiCreate_Popup("DVC", $iX, $iY) $idOptionsView = GUICtrlCreateContextMenu() ;$idOptionsDummy) For $i = 0 To $iUB_aMenuOpt_ViewStyle $aMenuOptViewStyle[$i][2] = GUICtrlCreateMenuItem($aMenuOptViewStyle[$i][0], $idOptionsView, -1, 1) Next If Not (@OSVersion = "WIN_XP") Then $idOptionsSize = GUICtrlCreateMenu("Size", $idOptionsView) For $i = 0 To $iUB_aMenuOpt_IconSize $aMenuOptIconSize[$i][2] = GUICtrlCreateMenuItem($aMenuOptIconSize[$i][0], $idOptionsSize, -1, 1) Next Menu_SetItem_Checked($aMenuOptIconSize[5][2], True) ;Default Size EndIf GUICtrlCreateMenuItem("", $idOptionsView, -1, 0) ;Seperator Local Const $idOptionsSave = GUICtrlCreateMenuItem("Save Positions", $idOptionsView) $GLOBAL_idOptionsAuto = GUICtrlCreateMenuItem("Auto Run", $idOptionsView) ;_Exit uses this value Local Const $idOptionsExit = GUICtrlCreateMenuItem("Exit", $idOptionsView) For $i = 0 To $iUB_aMenuOpt_ViewStyle If $sView = $aMenuOptViewStyle[$i][1] Then Menu_SetItem_Checked($idOptionsSave, FileExists(DesktopLV_Item_SavePos($hListView, $aMenuOptViewStyle[$i][1], False))) GUICtrlSetState($aMenuOptViewStyle[$i][2], $GUI_CHECKED) ExitLoop EndIf Next Menu_SetItem_Checked($GLOBAL_idOptionsAuto, Script_RunOnStartupCheck()) If Script_OsArch_is_CompiledArch() = False Then GUICtrlSetState($idOptionsSave, $GUI_DISABLE) If Script_IsCompiled() = False Then GUICtrlSetState($GLOBAL_idOptionsAuto, $GUI_DISABLE) GUISetState(@SW_SHOW) _Menu_Popup($hGui, $idOptionsView) ;Menu Message Loop Local $idMsg While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $idOptionsSave _Menu_SaveIconLayout($idOptionsSave, $aMenuOptViewStyle, $hListView) Case $idOptionsExit, $GUI_EVENT_CLOSE ;;;; ;msgbox(0,"",$idMsg) ExitLoop Case $GLOBAL_idOptionsAuto ; _Menu_AutoStart($GLOBAL_idOptionsAuto, $aMenuOptViewStyle, $aMenuOptIconSize) Case 0 If $iX - $iY = 0 Then _Menu_Popup($hGui, $idOptionsView) If Script_OsArch_is_CompiledArch() = False Then GUICtrlSetState($idOptionsSave, $GUI_DISABLE) If Script_IsCompiled() = False Then GUICtrlSetState($GLOBAL_idOptionsAuto, $GUI_DISABLE) Else ExitLoop EndIf Case $GUI_EVENT_MOUSEMOVE ContinueLoop Case -13 To -3 ;ConsoleWrite($idMsg) Sleep(100) Case Else ;ConsoleWrite($idMsg) ToolTip("", 0, 0) If _Menu_OptionArray($idMsg, $GLOBAL_idOptionsAuto, $aMenuOptViewStyle, $aMenuOptIconSize, $hListView) = True Then ;Traverse options array for Clicked Item $sView = _GUICtrlListView_GetView($hListView) For $i = 0 To $iUB_aMenuOpt_ViewStyle ;check for saved icon positions If $sView = $aMenuOptViewStyle[$i][1] Then Menu_SetItem_Checked($idOptionsSave, FileExists(DesktopLV_Item_SavePos($hListView, $aMenuOptViewStyle[$i][1], False))) ExitLoop EndIf Next Else If _Menu_OptionSize_Array($idMsg, $aMenuOptViewStyle, $aMenuOptIconSize, $hListView) = True Then ;Traverse OptionsSize array for Clicked Item EndIf EndIf EndSwitch If Script_OsArch_is_CompiledArch() = False Then GUICtrlSetState($idOptionsSave, $GUI_DISABLE) If Script_IsCompiled() = False Then GUICtrlSetState($GLOBAL_idOptionsAuto, $GUI_DISABLE) WEnd Script_Exit() EndFunc ;==>_Menu_InitDisplayItems Func _Menu_OptionArray($idMsg, $GLOBAL_idOptionsAuto, $aMenuOptViewStyle, $aMenuOptIconSize, $hListView) Local $bRet = False Local $iIconSz For $i = 0 To UBound($aMenuOptViewStyle, 1) - 1 If $idMsg = $aMenuOptViewStyle[$i][2] Then $iIconSz = _Menu_OptionChecked($aMenuOptIconSize) DesktopLV_SetView($hListView, $aMenuOptViewStyle[$i][1], $iIconSz) ;Set Selected View If Script_IsCompiled() Then If BitAND(GUICtrlRead($GLOBAL_idOptionsAuto), $GUI_CHECKED) Then Script_RunOnStartup(True, $aMenuOptViewStyle[$i][1] & " " & $iIconSz) ;Save to autorun if so desired ToolTip("On Start: " & $aMenuOptViewStyle[$i][0], 0, 0) Sleep(1000) EndIf EndIf $bRet = True Else GUICtrlSetState($aMenuOptViewStyle[$i][2], $GUI_ENABLE) ;Uncheck+Enable the other items EndIf Next Return $bRet EndFunc ;==>_Menu_OptionArray Func _Menu_OptionChecked($aMenuOptViewStyle) ;Returns the Value of the checked item Local $iRet = -1 For $i = 0 To UBound($aMenuOptViewStyle, 1) - 1 If BitAND(GUICtrlRead($aMenuOptViewStyle[$i][2]), $GUI_CHECKED) Then $iRet = $aMenuOptViewStyle[$i][1] ExitLoop EndIf Next Return $iRet EndFunc ;==>_Menu_OptionChecked Func _Menu_OptionSize_Array($idMsg, $aMenuOptViewStyle, $aMenuOptIconSize, $hListView) Local $bRet = False For $i = 0 To UBound($aMenuOptIconSize, 1) - 1 If $idMsg = $aMenuOptIconSize[$i][2] Then For $j = 0 To UBound($aMenuOptViewStyle, 1) - 1 If BitAND(GUICtrlRead($aMenuOptViewStyle[$j][2]), $GUI_CHECKED) Then DesktopLV_SetView($hListView, $aMenuOptViewStyle[$j][1], $aMenuOptIconSize[$i][1]) EndIf Next $bRet = True ExitLoop EndIf Next Return $bRet EndFunc ;==>_Menu_OptionSize_Array Func _Menu_Popup($hWnd, $idContext) ;Popup menu over left top of supplied hwnd Local $aPos = [0, 0, 0, 0] Local $hMenu = GUICtrlGetHandle($idContext) $aPos = WinGetPos($hWnd, "") DllCall("user32.dll", "bool", "TrackPopupMenu", "handle", $hMenu, "uint", 128, "int", $aPos[0], "int", $aPos[1], "int", 0, "hwnd", $hWnd, "ptr", 0) If @error Then Return SetError(@error, @extended, 0) ;_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd, $aPos[0], $aPos[1], 1, 1, 1) ;DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $aPos[0], "int", $aPos[1] + $aPos[3], "hwnd", $hWnd, "ptr", 0) Return $hMenu EndFunc ;==>_Menu_Popup Func _Menu_SaveIconLayout($idOptionsSave, $aMenuOptViewStyle, $hListView) ;Saves Icon positions checks the option if file was saved or exists Local $sIniFile = "" For $i = 0 To UBound($aMenuOptViewStyle, 1) - 1 If BitAND(GUICtrlRead($aMenuOptViewStyle[$i][2]), $GUI_CHECKED) Then Menu_SetItem_Checked($idOptionsSave, FileExists(DesktopLV_Item_SavePos($hListView, $aMenuOptViewStyle[$i][1]))) ExitLoop EndIf Next ;Menu_SetItem_Checked($idOptionsSave, FileExists($sIniFile)) EndFunc ;==>_Menu_SaveIconLayout Func Menu_SetItem_Checked($idOptions, $bChecked) ;Checks or Unchecks an item If $bChecked Then GUICtrlSetState($idOptions, $GUI_CHECKED) Else GUICtrlSetState($idOptions, $GUI_UNCHECKED) EndIf EndFunc ;==>Menu_SetItem_Checked Func _WinAPI_EnumChildWindows($hWnd, $bVisible = True) ;#include <WinAPISys.au3> If Not _WinAPI_GetWindow($hWnd, 5) Then Return SetError(2, 0, 0) ; $GW_CHILD Local $hEnumProc = DllCallbackRegister('__EnumWindowsProc', 'bool', 'hwnd;lparam') Dim $__g_vEnum[101][2] = [[0]] DllCall('user32.dll', 'bool', 'EnumChildWindows', 'hwnd', $hWnd, 'ptr', DllCallbackGetPtr($hEnumProc), 'lparam', $bVisible) If @error Or Not $__g_vEnum[0][0] Then $__g_vEnum = @error + 10 EndIf DllCallbackFree($hEnumProc) If $__g_vEnum Then Return SetError($__g_vEnum, 0, 0) __Inc($__g_vEnum, -1) Return $__g_vEnum EndFunc ;==>_WinAPI_EnumChildWindows Func _WinAPI_ShellChangeNotify($iEvent, $iFlags, $iItem1 = 0, $iItem2 = 0) ;#include <WinAPIShellEx.au3> ; Author.........: Yashied Local $sTypeOfItem1 = 'dword_ptr', $sTypeOfItem2 = 'dword_ptr' If IsString($iItem1) Then $sTypeOfItem1 = 'wstr' EndIf If IsString($iItem2) Then $sTypeOfItem2 = 'wstr' EndIf DllCall('shell32.dll', 'none', 'SHChangeNotify', 'long', $iEvent, 'uint', $iFlags, $sTypeOfItem1, $iItem1, $sTypeOfItem2, $iItem2) If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc ;==>_WinAPI_ShellChangeNotify ;====>Main Func Script_CheckCmdLine($hListView) Local $bRet = False If $CmdLine[0] > 1 Then If StringUpper($CmdLine[1]) = "/STARTUP" Then ;/startup and view #0- to 5# and Size 0 to 4 ;_ArrayDisplay($CmdLine) Local $iIconSz = -1 If $CmdLine[0] > 2 Then $iIconSz = Int($CmdLine[3]) ;Icon Size specified DesktopLV_SetView($hListView, Int($CmdLine[2]), $iIconSz) Exit Else ;at least any 2 random command line args. ;Used for context menu popup on DVC $bRet = True EndIf EndIf Return $bRet EndFunc ;==>Script_CheckCmdLine Func Script_Exit() If Script_IsCompiled() And GUICtrlGetState($GLOBAL_idOptionsAuto) = $GUI_UNCHECKED Then Script_RunOnStartup(False, 0) GUIDelete() _WinAPI_CoUninitialize() Exit EndFunc ;==>Script_Exit Func Script_IsCompiled() Local $bIsCompiled = False If StringUpper(StringRight(@ScriptName, 4)) = ".EXE" Then $bIsCompiled = True Return $bIsCompiled EndFunc ;==>Script_IsCompiled Func Script_OsArch_is_CompiledArch() Local $bRet = True If @OSArch = "X64" Then $bRet = @AutoItX64 Return $bRet EndFunc ;==>Script_OsArch_is_CompiledArch Func Script_RunOnStartup($bEnable, $sCmds) Local $sName = StringTrimRight(@ScriptName, 4) If $bEnable = False Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", "") RegDelete("HKCR\Directory\Background\shell\" & $sName) Else RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptFullPath & " /StartUp " & $sCmds) If Not (@OSVersion = "WIN_XP") Then RegWrite("HKCR\Directory\Background\shell\" & $sName) RegWrite("HKCR\Directory\Background\shell\" & $sName, "", "REG_SZ", $sName) RegWrite("HKCR\Directory\Background\shell\" & $sName & "\command", "", "REG_SZ", Chr(34) & @ScriptFullPath & Chr(34) & " /Mouse 1") EndIf EndIf EndFunc ;==>Script_RunOnStartup Func Script_RunOnStartupCheck() If StringInStr(RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", @ScriptName), @ScriptFullPath & " /StartUp") Then Return True Else Return False EndIf EndFunc ;==>Script_RunOnStartupCheck #CS ;;#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 #CE
×
×
  • Create New...