Sign in to follow this  
Followers 0
FredrikIdestam

GUI with Image but where is image?

16 posts in this topic

hi friends, i created the following GUI to learn about GUI but on another computer it is not showing image in my GUI. on my pc it is showing the image but on other pc not.

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=F:\Step1.kxf
$Form2 = GUICreate("My First GUI", 408, 207, 212, 214)
$Pic1 = GUICtrlCreatePic("F:\DreamyWorld.jpg", 0, 0, 404, 204)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

do i need to install autoit on other computers if i want to show my image in GUI on other computer?

Share this post


Link to post
Share on other sites



hi friends, i created the following GUI to learn about GUI but on another computer it is not showing image in my GUI. on my pc it is showing the image but on other pc not.

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=F:\Step1.kxf
$Form2 = GUICreate("My First GUI", 408, 207, 212, 214)
$Pic1 = GUICtrlCreatePic("F:\DreamyWorld.jpg", 0, 0, 404, 204)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

do i need to install autoit on other computers if i want to show my image in GUI on other computer?

You have picture in F:\DreamyWorld.jpg?

When the words fail... music speaks

Share this post


Link to post
Share on other sites

And, if you plan on using label, buttons, or etc... be sure to disable the pic

$Pic1 = GUICtrlCreatePic("F:\DreamyWorld.jpg", 0, 0, 404, 204)
GUICtrlSetState( -1, $GUI_DISABLE)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

You have picture in F:\DreamyWorld.jpg?

yes it's there with the same name and path.

And, if you plan on using label, buttons, or etc... be sure to disable the pic

i have posted the full code my first gui have no buttons, labels, etc only a image.

Share this post


Link to post
Share on other sites

try this....

#include <GUIConstants.au3>

Dim $Pic = "F:\DreamyWorld.jpg"

#Region ### START Koda GUI section ### Form=F:\Step1.kxf
$Form2 = GUICreate("My First GUI", 408, 207, 212, 214)
If Not FileExists($Pic) Then MsgBox(0x0, "ERROR", "The picture file could not be found   ", 5)
$Pic1 = GUICtrlCreatePic($Pic, 0, 0, 404, 204)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

on my pc it shows the image but after compiling it and copying to another computer it's not showing any image. only a GUI with nothing.

Share this post


Link to post
Share on other sites

OK... So we fixed one problem, now there is a new problem...

I can help.. one second

8)

#include <GUIConstantsEx.au3>

$Logo_jpg = @TempDir & "\Logo-au3.jpg"
FileInstall("F:\DreamyWorld.jpg", $Logo_jpg)

#Region ### START Koda GUI section ### Form=F:\Step1.kxf
$Form2 = GUICreate("My First GUI", 408, 207, 212, 214)
$Pic1 = GUICtrlCreatePic($Logo_jpg, 0, 0, 404, 204)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#include <GUIConstantsEx.au3>

$Logo_jpg = @TempDir & "\Logo-au3.jpg"
FileInstall("F:\DreamyWorld.jpg", $Logo_jpg)

#Region ### START Koda GUI section ### Form=F:\Step1.kxf
$Form2 = GUICreate("My First GUI", 408, 207, 212, 214)
$Pic1 = GUICtrlCreatePic($Logo_jpg, 0, 0, 404, 204)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

8)

it's working but why should i FileInstall() the image?

is it necessary everytime using images in GUI?

Share this post


Link to post
Share on other sites

it's working but why should i FileInstall() the image?

is it necessary everytime using images in GUI?

Yes, it is a part of the program and has to be "included" because your friend nor anyone else has that same picture in the same exact location as you do.

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Yes, it is a part of the program and has to be "included" because your friend nor anyone else has that same picture in the same exact location as you do.

can i include the images in exe and always use them without installing on user's computer?

Edited by FredrikIdestam

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

The way I should you IS how you "include" them. That is the best way AFAIK. Remember that the pic can be erased on autoit exit too.

... I can say that there might be a way to change the pic to data and then "include" it as a file. you will have to look for that UDF in the Example Scripts area.

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Look at my UDF:

Add and use binary data to/from resources

UDF - embed/use any data/files into/from AutoIt compiled EXE files

http://www.autoitscript.com/forum/index.php?showtopic=51103

thanks. can u give me a example of using your UDF with my code which i have posted in this thread. i tried your UDF but it was complex for me.

Share this post


Link to post
Share on other sites

thanks. can u give me a example of using your UDF with my code which i have posted in this thread. i tried your UDF but it was complex for me.

#AutoIt3Wrapper_useupx=n
#AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, DreamyWorld.jpg, rcdata, JPG_1, 0
#AutoIt3Wrapper_run_after=upx.exe --best --compress-resources=0 "%out%"

#include <GUIConstants.au3>
#include "resources.au3"

$Form2 = GUICreate("My First GUI", 408, 207, 212, 214)
$Pic1 = GUICtrlCreatePic("", 0, 0, 404, 204)
_ResourceSetImageToCtrl($pic1, "JPG_1")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

#AutoIt3Wrapper_useupx=n
#AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, DreamyWorld.jpg, rcdata, JPG_1, 0
#AutoIt3Wrapper_run_after=upx.exe --best --compress-resources=0 "%out%"

#include <GUIConstants.au3>
#include "resources.au3"

$Form2 = GUICreate("My First GUI", 408, 207, 212, 214)
$Pic1 = GUICtrlCreatePic("", 0, 0, 404, 204)
_ResourceSetImageToCtrl($pic1, "JPG_1")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
do i need to place my images in the same directory where the au3 is?

any extra tools needed for this or it will work fine after compiling as normal au3 files?

thanks for the information and help.

Share this post


Link to post
Share on other sites

do i need to place my images in the same directory where the au3 is?

Yes. but only at COMPILE time. At runtime you need only output EXE file.

do i need to place my images in the same directory where the au3 is?

any extra tools needed for this or it will work fine after compiling as normal au3 files?

thanks for the information and help.

All is described in my UDF post - just read it!

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