Example #1
0
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, int) {
	char  **argv;
    int    argc;

    // obtain command-line arguments in argv[] style array
    argv = GetArgvCommandLine(&argc);
#else
int main( int argc, const char** argv ) {
#endif
    GameSettings* settings = GameSettings::getSingletonPtr();
    if (!settings->parseArgv(argc, argv)) {
        return 1;
    }

    Client::GameRootSystem game;
    if (game.isLocked())
        return 2;

    game.setLocked(true);
    game.init();
    game.run();

    game.setLocked(false);

    return 0;
}
Example #2
0
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, int) {
	char  **argv;
    int    argc;

    // obtain command-line arguments in argv[] style array
    argv = GetArgvCommandLine(&argc);
#else
int main( int argc, char **argv ) {
#endif

    std::string cmdvar;
    int cmd = 0;

    Ogre::ConfigFile lconfig;
    lconfig.load("server.cfg");

    Ogre::String address = lconfig.getSetting("LocalAddress", "Network");
    unsigned int port = Ogre::StringConverter::parseInt(lconfig.getSetting("DefaultPort", "Network"));

    Server::ServerMain server = Server::ServerMain(lconfig);
    return 0;
}
Example #3
0
//
//	Entry-point for text-editor application
//
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int iShowCmd)
{
	MSG			msg;
	HACCEL		hAccel;
	TCHAR		**argv;
	int			argc;
	//TCHAR		*pszCmdlineFile = 0;
	TCHAR		arg[MAX_PATH];

	//
	// get the first commandline argument
	//
	TCHAR *pszCmdline = GetArg(GetCommandLineW(), arg, MAX_PATH);
	argv = GetArgvCommandLine(&argc);

	// check if we have any options
	if(pszCmdline && *pszCmdline == '-')
	{
		pszCmdline = GetArg(pszCmdline, arg, MAX_PATH);

		// do the user-account-control thing
		if(lstrcmpi(arg, _T("-uac")) == 0)
		{
			//return 0;
		}
		// image-file-execute-options
		else if(lstrcmpi(arg, _T("-ifeo")) == 0)
		{
			// skip notepad.exe
			pszCmdline = GetArg(pszCmdline, arg, MAX_PATH);
		}
		// unrecognised option
		else
		{
		}
	}


	// has a prior instance elevated us to admin in order to 
	// modify some system-wide settings in the registry?
	if(argv && argc == 4 && lstrcmpi(argv[1], _T("-uac")) == 0)
	{
		g_fAddToExplorer	= _ttoi(argv[2]);
		g_fReplaceNotepad	= _ttoi(argv[3]);

		if(SetExplorerContextMenu(g_fAddToExplorer) &&
			SetImageFileExecutionOptions(g_fReplaceNotepad))
		{
			SaveRegSysSettings();
			return 0;
		}
		else
		{
			return ERROR_ACCESS_DENIED;
		}
	}

	// default to the built-in resources
	g_hResourceModule = hInst;

	OleInitialize(0);

	// initialize window classes
	InitMainWnd();
	InitTextView();

	LoadRegSettings();

	// create the main window!
	g_hwndMain = CreateMainWnd();

	// open file specified on commmand line
	if(pszCmdline && *pszCmdline)
	{
		// check to see if it's a quoted filename
		if(*pszCmdline == '\"')
		{
			GetArg(pszCmdline, arg, MAX_PATH);
			pszCmdline = arg;
		}

		NeatpadOpenFile(g_hwndMain, pszCmdline);
		LoadFileData(pszCmdline, g_hwndMain);
	}
	// automatically create new document if none specified
	else
	{
		PostMessage(g_hwndMain, WM_COMMAND, IDM_FILE_NEW, 0);
	}

	ApplyRegSettings();
	ShowWindow(g_hwndMain, iShowCmd);

	//
	// load keyboard accelerator table
	//
	hAccel = LoadAccelerators(g_hResourceModule, MAKEINTRESOURCE(IDR_ACCELERATOR1));

	
	//
	// message-loop
	//
	while(GetMessage(&msg, NULL, 0, 0) > 0)
	{
		if(!TranslateAccelerator(g_hwndMain, hAccel, &msg))
		{
			if((!IsWindow(g_hwndSearchDlg) || !IsDialogMessage(g_hwndSearchDlg, &msg)))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
	}

	if(g_fSaveOnExit)
		SaveRegSettings();

	OleUninitialize();
	ExitProcess(0);
	return 0;
}