Results 1 to 3 of 3

Thread: Getting the Device Context

  1. #1

    Getting the Device Context

    I'm trying to create an opengl window with mfc. When I write "GetDC(hWnd)" in Oncreate, the compiler says "function does not take 1 parameters." Can anybody tell me what I might have done wrong?

  2. #2

    Re: Getting the Device Context

    I presume this comes from a CWindow or derivative....

    In the MSDN docs it says this...


    and in the class CWindow

    HDC GetDC()

    you are calling the latter in your class, which is fine omit the parameter unless the hwnd is not the CWindow. In that case call

    ::GetDC(HWND) (notice particularly the "::") to get to global scope

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Fargo, ND

    Re: Getting the Device Context

    There's also

    CDC* CWnd::GetDC();

    In that case if you want an HDC for that particular window, you can do something like this..

    HDC hDC = GetDC()->GetSafeHdc();
    Software Engineer and OpenGL enthusiast

Similar Threads

  1. Which CL device for GL context?
    By Dark Photon in forum OpenCL
    Replies: 0
    Last Post: 04-26-2011, 10:26 AM
  2. one device, no cpu and no context
    By the_dude in forum OpenCL
    Replies: 1
    Last Post: 12-13-2010, 10:58 AM
  3. Device Context
    By Andrew Jameson in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-24-2002, 08:35 PM
  4. can't get a device context
    By Ethan in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-14-2001, 05:49 PM
  5. Open GL Device Context and VB
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-14-2001, 01:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean