Jump to content

Image Help!


Recommended Posts

I need help embedding bitmap images into a compiled script, so that my program is only one file, and not five (the script and 4 bitmaps). I am completely new to Autoit and this forum, so forgive me if I have not included enough detail, or posted wrong, or something...

Link to comment
Share on other sites

#include <GuiConstants.au3>

FileInstall('C:\FullPath_ToFile\smile.jpg', @ScriptDir)

Dim $hGUI = GUICreate('Test', 200, 200)
Dim $Pic = GUICtrlCreatePic(@ScriptDir & '\smile.jpg', 0, 0)

GUISetState()

Do
    Sleep(20)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()

Change the file path and name, read the help file it must be a literal string (no interpolation of @macro or variables). Compile and test.

Link to comment
Share on other sites

#include <GuiConstants.au3>

FileInstall('C:\FullPath_ToFile\smile.jpg', @ScriptDir)

Dim $hGUI = GUICreate('Test', 200, 200)
Dim $Pic = GUICtrlCreatePic(@ScriptDir & '\smile.jpg', 0, 0)

GUISetState()

Do
    Sleep(20)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()

Change the file path and name, read the help file it must be a literal string (no interpolation of @macro or variables). Compile and test.

Do I need the "Dim", or can I just use this:

GUICtrlCreatePic(@ScriptDir & '\smile.jpg', 0, 0)

Link to comment
Share on other sites

you need the variables if you want to recall functions to that control.. but DIM not unless you have OPT('MustDeclareAllVars',1)

Link to comment
Share on other sites

So than why does the below script not show an image:

#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <TabConstants.au3>
FileInstall('C:\image.bmp', @ScriptDir)
Dim $hGUI = GuiCreate("Test", 300, 300,Default,Default,-1,$WS_EX_TOOLWINDOW)
GUISetState(@SW_SHOW)
sleep(50)
GuiCtrlCreateTab(2,2,297,397)
GuiCtrlCreateTabItem("Legend")
Dim $Pic = GuiCtrlCreatePic(@ScriptDir & '\image.bmp',20,20,220,280)
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd
Exit
Link to comment
Share on other sites

put GUISETSTATE() beneath everything but above the While

EDIT here try this

#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <TabConstants.au3>
FileInstall('C:\image.bmp', @ScriptDir & '\Image.bmp')
Dim $hGUI = GuiCreate("Test", 300, 300,Default,Default,-1,$WS_EX_TOOLWINDOW)
sleep(50)
GuiCtrlCreateTab(2,2,297,397)
GuiCtrlCreateTabItem("Legend")
$Pic = GuiCtrlCreatePic(@ScriptDir & '\image.bmp',20,20,220,280)
GUISetState(@SW_SHOW)

While 1
$m=Guigetmsg()
if $m=$GUI_EVENT_CLOSE then exit
WEnd
Edited by CodyBarrett
Link to comment
Share on other sites

yeah cause it looked like you werent even extracting the file... try having a file name in the dest.. like i posted

Link to comment
Share on other sites

autoit helpfile>Autoit>Marco Reference

@TempDir

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