Jump to content

Icon Treeview for x64


adamski
 Share

Recommended Posts

Is there a way to modify the following code so that it works on x64 systems?

It works fine on x86, but when run as x64 the wrong icons are displayed (all the same) and there are no text labels to the nodes. I want to add some more x64 functionality so don't want to have to compile as x86.

I guess if it is not possible I could compile my other x64 functions separately and execute the exe from this x86 code.

From Help File:

CODE
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <GuiConstantsEx.au3>

#include <GuiTreeView.au3>

#include <GuiImageList.au3>

#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hImage, $iImage, $hTreeView

Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Add Child", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)

GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)

_GUIImageList_AddIcon($hImage, "shell32.dll", 110)

_GUIImageList_AddIcon($hImage, "shell32.dll", 131)

_GUIImageList_AddIcon($hImage, "shell32.dll", 165)

_GUIImageList_AddIcon($hImage, "shell32.dll", 168)

_GUIImageList_AddIcon($hImage, "shell32.dll", 137)

_GUIImageList_AddIcon($hImage, "shell32.dll", 146)

_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)

For $x = 1 To Random(2, 10, 1)

$iImage = Random(0, 5, 1)

$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage)

For $y = 1 To Random(2, 10, 1)

$iImage = Random(0, 5, 1)

_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage)

Next

Next

_GUICtrlTreeView_EndUpdate($hTreeView)

; Loop until user exits

Do

Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()

EndFunc ;==>_Main

Thanks

Link to comment
Share on other sites

Is there a way to modify the following code so that it works on x64 systems?

It works fine on x86, but when run as x64 the wrong icons are displayed (all the same) and there are no text labels to the nodes. I want to add some more x64 functionality so don't want to have to compile as x86.

I guess if it is not possible I could compile my other x64 functions separately and execute the exe from this x86 code.

From Help File:

CODE
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <GuiConstantsEx.au3>

#include <GuiTreeView.au3>

#include <GuiImageList.au3>

#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hImage, $iImage, $hTreeView

Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Add Child", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)

GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)

_GUIImageList_AddIcon($hImage, "shell32.dll", 110)

_GUIImageList_AddIcon($hImage, "shell32.dll", 131)

_GUIImageList_AddIcon($hImage, "shell32.dll", 165)

_GUIImageList_AddIcon($hImage, "shell32.dll", 168)

_GUIImageList_AddIcon($hImage, "shell32.dll", 137)

_GUIImageList_AddIcon($hImage, "shell32.dll", 146)

_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)

For $x = 1 To Random(2, 10, 1)

$iImage = Random(0, 5, 1)

$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage)

For $y = 1 To Random(2, 10, 1)

$iImage = Random(0, 5, 1)

_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage)

Next

Next

_GUICtrlTreeView_EndUpdate($hTreeView)

; Loop until user exits

Do

Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()

EndFunc ;==>_Main

Thanks
I haven't got a 64 bit OS so this is just a guess, but if you are running in 64 bit then presumably shell32 is not automatically in the search path so maybe put the full path. Otherwise I would use some icon extractor tool to see where the icons you want are kept in a 64 bit dll because maybe icons are not stored the same in 32bit and 64 bit files.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I haven't got a 64 bit OS so this is just a guess, but if you are running in 64 bit then presumably shell32 is not automatically in the search path so maybe put the full path. Otherwise I would use some icon extractor tool to see where the icons you want are kept in a 64 bit dll because maybe icons are not stored the same in 32bit and 64 bit files.

I have tried using absolute paths to my own dll, exe and ico files. None work. If that was the issue, presumably it wouldn't affect the labels...

Link to comment
Share on other sites

I have tried using absolute paths to my own dll, exe and ico files. None work. If that was the issue, presumably it wouldn't affect the labels...

Ok. (I didn't notice any labels.) Are the dll, exe and ico files compiled for 64 bit? I would guess they would need to be, but I don't know so it's probably time for me to bow out of this thread. Sorry I can't help.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Ok. (I didn't notice any labels.) Are the dll, exe and ico files compiled for 64 bit? I would guess they would need to be, but I don't know so it's probably time for me to bow out of this thread. Sorry I can't help.

Sorry, I phrased that badly. I didn't mean labels - I meant the tree node text.

All the icons I'm using work except when trying treeview. I have used them successfully for buttons and in list boxes in both x86 and x64 mode.

The following images show the difference between running in x86 and x64 mode.

Posted Image Posted Image

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...