Jump to content

GUIRegisterMsg20 - Subclassing Made Easy


LarsJ
 Share

Recommended Posts

The range of messages is a Microsoft definition.


I've done a lot of performance tests. Primarily in this example.

If the same subclassing is performed with GUIRegisterMsg(), GUIRegisterMsg20() and SetWindowSubclass() then the message filtering speed will be this (fastest first): GUIRegisterMsg(), SetWindowSubclass() and GUIRegisterMsg20().

GUIRegisterMsg() is fastest because message filtering is done in internal compiled code.

If you implement SetWindowSubclass() yourself, you can optimize the message filtering a bit and therefore SetWindowSubclass() is the second fastest.

GUIRegisterMsg20() is slowest as the function is coded as a UDF and therefore cannot be easily optimized for the given situation.

An important purpose of GUIRegisterMsg20() is that it can be used in situations where GUIRegisterMsg() cannot be used. And in these situations, it's of no use that the message filtering is a bit faster in GUIRegisterMsg().

However, message filtering is not so important in terms of the overall performance of all the subclassing code. The code in the message handling function itself is far more important. Eg. the code in the WM_NOTIFY() function shown in the Too much code section in first post. And that code is the same in all three methods. Thus, in the Too much code example, the code will fail in all three methods.

Edited by LarsJ
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...