Jump to content

Embed Images In EXE When Compiling


Go to solution Solved by DW1,

Recommended Posts

It allows you to include a file within your executable like you are asking.  Take a look in the help file at

FileInstall()

For example:

If Not FileExists(@TempDir & '\MySubTempDir') Then DirCreate(@TempDir & '\MySubTempDir')
FileInstall('C:\_Resources\Images\MyImage.jpg', @TempDir & '\MySubTempDir\MyImage.jpg', 1)
Edited by danwilli
Link to comment
Share on other sites

  • Solution

 

I am able to compile; but when running the exe images aren't showing.

I have images in C:Script [where i code]

I want to bring in 1.gif and 2.gif when I compile.

However; I can compile but now 1.gif and 2.gif do not show and C:Scripts [where i am looking for these images] are not showing

Local $b = True
If $b = True Then FileInstall("C:Script1.gif", "C:Scripts1.gif")
Local $c = True
If $c = True Then FileInstall("C:Script2.gif", "C:Scripts2.gif")

You don't need the $b = True, $c = True stuff there at all.  The only reason that is there in the example help file is to make it clear that fileinstall() may be used conditionally.

As for the issue you are having.  Does C:Scripts exist already on the target machine?  If not, create it first.  In the example I gave you above, I first check if the directory I will be placing these files in exists, and if not, I create it.

EDIT: So in your case, you are embedding 1.gif and 2.gif in your executable from "C:Script", and trying to put them in "C:Scripts" on any machine the executable is run on, but you didn't first check to see if "C:Scripts" exists before trying to drop the files there.

If Not FileExists('C:\Scripts') Then DirCreate('C:\Scripts')
FileInstall("C:\Script\1.gif", "C:\Scripts\1.gif")
FileInstall("C:\Script\2.gif", "C:\Scripts\2.gif")
Edited by danwilli
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...