Thread: Help Learning
View Single Post
Old 29 April 2020, 19:58   #3
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 50
Posts: 579
Don't know about hisoftC but sas has the system's library calls defined in proto/ folder in includes.

So, if you want to use Exec's OpenLibrary, CloseLibrary etc you
#include <proto/exec.h>

If you want to use Intuition's OpenWindow, CloseWindow you
#include <proto/intuition.h>

Also, if you want to wait for some time, you can use Dos' Delay and you
#include <proto/dos.h>

So, here is the altered source with some notes within. Tested with SasC.
Code:
#include <exec/types.h>
#include <intuition/intuition.h>

#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/dos.h>

/* These are defined in proto/intuition.h  and proto/exec.h*/
/*
extern struct window *OpenWindow();
extern long *OpenLibrary();
*/
struct IntuitionBase *IntuitionBase;

#define INTUITION_REV 0

main()
{
	struct NewWindow NewWindow;
	struct Window *Window;
	long i ;

	IntuitionBase = ( struct IntuitionBase * ) OpenLibrary( "intuition.library" , INTUITION_REV );

	if ( IntuitionBase == NULL )  
		exit ( FALSE ) ; 

	NewWindow.LeftEdge	=20;
	NewWindow.TopEdge	=20;
	NewWindow.Width		=200;
	NewWindow.Height		=80;
	NewWindow.DetailPen	=0;
	NewWindow.BlockPen	=0;
	NewWindow.IDCMPFlags	= NULL;
	NewWindow.Flags		= SMART_REFRESH | ACTIVATE | WINDOWSIZING | WINDOWDRAG | WINDOWDEPTH | NOCAREREFRESH;
	NewWindow.FirstGadget = NULL;
	NewWindow.CheckMark	=  NULL;
	NewWindow.Title		= (UBYTE *)"The User Window";
	NewWindow.Screen		= NULL;
	NewWindow.BitMap		= NULL;
	NewWindow.MinWidth 	=80;
	NewWindow.MinHeight	=25;
	NewWindow.MaxWidth	=640;
	NewWindow.MaxHeight	=200;
	NewWindow.Type		=WBENCHSCREEN; 

	if (( Window = OpenWindow (&NewWindow)) == NULL) 
	 exit (FALSE);
	/* If we exit above, we leave intuition library open */

	/* horrible busy wait loop */
	/* Also with typo 1<800000 makes it infinite*/
	/* Probably meant as i<800000 */
	/*for(i =0; 1<800000; i++);*/

	/* let's just wait properly for 10 secs */
	Delay(50*10);
	
	CloseWindow (Window);
	CloseLibrary (IntuitionBase);
	exit (TRUE);
}
alkis is offline  
 
Page generated in 0.04327 seconds with 11 queries