Okay, I am trying to learn Windows programming and there are all sorts of new data types that I am running into and need to learn. I'm trying to understand the point of it all and failing. If there is no point and it's just Microsoft making things difficult for no reason, well I guess that's life and I'll just deal with it. But if there IS a point to these types, I'd like to understand.

For example, pretty much anything starting with a P is a pointer to something, so PINT8 is the same as INT8*, PINT16 is the same as INT16*, PUCHAR is the same as UCHAR*, etc. Also, everything seems to be capitalized for some reason. int is the same as INT, char is the same as CHAR, long is LONG.

Now there is something called a "handle", which is new to me, which is a void* or PVOID. There are a whole bunch of "handles". Regular old "Handle" appears to be a handle to an "Object". Then you get more specific. A handle to a brush is an HBRUSH, and handle to a bitmap is an HBITMAP, a handle to a cursor is an HCURSOR, etc.

However, looking at the typedefs, almost all the handles appear to typedef to HANDLE, which is PVOID, which is void*. HFILE is an exception. It's an int, so not a pointer at all.

There's also something called LPARAM, which is typedefed to be equivalent to LONG_PTR. I'm seeing types like LPLONG, which is defined as long*. And I'm seeing PLONG which is also a pointer to a long, or long*. So LPLONG and PLONG are equivalent? So why have both?

There is also a PHANDLE, which is a pointer to a HANDLE, so if a HANDLE is a void*, then PHANDLE must be a void**?

My source is this link. In the comments section, someone opined that some of the "Handle" stuff is obsolete. I've also heard that "handles" are not to be thought of as normal C++ pointers, but are rather things that are not to be dereferenced or used with pointer arithmetic, etc. Thus even though HANDLE is defined as a PVOID, you use PVOID if you're doing the regular C++ stuff and need a void* pointer (i.e. malloc), but not HANDLE, even though it's defined as the same thing.

It's all quite confusing to me. They have all these typedefs that end up being defined as the same thing, so I'm wondering why bother having them. Clearly it's for the humans READING the code, so I'm wondering whether we're supposed to start writing code like this...

PINT a = new INT[10];

instead of

int* a = new int[10];

which seems rather silly as the former is now completely un-portable for no obvious reason. Just want to know if there is a method to this madness. This "handle" stuff is supposed to make things easier to understand, but it's having the opposite effect.

My view over the years is that there were and are some thousands that made this mess. There have been efforts to clean it all up but since it's a commercial enterprise there is a limit to what they'll do.

OK, so there is no master plan here so it would be a never ending slog to find all the data types used by all C++ and Windows API today.

This is why I never tried to learn me all (Pokemon?) but only dive back into the areas I need to understand and little more.

There are academia types that will disagree so I'll tell why I took this approach. "I want this app in 2 weeks." (Obvious Money Pitt reference?)

OK, so there is no master plan here

All right, I'll take that as an "It is what it is, roll with it" philosophy and that there is no deeper meaning to it all that I should master in order to do Microsoft programming. Wouldn't be the first time some guy decided to get creative and create a bunch of new names for the same types and then those types remained for legacy reasons. Thanks.

At least you rolled with my typos too. Thanks for that. At least it's not like one job I had where they insisted to redefining int, Int, true, false and so on. But I did not complain as a few week job took months.

Why they do that? (bad grammar intentional) "Productivity."

At least you rolled with my typos too.

Huh? You had typos? Didn't see them. Re-reading it, I STILL don't see them (unless you meant "Pit" instead of "Pitt". I looked that one up. Brad Pitt wasn't in it. I recall that movie... now). "Learn me all" I assumed was intentional. My spell-check isn't finding any typos either. As far as "Why they do that?", I see you've never been a consultant. I believe the answer is "Billable hours". The more productive you are, the less money you make for the company.

But I did not complain as a few week job took months.

Or maybe you HAVE been a consultant.

Anyway, if I was getting PAID to learn Microsoft data types, I wouldn't complain, but as this is on my own time, types like LPWSTR are starting to bug me. I imagine that Microsoft has its own version of every C++ function that takes a char* parameter that I'll need to learn.

I meant to write "learn them all" which is like "catch them all" as the Pokemon Go craze is in full swing here.

As to the two weeks, I kid you not. And yes I've been in many engineering positions and the only old new thing is that some think apps will only take two weeks given all the advancements over the years. The consultant label is tossed at me when they want to well, I would be guessing it has to do with health insurance and the ability to tell me goodbye at any time.

That goodbye is something you have to be at ease with. There have been so many projects over the years.

commented: +Rep for Pokemon Go +5