Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem with CreateWindowEx(..)! Please Help!

Problem with CreateWindowEx(..)! Please Help!

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nutkase
    wrote on last edited by
    #1

    Well, while working on a class i am facing a really bad problem! well, i just cant get it! i just run the following code BOOL COpenGLWindow::CreateOpenGLWindow(RECT Rect,char* WindowCaption,bool Fullscreen,int Bits,UINT ExStyle,UINT Style,HWND Parent) { WNDCLASS WndClass; WndClass.style=CS_VREDRAW|CS_HREDRAW|CS_OWNDC; WndClass.lpfnWndProc=OpenGLWndProc; WndClass.cbClsExtra=0; WndClass.cbWndExtra=0; WndClass.hInstance=GetInstHandle(); WndClass.hIcon=::LoadIcon(NULL,IDI_WINLOGO); WndClass.hCursor=::LoadCursor(NULL,IDC_ARROW); WndClass.hbrBackground=0; WndClass.lpszMenuName=0; WndClass.lpszClassName="OpenGLClass"; if(!RegisterClass(&WndClass)) { OutputDebugString(); return FALSE; } bool ShowWnd=(Style&WS_VISIBLE); Style|=~WS_VISIBLE; //AdjustWindowRectEx(&Rect,Style,FALSE,ExStyle); if(!(hWnd=CreateWindowEx(ExStyle,"OpenGLClass",WindowCaption,Style,Rect.left,Rect.top,Rect.right-Rect.left,Rect.bottom-Rect.top,Parent,(HMENU)NULL,GetInstHandle(),NULL))) { OutputDebugString(); return FALSE; } if(!(hDC=GetDC())) { OutputDebugString(); return FALSE; } PIXELFORMATDESCRIPTOR pfd= { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, Bits, 0,0,0,0,0,0,0,0,0,0,0,0,0, 24, 0,0,0,0,0,0,0 }; int PixelFormat; if(!(PixelFormat=ChoosePixelFormat(hDC,&pfd))) { OutputDebugString(); return FALSE; } if(!SetPixelFormat(hDC,PixelFormat,&pfd)) { OutputDebugString(); return FALSE; } if(!(hRC=wglCreateContext(hDC))) { OutputDebugString(); return FALSE; } if(!wglMakeCurrent(hDC,hRC)) { OutputDebugString(); return FALSE; } if(ShowWnd) { ShowWindow(hWnd,SW_SHOW); SetForegroundWindow(hWnd); SetFocus(hWnd); } return TRUE; } and the call to CreateWindowEx Failes ! GetLastError() prints INvalid Window Handle.?!?!?!?:confused: well the call bieing made to this function is as follows: CreateOpenGLWindow(Rect,"Mine",false,16,WS_EX_APPWINDOW|WS_EX_WINDOWEDGE,WS_POPUPWINDOW,NULL); WEll i m in serious trouble so please help as soon as possible! shoaib. Doesn't Window Really Sucks!

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups