Esempio n. 1
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
#endif
{
    if (strncmp(szCmdLine, "-launch ", 8) == 0) {
        HWND hwnd;
        ULONG id;
        sscanf(&szCmdLine[8], "%lx:%lx", &hwnd, &id);
        MetaLauncher::launch(hwnd, id);
        return 0;
    }

    if (strcmp(szCmdLine, "-cleanmenu") == 0) {
        MetaLauncher::cleanAllMenus();
        return 0;
    }

	// The state of the application as a whole is contained in the one app object
	#ifdef _WIN32_WCE
		VNCviewerApp app(hInstance, szCmdLine);
	#else
		VNCviewerApp32 app(hInstance, szCmdLine);
	#endif

	// Start a new connection if specified on command line, 
	// or if not in listening mode
	
	if (app.m_options.m_connectionSpecified) {
		app.NewConnection(app.m_options.m_host, app.m_options.m_port);
	} else if (!app.m_options.m_listening) {
		// This one will also read from config file if specified
		app.NewConnection();
	}

	MSG msg;
	std::list<HWND>::iterator iter;

	try {
		while (GetMessage(&msg, NULL, 0, 0)) {
			if ( !hotkeys.TranslateAccel(&msg) &&
				 !help.TranslateMsg(&msg) &&
				 !app.ProcessDialogMessage(&msg) ) {
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
	} catch (WarningException &e) {
		e.Report();
	} catch (QuietException &e) {
		e.Report();
	}
	
	// Clean up winsock
	WSACleanup();

	vnclog.Print(3, _T("Exiting\n"));

	return msg.wParam;
}
Esempio n. 2
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
#endif
{
  //
  // FIXME: Resource loader owner must be Application class
  // or something like this. Instanize resourse loader here
  // is not good way.
  //

  ResourceLoader resourceLoader(hInstance);
  VncViewerConfig config;

	// The state of the application as a whole is contained in the one app object
	#ifdef _WIN32_WCE
		VNCviewerApp app(hInstance, szCmdLine);
	#else
		VNCviewerApp32 app(hInstance, szCmdLine);
	#endif

	// Start a new connection if specified on command line, 
	// or if not in listening mode
	
	if (app.m_options.m_connectionSpecified) {
		app.NewConnection(app.m_options.m_host, app.m_options.m_port);
	} else if (!app.m_options.m_listening) {
		// This one will also read from config file if specified
		app.NewConnection();
	}

	MSG msg;
	std::list<HWND>::iterator iter;

	try {
		while (GetMessageW(&msg, NULL, 0, 0)) {
			if ( !hotkeys.TranslateAccel(&msg) &&
				 !help.TranslateMsg(&msg) &&
				 !app.ProcessDialogMessage(&msg) ) {
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
	} catch (WarningException &e) {
		e.Report();
	} catch (QuietException &e) {
		e.Report();
	}
	
	// Clean up winsock
	WSACleanup();

    Log::warning(_T("Exiting\n"));

	return msg.wParam;
}
Esempio n. 3
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   PSTR szCmdLine, int iCmdShow)
{
  int retval = 0;

  // The state of the application as a whole is contained in the one app object
  VNCviewerApp32 app(hInstance, szCmdLine);

  // Start a new connection if one if specified on the command line or if
  // listening mode is not specified

  if (app.m_options.m_connectionSpecified) {
    retval = app.NewConnection(app.m_options.m_host, app.m_options.m_port);
  } else if (!app.m_options.m_listening) {
    // This one will also read from a config file, if specified
    retval = app.NewConnection();
  }

  if (app.m_options.m_benchFile) {
    fclose(app.m_options.m_benchFile);
    return retval;
  }

  MSG msg;
  std::list<HWND>::iterator iter;

  try {
    while (GetMessage(&msg, NULL, 0, 0)) {
      if (!hotkeys.TranslateAccel(&msg) && !help.TranslateMsg(&msg) &&
          !app.ProcessDialogMessage(&msg)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
      }
      if (msg.message == WM_CLOSE) retval = (int)msg.wParam;
    }
  } catch (WarningException &e) {
    e.Report();
    retval = 1;
  } catch (QuietException &e) {
    e.Report();
    retval = 1;
  }

  // Clean up winsock
  WSACleanup();

  vnclog.Print(3, "Exiting\n");

  return retval;
}