Advertisement
vovan333

-10/10 mom get the camera i managed to open the window

Dec 30th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <windows.h>
  2. #define null NULL
  3.  
  4. int MBox(LPWSTR title, LPWSTR text, long type)
  5. {
  6.     return MessageBox(null, text, title, type);
  7. }
  8.  
  9. int MBox(LPWSTR title, LPWSTR text)
  10. {
  11.     return MBox(title, text, MB_OK);
  12. }
  13.  
  14. LRESULT CALLBACK OnWindowEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  15. {
  16.     switch (message)
  17.     {
  18.         case WM_DESTROY:
  19.             PostQuitMessage(0);
  20.             return 0;
  21.             break;
  22.     }
  23.     return DefWindowProc(hWnd, message, wParam, lParam);
  24. }
  25.  
  26. int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
  27. {
  28.     HWND hWnd;
  29.     WNDCLASSEX wc;
  30.     ZeroMemory(&wc, sizeof(wc));
  31.  
  32.     wc.cbSize = sizeof(WNDCLASSEX);
  33.     wc.style = CS_HREDRAW | CS_VREDRAW;
  34.     wc.lpfnWndProc = OnWindowEvent;
  35.     wc.hInstance = hInstance;
  36.     wc.hCursor = LoadCursor(null, IDC_ARROW);
  37.     wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
  38.     wc.lpszClassName = L"Window1";
  39.  
  40.     RegisterClassEx(&wc);
  41.     hWnd = CreateWindowEx(null, L"Window1", L"D3DTest1 Main Window", WS_OVERLAPPEDWINDOW, 300, 300, 500, 600, null, null, hInstance, null);
  42.     ShowWindow(hWnd, nShowCmd);
  43.  
  44.     MSG message;
  45.     while (GetMessage(&message, null, 0, 0))
  46.     {
  47.         TranslateMessage(&message);
  48.         DispatchMessage(&message);
  49.     }
  50.  
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement