You are here:

C++/Subclassing in Excel 2000


Apologies in advance. I just asked your Expert colleague, Lal, the same question as follows. But after reading your crudentials, I thought your knowledge of the API might be more appropriate!

I'm working on a project that subclasses the 'EXCEL7' child of the 'XLMAIN' top-level window in Excel. Specifically, I am testing for the WM_NCHITTEST mouse_move message.

The messages are being sent properly to my WindowProc, I am able to process them effectively, and I am sure to pass them along to the client window.

However, as soon as the sublass initializes, the window will no longer receive mouse-clicks. It's especially odd since I can enter the formula bar in the 'XLMAIN' window, hit enter, then navigate the screen normally using the cursor keys.

I'll be happy to post/mail the project so you can see for yourself.

Kind regards, Tim

Tim, Thank you for your question.

It sounds like your subclassing procedure is failing to pass some Windows messages on to the original windows procedure, or is modifying the arguments.

Remember that your subclassing procedure is executed in the Excel process, not that of your application, so be careful in referencing any global data. Be sure to call the CallWindowProc function, not the original windows procedure directly.

I regret that I am unable to take the time to study your source code due to the volume of questions received.

David Spector


All Answers

Answers by Expert:

Ask Experts


David Spector


Highly knowledgeable in the C++ language, Visual C++ (MSVC), Windows API, documentation and other quality-assurance techniques, and debugging. Knowledgeable in MFC, COM, GUI design, and object-oriented design.


I have been a software engineer since 1965. I have been published. My specializations have been: biomedical programming, compiler implementation, and many kinds of Windows programming. I don't do Databases or other business-oriented stuff.

Windows?/DOS Developer's Journal, ACM SIGPLAN Notices, and Computer Science Press.

ICCP Systems Programming Certification
Master's degree equivalent in Computer Science

©2016 All rights reserved.