tags:

views:

177

answers:

3

I'm searching for some examples on drawing basic shapes on the screen using only the Win32 API in C++

  • Do you need other libraries beside the standard Win32 API?
  • Could you give me a very short example on how to, e.g.: draw a single line on the screen?
  • Are there libaries that are easier to use for basic drawing than Win32?
A: 

1) You can use the Win32 API by its self.

2) short, simple and Win32API don't go in the same sentence, just creating the window to draw your text in is over 100 lines. Some Win32 API tutorials can be found here, looking at the "A Simple Window" tutorial will show you what I mean.

3) My personal favourite is wxWidgets I uses the Win32 API behind the scenes so looks like a proper Windows app to the user, but is far nicer to code with and is fully OO. Edit you also have Microsofts MFC, and QT.

If your going for graphics (eg for a game) rather than a fully functional GUI thing, you might also look at things like Direct2D, Direct3D, OpenGL, SDL, etc. which are designed more for the graphical side of things.

Fire Lancer
+1  A: 

This should help you out: Using GDI+ from MSDN

kitchen
+2  A: 

If you are targeting windows 7, you can also use Direct2D:
http://blogs.msdn.com/directx/archive/2009/05/12/2d-drawing-apis-in-windows.aspx

Joel Martinez