Beispiel #1
0
BOOL CSaverApp::InitInstance()
{
	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

	Enable3dControls();
	SetRegistryKey(_T("Complex\\ProbableWorlds"));
	
	if (__argc == 1 || MatchOption(__argv[1], _T("c"))) DoConfig();
	else if (MatchOption(__argv[1], _T("p")))
	{
/*
// sorry no preview!!!
		CWnd* pParent = CWnd::FromHandle((HWND)atol(__argv[2]));
		ASSERT(pParent != NULL);
		CDrawWnd* pWnd = new CDrawWnd();
		CRect rect;
		pParent->GetClientRect(&rect);
		pWnd->Create(NULL, WS_VISIBLE|WS_CHILD, rect, pParent, NULL);
		m_pMainWnd = pWnd;
		return TRUE;
*/
		return FALSE;
	}

	else if (MatchOption(__argv[1], _T("s")))
	{
		CSaverWnd* pWnd = new CSaverWnd;
		pWnd->Create();
		m_pMainWnd = pWnd;
		return TRUE;
	}

/*
	CSaverWnd* pWnd = new CSaverWnd;
	pWnd->Create();
	m_pMainWnd = pWnd;
	return TRUE;
*/
	return FALSE;
}
void MpGlobal::ParseOptions (int argc, const char *argv[], 
                             const char *application)
{
  // If the application name is given the parse the X resources data base.
  // This is done before the command line arguments to allow overriding

  if (application != NULL) ParseResources (application);

  // now parse the command line options

  for (int i = 1; i < argc; i++) {

    // toggles

    if (! MatchOption(argv[i],"-german",4) ) {
      Mp.Language = MpGerman;
            
    } else if (! MatchOption(argv[i],"-english",4) ) {
      Mp.Language = MpEnglish;

    // integers
            
    } else if (! MatchOption(argv[i],"-framewidth",7) ) {
        Mp.FrameWidth = GetInteger(argc,argv,++i);

    } else if (! MatchOption(argv[i],"-framemidwidth",7) ) {
        Mp.FrameMidWidth = GetInteger(argc,argv,++i);
            
    } else if (! MatchOption(argv[i],"-framestyle",7) ) {
        Mp.FrameStyle = GetInteger(argc,argv,++i);

    } else if (! MatchOption(argv[i],"-buttonheight",8) ) {
        Mp.ButtonHeight = GetInteger(argc,argv,++i);

    } else if (! MatchOption(argv[i],"-buttonwidth",8) ) {
        Mp.ButtonWidth = GetInteger(argc,argv,++i);

    } else if (! MatchOption(argv[i],"-shifterwidth",9) ) {
        Mp.ShifterWidth = GetInteger(argc,argv,++i);

    } else if (! MatchOption(argv[i],"-toggleimagesize",9) ) {
        Mp.ToggleImageSize = GetInteger(argc,argv,++i);
        
    } else if (! MatchOption(argv[i],"-pulldownimagesize",11) ) {
        Mp.PulldownImageSize = GetInteger(argc,argv,++i);
            
    } else if (! MatchOption(argv[i],"-radioimagesize",8) ) {
        Mp.RadioImageSize = GetInteger(argc,argv,++i);

    // strings

    } else if (! MatchOption(argv[i],"-printer",3) ) {
      if (++i < argc) 
        strncpy(DefaultPrinter,argv[i],str_max);

    } else if (! MatchOption(argv[i],"-viewer",3) ) {
      if (++i < argc) 
        strncpy(DefaultViewer,argv[i],str_max);

    } else if (! MatchOption(argv[i],"-psviewer",3) ) {
      if (++i < argc) 
        strncpy(DefaultPSViewer,argv[i],str_max);
    }
  }
}