To compile Viewdesk form ViewMax 3 (Beta) Panther you need the following
things. VIEWDESK.ZIP, VIEWICON.ZIP, BCC 3.0, RASM86 and TLINK.
If you want to use BCC 3.1 or higher some other modifications are needed.
Look at the section with the title BCC3.1 of this mail if you want to know.
The other patches and the file COMP.BAT must not be changed.

Also you need  VIEWMAX.INI and GENERIC.ICF.A Viewmax.ini file you find at
the end of this mail.
GENERIC.ICF is a normal ICO file which is used for all files where no icon
is already defined for. You can simple copy GENERIC.ICO to GENERIC.ICF but
this would make identifiy executable files harder.Simply paint with an
a Program a Windows ICON with 16 colors and rename it to GENERIC.ICF.
But look first one of the original ICO so that the size is correct.

The compiled file will work und GEM/3 and FreeGEM. But icons can only be
viewed under FreeGEM AES because of 2 calls wich are not included in GEM/3
but are included in FreeGEM AES.
The calls are:
     xgrf_colour
     xgrf_dtmfdb


To compile you need the COMP.BAT script which you find at the end of this
mail.

Before you can compile there are some modifications to make.
1. Set the pathes to your compilers correct in file COMP.BAT
2. Insert the following patches
The ready compiled file is called DESK.APP

If you have additonal questions write to me:
Heinz Rath. (hans.rath@vpn.at)

------------------------PATCHES-------------------------------------------

In File DESKCICN.C
Line number 1.
#define USE_ASM 1
Must be changed so that it looks like this
#define USE_ASM 0

In File DESKINIT.C in routine: WORD init (void).
This patch is needed cause when this wind_open is called GEM and
FreeGem crashes.
Line number 475.
 wind_open( ROOT, 0, 0, gl_width, gl_height ) ;
Must be excluded so that it looks like this
// wind_open( ROOT, 0, 0, gl_width, gl_height ) ;

In File DESKTREE.C in routine: WORD tree_open( PNODE far * thepath, BOOLEAN end_draw)
This patch is needed cause on my system it sometimes happened that the
desk wanted to set drive number -65 (This makes a crash).
Line number 634,635.
    drv = thepath->p_spec[0]-'A';
    dos_sdrv(drv);

Must be changed so that it looks like this
    drv = thepath->p_spec[0]-'A';
    if (drv<0) drv=0; 
    dos_sdrv(drv);

***********************************************************************
If you want you can also make the following patches but they are not
necessary to get a running Desk. The only makes desk usefuller.

If you want to use Desk as a desktop under FreeGEM you also would like to
can start GEM programs. In original GEM.BAT is used. This patch corrects this.

In File DESKAPP.C in routine:  MLOCAL void initAppList( void )
Line number 390.
    pa->a_match = "*.EXE,*.BAT,*.COM" ;
Must be changed so that it looks like this
    pa->a_match = "*.EXE,*.BAT,*.COM,*.APP" ;

In File DESKINF.C
Line number 896
Function: WORD opn_appl(papname, papparms, pcmd, ptail, isgemapp)
Must be removed. An insert the following routine.
WORD opn_appl(papname, papparms, pcmd, ptail, isgemapp)
	BYTE		*papname, *papparms;
	BYTE		*pcmd, *ptail;
	WORD		*isgemapp;
{
        char            extend[4];
	TREE		tree;
	BYTE		popath[60];
	BYTE		poname[LEN_ZFNAME+LEN_PASSW];
	WORD		n;
	
	if( papname == 0 ){	/* Get an app name for a document */
	  rsrc_gaddr( R_TREE, ADEXEC, &tree ) ;
#if HELP_ALERTS    
	  inf_show(tree, EXECPROG, HOPENFIL, TRUE );
#else /* HELP_ALERTS */
	  inf_show(tree, EXECPROG, TRUE );
#endif /* HELP_ALERTS */
					/* now find out what happened	*/
	  if ( inf_what(tree, EXECOK, EXECCANC) )
	  {
	    tedinfo_get(tree, EXECPATH, (BYTE far *)popath);
	    tedinfo_get(tree, EXECPROG, (BYTE far *)poname);
	    if( popath[0]!='@' ){
/*??	      unfmt_str(popath, pcmd );
*/
	      strcpy(pcmd, popath);
	      if( *pcmd && pcmd[strlen(pcmd)-1] != '\\' )
	        strcat(pcmd ,  "\\" );
	    }  
	    else
	      *pcmd = 0;
	    if ( !strcmp( &poname[8],"APP" ) )
		    *isgemapp = TRUE;
	    else
		    isgemapp = FALSE;
	    unfmt_str(poname, pcmd+(strlen(pcmd)) );
	    for( n=0 ; pcmd[n]!='.' && pcmd[n] ; n++ );
	    if( !pcmd[n] ) 
	      strcpy(&pcmd[n] ,  ".EXE" );
	    return(TRUE);
	   }
       }
	else{		/* Get a document for an app */
        extend[0]=papname[strlen(papname)-3];
        extend[1]=papname[strlen(papname)-2];
        extend[2]=papname[strlen(papname)-1];
        extend[3]='\0';

          if ( strcmp( extend,"APP" )!=0 )
          {
	  rsrc_gaddr( R_TREE, ADOPENAP, &tree ) ;
	  fmt_str(papname, poname);
	  passw_strip( (LONG)(char far *)poname );
	  tedinfo_set(tree, APPLNAME, (BYTE far *)poname);
	  tedinfo_set(tree, APPLPARM, (BYTE far *)papparms);
#if HELP_ALERTS    
	  inf_show(tree, APPLPARM, HOPENAPP, TRUE );
#else /* HELP_ALERTS */
	  inf_show(tree, APPLPARM, TRUE );
#endif /* HELP_ALERTS */
					/* now find out what happened	*/
	  if ( inf_what(tree, APPLOK, APPLCNCL) )
	  {
/*	    tedinfo_get(tree, APPLNAME, (BYTE far *)poname);
	    unfmt_str(poname, pcmd);*/
	    strcpy( pcmd ,  papname );
	    tedinfo_get(tree, APPLPARM, (BYTE far *)ptail);
	    return(TRUE);
	  }
          }
          else
          {
            strcpy(pcmd,papname);
            return(TRUE);
          }
        }
	return( FALSE );
	
} /* opn_appl() */

In File DESKSUPP.C
Line number 525
Function: MLOCAL  WORD do_aopen(pa, isapp, drv, p_path, p_name)
Must be removed. An insert the following routine.
MLOCAL	WORD do_aopen(pa, isapp, drv, p_path, p_name)
	ANODE		*pa;
	WORD		isapp;
	WORD		drv;
	BYTE		*p_path;
	BYTE far	*p_name;
{
	WORD		ret, n;
	WORD		isgraf, isover, isparm, uninstalled, isgem;
	BYTE		*ptmp, *pcmd, *ptail;
	BYTE		name[LEN_ZPATH];
	BYTE		temp1[LEN_ZPATH], temp2[LEN_ZPATH];
	BYTE		*pname,*ppath;
	WORD		cnt = 0;
        char            extend[4];

						/* set flags		*/
	pname = temp1;
	ppath = temp2;
	fstrcpy((BYTE far *)pname, p_name);
				/* Filter spaces from ends of passws */
	for( n=0 ; *(p_path+n) ; n++ )	
		if( *(p_path+n)!=' ' ) *ppath++ = *(p_path+n);
	*ppath = 0;
	ppath = temp2;
	
	isgraf = FALSE /* pa->a_flags & AF_ISGEM */;
	isover = 2;	/* Always full step aside */
	isparm = pa->a_flags & AF_ISPARM;

	uninstalled = !is_installed( pa ) ;
						/* change current dir.	*/
						/*   to selected icon's	*/
	pro_chdir(drv, ppath);
	do
	{				/* Try to open for writing */
		dos_func( 0x3d01, (LONG)(BYTE far *)pname );
	  if( DOS_ERR && DOS_AX == 0x56 )
	  {				/* Passw error ? */
		  passw_strip( (LONG)(BYTE far *)pname );
		  ret=passw_ferror( (BYTE far *)pname, cnt++ );
	  }	/* If so get the password */
	}while( ret && (DOS_ERR && DOS_AX == 0x56) );

	if( DOS_ERR && DOS_AX==0x56 ) return( FALSE );
	if( !DOS_ERR ) dos_close( DOS_AX );
						/* see if application	*/
						/*   was selected 	*/
						/*   directly or a 	*/
						/*   data file with an	*/
	pcmd = pname;				/*   associated primary	*/
	ptail = (BYTE *)NULL;
	G.g_cmd[0] = G.g_tail[1] = NULL;
	ret = TRUE;

        if ( wildcmp( ini_str(STGEMBAT), pcmd) || isgraf )
	{
		G.g_1text[0] = NULL;
		if( isgraf )
		{			/* GEM app or file */
			if( !isapp )
			{		/* Copy document name/path to  */
					/* command tail */
				do_cmdtail( ppath, pname, G.g_1text, drv ); 
				pcmd = pa->a_match;
			}
			if ( !use_gem( name, ppath, pname, pcmd, &drv, isapp ) )
				return( FALSE );

#if 0
			if( isapp )	/* App only */
				do_cmdtail( ppath,"",&name[strlen(name)],drv);
			*ppath=0;
			ptmp = &name[strlen(name)];
			pname = pcmd;
			while ( *pname != '.' )
				*ptmp++ = *pname++;
			*ptmp = NULL;
#endif /* 0 */
		}
		else
		{	/* For batch files */
			strcpy( name, pname );
			for( ptmp=pname ; *ptmp!=';' && *ptmp ; ptmp++ );
			*ptmp = NULL;
			if( uninstalled || isparm )
			{
				if( !opn_appl(pname, "\0", pname, G.g_1text, &isgem) )
					return( FALSE );
			}
		}
		if( pro_cmd( name, G.g_1text, drv, ppath, TRUE) )
		{
                        return( pro_run( isgraf,isover ) );
		}
		else
			return( FALSE );
	} /* if */

	if( (!uninstalled) && (!isapp) )
	{					/* Program is app icon */
		strcpy( G.g_cmd, pa->a_match );
		strcpy( G.g_1text, pname );	/* Parameter is data icon */
		do_cmdtail( ppath,G.g_1text,&G.g_tail[1],drv );
		if ( wildcmp( ini_str(STGEMBAT), pa->a_match) )
		{
			strcpy( G.g_1text, &G.g_tail[1] );
			strcpy( name , pa->a_match );
			*ppath = 0;
			if ( !shel_find( (LONG)(BYTE far *)name ) ||
			     !pro_cmd(name, G.g_1text,
				(name[1]==':')? name[0] : drv, ppath, TRUE) )
				return( FALSE );
		}
                return( pro_run( 0,isover ) );
	}

	if ( isapp )			/* DOS-based app. has	*/
	{
		pcmd = G.g_cmd;
		ptail = &G.g_tail[1];
		if (isparm)		/*   been selected	*/
		{
			if( opn_appl(pname, "\0", pcmd, ptail, &isgem) )
			{
 extend[0]=pname[strlen(pname)-3];
 extend[1]=pname[strlen(pname)-2];
 extend[2]=pname[strlen(pname)-1];
 extend[3]='\0';
                                
                                if (strcmp(extend,"APP")==0)
                                {
                                  return( pro_run( 1, 1 ) );
                                }
                                 else
                                 {
                                   return (pro_run(0,isover));
                                 }
			}
			else
				return( FALSE );
		}
		else
		{
			strcpy(pcmd ,  pname );
                        return( pro_run( 0,isover ) );
		}
	} /* if isapp */
	else					/* DOS-based document 	*/
	{
		pcmd = G.g_cmd;	  	/*   has been selected	*/
		if( opn_appl(0, "\0", pcmd, ptail, &isgem) )
		{
			do_cmdtail( ppath, pname, G.g_1text, drv );
			if ( !strcmp( &pcmd[strlen(pcmd)-3], "BAT" ) )
			{
				strcpy( name, pcmd );
				*ppath = 0;
				if ( !pro_cmd( name, G.g_1text,
			 	  (name[1]==':')? name[0] : drv, ppath, TRUE) )
					return( FALSE );
			}
			else
			if (isgem)
			{
				if (use_gem( name, ppath, pname, pcmd, &drv, FALSE ))
				{
					if( !pro_cmd( name, G.g_1text, drv, 
						ppath, TRUE) )
						return FALSE;
				}
				else	return( FALSE );
			}
			else	strcpy( &G.g_tail[1], G.g_1text );
                        return( pro_run( isgem ? 2 : 0, isover ) );

		}
		else
			return( FALSE );
	} /* else */

} /* do_aopen */

