Results 1 to 6 of 6

Thread: [RESOLVED] ListView/Treeview API Classes?

  1. #1

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,482

    Resolved [RESOLVED] ListView/Treeview API Classes?

    Before I spend hours on the web searching for these, wonder if any of you may already have links you'd be willing to provide?

    What I'm looking for is something to update one of my projects with unicode support. Specifically, the listview & treeview controls. I know that we can coerce these to use a font and code page to enable unicode support for a specific locale, but I'm wanting to use these controls to potentially display multiple locales.

    I am not opposed to and am very willing to use APIs to set/retrieve text strings for these controls, but am opposed to using some 3rd party replica. I'm sure there have been a few projects out there that created the API version of these controls & have classes that access them with/without events. CreateWindowEx will be used to create these controls.

    Currently, my project does support unicode but only displays unicode on demand as seen in the simple workup I posted below. I'd prefer to display all fields with actual unicode characters vs a "{Unicode}" placeholder that displays the actual characters when activated/double clicked. Haven't really messed with these controls in this respect, otherwise I'd be on the giving end vs. receiving end in this case. Ideas welcomed.
    Attached Images Attached Images  
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    21,446

    Re: ListView/Treeview API Classes?

    I tend to begin with stuff like peoples' Common Controls "replacement" projects (I think one here offers the source), vbAccelerator controls, etc. These often aren't well polished but can serve as the starting point to meet a specific need.

  3. #3

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,482

    Re: ListView/Treeview API Classes?

    Thanks D, I'll browse vbAccelerator. I don't need a full blown suite, just setting/retrieving the list/tree view items basically. Already have the code I need to mess with styles/formatting. And kinda set on using v5 of the controls vs v6 due to themes
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,482

    Re: ListView/Treeview API Classes?

    Spot on. Krools project in the code bank appears to have what I need. Just need to sift thru it.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166

    Re: [RESOLVED] ListView/Treeview API Classes?

    http://btmtz.mvps.org/

    LaVolpe: You might also want to take a look at Brad's site. Has both.

  6. #6

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,482

    Re: [RESOLVED] ListView/Treeview API Classes?

    FYI. This was sooooo easy, it's almost a shame that seems none of us were aware of it.

    The common controls (at least some of them) appear to be completely Unicode available as of v5.8+. No manifest needed, no subclassing, no API window creation required. More testing needed, but here is a simple example that works on my Vista box:

    Code:
    ' declarations section
    Private Type LVITEM
        Mask As Long
        iItem As Long
        iSubItem As Long
        State As Long
        StateMask As Long
        pszText As Long
        cchTextMax As Long
        iImage As Long
        lParam As Long
        iIndent As Long
    End Type
    Private Const LVM_FIRST As Long = &H1000&
    Private Const LVM_SETITEMTEXTW As Long = (LVM_FIRST + 116)
    Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
    
    ' sample call
        Dim sText As String
        Dim LVI As LVITEM
        sText = ChrW$(12434) & ChrW$(21628) & ChrW$(12403) & ChrW$(20986) & ChrW$(12377) & ChrW$(12383) & ChrW$(12417)
        
        With LVI
            .pszText = StrPtr(sText)
            .cchTextMax = Len(sText) + 1
            .iSubItem = 1   ' subitem 1
        End With
        SendMessage ListView1.hWnd, LVM_SETITEMTEXTW, 0, ByVal VarPtr(LVI)
    ' the 0 in above line indicates 1st listview item, which are 0-bound when called by API
    The 1st example below is result of: ListView1.ListItems(1).SubItems(1) = sText
    The 2nd example is use of SendMessage call
    Name:  listview2.jpg
Views: 224
Size:  24.7 KB

    Edited: If anyone is trying this at home, ensure the listview's font is true-type
    Tested this on WinXP also, themed or unthemed and it works. For far-eastern unicode characters, you must ensure you installed the far-eastern fonts.
    Attached Files Attached Files
    Last edited by LaVolpe; Feb 4th, 2015 at 04:08 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width