Jump to content

Locking a moveable listview collumn [Bugged]


Armand
 Share

Recommended Posts

Well...

I was trying to get one of my list-view columns locked so i looked up the forum and found an example that does just that [EG1] so, i've tried to use it in my script but it doesn't work, so i've made a reproduction.... if you can please have a look and tell me why does EG2 isn't locking it's last column... it'd be great !!!

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Global Const $HDN_FIRST = -300
Global Const $HDN_ITEMCHANGINGA = $HDN_FIRST - 0
Global Const $HDN_BEGINTRACKA = $HDN_FIRST - 6
Global $hListView
Example1()
Example2()

Func Example1()
$Gui = GUICreate("Test", 320, 220)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$hListView = _GUICtrlListView_Create($GUI, "Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_EDITLABELS, $LVS_REPORT), $WS_EX_CLIENTEDGE)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 80)

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 11)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 22)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 33)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_AddItem($hListView, "Item1",0)
_GUICtrlListView_AddItem($hListView, "Item2",2)
_GUICtrlListView_AddItem($hListView, "Item3",1)
_GUICtrlListView_AddItem($hListView, "Item4",3)

_GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2)
_GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1)
_GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0)
_GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3)

_GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1)
_GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3)
_GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2)
_GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        GUIDelete($Gui)
        ExitLoop
    EndSwitch
WEnd
EndFunc

Func Example2()
    $Gui = GUICreate("Test", 320, 220)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$hListView =GUICtrlCreateListView("Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), _
BitOR($LVS_EX_GRIDLINES, $LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT, 0x00010000, $LVS_EX_SUBITEMIMAGES))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 80)

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 11)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 22)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 33)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_AddItem($hListView, "Item1",0)
_GUICtrlListView_AddItem($hListView, "Item2",2)
_GUICtrlListView_AddItem($hListView, "Item3",1)
_GUICtrlListView_AddItem($hListView, "Item4",3)

_GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2)
_GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1)
_GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0)
_GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3)

_GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1)
_GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3)
_GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2)
_GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        GUIDelete($Gui)
        ExitLoop
    EndSwitch
WEnd
EndFunc

;------------------------------------------------------------------------------

;-----------------------------------------------------------------------------------
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR, $iCode, $tInfo, $iItem
   
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $iCode
    Case $HDN_ITEMCHANGINGA, $HDN_BEGINTRACKA
        $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
        $iItem = DllStructGetData($tInfo, "Item")
        If $iItem = _GUICtrlListView_GetColumnCount($hListView) - 1 Then Return 1
    EndSwitch
   
    Return $GUI_RUNDEFMSG
EndFunc

It seems like EG2 list view isn't launching the -306 WM_Notify msg at all !!!! - why ?!

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

Well i'm no expert but this should work

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Global Const $HDN_FIRST = -300
Global Const $HDN_ITEMCHANGINGA = $HDN_FIRST - 0
Global Const $HDN_BEGINTRACKA = $HDN_FIRST - 6
Global $hListView
Example1()
Example2()

Func Example1()
$Gui = GUICreate("Test", 320, 220)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$hListView = _GUICtrlListView_Create($GUI, "Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_EDITLABELS, $LVS_REPORT), $WS_EX_CLIENTEDGE)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 80)

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 11)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 22)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 33)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_AddItem($hListView, "Item1",0)
_GUICtrlListView_AddItem($hListView, "Item2",2)
_GUICtrlListView_AddItem($hListView, "Item3",1)
_GUICtrlListView_AddItem($hListView, "Item4",3)

_GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2)
_GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1)
_GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0)
_GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3)

_GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1)
_GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3)
_GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2)
_GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        GUIDelete($Gui)
        ExitLoop
    EndSwitch
WEnd
EndFunc

Func Example2()
    $Gui = GUICreate("Test", 320, 220)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$hListView =GUICtrlCreateListView("Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), _
BitOR($LVS_EX_GRIDLINES, $LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT, 0x00010000, $LVS_EX_SUBITEMIMAGES))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 80)

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 11)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 22)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 33)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_AddItem($hListView, "Item1",0)
_GUICtrlListView_AddItem($hListView, "Item2",2)
_GUICtrlListView_AddItem($hListView, "Item3",1)
_GUICtrlListView_AddItem($hListView, "Item4",3)

_GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2)
_GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1)
_GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0)
_GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3)

_GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1)
_GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3)
_GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2)
_GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        GUIDelete($Gui)
        ExitLoop
    EndSwitch
WEnd
EndFunc

;------------------------------------------------------------------------------

;-----------------------------------------------------------------------------------
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR, $iCode, $tInfo, $iItem
   
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $iCode
    Case -326,-321
        $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
        $iItem = DllStructGetData($tInfo, "Item")
        If $iItem = _GUICtrlListView_GetColumnCount($hListView) - 1 Then Return 1
    EndSwitch
   
    Return $GUI_RUNDEFMSG
EndFunc
Link to comment
Share on other sites

@oren

Great work!!! it freakin' works !!!

but as the MDSN library And other site shows the MSG should be -300 + -6 [-306]... so i think the AU3 built it listview is sending wrong WM_Notifications.... ?!?

E.G: http://vbnet.mvps.org/index.html?code/subc...tifications.htm

EDIT ->>>

Well... was too soon.... it works on the example script but not on my script which seems to not send any notify while i resize the columns ... any idea ?!

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

any idea ?!

I think you should check these messages:

Case $HDN_ITEMCHANGINGW, $HDN_ITEMCHANGINGA, $HDN_BEGINTRACKA, $HDN_BEGINTRACKW

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Or you can just resize the columns manualy, thrue the main loop (the items will be checked more properly in this case):

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>

Global Const $HDN_FIRST = -300
Global Const $HDN_ITEMCHANGINGA = $HDN_FIRST - 0
Global Const $HDN_BEGINTRACKA = $HDN_FIRST - 6

Global $iIsItemChanging = False

$Gui = GUICreate("Test", 320, 220)

$hListView = GUICtrlCreateListView("Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), _
BitOR($LVS_EX_GRIDLINES, $LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT, 0x00010000, $LVS_EX_SUBITEMIMAGES))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 80)

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 11)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 22)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 33)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_AddItem($hListView, "Item1",0)
_GUICtrlListView_AddItem($hListView, "Item2",2)
_GUICtrlListView_AddItem($hListView, "Item3",1)
_GUICtrlListView_AddItem($hListView, "Item4",3)

_GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2)
_GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1)
_GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0)
_GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3)

_GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1)
_GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3)
_GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2)
_GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete($Gui)
            ExitLoop
    EndSwitch
    
    If IsString($iIsItemChanging) Then
        $sItem_Data = $iIsItemChanging
        $iIsItemChanging = False
        
        _ItemChanging_Proc($sItem_Data)
    EndIf
WEnd

Func _ItemChanging_Proc($sItem_Data)
    Local $aItem_Data, $iItem, $iDoubleClicked, $iFixedItem, $aItemPos, $iItemXPos, $iOld_MCM, $aLV_Pos, $iMouseXPos, $iCol_Size
    
    $aItem_Data = StringSplit($sItem_Data, "|")
    
    $iItem = Number($aItem_Data[1])
    $iDoubleClicked = $aItem_Data[2]
    
    $iFixedItem = _GUICtrlListView_GetColumnCount($hListView) - 1
    $aItemPos = _GUICtrlHeader_GetItemRect(GUICtrlSendMsg($hListView, $LVM_GETHEADER, 0, 0), $iItem)
    
    $iItemXPos = $aItemPos[0]
    
    $iOld_MCM = Opt("MouseCoordMode", 0)
    
    $aLV_Pos = ControlGetPos($Gui, "", $hListView)
    $iMouseXPos = MouseGetPos(0) - $aLV_Pos[0] - 6
    
    Opt("MouseCoordMode", $iOld_MCM)
    
    If $iMouseXPos < $iItemXPos Then Return 0
    $iCol_Size = $iMouseXPos - $iItemXPos
    
    If $iItem <> $iFixedItem Then
        GUIRegisterMsg($WM_NOTIFY, "")
        
        If $iDoubleClicked = "True" Then
            GUICtrlSendMsg($hListView, $LVM_SETCOLUMNWIDTH, $iItem, -1)
        Else
            GUICtrlSendMsg($hListView, $LVM_SETCOLUMNWIDTH, $iItem, $iCol_Size)
        EndIf
        
        GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    EndIf
EndFunc

Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    Local $tNMHDR, $iCode, $tInfo
   
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $iCode = DllStructGetData($tNMHDR, "Code")
    
    Switch $iCode
        Case $HDN_ITEMCHANGINGW, $HDN_ITEMCHANGINGA ;, $HDN_BEGINTRACKA, $HDN_BEGINTRACKW
            $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam)
            
            $iIsItemChanging = DllStructGetData($tInfo, "Item") & "|" & (DllStructGetData($tInfo, "NewState") = 9035028)
            
            Return 1
    EndSwitch
   
    Return $GUI_RUNDEFMSG
EndFunc
Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

what if i don't get the $iCode -300 and -306 ... EVER !!!

how do i get it to show ?! why does it ever change ?!

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

what if i don't get the $iCode -300 and -306 ... EVER !!!

Post a reproducing code, where we can see that it's really don't recieve the message (i doubt that this is the problem). You can check if the WM_NOTIFY function is called at all (put ConsoleWrite at the begining), or there is Return before it reaches the Case part.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

@MrCreatoR

Mate, my first example shows that the $ICodes -300 and -306 aren't received, instead there are some -321 and -328....

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Global Const $HDN_FIRST = -300
Global Const $HDN_ITEMCHANGINGA = $HDN_FIRST - 0
Global Const $HDN_BEGINTRACKA = $HDN_FIRST - 6
Global $hListView
Example1()
Example2()

Func Example1()
$Gui = GUICreate("Test", 320, 220)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$hListView = _GUICtrlListView_Create($GUI, "Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_EDITLABELS, $LVS_REPORT), $WS_EX_CLIENTEDGE)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 80)

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 11)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 22)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 33)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_AddItem($hListView, "Item1",0)
_GUICtrlListView_AddItem($hListView, "Item2",2)
_GUICtrlListView_AddItem($hListView, "Item3",1)
_GUICtrlListView_AddItem($hListView, "Item4",3)

_GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2)
_GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1)
_GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0)
_GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3)

_GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1)
_GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3)
_GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2)
_GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        GUIDelete($Gui)
        ExitLoop
    EndSwitch
WEnd
EndFunc

Func Example2()
    $Gui = GUICreate("Test", 320, 220)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$hListView =GUICtrlCreateListView("Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), _
BitOR($LVS_EX_GRIDLINES, $LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT, 0x00010000, $LVS_EX_SUBITEMIMAGES))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 80)

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 11)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 22)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 33)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_AddItem($hListView, "Item1",0)
_GUICtrlListView_AddItem($hListView, "Item2",2)
_GUICtrlListView_AddItem($hListView, "Item3",1)
_GUICtrlListView_AddItem($hListView, "Item4",3)

_GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2)
_GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1)
_GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0)
_GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3)

_GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1)
_GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3)
_GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2)
_GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        GUIDelete($Gui)
        ExitLoop
    EndSwitch
WEnd
EndFunc

;------------------------------------------------------------------------------

;-----------------------------------------------------------------------------------
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR, $iCode, $tInfo, $iItem
   
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $iCode = DllStructGetData($tNMHDR, "Code")
    ConsoleWrite("!!! My $iCode="&$iCode&"  !!!"&@CRLF)
    Switch $iCode
    Case $HDN_ITEMCHANGINGA, $HDN_BEGINTRACKA
        $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
        $iItem = DllStructGetData($tInfo, "Item")
        If $iItem = _GUICtrlListView_GetColumnCount($hListView) - 1 Then Return 1
    EndSwitch
   
    Return $GUI_RUNDEFMSG
EndFunc

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

Well, i supose that when you create the list view by built-in function, the messages are unicode (if you are compiling in unicode you should take it in acount, when runing non-compiled script, i think it always in unicode). So you just need to catch the unicode version of the messages too:

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Global Const $HDN_FIRST = -300
Global Const $HDN_ITEMCHANGINGA = $HDN_FIRST - 0
Global Const $HDN_BEGINTRACKA = $HDN_FIRST - 6
Global $hListView

Example2()

Func Example2()
    $Gui = GUICreate("Test", 320, 220)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$hListView =GUICtrlCreateListView("Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), _
BitOR($LVS_EX_GRIDLINES, $LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT, 0x00010000, $LVS_EX_SUBITEMIMAGES))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 80)

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 11)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 22)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 33)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_AddItem($hListView, "Item1",0)
_GUICtrlListView_AddItem($hListView, "Item2",2)
_GUICtrlListView_AddItem($hListView, "Item3",1)
_GUICtrlListView_AddItem($hListView, "Item4",3)

_GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2)
_GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1)
_GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0)
_GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3)

_GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1)
_GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3)
_GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2)
_GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        GUIDelete($Gui)
        ExitLoop
    EndSwitch
WEnd
EndFunc

;------------------------------------------------------------------------------

;-----------------------------------------------------------------------------------
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR, $iCode, $tInfo, $iItem
   
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $iCode = DllStructGetData($tNMHDR, "Code")
    
    Switch $iCode
        Case $HDN_ITEMCHANGINGA, $HDN_ITEMCHANGINGW, $HDN_BEGINTRACKA, $HDN_BEGINTRACKW
            ConsoleWrite("+ $iCode = $HDN_ITEMCHANGINGW/$HDN_ITEMCHANGINGA/$HDN_BEGINTRACKA/$HDN_BEGINTRACKW" & @CRLF)
            
            $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
            $iItem = DllStructGetData($tInfo, "Item")
            If $iItem = _GUICtrlListView_GetColumnCount($hListView) - 1 Then Return 1
        Case Else
            ConsoleWrite("!!! My $iCode=" & $iCode & "  !!!" & @CRLF)
    EndSwitch
   
    Return $GUI_RUNDEFMSG
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Btw, you will get the same results on the first example if you add this line after _GUICtrlListView_Create():

_GUICtrlListView_SetUnicodeFormat($hListView, True)

:mellow:

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

ohh... and what about the fact that my original function just never returns these codes ?!

[i tried to but can't reproduce it exactly...]

it seems like i can pull the column over and over again and it never fires WM_Notify event for that specific action....

I'll try it again and edit this post with the values [all values] that are sent from my list view while i am resizing the column...

Ohhh christ... it does work with the Unicode format codes, GRRRRRRR !!!!!!!!!!!!!!!!!!!!!!!

THANKS A LOT TO ALL WHO HELP / READ MY POSTS !!!!

P.S - Sorry for wasting your time !!!

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

ohh... and what about the fact that my original function just never returns these codes ?!

[i tried to but can't reproduce it exactly...]

it seems like i can pull the column over and over again and it never fires WM_Notify event for that specific action....

I'll try it again and edit this post with the values [all values] that are sent from my list view while i am resizing the column...

Ohhh christ... it does work with the Unicode format codes, GRRRRRRR !!!!!!!!!!!!!!!!!!!!!!!

THANKS A LOT TO ALL WHO HELP / READ MY POSTS !!!!

P.S - Sorry for wasting your time !!!

Privet Moldove :mellow:

Try this:

#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Global $hListView, $hHeader
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

Example1()
Example2()

Func Example1()
$Gui = GUICreate("Test", 320, 220)

$hListView = _GUICtrlListView_Create($GUI, "Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_EDITLABELS, $LVS_REPORT), $WS_EX_CLIENTEDGE)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

$hHeader = _GUICtrlListView_GetHeader($hListView)

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 80)

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 11)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 22)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 33)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_AddItem($hListView, "Item1",0)
_GUICtrlListView_AddItem($hListView, "Item2",2)
_GUICtrlListView_AddItem($hListView, "Item3",1)
_GUICtrlListView_AddItem($hListView, "Item4",3)

_GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2)
_GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1)
_GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0)
_GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3)

_GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1)
_GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3)
_GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2)
_GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        GUIDelete($Gui)
        ExitLoop
    EndSwitch
WEnd
EndFunc

Func Example2()
$Gui = GUICreate("Test", 320, 220)

$hListView = GUICtrlCreateListView("Items|SubItems1|SubItems2", 10, 10, 300, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), _
BitOR($LVS_EX_GRIDLINES, $LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT, 0x00010000, $LVS_EX_SUBITEMIMAGES))

$hHeader = GUICtrlSendMsg($hListView, $LVM_GETHEADER, 0, 0)

_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 80)

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 11)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 22)
_GUIImageList_AddIcon ($hImage, "shell32.dll", 33)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_AddItem($hListView, "Item1",0)
_GUICtrlListView_AddItem($hListView, "Item2",2)
_GUICtrlListView_AddItem($hListView, "Item3",1)
_GUICtrlListView_AddItem($hListView, "Item4",3)

_GUICtrlListView_AddSubItem ($hListView, 0,'44', 1, 2)
_GUICtrlListView_AddSubItem ($hListView, 1,'22', 1, 1)
_GUICtrlListView_AddSubItem ($hListView, 2,'11', 1, 0)
_GUICtrlListView_AddSubItem ($hListView, 3,'33', 1, 3)

_GUICtrlListView_AddSubItem ($hListView, 0,'New', 2, 1)
_GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2, 3)
_GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2, 2)
_GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2, 0)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        GUIDelete($Gui)
        ExitLoop
    EndSwitch
WEnd
EndFunc

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR, $iCode, $iItem, $hWndFrom
   
    $tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHEADER, "hWndFrom"))
    $iItem = DllStructGetData($tNMHEADER, "Item")
    $iCode = DllStructGetData($tNMHEADER, "Code")
    
    Switch $hWndFrom
        Case $hHeader
            Switch $iCode
                Case $HDN_BEGINTRACK, $HDN_BEGINTRACKW
                    If $iItem = _GUICtrlListView_GetColumnCount($hListView) - 1 Then Return 1
            EndSwitch
    EndSwitch
   
    Return $GUI_RUNDEFMSG
EndFunc

:(

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...