GetWindowLong question

What does GetWindowLong(hwnd, 0) mean? I saw this in neatpad tutorial
Did you check MSDN??

https://msdn.microsoft.com/en-us/office/ms633584%28v=vs.103%29.aspx

It seems that function call is either accessing extra window data or, for a dialog box, the return value from its window procedure.
In my IMNSHO, that function, along with SetWindowLong(), are among the most important Windows API functions for GUI Apps. They constitute nothing less than the 'getters/setters' of object properties (properties of windows) in terms of the OOP paradigm, when implemented in non - OOP languages such as C. And don't forget the Windows Api is C based - not C++.

So in C++ you can create classes and include member variables in your class. In C based OOP, your RegisterClassEx() window constitutes an instance of a 'class', and you mutate member variables of the 'class' through GetWindowLong()/SetWindowLong(). Actually, these have been superceeded by GetWindowLongPtr()/SetWindowLongPtr().

It is a more awkward way of accessing your member variables than if they were wrapped in a C++ class, but there is an offsetting benefit. When OOP is done using procedural languages such as C or PowerBASIC, the resulting executables are really small. That doesn't matter to too many folks anymore, but it matters to me.
Last edited on
When OOP is done using procedural languages such as C or PowerBASIC, the resulting executables are really small. That doesn't matter to too many folks anymore, but it matters to me.

ummm no... first of all, you are writing a lot of boiler plate code to achieve oop, whereas in a language such as small talk or c++, you already have it, you can also achieve things a lot cleaner with a lot less boilerplate in oop than in procedural (assuming you are trying to emulate oop in a procedural language). does that mean the executable of an oop-through-procedural exe will never be smaller than a real oop language exe? no. that would just depend on the environment, like normal
Topic archived. No new replies allowed.