Beispiel #1
0
int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
		LPWSTR lpCmdLine, int nCmdShow) {
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	MainWnd window;
	if (!window.getWindowHandle()) {
		// If window was not initialized, test failed
		return 1;
	}
	window.Show(nCmdShow);

	MessageBoxW(GetActiveWindow(),
			L"1. The window underneath should have label,\n"
			 "   which will provide further instructions",
			L"Instructions", MB_OK);

	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0)) {
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	if(MessageBoxW(GetActiveWindow(), L"Was everything according to the instructions?",
			L"Test", MB_YESNO) == IDNO)
		return 1;

	return (int) msg.wParam;
}
Beispiel #2
0
bool NutcrackerApp::OnInit()
{
	gParameters = std::make_unique<cz::Parameters>();
	gParameters->set(argc, argv);

    // call the base class initialization method, currently it only parses a
    // few common command-line options but it could be do more in the future
	// NOTE: Not calling it, as it will show an error message because the I try to use my own command lines
    // if ( !wxApp::OnInit() )
    //   return false;


 #if wxUSE_XPM
	wxImage::AddHandler(new wxXPMHandler);
#endif
#if wxUSE_LIBPNG
	wxImage::AddHandler(new wxPNGHandler);
#endif
#if wxUSE_LIBJPEG
	wxImage::AddHandler(new wxJPEGHandler);
#endif
#if wxUSE_GIF
	wxImage::AddHandler(new wxGIFHandler);
#endif


	//
	// Initialize image lists
	//
	for (int i = 0; i < SMALLIMG_IDX_MAX; i++)
		gImageListSmall.Add(wxArtProvider::GetBitmap(wxART_MISSING_IMAGE, wxART_OTHER, wxSize(16, 16)));
	gImageListSmall.Replace(SMALLIMG_IDX_FOLDER, wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, wxSize(16, 16)));
	gImageListSmall.Replace(SMALLIMG_IDX_FILE_OTHER, wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16, 16)));
	gImageListSmall.Replace(SMALLIMG_IDX_FILE_NUT, wxBITMAP_PNG(APP_IMG_16x16_FILE_NUT));
	gImageListSmall.Replace(SMALLIMG_IDX_REFRESH, wxBITMAP_PNG(APP_IMG_16x16_REFRESH));
	gImageListSmall.Replace(SMALLIMG_IDX_FOLDER_ADD, wxBITMAP_PNG(APP_IMG_16x16_FOLDER_ADD));
	gImageListSmall.Replace(SMALLIMG_IDX_NUT, wxBITMAP_PNG(APP_IMG_16x16_NUT));
	gImageListSmall.Replace(SMALLIMG_IDX_CALLSTACK_CURRENT, wxBITMAP_PNG(APP_IMG_16x16_CALLSTACK_CURRENT));

	for (int i = 0; i < BIGIMG_IDX_NUT; i++)
		gImageList32x32.Add(wxArtProvider::GetBitmap(wxART_MISSING_IMAGE, wxART_OTHER, wxSize(32, 32)));
	gImageList32x32.Replace(BIGIMG_IDX_NUT, wxBITMAP_PNG(APP_IMG_32x32_NUT));

	gWorkspace = std::make_shared<Workspace>();
	// create the main application window
    MainWnd *mainWnd = new MainWnd();

    mainWnd->Show(true);

	if (gParameters->has("workspace"))
	{
		try
		{
			gWorkspace->load(gParameters->get("workspace"));
		}
		catch (std::exception& e)
		{
			showException(e);
		}
	}

	/*
	postAppLambdaEvent([]()
	{
		fireAppEvent(AppEventID::OpenWorkspace);
	});
	*/

	std::shared_ptr<std::function<void()>> func;

	//
	// Test project handling
	//

    // success: wxApp::OnRun() will be called which will enter the main message
    // loop and the application will run. If we returned false here, the
    // application would exit immediately.
    return true;
}
Beispiel #3
0
XERCES_CPP_NAMESPACE_USE

// ----------------------------------------------------------------------------
// WinMain
//
// Windows equivalent of main. 
// ----------------------------------------------------------------------------
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,
				   LPSTR lpCmdLine, int nCmdShow)
{
	// the message thats collected and dispatched
	MSG   Msg;
	// the name of the class to build a window
	char *ClsName = "Main window class";
	// the name printed on an individual window
	char *WndName = "Mamoview";

	CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
	// Some code thats necessary to initialise gdi, don;t know how it
	// works must just call some things in the dll
    Gdiplus::GdiplusStartupInput gdiplusStartupInput; 
	ULONG_PTR gdiplusToken; 
	Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

	try {
	 XMLPlatformUtils::Initialize();
	}
	catch (const XMLException& toCatch) {
    // Do your failure processing here
    return 1;
	}

  // Do your actual work with Xerces-C++ here.

  


	
	// Declare and initialize the application class, which contains data needed
	// to make a window in the first place
	WApplication WinApp(hInstance, ClsName, WndProc, IDR_MENU1);
	WinApp.Register();

	// // Declare a MainWnd object which represents what is seen graphically
	// and then create it
	MainWnd Wnd;
	/*HWND Create(HINSTANCE hinst,                        // application instance
		        LPCTSTR clsname,						// the name of the window class
     		    LPCTSTR wndname,						// the name of the window
	            HWND parent   = NULL,					// the parent window reference
	            DWORD dStyle  = WS_OVERLAPPEDWINDOW,	// the window style
	            DWORD dXStyle = 0,						// extended window style
		        int x         = 10,			// x position of the window
                int y         = 10,			// y position of the window
		        int width     = 300,			// width of the window
                int height    = 300);			// height of the window*/
	Wnd.Create(hInstance, ClsName, WndName, NULL, WS_OVERLAPPEDWINDOW | 
				WS_CLIPCHILDREN,WS_EX_LAYERED | WS_EX_OVERLAPPEDWINDOW );
	// Display the main window
	Wnd.Show();
	

	//prepareGraphics();
	// Process the main window's messages
	while( GetMessage(&Msg, NULL, 0, 0) )
	{
		// convert virtual key messages to character ones and put back into message queue
		TranslateMessage(&Msg);
		// send to window procedure, of which there might be a few in 1 app
		DispatchMessage(&Msg);
	}
	Gdiplus::GdiplusShutdown(gdiplusToken); 
	XMLPlatformUtils::Terminate();
	return 0;
} // --- WinMain --------------------------------------------------------------