i am new in window programming. can i ask u something about this?
what is Hwnd?
what is Hdc HDC?
Wparam,wm_paint,wm_char!!! that is far i asked first.
can i have some good explanation on this?
plss...
))
why we need the HDC?
i am new in window programming. can i ask u something about this?
what is Hwnd?
what is Hdc HDC?
Wparam,wm_paint,wm_char!!! that is far i asked first.
can i have some good explanation on this?
plss...
))
why we need the HDC?
Originally posted by MITCHELL
i am new in window programming. can i ask u something about this?
what is Hwnd?
what is Hdc HDC?
Wparam,wm_paint,wm_char!!! that is far i asked first.
can i have some good explanation on this?
plss...
))
why we need the HDC?
Well first off to do almost anything in windows programming you need what's known as a handle to what you want to mess with.
HWND = handle to a window
HDC = handle to a device context
A device context is what you need to do any painting (which includes text, etc). It specifies what region you're referring to painting on.
WParam and LParam are different parts of messages that you can get. Windows is a message(event)-driven system. This means that when your program recieves a message from windows, your program needs to react accordingly. WM_PAINT and WM_CHAR are examples of messages you can get. In WParam or LParam might get passed coordinates or other values that the code for each message may require.
couldn't have said it better, you just missed what a handle is:
a handle is basically a number used to access a window, a device context, or even an application.
Oskilian
hi,zen.
i think u have given me a good explanation.
but..what can we do with the lparam and wparam?
i am still confious in that matter.
pls help me out with this.Thanks.
where can i learn more in here?
show me the way.... ))
When you create an application/program it has a HINSTANCE. This is the HWND to the program.
Each window or dialog in the program has a HWND(as do the controls on the dialog/windows).
When Windows gets a message for your program it is passed to a special function, a CALLBACK.
Here you write a complicated SWITCH/CASE statement to handle the different types of messages(ie WM_PAINT to redraw the screen)
Additional information is passed with the message, WPARAM and LPARAM. Depending on what message, you determine what happened.
for example if the user resized the window the following would be your code
Code://******************************* case WM_SIZE://size message cxSize=(int)(LOWORD(lParam));//get the new width cySize=(int)(HIWORD(lParam));//get the new height RePaintView(hWnd,cxSize,cySize);//do the resize in your function break; //*******************************