Sign in to follow this  
Followers 0
gcue

list of items and pictures

12 posts in this topic

#1 ·  Posted (edited)

im trying to read from a list of items in an INI and generate the pictures associated to it in the INI

so far it doesnt load the images =/

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <Constants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global $ini = "settings.ini"

Local $hImage, $hListView

GUICreate("Custom Picture", 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
        $hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
        GUICtrlSetStyle($hListView, $LVS_ICON)
        GUISetState()

$products = IniReadSection($ini, "PRODUCTS")

If IsArray($products) Then
    For $n = 1 To $products[0][0]
        $product_list = _WinAPI_LoadImage(0, $products[$n][1], $IMAGE_BITMAP, 175, 175, BitOR($LR_LOADFROMFILE, $LR_DEFAULTSIZE))

; Load images
        $hImage = _GUIImageList_Create()
        _GUIImageList_Add($hImage, $products[$n][1])
        _GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add items
        _GUICtrlListView_AddItem($hListView, $products[$n][0], 0)
    Next
EndIf
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()

INI

[PRODUCTS]
bah=pam.jpg
junk=pam.bmp
Edited by gcue

Share this post


Link to post
Share on other sites



Are the pictures in the same directory as the script?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

yep =/

does it care about the pic dimensions/format?

Edited by gcue

Share this post


Link to post
Share on other sites

Your missing hisntance. You may want to try the GDIPlus library functions instead (Load from file one I believe). Then set the bitmap/picture to the GUI. I believe martin and nahuel put a function together yesterday or the day before to do this called SetBitmap, you can do a search for it.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

what's hisntance?

thanks for the info

Share this post


Link to post
Share on other sites

LOL i tried using this line

$product_list = _GDIPlus_BitmapCreateFromFile($products[$n][1])

in place of this line

$product_list = _WinAPI_LoadImage(0, $products[$n][1], $IMAGE_BITMAP, 175, 175, BitOR($LR_LOADFROMFILE, $LR_DEFAULTSIZE))

i get a gui crash hehehe.

Share this post


Link to post
Share on other sites

LOL i tried using this line

in place of this line

i get a gui crash hehehe.

Try _GDIPlus_ImageLoadFromFile(). :)

When the words fail... music speaks

Share this post


Link to post
Share on other sites

heheh same thing.. get hour glass then crash..

i tried to make the pic alot smaller 10x50 and still get the crash =/

jpg format

filesize 844 bytes

Share this post


Link to post
Share on other sites

heheh same thing.. get hour glass then crash..

i tried to make the pic alot smaller 10x50 and still get the crash =/

jpg format

filesize 844 bytes

An example to use GDI+, to show you that isn't error with _GDIPlus_ImageLoadFromFile()

#include <GDIPlus.au3>
$FILE = FileOpenDialog("SELECT",@ScriptDir,"Pictures (*.bmp;*.png;*.jpg)",1)
_GDIPlus_Startup()
$hIMG = _GDIPlus_ImageLoadFromFile($FILE)
$X = _GDIPlus_ImageGetWidth($hIMG)
$Y = _GDIPlus_ImageGetHeight($hIMG)
$GUI = GUICreate("TEST",$X,$Y)
GUISetState(@SW_SHOW,$GUI)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($GUI)
_GDIPlus_GraphicsDrawImage($hGraphic,$hIMG,0,0)

While 1
    If GUIGetMsg() = -3 Then ExitLoop
    Sleep(20)
WEnd
_GDIPlus_Shutdown()

When the words fail... music speaks

Share this post


Link to post
Share on other sites

no dice.

have u tried it? i cant see whats going on! grrrr

Share this post


Link to post
Share on other sites

no dice.

have u tried it? i cant see whats going on! grrrr

You think I would be posted unless to test the script first.

For me work fine. Please, someone to test it to see if it works properly or I am wrong. :)


When the words fail... music speaks

Share this post


Link to post
Share on other sites

no i meant test mine

i did test urs.. it works =D

any other ideas?

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  
Followers 0