CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Wm_message?

  1. #1
    Join Date
    Apr 2003
    Location
    Sydney, Australia
    Posts
    151

    Wm_message?

    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?

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543
    What about SetWindowsHookEx with WH_CBT parameter?

  3. #3
    Join Date
    Apr 2003
    Location
    Sydney, Australia
    Posts
    151
    Originally posted by Alex F
    What about SetWindowsHookEx with WH_CBT parameter?
    Nah, I'm trying to avoid SetWindowsHookEx()- all hooking + more can be achieved by hooking the functions that receive messages from the message pump. And I don't need to worry about ALT+CTRL+DEL, CTRL+ESC or ALT+ESC terminating it

  4. #4
    Join Date
    Apr 2003
    Location
    Sydney, Australia
    Posts
    151
    Or, would anyone have any idea which API function would 'most likely' be called when a dialog box is to be created?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured