I'm at the very beginning of programming for Windows.
int a=1; // global integer
long WINAPI WndProc(msg){
HDC hdc; /* What is the exact meaning of this
line? */
switch(msg){
case WM_PAINT:
RECT rect;
BeginPaint(&rect);
DrawText("Hello World");
EndPaint();
default: ...}}
Q: Why do I always have to write RECT, BeginPaint, EndPaint, HDC ? What are the exact meanings of these Instructions? All my books say HDC has something to do with a device context, and that it is necessary. How is a line like HDC hdc; translated into Machine Instructions (such simple lines like LW r1,1000(r0) will not be enough, am I right?) What about the portability of programs using HDC hdc?
I've also trouble with the SetFocus function, it almost ever leads to a window that can't be closed (this problem occurs in other contexts too. Sometimes I think GetMessage doesn't receive WM_CLOSE Messages though it had to.)
If you could answer any of these questions I'd be grateful because it would improve my understanding of WINAPI programming (Those thousands of classes and functions found in the Windows-libraries are very confusing, I doubt there is anyone on earth who can say: "I'm a perfect WINAPI-programmer.")
******************** *************************