hDC (newbie)

This is a discussion on hDC (newbie) within the C++ Programming forums, part of the General Programming Boards category; I'm completely confused over what this hDC thing is. In the OpenGL tutorials ( http://www.cprogramming.com/tutorial/gl5.html ), it mentions them, but ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    2

    hDC (newbie)

    I'm completely confused over what this hDC thing is. In the OpenGL tutorials (http://www.cprogramming.com/tutorial/gl5.html), it mentions them, but I don't quite understand what exactly it is. Could someone please explain it in a jargon-free way?

    Thanks!

    HGLRC wglCreateContext(HDC hDC);

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    You should've posted this in the Win32 section, but oh well.

    HDC is a handle to a device context.

    A device context is a Windows data structure containing information about the drawing attributes of a device such as a display or a printer. All drawing calls are made through a device-context object, which encapsulates the Windows APIs for drawing lines, shapes, and text. Device contexts allow device-independent drawing in Windows. Device contexts can be used to draw to the screen, to the printer, or to a metafile.


    Reference: MSDN April 2000


    Hopefully that clears it up for you.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    2
    Oh, OK. I think I get it, thanks!

    Sorry about posting on the wrong board.

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    14
    It is really like a handle to the video memory. MS Windows cares for the interface between your programm and your video card.

    example:

    case WM_PAINT:
    hdc = BeginPaint (hwnd, &ps);
    TextOut (hdc, 20, 20, "Ich bin ein Fenster.", 20);
    EndPaint (hwnd, &ps);
    return 0;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My progress.. thnx to Cprogramming forumites
    By csonx_p in forum Windows Programming
    Replies: 6
    Last Post: 05-21-2008, 01:17 AM
  2. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  3. My first "real" windows app
    By JoshR in forum Windows Programming
    Replies: 2
    Last Post: 07-28-2005, 07:40 AM
  4. destroywindow() problem
    By algi in forum Windows Programming
    Replies: 6
    Last Post: 03-27-2005, 10:40 PM
  5. opengl program as win API menu item
    By SAMSAM in forum Game Programming
    Replies: 1
    Last Post: 03-03-2003, 06:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21