-----------------------BCC3.1----------------------------------------
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!ONLY FOR BCC 3.1 AND HIGHER !!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The following things must be done to get the files to correct compile
under BCC3.1 and higher.

If you compile you will get error messages. The errors are all the same.
There are different error message but this is what doesn't work correct.
BCC3.0 says that the following code is right
/*
   int l
   /* djfkasjf */
*/
but BCC3.1 says error so change that in a way like this
/*
   int l
   // djfkasjf 
*/
and every thing is alright to compile. This errors are in the following
files.
VIEWAPPS.H
DESKINF.C
DESKSUPP.C
DANUTIL.C
DESKDIR.C
DESKFPD.C
DESKFUN.C
DESKMAIN.C
DESKPASS.C
DESKPRO.C
DESKTREE.C
DESKTYPE.C
DESKWIN.C
GEMBIND.C
GEMDOS.C
INIFILES.C

-----------------------COMP.BAT----------------------------------------
@echo off
SET LIB=i:\tools\lib
SET INC=i:\tools\include
SET BC=i:\tools\bcc.exe
SET rasm=i:\tools\rasm86.exe
SET link=i:\tools\tlink.exe

echo %lib%\c0m.obj+>desk.
echo DESKSTAR.OBJ+ >>desk.
echo DESKMAIN.OBJ+ >>desk.
echo DESKSUPP.OBJ+ >>desk.
echo DESKRSRC.OBJ+ >>desk.
echo DESKAPP.OBJ + >>desk.
echo DESKACT.OBJ + >>desk.
echo DESKFUN.OBJ + >>desk.
echo DESKDIR.OBJ + >>desk.
echo DESKINF.OBJ + >>desk.
echo DESKINS.OBJ + >>desk.
echo DESKWIN.OBJ + >>desk.
echo DESKOBJ.OBJ + >>desk.
echo DESKFPD.OBJ + >>desk.
echo DESKPRO.OBJ + >>desk.
echo DESKGRAF.OBJ+ >>desk.
echo DESKGSX.OBJ + >>desk.
echo GSX2.OBJ    + >>desk.
echo GEMBIND.OBJ + >>desk.
echo GEMDOS.OBJ  + >>desk.
echo OPTIMIZE.OBJ+ >>desk.
echo LONGASM.OBJ + >>desk.
echo DESKOSIF.OBJ+ >>desk.
echo OPTIMOPT.OBJ+ >>desk.
echo DESKGLOB.OBJ+ >>desk.
echo DESKCICN.OBJ+ >>desk.
echo BUTTON.OBJ  + >>desk.
echo DANUTIL.OBJ + >>desk.
echo DESKBKGD.OBJ+ >>desk.
echo DESKCET.OBJ + >>desk.
echo DESKINIT.OBJ+ >>desk.
echo DESKPASS.OBJ+ >>desk.
echo DESKCLRS.OBJ+ >>desk.
echo DESKPGRP.OBJ+ >>desk.
echo DESKSCSV.OBJ+ >>desk.
echo DESKTMAX.OBJ+ >>desk.
echo DESKTREE.OBJ+ >>desk.
echo DESKTYPE.OBJ+ >>desk.
echo EMS.OBJ     + >>desk.
echo EXFORMDO.OBJ+ >>desk.
echo EXOBJ.OBJ   + >>desk.
echo FNDEXOBJ.OBJ+ >>desk.
echo FNDEXPNT.OBJ+ >>desk.
echo FRUNTIME.OBJ+ >>desk.
echo INIFILES.OBJ+ >>desk.
echo LIST.OBJ    + >>desk.
echo LISTBOX.OBJ + >>desk.
echo LISTEXOB.OBJ+ >>desk.
echo MEMYMAN.OBJ + >>desk.
echo PARSESTR.OBJ+ >>desk.
echo RADIO.OBJ   + >>desk.
echo SLIDER.OBJ  + >>desk.
echo SLIDTRAN.OBJ+ >>desk.
echo TRNSRSC.OBJ + >>desk.
echo UTIL.OBJ    + >>desk.
echo VALUEBOX.OBJ+ >>desk.
echo VIEWAPPS.OBJ  >>desk.
echo desk.app      >>desk.
echo desk.map      >>desk.
echo %lib%\cm.lib >>desk.


