/********************************************************************
*   TwinStandaloneBinApp.c
*
*   A modified version of "MacWin" aka "xwin" for specific handling exe files to make them look
*		like a real macintosh application.
*
*   Copyright (c) 1994, Willows Software Inc.  All rights reserved.
********************************************************************/

static char *TwinStandaloneBinApp_c =  "IDENT:  @(#)TwinStandaloneBinApp.c	1.1 1/14/96 17:52:29";

#include <string.h>

#include "windows.h"
#include "Resources.h"
#include "Module.h"

/* This is to determine whether this object file has been linked in */
BOOL bIsXWin = FALSE;		/* Set this to false for this case (MacWin sets it to TRUE) */
										/* This allows the command line to receive files as the first arguments */
										/* The side effect is the the native modules have to be replaced by binary modules (not as efficient) */

/* Undocumented API's */
extern LPSTR strpbrkr(LPCSTR,LPCSTR);
extern HANDLE InternalLoadLibrary(WORD,LPSTR,LPARAM);
extern char *TwinMac_GetAppName(char *appName, int size);

extern int __argc;
extern char **__argv;


/********************************************************************
*   WinMain
*
********************************************************************/
int WinMain(HINSTANCE, HINSTANCE, LPSTR lpCmdLine, int)
{
int    rc;
char	appName[256];

	memset (appName, 0, sizeof(appName) );

	/* Get the native name of our "application" */
	TwinMac_GetAppName(appName, 256);
	
	/* Force the loading of the .exe file.  */
	strcat(appName, ".exe");

    rc = InternalLoadLibrary(ILL_BINARY|ILL_APPL|ILL_FILENAME|ILL_NOFORK, lpCmdLine, (LPARAM) appName);

    return rc;
}

