I was wondering what the differences between LOWORD and HIWORD are, i want to know what there used for, how there used and why. I looked it up and on one site it says that "LOWORD returns the lower 16 bits of WHATEVER is passed into it. HIWORD the upper 16 bits." the upper and lower 16 bits of what???
Also what does WPARAM and LPARAM do? what are they used with and why. i read that there meant for mouse tracking and when you resize a window and getting the mouses button state. but is that correct? please elaborate on the 4 words please with as much detail as you can give.
In this case, the WPARAM wParam argument contains a 32 bits value. The upper 16 bits specifies that the event BN_CLICKED ocurred (the user pressed the mouse button) and the lower 16 bits specifies on which element the BN_CLICKED event have been actioned, in this case a button called MY_BUTTON. Instead of sending a 16 bits value for the event and another 16 bits value for the object affected by the event we send only a 32bit value (now when almost everyone has 32bit architecture computers) containing both values.
Somebody correct me if I am wrong.
Ok so if i understand this correctly, in a nutshell HIWORD is the Upper 16 bits of UINT and LOWORD is the Lower 16 bits of UINT???? am i correct so far??
WPARAM and LPARAM are just additional information that comes with the message. Their exact purpose depends on which message is actually being sent. They can mean completely different things for different messages.
For example, in a mouse click message, they might indication the position of the mouse. But for a button press message, they might be the ID of the button being pressed.
To know exactly how they're used, the easiest way is to look up the desired message on MSDN (ie, WM_MOUSEMOVE's page will say exactly what the WPARAM and LPARAM for that message do).
Ok, now UINT does what exactly? I know it stands for Unsigned Integer an i think i read that the value is higher than a regular Int, or something like that.
Ok so is there a site that explains this stuff other than MSDN? MSDN tends to get a little too technical for me, and sometimes doesnt explain things enough.
Also when you say something like int or char can hold x amount of values, does that mean just numbers or words? i assume words and numbers all have certain sizes correct?
MSDN is the best reference for WinAPI, but not necessarily the best way to learn it. There are books/tutorials that are much better in teaching it because they will walk you through how to actually use it.
MSDN is more like an encycopedia. It's more for looking up the details of a specific function/struct, as it will tell you pretty much every detail... what the parameters do, what the function returns, what the function actually does, any side-effects, etc.
Unfortunately, I don't have any recommendations for books/tutorials, as it's been so long since I've had to read any. :( Maybe someone else can help.
I have a question about my code also. So in it there is this:
1 2 3 4 5 6 7 8 9 10 11 12 13
INITCOMMONCONTROLSEX commCon;
commCon.dwSize = sizeof(INITCOMMONCONTROLSEX);
commCon.dwICC = ICC_TAB_CLASSES;
InitCommonControlsEx(&commCon); // have to run this to use tab control
hTabControl = GetDlgItem(H, TAB_MAIN);
TCITEM tcItem;
tcItem.mask = TCIF_TEXT; // I'm only having text on the tab
//Tab 1
tcItem.pszText = "Project Setup";
TabCtrl_InsertItem(hTabControl, 0, &tcItem);
What is commCon.dwSize?? I know commCon is assigned to INITCOMMONCONTROLSEX but why is there a '.' there? and is dwSize a keyword? is dwICC?
INITCOMMONCONTROLSEX is a structure and dwSize and dwICC are members (probably DWORD since they start with the 'dw'). DWORD is just a typedef for 32-bit integer, whereas WORD is a typedef for a 16-bit integer.
1 2 3 4 5 6 7 8 9 10 11
struct Girlfriend
{
string Name;
int age;
bool Keeper;
}; // sorry, forgot this first time around...
Girlfriend Jill; // creates an object of Girlfriend called Jill
Jill.Name = "Jill"; // Sets Name to "Jill"
Jill.Age = 24; // Sets Age to 24;
bool Keeper = false; // Poor Jill's just not a keeper...
If Jill had been a pointer to Girlfriend instead of an object the notation would have looked like:
Jill->Name = "Jill";
EDIT: fixed, forgot closing semicolon after struct definition