newb question:MSG struct? C++

im realy new to windows.h
i was wondering if i could have an explanation of what is the MSG handle class thing...

is it the same as UINT msg?
do i need multiple "MSG"s or
i just need one MSG class for everything?
it stores unsigned hex ints? like 0x41?

i just cant understand this code:
//also why do i need it?

MSG Msg; //every msg in the program?

while(GetMessage(&Msg, NULL, 0, 0) > 0) //0x0000001 or more?
{


TranslateMessage(&Msg); //turns it into string?
DispatchMessage(&Msg); // send to system?
}



//sorry for newbish
Last edited on
MSG is not a handle type.

From MSG structure
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644958%28v=vs.85%29.aspx

MSG structure

Contains message information from a thread's message queue.

Syntax (C++)

1
2
3
4
5
6
7
8
typedef struct tagMSG {
  HWND   hwnd;
  UINT   message;
  WPARAM wParam;
  LPARAM lParam;
  DWORD  time;
  POINT  pt;
} MSG, *PMSG, *LPMSG;


MSDN is the place to go to find out about Windows programming, if googling doesn't help.

MSDN -- Microsoft Developer Network
http://msdn.microsoft.com/

Andy
thank you for your answer
but i still wonder how MSG "Msg" get the values from here


__stdcall long int WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{


switch(msg)
{

case WM_CLOSE:
DestroyWindow(hwnd);
break;

case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
Last edited on
See Understanding the Message Loop
http://www.winprog.org/tutorial/message_loop.html

In particular the section "What is a Message Loop"

Andy

thanks andy
Topic archived. No new replies allowed.