Jump to content
Sign in to follow this  

Need help with Image List view

Recommended Posts

Hi Guys,

Just need a little help with creating a Listview which is populated with .jpg image files, and upon selecting on of the listed objects it displays the image in a preview window.

I have been looking through the forums and havent found anything on this subject, but I am not 100% sure what I need to look for in this case.

Below is a code snippet I have taken from the help file, im not sure I am on the right path. Also not sure what to search for with regards to making each listed object have its own function.

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

Opt('MustDeclareVars', 1)


Func _Main()
    Local $listview, $hImage, $imageDirectory
    $imageDirectory = "C:\temp\Images"

    GUICreate("Wallpaper selector", 400, 300)
    $listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)

    ; Load images
    $hImage = _GUIImageList_Create(11, 11)
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, $imageDirectory, 11, 11))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, "", 11, 11))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, "", 11, 11))
    _GUICtrlListView_SetImageList($listview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($listview, "Items", 120)
    _GUICtrlListView_AddColumn($listview, "Image Description", 220)

    ; Add items
    _GUICtrlListView_AddItem($listview, "Camera Image1", 0)
    _GUICtrlListView_AddItem($listview, "Camera Image2", 1)
    _GUICtrlListView_AddItem($listview, "Camera Image3", 2)

    ; Loop until user exits
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main

The other thing is how do you remove the third column from being created?

another part of the script I would like to implement when user chooses the desired wallpaper.

$picpath = ""
RegWrite ("HKEY_CURRENT_USER\Control Panel\Desktop", "ConvertedWallpaper", "Reg_SZ", $picpath)
RegWrite("HKCU\Control Panel\Desktop", "Wallpaper", "REG_SZ", $picpath)
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", "2")
Run("RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True") ;will refresh the desktop
Run("RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True") ;will refresh the desktop

If anyone could point me where to look in helpfile or if someone knows of something already created like this please let me know.

thanks in advance ftc

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...