%bc% -O -w- -c -mm -I%inc% DESKINIT.C DESKINF.C DESKSUPP.C
%bc% -O -w- -c -mm -I%inc% BUTTON.C DANUTIL.C DESKACT.C DESKAPP.C DESKBKGD.C
%bc% -O -w- -c -mm -I%inc% DESKCET.C DESKCLRS.C DESKDIR.C DESKFPD.C DESKFUN.C
%bc% -O -w- -c -mm -I%inc% DESKGLOB.C DESKGRAF.C DESKGSX.C DESKINS.C DESKMAIN.C
%bc% -O -w- -c -mm -I%inc% DESKOBJ.C DESKPASS.C DESKPGRP.C DESKPRO.C DESKRSRC.C
%bc% -O -w- -c -mm -I%inc% DESKSCSV.C DESKCICN.C DESKTMAX.C DESKTREE.C DESKTYPE.C
%bc% -O -w- -c -mm -I%inc% DESKWIN.C EMS.C EXFORMDO.C EXOBJ.C FNDEXOBJ.C FNDEXPNT.C
%bc% -O -w- -c -mm -I%inc% FRUNTIME.C GEMBIND.C GEMDOS.C INIFILES.C LIST.C LISTBOX.C
%bc% -O -w- -c -mm -I%inc% LISTEXOB.C MEMYMAN.C OPTIMIZE.C PARSESTR.C RADIO.C
%bc% -O -w- -c -mm -I%inc% SLIDER.C SLIDTRAN.C TRNSRSC.C UTIL.C VALUEBOX.C VIEWAPPS.C

%rasm% DESKOSIF.A86
%rasm% DESKSTAR.A86
%rasm% GSX2.A86
%rasm% LONGASM.A86
%rasm% OPTIMOPT.A86

%link% @desk.
------------------------End of file: COMP.BAT--------------------------
-----------------------VIEWMAX.INI-------------------------------------
[Prefs]
ConfirmDeletes=1
ConfirmCopies=1
ClicksSpeed=0
ConfirmOverwrites=1
MenuKind=0
AutoSave=0
TMaxCtrl=0
Sound=1
Background=0
ScreenSave=0,[Window1]

[Window1]
Sliders=0,0,0
Size=0,32,0,0,0
Tree=6
View=6
Sort=3
Path=ep
Wildcards=*.*

[Window2]
Sliders=0,0,0
Size=0,38,845,573,0
Tree=0
View=0
Sort=3
Path=C:\IP\*.*
Wildcards=*.*

[FileIcons]

[Colors]
CurrentColor=-1
[Drivers]
MaxDrv=7
CurrentDrv=0
Driver0="IBM VGA Colour Display or compatible (640x480)",udpsc9.vga
Driver1="IBM VGA Monochrome Display or compatible (640x480)",sdpsc??.vga
Driver2="IBM EGA Colour Display or compatible (640x350)",uduni9.vga
Driver3="IBM EGA Monochrome Display or compatible (640x350)",uduni9.vga
Driver4="IBM CGA Colour Display or compatible (640x200)",udcat9.ega
Driver5="Compaq, Olivetti, or Toshiba Display in 640x400 mode",udcat9.ega
Driver6="Hercules or compatible with Mono screen (720x348)",udhrc9.ega
VidPatch=FF
MouseType=2
MousePort=255
------------------------End of file: VIEWMAX.INI-----------------------
