title: WinGdi SetPixelFormat failure and returns 0xFFFFFFFF
body: <p>i am trying to attach window to opengl (wglCreateContext) but before doing it, i need to set a pixel format for it. ChoosePixelFormat succeeds but SetPixelFormat returns always 0xFFFFFFFF (-1). Calling GetLastError returns 0 (success) so i am confused about what is wrong. MSDN says that SetPixelFormat should return only 0 or 1 (not -1). Im doing it in asm but here is pseudo c code:</p>
  
  <pre><code>hdc = GetDC(CreateWindowExA(0, "edit", 0, WS_POPUP | WS_MAXIMIZE | WS_VISIBLE, 0, 0, 0, 0, 0, 0, 0, 0)); //window is successfully created
  SetPixelFormat(hdc, ChoosePixelFormat(hdc, ppfd), ppfd); //ChoosePixelFormat returns 7
  //returned value is -1
  //GetLastError returns 0
  wglMakeCurrent(hdc, wglCreateContext(hdc)); //both fails and GetLastError = 0x7D0 (The pixel format is invalid)
  </code></pre>
  
  <p>its based on reverse engineering so the pixel format descriptor is in bytes, sorry:</p>
  
  <pre><code>db 0x28,0x00,0x01,0x00,0x25,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
  </code></pre>
  
  <p>Thank you for any help</p>
  
  <p>--EDIT:
  The pixel format descriptor rewrited to c:</p>
  
  <pre><code>LPPIXELFORMATDESCRIPTOR ppfd;
  ::memset(ppfd, 0x0, 0x28);
  ppfd-&gt;nSize = 0x28;
  ppfd-&gt;nVersion = 1;
  ppfd-&gt;dwFlags = PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
  ppfd-&gt;iPixelType = 0x0;
  ppfd-&gt;cColorBits = 32;
  ppfd-&gt;cDepthBits = 16;
  </code></pre>