Jump to content

Recommended Posts

Posted (edited)

After reading a topic that supposedly has this fixed/solved -

I am trying this

- dependancy udf

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Res_File_Add=glasses.png, 10, glasses_png
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include "resources.au3"
_Main()
Func _Main()
Local $listview, $hImage
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\Advanced\Images"
GUICreate("ImageList AddBitmap", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER))
GUISetState()
; Load images
$hImage = _GUIImageList_Create(16, 32, 5, 3)
_GUIImageList_AddBitmap($hImage, $sPath & "\Red.bmp")
_GUIImageList_AddBitmap($hImage, $sPath & "\Green.bmp")
_GUIImageList_AddEx($hImage, "glasses_png")
_GUICtrlListView_SetImageList($listview, $hImage, 1)
; Add columns
_GUICtrlListView_AddColumn($listview, "Items", 120)
; Add items
_GUICtrlListView_AddItem($listview, "Item 1", 0)
_GUICtrlListView_AddItem($listview, "Item 2", 1)
_GUICtrlListView_AddItem($listview, "Item 3", 2)
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc   ;==>_Main

Func _GUIImageList_AddEx($hImageList, $sResource)
    Local $handleimg = _ResourceGet($sResource, $RT_BITMAP)
    _GUIImageList_Add($hImageList, $handleimg)
    _WinAPI_DeleteObject($handleimg)
    Return 1
EndFunc   ;==>_GUIImageList_AddEx

But no avail, i am thinking am i doing some stupid mistake here but cant seem to find it...

Edited by Aktonius
Posted

Use _ResourceGetAsBitmap() with $RT_RCDATA (10) not $RT_BITMAP (2)

Local $handleimg = _ResourceGetAsBitmap($sResource, $RT_RCDATA)

I see fascists...

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
×
×
  • Create New...