[LIB] LV_EX - update on 2016-04-28

Post your working scripts, libraries and tools for AHK v1.1 and older
rakesha002
Posts: 46
Joined: 04 Dec 2017, 00:11

Re: [LIB] LV_EX - update on 2016-04-28

Post by rakesha002 » 04 Dec 2020, 00:21

just me wrote:
03 Dec 2020, 04:16
3. some times the gui (which is another process) ...
LV_EX functions are not designed to work with controls in other processes. All functions using structures like LVITEM need to allocate memory in the address space of the other process to work properly.
hi,
just me, thanks for the clarification, i understood most of what you said, which is almost impossible
but ExtListView lib "Cyruz" seems to get item text, gave me hope, i thought same way i could set text (LVM_SETITEMTEXT) ....?

"Text := ExtListView_GetItemText(this.JLV, A_Index - 1, nCol)"

if possible may be some one could help me writing "LVM_SETITEMTEXT" function. i can't do it on my own (consider me as noob in LVITEM and dll calls), please help me
thanks in advance.

just me
Posts: 9425
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 04 Dec 2020, 04:15

I'll check what I can do for you. But since it's not related to LV_EX open a new thread in 'Ask For Help', please.

rakesha002
Posts: 46
Joined: 04 Dec 2017, 00:11

Re: [LIB] LV_EX - update on 2016-04-28

Post by rakesha002 » 04 Dec 2020, 05:39

hi,
just me

"I'll check what I can do for you."
thank you for trying

"But since it's not related to LV_EX open a new thread in 'Ask For Help',"
i'll wait till the next update from you and then ill ask for help.

just me
Posts: 9425
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 04 Dec 2020, 05:54

Open a new thread please.

hasantr
Posts: 933
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: [LIB] LV_EX - update on 2016-04-28

Post by hasantr » 13 Feb 2021, 10:44

Clicking on the group title selects all rows in the group. Can't we set it to Expand or collapse the group instead?
Clicking on the group title expands or collapses the open group.
Any idea.

just me
Posts: 9425
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 13 Feb 2021, 12:17

It might be feasible if you monitor the list view's notifications (WM_NOTIFY) and use the LV_EX_Group(Get/Set)State() functions. Maybe you need to subclass the control.

User avatar
dd900
Posts: 121
Joined: 27 Oct 2013, 16:03

Re: [LIB] LV_EX - update on 2016-04-28

Post by dd900 » 27 Nov 2021, 17:26

Is it possible to change the header text of an existing group?
and
Is there a way to get the number of items in a group?

just me
Posts: 9425
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 28 Nov 2021, 06:05

There are LVM_GETGROUPINFO and LVM_SETGROUPINFO messages which might be used to get/set the information.

User avatar
dd900
Posts: 121
Joined: 27 Oct 2013, 16:03

Re: [LIB] LV_EX - update on 2016-04-28

Post by dd900 » 02 Dec 2021, 19:48

just me wrote:
28 Nov 2021, 06:05
There are LVM_GETGROUPINFO and LVM_SETGROUPINFO messages which might be used to get/set the information.
Changing the Header was pretty straight forward

Code: Select all

LV_GroupSetHeader(HLV, gId, sHeader)
{
    ; LVGF_HEADER := 0x1
    ; LVM_SETGROUPINFO := 0x1093
    
    LVG_Size := (A_PtrSize * 6) + (17 * 4)
    , VarSetCapacity(LVG, LVG_Size, 0)      ; struct LVGROUP
    , NumPut(LVG_Size, LVG, 0, "UInt")       ; cbSize
    , NumPut(0x1, LVG, 4, "UInt")            ; Mask
    , NumPut(&sHeader, LVG, 8, "Ptr")       ; pszHeader
    SendMessage, 0x1093, % gId, % &LVG, , % "ahk_id " . HLV
}
I am unsure of how to get UINT cItems; using LVM_GETGROUPINFO
Assuming 64bit I calculated the offset to be 108 is this correct?

Code: Select all

typedef struct tagLVGROUP {		;Offset
  UINT   cbSize;				0
  UINT   mask;					4
  LPWSTR pszHeader;				8
  int    cchHeader;				16
  LPWSTR pszFooter;				20
  int    cchFooter;				28
  int    iGroupId;				36
  UINT   stateMask;				40
  UINT   state;					44
  UINT   uAlign;				48
  LPWSTR pszSubtitle;			52
  UINT   cchSubtitle;			56
  LPWSTR pszTask;				60
  UINT   cchTask;				64
  LPWSTR pszDescriptionTop;		68
  UINT   cchDescriptionTop;		72
  LPWSTR pszDescriptionBottom;	76
  UINT   cchDescriptionBottom;	80
  int    iTitleImage;			88
  int    iExtendedImage;		96
  int    iFirstItem;			104
  UINT   cItems;				108
  LPWSTR pszSubsetTitle;		112
  UINT   cchSubsetTitle;		116
} LVGROUP, *PLVGROUP;
At this point Im stuck. This does not work

Code: Select all

LV_GetGroupItems(HLV, gId)
{
    ; LVM_GETGROUPINFO := 0x1095
    ; LVGF_ITEMS := 0x4000
    
    Static cItemsOffset := (A_PtrSize * 6) + (15 * 4)
    
    LVG_Size := (A_PtrSize * 6) + (17 * 4)
    , VarSetCapacity(LVG, LVG_Size, 0)            ; struct LVGROUP
    , NumPut(LVG_Size, LVG, 0, "UInt")            ; cbSize
    , NumPut(0x4000, LVG, 4, "UInt")           ; Mask
    SendMessage, 0x1095, % gId, % &LVG, , % "ahk_id " . HLV
    return NumGet(LGV, cItemsOffset, "UInt")
}

just me
Posts: 9425
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 03 Dec 2021, 05:44

@dd900,

you need to consider the 64-bit default alignment. 64-bit pointers must start at an offset which is a multiple of 8 by default. So the following might be correct:

Code: Select all

typedef struct tagLVGROUP                 Type     Off32    Off64
{
    UINT    cbSize;                       UInt     0        0
    UINT    mask;                         UInt     4        4
    LPWSTR  pszHeader;                    Ptr      8        8
    int     cchHeader;                    Int      12       16
                                          *P64              20  (4)
    LPWSTR  pszFooter;                    Ptr      16       24
    int     cchFooter;                    Int      20       32
    int     iGroupId;                     Int      24       36
    UINT    stateMask;                    UInt     28       40
    UINT    state;                        UInt     32       44
    UINT    uAlign;                       UInt     36       48
                                          *P64              52  (4)
    LPWSTR  pszSubtitle;                  Ptr      40       56
    UINT    cchSubtitle;                  UInt     44       64
                                          *P64              68  (4)
    LPWSTR  pszTask;                      Ptr      48       72
    UINT    cchTask;                      UInt     52       80
                                          *P64              52  (4)
    LPWSTR  pszDescriptionTop;            Ptr      56       88
    UINT    cchDescriptionTop;            UInt     60       96
                                          *P64              100 (4)
    LPWSTR  pszDescriptionBottom;         Ptr      64       104
    UINT    cchDescriptionBottom;         UInt     68       112
    int     iTitleImage;                  Int      72       116
    int     iExtendedImage;               Int      76       120
    int     iFirstItem;                   Int      80       124          // Read only
    UINT    cItems;                       UInt     84       128          // Read only
                                          *P64              132 (4)
    LPWSTR  pszSubsetTitle;               Ptr      88       136          // NULL if group is not subset
    UINT    cchSubsetTitle;               UInt     92       144
                                          *P64              148 (4)

                                                   96       152
} LVGROUP, *PLVGROUP;

*P64: 64-bit padding

User avatar
dd900
Posts: 121
Joined: 27 Oct 2013, 16:03

Re: [LIB] LV_EX - update on 2016-04-28

Post by dd900 » 28 Dec 2021, 15:34

@just me

Thanks for the help. Here are the two working functions

Code: Select all

LV_GetGroupItemsCount(HLV, gId)
{
    static LVM_GETGROUPINFO := 0x1095
         , LVGF_ITEMS := 0x4000
    
    cItemsOffset := A_PtrSize = 8 ? 128 : 84
    , LVG_Size := A_PtrSize = 8 ? 152 : 96
    , VarSetCapacity(LVGROUP, LVG_Size, 0)
    , NumPut(LVG_Size, LVGROUP, 0, "UInt")
    , NumPut(LVGF_ITEMS, LVGROUP, 4, "UInt")
    SendMessage, % LVM_GETGROUPINFO, % gId, % &LVGROUP,, % "ahk_id " HLV
    return NumGet(LVGROUP, cItemsOffset, "UInt")
}

Code: Select all

LV_GroupSetHeader(HLV, gId, sHeader)
{
    static LVGF_HEADER := 0x1
         , LVM_SETGROUPINFO := 0x1093
    
    LVG_Size := A_PtrSize = 8 ? 152 : 96
    , VarSetCapacity(LVGROUP, LVG_Size, 0)      ; struct LVGROUP
    , NumPut(LVG_Size, LVGROUP, 0, "UInt")       ; cbSize
    , NumPut(LVGF_HEADER, LVGROUP, 4, "UInt")            ; Mask
    , NumPut(&sHeader, LVGROUP, 8, "Ptr")       ; pszHeader
    SendMessage, LVM_SETGROUPINFO, % gId, % &LVGROUP,, % "ahk_id " HLV
}

CyberKlabauter
Posts: 44
Joined: 26 Jan 2017, 17:59

Re: [LIB] LV_EX - update on 2016-04-28

Post by CyberKlabauter » 27 Jan 2023, 09:57

Do you have any plans to update the lib to v2? It is such a great basic lib.

just me
Posts: 9425
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [LIB] LV_EX - update on 2016-04-28

Post by just me » 27 Jan 2023, 10:53

@CyberKlabauter,

you'll find many of the functions in ListViewExtensions written for AHK v2.0-beta.1. I didn't try as yet whether all is running well with AHK v2.0.0+.

CyberKlabauter
Posts: 44
Joined: 26 Jan 2017, 17:59

Re: [LIB] LV_EX - update on 2016-04-28

Post by CyberKlabauter » 28 Jan 2023, 08:35

you'll find many of the functions in ListViewExtensions written for AHK v2.0-beta.1. I didn't try as yet whether all is running well with AHK v2.0.0+.
[Mod edit: Fixed quote tags.]

Thanks for the hint! I missed this. I think I will start converting my script and see how far I get.

User avatar
lmstearn
Posts: 688
Joined: 11 Aug 2016, 02:32
Contact:

Re: [LIB] LV_EX - update on 2016-04-28

Post by lmstearn » 11 Feb 2024, 11:06

Wrong thread, sorry.
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH

Post Reply

Return to “Scripts and Functions (v1)”