Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

need a help

Intel_C_Intel
Employee
654 Views
hello,
i get stuck! i reaaly need to know if i can draw a graphic on a windows client area, or calling graphic from menu bar. i am trying to understand gdi, but it is hard. is this posssible to do that? if yes, is there anyone who tried it before? could you help me?
0 Kudos
3 Replies
Jugoslav_Dujic
Valued Contributor II
654 Views
The most important concept you must have in mind is that Windows doesn't do the screen buffering for you; instead, every application is being informed via WM_PAINT message that it should update its screen. WM_PAINT is sent whenever a portion of the window is revealed; application is supposed to do a BeginPaint, draw onto supplied device context (DC), and call EndPaint to tell Windows that it has updated the screen OK and that the update rectangle is now valid.

However, if you draw directly (using e.g. Rectangle) on supplied DC, the window contents will flicker during moving/sizing, as updating takes considerable time. Thus, any non-trivial application usually does double-buffering itself -- it creates an off-screen (memory) DC and it just "copies&pastes" its contents onto DC returned by BeginPaint.

I wouldn't say GDI is hard; rather, it's a bit boring, because you have to take care to create and delete GDI objects yourself. Attached workspace uses double-buffering technique and my XFTGDI module, which is a thin wrapper around most frequently used GDI calls; you can find the documentation (.chm) here. Make sure you read the Platform SDK/Graphic and Multimedia services/GDI/Painting and Drawing chapter first.

(Attachment in the followup. My additions to wizard-generated code are clearly marked).

Jugoslav
0 Kudos
Jugoslav_Dujic
Valued Contributor II
654 Views
Here it is.
0 Kudos
Intel_C_Intel
Employee
654 Views
hi,
thank you for your kindly respond. i will try to understand what you wrote...
0 Kudos
Reply