All pastes #635419 Raw Edit

Anonymous

public text v1 · immutable
#635419 ·published 2007-07-27 01:37 UTC
rendered paste body
#include <windows.h>
#include <iostream>
#pragma comment(lib, "user32.lib")

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );

int main()
{
  WNDCLASSEX wnd;
  SecureZeroMemory(&wnd, sizeof(WNDCLASSEX));

  wnd.cbSize = sizeof(WNDCLASSEX);
  wnd.style = CS_VREDRAW | CS_HREDRAW;
  wnd.lpfnWndProc = WndProc;
  wnd.hInstance = GetModuleHandle(NULL);
  wnd.lpszClassName = "Thing";
  wnd.hbrBackground = (HBRUSH) COLOR_BACKGROUND+1;

  RegisterClassEx(&wnd);

   HWND hwnd = CreateWindow("Thing", "Thing", WS_OVERLAPPEDWINDOW, 50, 50, 800, 600, 0, 0, wnd.hInstance, 0);

   ShowWindow(hwnd, SW_SHOW);
   MSG msg;

   while(GetMessage(&msg, 0, 0, 0))
   {
     if(msg.message == WM_QUIT)
       break;
     TranslateMessage(&msg);
     DispatchMessage(&msg);     
   }   
  

   return 0;
}

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{

  switch(uMsg)
  {
    case WM_CLOSE:
    {
      PostQuitMessage(0);
      return 0;
    }
  
    default:
    {
      return DefWindowProc(hWnd, uMsg, wParam, lParam);
    }
  }
  
}