gcue Posted September 24, 2008 Share Posted September 24, 2008 (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 September 24, 2008 by gcue Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 24, 2008 Moderators Share Posted September 24, 2008 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. Link to comment Share on other sites More sharing options...
gcue Posted September 24, 2008 Author Share Posted September 24, 2008 (edited) yep =/ does it care about the pic dimensions/format? Edited September 24, 2008 by gcue Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 24, 2008 Moderators Share Posted September 24, 2008 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. Link to comment Share on other sites More sharing options...
gcue Posted September 24, 2008 Author Share Posted September 24, 2008 what's hisntance? thanks for the info Link to comment Share on other sites More sharing options...
gcue Posted September 24, 2008 Author Share Posted September 24, 2008 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. Link to comment Share on other sites More sharing options...
Andreik Posted September 24, 2008 Share Posted September 24, 2008 LOL i tried using this linein place of this linei get a gui crash hehehe.Try _GDIPlus_ImageLoadFromFile(). When the words fail... music speaks. Link to comment Share on other sites More sharing options...
gcue Posted September 24, 2008 Author Share Posted September 24, 2008 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 Link to comment Share on other sites More sharing options...
Andreik Posted September 24, 2008 Share Posted September 24, 2008 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. Link to comment Share on other sites More sharing options...
gcue Posted September 24, 2008 Author Share Posted September 24, 2008 no dice. have u tried it? i cant see whats going on! grrrr Link to comment Share on other sites More sharing options...
Andreik Posted September 24, 2008 Share Posted September 24, 2008 no dice.have u tried it? i cant see whats going on! grrrrYou 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. Link to comment Share on other sites More sharing options...
gcue Posted September 24, 2008 Author Share Posted September 24, 2008 no i meant test mine i did test urs.. it works =D any other ideas? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now