PDA

Click to See Complete Forum and Search --> : Stupid question, I know, but...


CyberCarsten
Feb 28th, 2001, 09:51 AM
VB is easy, really easy compared to C++ right??
Well something(s!!!) really confuse me with C++
Fx.


HWND hwnd;
MSG msg;


What does this do??Does it make hwnd equal to HWND, or is a variable with the HWND created or??????!!!!!
It's the same with this:

LRESULT CALLBACK WindowProc(HWND hwnd,
UINT msg, WPARAM wparam, LPARAM lparam)


What does LRESULT and CALLBACK mean, is somekind of WORD parameter passed on to wParam???

Sorry if this is only a bunch of stupid questions! :)

HarryW
Feb 28th, 2001, 10:25 AM
It's just a different syntax to VB. Perhaps the reason you don't recognise it is because you haven't seen these data types before.

HWND is a datatype for a window handle.

HWND hwnd;

is the same as this in VB:
Dim hwnd as hWnd

MSG is the datatype for a windows message. These are defined in windows.h I believe.

LRESULT is just another datatype.


LRESULT CALLBACK WindowProc(........
here, LRESULT is the return type of the function WindowProc(). The return type always comes first in the function header. CALLBACK here means that it is a callback function, it's just a kind of function. I think it means that it's a function that is called by something outside your application. In this case, WindowProc is called by the Windows O/S whenever you dispatch a message to Windows. You tell Windows which function you want it to use to process messages when you register the window class for your window. You can have different functions for different window classes in your app if you like.

CyberCarsten
Feb 28th, 2001, 11:31 AM
Thanks again Harry! That helped alot! :)