title: Draw on a windows program
body: <p>Ok so here it is: 
  I'm making a basic pong game for school, and I can get anything set up. But after the intialisation (start) of the program I can't seem to update the window. I've tried drawing a backbuffer first and yet it doesn't do anything. code is under here so have a look pretty please and thank you in advance!!</p>
  
  <pre><code>//=============================================================================
  //Seth Dark @2011
  //Pong v1.0
  //=============================================================================
  
  //=============================================================================
  //to do list
  // - get the ball moving
  // - figure out the AI
  // - figure out the ball vs paddle
  // Version 2
  // - count time or points
  // - hiscore bord
  //=============================================================================
  
  // Pong.cpp : Defines the entry point for the application.
  
  #include "stdafx.h"
  #include "Resource.h"
  
  #define MAX_LOADSTRING 100
  
  // Global Variables:
  HINSTANCE hInst;                     // current instance
  TCHAR szTitle[MAX_LOADSTRING];       // The title bar text
  TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
  BackBuffer* gBackBuffer = 0;         // The backbuffer we will render
  
  HDC    hdc;                          // ------------------------------ gamble
  
  const int gClientWidth = 800;
  const int gClientHeight = 600;
  
  Vec2 playerPos(20.0f, 250.0f);
  Vec2 aiPos(780.0f,250.0f);
  Vec2 ballPos(400.0f, 250.0f);
  
  // Forward declarations of functions included in this code module:
  ATOM             MyRegisterClass(HINSTANCE hInstance);
  BOOL             InitInstance(HINSTANCE, int);
  LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
  
  //---------------------------------------------
  //INT RUN
  //---------------------------------------------
  int APIENTRY _tWinMain(HINSTANCE hInstance,
      HINSTANCE hPrevInstance,
      LPTSTR    lpCmdLine,
      int       nCmdShow)
  {
      UNREFERENCED_PARAMETER(hPrevInstance);
      UNREFERENCED_PARAMETER(lpCmdLine);
  
      // TODO: Place code here.
      HDC bbDC = gBackBuffer-&gt;getDC();
      //Clear backbuffer
      HBRUSH oldBrush = (HBRUSH)SelectObject(bbDC, GetStockObject(BLACK_BRUSH));
      Rectangle(bbDC,0 ,0 ,800, 600);
  
      //Draw player
      SelectObject(hdc,GetStockObject(WHITE_BRUSH)); // drawing the thing
      Rectangle(bbDC,
          (int)playerPos.x -10,
          (int)playerPos.y - 50,
          (int)playerPos.x + 10,
          (int)playerPos.y + 50); 
  
      MSG msg;
      HACCEL hAccelTable;
  
      // Initialize global strings
      LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
      LoadString(hInstance, IDC_PONG, szWindowClass, MAX_LOADSTRING);
      MyRegisterClass(hInstance);
  
      // Perform application initialization:
      if (!InitInstance (hInstance, nCmdShow))
      {
          return FALSE;
      }
  
      hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_PONG));
  
      // Main message loop:
      while (GetMessage(&amp;msg, NULL, 0, 0))
      {
          if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg))
          {
              TranslateMessage(&amp;msg);
              DispatchMessage(&amp;msg);
          }
      }
  
      return (int) msg.wParam;
  }
  
  //
  //  FUNCTION: MyRegisterClass()
  //
  //  PURPOSE: Registers the window class.
  //
  //  COMMENTS:
  //
  //    This function and its usage are only necessary if you want this code
  //    to be compatible with Win32 systems prior to the 'RegisterClassEx'
  //    function that was added to Windows 95. It is important to call this function
  //    so that the application will get 'well formed' small icons associated
  //    with it.
  //      Creation of the window upon wich we will draw
  //
  ATOM MyRegisterClass(HINSTANCE hInstance)
  {
      WNDCLASSEX wcex;
  
      wcex.cbSize = sizeof(WNDCLASSEX);
  
      wcex.style         = CS_HREDRAW | CS_VREDRAW;
      wcex.lpfnWndProc   = WndProc;
      wcex.cbClsExtra    = 0;
      wcex.cbWndExtra    = 20;
      wcex.hInstance     = hInstance;
      wcex.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_PONG));
      wcex.hCursor       = LoadCursor(NULL, IDC_ARROW);
      wcex.lpszMenuName  = MAKEINTRESOURCE(IDC_PONG);
      wcex.lpszClassName = szWindowClass;
      wcex.hIconSm       = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
      wcex.hbrBackground = (HBRUSH)GetStockObject (BLACK_BRUSH);
  
      return RegisterClassEx(&amp;wcex);
  }
  
  BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
  {
      HWND hWnd;
  
      hInst = hInstance; // Store instance handle in our global variable
  
      hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, 819, 600, NULL, NULL, hInstance, NULL);
  
      if (!hWnd)
      {
          return FALSE;
      }
  
      ShowWindow(hWnd, nCmdShow);
      UpdateWindow(hWnd);
  
      return TRUE;
  }
  
  LRESULT CALLBACK WndProc(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 DefWindowProc(hWnd, message, wParam, lParam);
          }
          break;
  
      case WM_PAINT:
          hdc = BeginPaint(hWnd, &amp;ps);
          // TODO: Add any drawing code here...
  
          //Draw player rectangle get class look page 237 - 
          SelectObject(hdc,GetStockObject(WHITE_BRUSH));
          Rectangle(hdc,
              (int)playerPos.x -10,
              (int)playerPos.y - 50,
              (int)playerPos.x + 10,
              (int)playerPos.y + 50); 
  
          //Draw AI rectangle get class look page 237 - AI
          Rectangle(hdc,
              (int)aiPos.x -10,
              (int)aiPos.y - 50,
              (int)aiPos.x + 10,
              (int)aiPos.y + 50);  
  
          //Draw the ball 
          Ellipse(hdc,
              (int)ballPos.x -20,
              (int)ballPos.y - 20,
              (int)ballPos.x + 20,
              (int)ballPos.y + 20);
  
          EndPaint(hWnd, &amp;ps);
          break;
  
      case WM_KEYDOWN:
      {
          switch(wParam)
          {
          case 'Z':
              playerPos.y -= 5;
              break;
          case 'S':
              playerPos.y += 5;
              break;
          }
  
          // up, down, enter to play or restart
  
          break;
          return 0;
      }
  
      case WM_DESTROY:
          PostQuitMessage(0);
          break;
      default:
          return DefWindowProc(hWnd, message, wParam, lParam);
      }
      return 0;
  }
  
  // Message handler for about box.
  INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  {
      UNREFERENCED_PARAMETER(lParam);
      switch (message)
      {
      case WM_INITDIALOG:
          return (INT_PTR)TRUE;
  
      case WM_COMMAND:
          if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
          {
              EndDialog(hDlg, LOWORD(wParam));
              return (INT_PTR)TRUE;
          }
          break;
      }
      return (INT_PTR)FALSE;
  }
  </code></pre>
  
  <p>I hope this is enough info! this thing is driving me crazy since sunday. Any help why I can't draw would be appriciated, I've tried putting it in the run and the drawing and a couple of other things</p>