This question relates to messages, subclassing and hooking windows and windows messages.

Now, I have my application that successfully hooks GetMessageW() and DispatchMessageW() in another.

What I wish to do with this program I have hooked is to subclass a window STRAIGHT AFTER it has been created.

I just don't understand how I would do this though. I mean, the inadequate solution I am using now works- check if FindWindow() returns a HWND every time GetMessageW() is called- but this is exactly my problem. GetMessageW() doesn't get called until it gets a message from user input. So I need to actually bring down a menu or similar to call GetMessageW(). This means that EVERYTIME GetMessageW() is called it calls FindWindow() in hope.

And even if it does find the window (the dialog has been created) it'll miss all the messages until I actually do something to the window. I want to EnableWindow(HWND, FALSE) almost immediately after it has been drawed.

There has to be a way to SetWindowLongPtr() immediately after a Dialog has been created... but how? What message would be sent through the messagepump to the app when a new dialog is created? Is there even one?

I'm soo lost. The only thing I can think of is hooking a Create Dialog function...

Could someone please help me on this one?