Jump to content

Imbedding Resouces Into Compiled Script?


Recommended Posts

I thought I saw a thread on here about it before, but I can't find it. Basically I'd like to imbed a jpeg I'm using for the GUI background into the exe itself to make it looks more... professional. I know it is possible to do in C++, but it isn't possible to rewrite my script in C++ due to the dynamic variable usage.

Any ideas/suggestions?

Thanx,

-CMR

Link to comment
Share on other sites

I thought I saw a thread on here about it before, but I can't find it. Basically I'd like to imbed a jpeg I'm using for the GUI background into the exe itself to make it looks more... professional. I know it is possible to do in C++, but it isn't possible to rewrite my script in C++ due to the dynamic variable usage.

Any ideas/suggestions?

Thanx,

-CMR

Hi,

what about FileInstall it first before using?

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I'd prefer to have the file imbeded, but if it isn't possible, then so be it. I'd just prefer to have my logo imbedded is all.

-CMR

HI,

hmmh I don't think that is possible, but you can install it via FileInstall with the hidden attribute and when closing you delete it.

Not that what you wanted, but nearby I guess. :think:

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I thought I saw a thread on here about it before, but I can't find it. Basically I'd like to imbed a jpeg I'm using for the GUI background into the exe itself to make it looks more... professional. I know it is possible to do in C++, but it isn't possible to rewrite my script in C++ due to the dynamic variable usage.

Any ideas/suggestions?

Thanx,

-CMR

It's possible and not so much complicated :think: I use it in my project for icons for ListView items but it can be whatever you want (embeded as resource in EXE and simply directly used in script).

Look here at my post Adding "resources" to a compiled script, Better than FileInstall for icons, etc

Link to comment
Share on other sites

It's possible and not so much complicated :think: I use it in my project for icons for ListView items but it can be whatever you want (embeded as resource in EXE and simply directly used in script).

Look here at my post Adding "resources" to a compiled script, Better than FileInstall for icons, etc

Ok, I'm glad it is possible. Can you possibly give a step-by-step method of imbedding:

C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg

Into a simple script:

#include <GUIConstants.au3>

HotKeySet("{ESC}","Quit")

$GUI = GUICreate("Sunset",800,600,0,0,$WS_POPUP,$WS_EX_TOPMOST)
$Pic = GUICreate("Sunset.jpg",0,0,800,600)
GUISetState(@SW_SHOW,$GUI)

While 1
    Sleep(100)
WEnd

Func Quit()
    Exit
EndFunc

I am asking for step-by-step directions for my own ignorance and for those who come across this thread in the future.

Thanx,

CMR

Link to comment
Share on other sites

Ok, I'm glad it is possible. Can you possibly give a step-by-step method of imbedding:

Into a simple script:

I am asking for step-by-step directions for my own ignorance and for those who come across this thread in the future.

Thanx,

CMR

My example is for icons, for JPEG has to be used some other resource type (I don't know which, maybe some of standard types or new one or generic DATA) and probably can't be used directly by GUICtrlSetImage() as for icons to use resource within the script.

Probably there must be used some of API calls to for resources like FindResource, LoadResource, ...

It's described at MSDN: Introduction to Resources

Link to comment
Share on other sites

I've made some progress, I've got the logo imbedded. Now to figure out how to access it...

When I extract all the resources from my new exe, the logo is there (as a bitmap) named "Bitmap_1.bmp", but I cannot access it directly in the script. Now, I would try a DLL Call for LoadBitmap() or LoadImage() in User32.dll, but I'm not sure exactly how to go about it, muchless know if it would work :/

Guess I'll keep trying or just save myself some hassle and rewrite this in C++... somehow..

-CMR

Link to comment
Share on other sites

I've made some progress, I've got the logo imbedded. Now to figure out how to access it...

When I extract all the resources from my new exe, the logo is there (as a bitmap) named "Bitmap_1.bmp", but I cannot access it directly in the script. Now, I would try a DLL Call for LoadBitmap() or LoadImage() in User32.dll, but I'm not sure exactly how to go about it, muchless know if it would work :/

Guess I'll keep trying or just save myself some hassle and rewrite this in C++... somehow..

-CMR

I searched in forum for LoadBitmap and LoadImage and there is lot of stuff to use :think:

Look for example here: Larry's example

It's exactly what we need, only at LoadImage() use LR_LOADFROMRESOURCE instead of LR_LOADFROMFILE.

So princip: Place Picture control on your GUI and this example will draw bitmap obtained by LoadImage on that Picture control.

EDIT: another related great post from Larry Pixel Color in BMP file

Edited by Zedna
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...