Yashied Posted May 15, 2011 Share Posted May 15, 2011 (edited) This is a simple example of using Windows Vista+ new styles and formats of Header control. expandcollapse popup#Include <Constants.au3> #Include <GUIConstantsEx.au3> #Include <GUIHeader.au3> #Include <GUIListView.au3> #Include <GUIMenu.au3> #Include <StructureConstants.au3> #Include <WindowsConstants.au3> ; Vista+ format constants Global Const $HDF_CHECKBOX = 0x00000040 Global Const $HDF_CHECKED = 0x00000080 Global Const $HDF_FIXEDWIDTH = 0x00000100 Global Const $HDF_SPLITBUTTON = 0x01000000 ; Vista+ notification constants Global Const $HDN_DROPDOWN = $HDN_FIRST - 18 $hForm = GUICreate('MyGUI', 400, 200) $LV = GUICtrlCreateListView('Column1|Column2|Column3', 10, 10, 380, 180) DllCall('uxtheme.dll', 'uint', 'SetWindowTheme', 'hwnd', GUICtrlGetHandle($LV), 'wstr', 'Explorer', 'ptr', 0) $hHdr = _GUICtrlListView_GetHeader(-1) $Format = _GUICtrlHeader_GetItemFormat($hHdr, 0) _WinAPI_SetWindowLong($hHdr, $GWL_STYLE, BitOR(_WinAPI_GetWindowLong($hHdr, $GWL_STYLE), $HDS_CHECKBOXES)) _GUICtrlHeader_SetItemFormat($hHdr, 0, BitOR($Format, $HDF_SPLITBUTTON)) _GUICtrlHeader_SetItemWidth($hHdr, 0, 120) _GUICtrlHeader_SetItemFormat($hHdr, 1, BitOR($Format, $HDF_SPLITBUTTON)) _GUICtrlHeader_SetItemWidth($hHdr, 1, 120) _GUICtrlHeader_SetItemFormat($hHdr, 2, BitOR($Format, BitOR($HDF_CHECKBOX, $HDF_FIXEDWIDTH, $HDF_SPLITBUTTON))) _GUICtrlHeader_SetItemWidth($hHdr, 2, 120) $Dummy = GUICtrlCreateDummy() $Menu = GUICtrlCreateContextMenu($Dummy) GUICtrlCreateMenuItem('Item1', $Menu) GUICtrlCreateMenuItem('Item2', $Menu) GUICtrlCreateMenuItem('Item3', $Menu) $Menu = GUICtrlGetHandle($Menu) GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY') GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Dummy _GUICtrlMenu_TrackPopupMenu($Menu, $hForm) EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hForm Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = DllStructGetData($tNMHDR, 'hWndFrom') Local $Code = DllStructGetData($tNMHDR, 'Code') Switch $hWndFrom Case $hHdr If @AutoItX64 Then Local $tNMHEADER = DllStructCreate('hwnd hWndFrom;uint_ptr IDFrom;int Code;uint Aligment;int Item;int Button;ptr pItem', $lParam) Else Local $tNMHEADER = DllStructCreate($tagNMHEADER, $lParam) EndIf Local $tHDITEM = DllStructCreate($tagHDITEM, DllStructGetData($tNMHEADER, 'pItem')) Local $Item = DllStructGetData($tNMHEADER, 'Item') Switch $Code Case $HDN_DROPDOWN GUICtrlSendToDummy($Dummy, $Item) Case $HDN_ITEMCHANGINGW If BitAND(DllStructGetData($tHDITEM, 'Mask'), $HDI_FORMAT) Then $Format = BitAND($Format, $HDF_CHECKED) If BitXOR(BitAND(DllStructGetData($tHDITEM, 'Fmt'), $HDF_CHECKED), $Format) Then If $Format Then ConsoleWrite('Column' & ($Item + 1) & ': ' & 'Unchecked' & @CR) Else ConsoleWrite('Column' & ($Item + 1) & ': ' & 'Checked' & @CR) EndIf EndIf EndIf Case $HDN_ITEMCHANGEDW If BitAND(DllStructGetData($tHDITEM, 'Mask'), $HDI_FORMAT) Then $Format = _GUICtrlHeader_GetItemFormat($hHdr, $Item) EndIf EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Edited December 22, 2013 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 15, 2011 Share Posted May 15, 2011 Me like! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
guinness Posted May 15, 2011 Share Posted May 15, 2011 Great Example! UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now