Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Launching a Squeak application
Last updated at 4:41 pm UTC on 7 November 2006
[Newbies] Re: self executable with squeak

Bert Freudenberg
Wed, 07 Jun 2006 05:27:11 -0700
We save an image with our main application window already opened, and
unwanted things disabled (halos, alt-., menus, etc). Additionally, we
have a class-side #startUp: method to initialize what's necessary on
startup, like re-reading config files etc.

The image is started automatically when double-clicking "plopp.exe",
or rather a short-cut in the program menu placed there by the installer.
This exe is nothing more than a renamed Squeak.exe, with a different icon
patched in using a resource editor. There is a VM config file "plopp.ini",
which most importantly contains the path to the image to load (see
Win32 Ini File Settings).

The exe along with the needed plugins, the image and other data files is
installed in the "programs" directory by a regular Windows installer
(InstallShield).

It's really not too different from other applications, which nowadays also
consist of an executable and several additional files. That the actual
application logic in Squeak's case is not contained in the executable but
in a "data file" is of no concern to the end user.

Note that this is an FAQ item (FAQ: Distributing Squeak Programs).
Feel free to put my explanation on the Swiki, I haven't checked carefully
if a similar answer is already there.

- Bert -

Am 07.06.2006 um 11:47 schrieb Elod Kironsky:

Nice, but I was curious more about the process how to transfrom a
Squeak package to an out-of-the-box program. Of course only, if it is not
an industrial secret ;-)

Elod

Hi Elod,

Planet Plopp was made by impara (http://www.impara.de). Bert was
one of the developers. I saw a little bit from the production of
this program. Very impressive how these
guys working with squeak.
Cheers,
Frank

——– Original Message ——–

Subject: Re: [Newbies] Re: self executable with squeak (07- Jun-2006 10:55)

From: Elod Kironsky <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]

Klaus D. Witzel wrote:

Hi Benjamin,

on Wed, 07 Jun 2006 07:48:52 +0200, you wrote:

hello,

I apologize if this question has already been posted,
but i did not find it. i wanted to know if it is possible
to make a self executable file with a squeak package or
more packages. Just so that someone can use it without using
squeak or even without having it. I heard about stripers what
is it and how does it work?

Have a look at http://www.amazon.de/exec/obidos/ASIN/3898353664
(sorry, only in German). This is a Squeak application which runs
out of the box.

Interesting. May I ask you, how did you make that program?

Elod

Deploying Squeak applications
Mikael Kindborg Jul 13

Hi,

We are developing a software product for children we call "Magic
Words" and these are our experiences from experimenting with a
deployment version for WIndows.

We have found it useful to use a tiny laucher exe.

The problem we have had with the approach that Bert describes in the
page referred to below is that it takes quite a while for the
application to launch. We tried different variations for the ImageFile
parameter in the ini-file, but even when using the full pathname it
takes 15 seconds on my machine to start the app. (The parameters I
refer to are on this page, which is already pointed to by Bert's
message: Win32 Ini File Settings)

As I recall, this problem have been discussed previously on the list,
and is related to how the virtual machine searches for image files at
startup and some quirks with a Windows API call involved in this. Hot
having investigated the detail about this (perhaps it can be fixed),
we wrote a tiny C program that simply starts Squeak with the image
file that contains our app as an argument. Using this method the app
launches in 1 second.

Here is the source for the launcher app:
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

void LaunchSqueak(void);

int PASCAL WinMain( HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline,
                   int cmdshow )
{
   // shut up warning
   previnst = previnst;
   cmdline = cmdline;

   LaunchSqueak();

   return(0);
}

