Example #1
0
int PASCAL WinMain( HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show )
{
    char buffer[PATH_MAX];

#if !defined( __WATCOMC__ ) && defined( __NT__ )
    _argc = __argc;
    _argv = __argv;
#endif
    EXEName = _cmdname( buffer );
    InstanceHandle = inst;
    showHow = show;
    prev = prev;
    cmdline = cmdline;

    InitMem();

#ifndef __NT__
    if( prev != NULL && !HasShare() ) {
        MessageBox( NULLHANDLE, "SHARE.EXE must be loaded before starting Windows in order to run multiple instances of the editor",
                    EditorName, MB_OK );
        MyGetInstanceData( (unsigned short) prev, (void near *) &Root, sizeof( Root ) );
        SetFocus( Root );
        return( 0 );
    }
#endif

    Comspec = getenv( "COMSPEC" );
#ifdef __NT__
    VarAddGlobalStr( "OS", "winnt" );
#else
    VarAddGlobalStr( "OS", "win" );
#endif
    SetConfigFileName( CFG_NAME );
    ReadProfile();

    ShowStartupDialog();

    initApplication();
    if( !initInstance() ) {
        return( 0 );
    }
    InitializeEditor();
    SetSaveConfig();
    if( !BAD_ID( CurrentWindow ) ) {
        SetFocus( Root );
    }

    SetWindowCursorForReal();
    ResizeRoot();
    EditMain();

    FiniMem();

    return( 0 );

} /* WinMain */
Example #2
0
//-----------------------------------------------------------------------------------
//		Purpose	:
//		Return	:
//-----------------------------------------------------------------------------------
int CNtlServerApp::Create(int argc, _TCHAR* argv[], const char * lpszConfigFile /* = NULL */)
{
	int rc = 0;

	SetConfigFileName(argv[0], lpszConfigFile);
	rc = CNtlServerApp::OnConfiguration( m_strConfigFile.c_str() );
	if( NTL_SUCCESS != rc )
	{
		return rc;
	}
	rc = OnConfiguration( m_strConfigFile.c_str() );
	if( NTL_SUCCESS !=  rc )
	{
		return rc;
	}


	rc = CNtlServerApp::OnCommandArgument( argc, argv );
	if( NTL_SUCCESS != rc )
	{
		return rc;
	}
	rc = OnCommandArgument( argc, argv );
	if( NTL_SUCCESS != rc )
	{
		return rc;
	}


	rc = CNtlServerApp::OnInitApp();
	if( NTL_SUCCESS != rc )
	{
		return rc;
	}
	rc = OnInitApp();
	if( NTL_SUCCESS != rc )
	{
		return rc;
	}


	rc = CNtlServerApp::OnCreate();
	if( NTL_SUCCESS != rc )
	{
		return rc;
	}
	rc = OnCreate();
	if( NTL_SUCCESS != rc )
	{
		return rc;
	}


	return NTL_SUCCESS;
}
Example #3
0
/*
 * readConfigFile - get the name of the config file that we are to read
 */
static void readConfigFile( void )
{
    char        cname[FILENAME_MAX];
    //char      str[MAX_STR]; // not used if not prompting for new cfg files
    char        *cfgname;
    struct stat cfg;
    int         rc;
    DWORD       new_cfgtime = 0;

    cfgTime = getProfileLong( keyCfgTime );
    cfgname = GetConfigFileName();
    GetFromEnv( cfgname, cname );
    if( cname[0] != '\0' ) {
        stat( cname, &cfg );
        new_cfgtime = cfg.st_mtime;
        if( cfgTime == 0 ) {
            cfgTime = new_cfgtime;
        }
    }

    if( access( cfgFile, R_OK ) != -1 ) {
        rc = IDNO;
#if 0
        // don't prompt for newer config files
        if( new_cfgtime > cfgTime ) {
            MySprintf( str, "The configuration file \"%s\" is newer than your .INI file, do you wish to use the new configuration?",
                       cname );
            rc = MessageBox( NO_WINDOW, str, EditorName, MB_YESNO | MB_TASKMODAL );
            if( rc == IDYES ) {
                cfgTime = new_cfgtime;
            }

        }
#endif
        if( rc == IDNO ) {
            SetConfigFileName( cfgFile );
        }
    } else {
        cfgTime = new_cfgtime;
    }
    saveConfig = getProfileLong( keySaveConfig );

} /* readConfigFile */