mlelias@miavx1.acs.muohio.edu (Mike Elias (Mighty Amigo) Systems Analysis) (07/10/90)
Hi all,
I am a new C programmer using Lattice 5.04, and of course I have a
question. I would like to be able to start a program via Icon without that
WBench window popping up. To be more specific, I would like to close the
WorkBench Screen. Using Abacus's _C for Advanced Programmers_, I was able
to write the source, compile and (b)link. No problem, but nothing happens
when I run it. I don't have any shell's running, or any other processes
which might write to the Screen, just the bare minimum, Intuition. Regardless
of wether or not I can get the WBench to close, I would *still* like to lose
that &#%$^@!&$ window. :)
Can anyone help? BTW, I have included the source just in
case I goofed it.
Thanx
___________________________________________________________________________
# include <workbench/startup.h>
# include <workbench/workbench.h> /* don't think I need this, do I? */
# include <exec/types.h>
# include <intuition/intuition.h>
struct IntuitionBase *IntuitionBase;
struct Screen *FirstScreen;
struct Window *FirstWindow;
struct IntuiMessage *message;
struct NewScreen NewScreenStructure = {
0,0, /* screen XY origin relative to View */
640,200, /* screen width and height */
1, /* screen depth (number of bitplanes) */
0,1, /* detail and block pens */
HIRES, /* display modes for this screen */
CUSTOMSCREEN, /* screen type */
NULL, /* pointer to default screen font */
"Screen Test", /* screen title */
NULL, /* first in list of custom screen gadgets */
NULL /* pointer to custom BitMap structure */
};
#define NEWSCREENSTRUCTURE NewScreenStructure
USHORT Palette[] = {
0x0356, /* color #0 */
0x0FFF /* color #1 */
#define PaletteColorCount 2
};
#define PALETTE Palette
struct NewWindow NewWindowStructure1 = {
160,50, /* window XY origin relative to TopLeft of screen */
320,150, /* window width and height */
0,1, /* detail and block pens */
CLOSEWINDOW, /* IDCMP flags */
WINDOWSIZING+WINDOWDRAG+WINDOWDEPTH+WINDOWCLOSE+SMART_REFRESH, /* other window flags */
NULL, /* first gadget in gadget list */
NULL, /* custom CHECKMARK imagery */
"Test Custom-Screen", /* window title */
NULL, /* custom screen pointer */
NULL, /* custom bitmap */
100,50, /* minimum width and height */
-1,-1, /* maximum width and height */
CUSTOMSCREEN /* destination screen type */
};
/* end of PowerWindows source generation */
void main()
{
Open_All();
CloseWorkBench();
Delay(360L);
OpenWorkBench();
Delay(180L);
Close_All();
exit(TRUE);
}
Open_All()
{
LONG OpenLibrary();
struct Window *OpenWindow();
struct Screen *OpenScreen();
if(!(IntuitionBase = (struct IntuitionBase *)
OpenLibrary("intuition.library", 0)))
{
printf("Cannot open Intuition Library.\n");
exit(FALSE);
}
if(!(FirstScreen = (struct Screen *)
OpenScreen(&NewScreenStructure)))
{
printf("Cannot open screen.\n");
Close_All();
exit(FALSE);
}
NewWindowStructure1.Screen = FirstScreen;
if(!(FirstWindow = (struct Window *)
OpenWindow(&NewWindowStructure1)))
{
printf("Cannot open window.\n");
Close_All();
exit(FALSE);
}
return(NULL);
}
Close_All()
{
if(FirstWindow) CloseWindow(FirstWindow);
if(FirstScreen) CloseScreen(FirstScreen);
if(IntuitionBase) CloseLibrary(IntuitionBase);
return(NULL);
}
___________________________________________________________________________
--
---------------------------------------------------------------------------
When things are blackest, I just tell | Mlelias@Miavx1.Bitnet
myself 'cheer' up, things could be worse!'| Oxford, Oh
And sure enough, they get worse! | Miami University
------------------------------------------| Mike Elias
---------------------------------------------------------------------------cmcmanis@stpeter.Eng.Sun.COM (Chuck McManis) (07/11/90)
In article <1699.26992863@miavx1.acs.muohio.edu> (Mike Elias (Mighty Amigo) Systems Analysis) writes: > ... Regardless of wether[sic] or not I can get the WBench to close, I > would *still* like to lose that &#%$^@!&$ window. :) You must close all windows on the Workbench and the console window you are swearing about above is the culprit I suspect. You need a recompiled _main.o which doesn't open the window for you. Go into the lc/Sources directory where the source to _main.c lives, recompile it with the -DTINY flag option and then copy the .o file to lib: then you can blink with Blink Lib:_main.o+your.o to test lib lib:lc.lib+lib:amiga.lib And that should do the trick for you. -- --Chuck McManis Sun Microsystems uucp: {anywhere}!sun!cmcmanis BIX: <none> Internet: cmcmanis@Eng.Sun.COM These opinions are my own and no one elses, but you knew that didn't you. "I tell you this parrot is bleeding deceased!"