void LaunchSqueak()
{
   BOOL success;
   LPSTARTUPINFO sinfo;
   LPPROCESS_INFORMATION pinfo;
   LPSTR dir;
   LPSTR wdir;
   LPSTR command;

   // Startup info - no settings are used.

   sinfo = malloc (sizeof(STARTUPINFO));
   sinfo->cb = sizeof(STARTUPINFO);
   sinfo->lpReserved = (LPTSTR) NULL;
   sinfo->lpDesktop = (LPTSTR) NULL;
   sinfo->lpTitle = (LPTSTR) NULL;
   sinfo->dwX = (DWORD) NULL;
   sinfo->dwY = (DWORD) NULL;
   sinfo->dwXSize = (DWORD) NULL;
   sinfo->dwYSize = (DWORD) NULL;
   sinfo->dwXCountChars = (DWORD) NULL;
   sinfo->dwYCountChars = (DWORD) NULL;
   sinfo->dwFillAttribute = (DWORD) NULL;
   sinfo->dwFlags = (DWORD) NULL;
   sinfo->wShowWindow = 0;
   sinfo->cbReserved2 = 0;
   sinfo->lpReserved2 = NULL;
   sinfo->hStdInput = (HANDLE) NULL;
   sinfo->hStdOutput = (HANDLE) NULL;
   sinfo->hStdError = (HANDLE) NULL;

   // Returned process info - not used.

   pinfo = malloc(sizeof(PROCESS_INFORMATION));

   // Get current directory.

   dir = malloc(1000);
   GetCurrentDirectory(1000, dir);

   // Set working directory.

   wdir = malloc(1000);
   strcpy(wdir, dir);
   strcat(wdir, "\\Data");

   // Set command string.

   command = malloc(1000);
   strcpy(command, dir);
   strcat(command, "\\Data\\Squeak.exe App.image");
   //strcpy(command, dir);
   //strcat(command, "\\Data\\App.image");

   // Create the Squeak process.

   success = CreateProcess
       (
       NULL,           //LPCTSTR lpApplicationName,
       command,        //LPTSTR lpCommandLine,
       NULL,           //LPSECURITY_ATTRIBUTES lpProcessAttributes,
       NULL,           //LPSECURITY_ATTRIBUTES lpThreadAttributes,
       FALSE,          //BOOL bInheritHandles,
       (DWORD) NULL,   //DWORD dwCreationFlags, ?? CREATE_NO_WINDOW Should we use this flag? Apparently not needed.
       NULL,           //LPVOID lpEnvironment,
       wdir,           //LPCTSTR lpCurrentDirectory,
       sinfo,          //LPSTARTUPINFO lpStartupInfo,
       pinfo           //LPPROCESS_INFORMATION lpProcessInformation
       );

   success = success;  // You can remove this, it was just to get a place for a breakpoint for debugging.
}

We simply hardcoded the name of the application image and the
directory it is placed in. A bit ugly but seems to work. The following
is the directory layout:
AppDir (name of your program's directory)
 App.exe (name of the app's exe-file)
 Data
   App.image
   Squeak.exe (and related files you need)

We built this using the Open Watcom compiler.

Tried some of the ini options mention on Win32 Ini File Settings
and WindowTitle works fine, but the options related to the Quit dialog
box did not work. The dialog always shows, with the standard text.
Here is the ini-file I used for testing, perhaps I got something
wrong:
[Global]
DeferUpdate=1
ShowConsole=0
DynamicConsole=1
ReduceCPUUsage=1
ReduceCPUInBackground=1
3ButtonMouse=0
1ButtonMouse=0
UseDirectSound=0
PriorityBoost=1
B3DXUsesOpenGL=0
CaseSensitiveFileMode=0
WindowTitle="Magic Words"
ImageFile="C:\Documents and
Settings\Mikael\Skrivbord\MagicWords\MagicWordsDev.image"
EnableAltF4Quit=0
QuitDialogMessage="Do you want to quit Magic Words?"
QuitDialogLabel="Magic Words"

To sum up, I think the deployment method we have used works very well,
and with a good installer installation is smooth. It is also easy to
put the program in a zip file and deploy it that way, or make a CD
with auto start.

I guess Mac and Linux also could use a simple start script to launch
Squeak with the desired image.

Regarding making a single exe, that would be nice for small
applications, but as Bert writes in this message, most programs need
additional files and various directories for application data etc.

Best regards, Micke

On 7/13/06, Klaus D. Witzel wrote:
> Have a look at what Bert wrote recently in
>
> -
> http://www.mail-archive.com/beginners@lists.squeakfoundation.org/msg00330.html
>
> /Klaus
>
> On Thu, 13 Jul 2006 09:25:49 +0200, Dan Shafer wrote:
>
> > Can someone give me or point me to a succinct status update on the
> > current state of the ability to convert a Squeak image into a standalone
> > application for WIndows, OSX and Linux? I know we can always deliver an
> > image and a VM without sources and effectively create the appearance of
> > a standalone but those suckers are huge, so my client is asking if the
> > prospects for being able to deliver stripped-down and double-clickable
> > apps is in the offing or in the distance.
> >
> > Thanks.
> > Dan
> >
> >