//! runs the device. Returns false if device wants to be deleted
bool CIrrDeviceWinCE::run()
{
	os::Timer::tick();

	MSG msg;

	bool quit = false;

	while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
	{
		TranslateMessage(&msg);

		if (ExternalWindow && msg.hwnd == HWnd)
			WndProc(HWnd, msg.message, msg.wParam, msg.lParam);
		else
			DispatchMessage(&msg);

		if (msg.message == WM_QUIT)
			quit = true;
	}

	if (!quit)
		resizeIfNecessary();

	_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
	return !quit;
}
Esempio n. 2
0
LRESULT CBufferedWnd::WindowProc(unsigned int msg, WPARAM wParam, LPARAM lParam)
{
	try
	{
		if(msg == WM_PAINT)
		{
			Paint();
		}
		else if(msg == WM_ERASEBKGND)
		{
			//LRESULT result = WndProc(msg, wParam, lParam);
			return TRUE;
		}
		else if(msg == WM_INVALIDATE)
		{
			Invalidate();
		}
		else return WndProc(msg, wParam, lParam);
	}
	catch(...)
	{
		TCHAR out[512];
		_stprintf_s(out, _T("The following error: 0x%.8x\r\nHas occurred please fill out a bug report explaining the actions which lead to this error.  Our apologies for any inconvenience."), GetLastError());
		MessageBox(m_hwnd, out, _T("Program Error"), MB_OK);
	}
    return 0;
}
Esempio n. 3
0
void __fastcall Tform_Main::NewWndProc(TMessage &Msg)
{
    // ----- Update event -----
    if ( Msg.Msg == MESSAGE_STOP_DEVICE && isStoped == false )
    {
        bStopClick(NULL);
    }                                              //
    WndProc(Msg);
}
Esempio n. 4
0
void kgmWindow::loop()
{
  m_loop = true;

#ifdef WIN32

  MSG msg;

  while(m_wnd && m_loop)
  {
    if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
    }
    else
    {
      onIdle();
    }

    Sleep(0);
  }

#elif defined(ANDROID)

#else

  XEvent evt;

  while(m_loop && m_dpy)
  {
    while(XPending(m_dpy) > 0)
    {
      XNextEvent(m_dpy, &evt);

      WndProc(this, &evt);

      if(!m_dpy)
        return;
    }

    if(!m_loop || !m_dpy)
      break;

    //else
    onIdle();
    usleep(0);
  }

#endif

  m_loop = false;
}
LRESULT WindowBase::ApplicationWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	// Store handle
	if (message == WM_CREATE) windowHandle = hWnd;

	// Run window process
	LRESULT result = WndProc(hWnd, message, wParam, lParam);

	// Remove handle if destroyed
	if (message == WM_DESTROY) windowHandle = NULL;

	// Return result
	return result;
}
Esempio n. 6
0
LRESULT CALLBACK WndProc3(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message)
	{
	case WM_COMMAND:
		wmId = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case IDM_ABOUT:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		default:
			return WndProc(hWnd, message, wParam, lParam);
		}
		break;
	case WM_LBUTTONUP:
	{
		int x = LOWORD(lParam);
		int y = HIWORD(lParam);

		HDC hdc = GetDC(hWnd);
		SelectObject(hdc, class3Brush);
		Rectangle(hdc, x - 100, y - 100, x + 100, y + 100);
		ReleaseDC(hWnd, hdc);
	}
	break;
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &ps);
		// TODO: Add any drawing code here...
		EndPaint(hWnd, &ps);
		break;
	case WM_DESTROY:
		//PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

 	// TODO: Place code here.
	MSG msg={0};
	HACCEL hAccelTable;

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_D3D11SIMPLETEAPOT, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	// Perform application initialization:
	if (!InitInstance (hInstance, nCmdShow))
	{
		return FALSE;
	}

	hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_D3D11SIMPLETEAPOT));

	
// Force Init
	WndProc(g_hWnd, WM_COMMAND, 98307, NULL);
	
	while( WM_QUIT != msg.message )
    {
        if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
        {
            TranslateMessage( &msg );
            DispatchMessage( &msg );
        }
        else
        {
			Render();
			
        }
    }

	
	
	return (int) msg.wParam;
}
Esempio n. 8
0
int WINAPI StartSystem(HINSTANCE hInstance, 
					   HINSTANCE hPrevInstance, 
					   PSTR szCmdLine, int nCmdShow)
{
     HWND        hwnd ;
     MSG         msg ;
     WNDCLASS    wndclass ;
	 LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
		 WPARAM wParam, LPARAM lParam);

     wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = 0 ;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon (NULL, IDI_WINLOGO) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
     wndclass.lpszMenuName  = NULL ;
     wndclass.lpszClassName = szAppName ;
     
     if (!RegisterClass (&wndclass))
          return 0 ;
     
     hwnd = CreateWindow (szAppName, szAppName,
                          WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          NULL, NULL, hInstance, NULL) ;

	 ShowWindow(hwnd, nCmdShow);

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

     return msg.wParam ;
}
Esempio n. 9
0
 LRESULT WTFWindow::DefaultWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
     return WndProc(hWnd, message, wParam, lParam);
 }
Esempio n. 10
0
void DllWrapperWndProc(int hWndPtrAddress, int msg, int wParam, int lParam)
{
	HWND hWnd = (HWND)hWndPtrAddress;
	WndProc( hWnd, msg, WPARAM(wParam), LPARAM(lParam) );
}