Announcement

Collapse
No announcement yet.

receiving registerd message

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • receiving registerd message

    i have a console app that needs to monitor for a windows message (created with RegisterWindowMessageand received in response to BroadcastSystemMessage). can anyone tell me how to intercept this message from a pbcc app?

    tia
    don
    Don Dickinson
    www.greatwebdivide.com

  • #2
    Code:
    FUNCTION PBMAIN () ...
    
       CreateWindowEx   ..     (NOT %WS_VISIBLE IS FINE) 
       ShowWindow 
       MessageLoop 
    
    
    FUNCTION myWndProc 
    
      [COLOR="Red"]STATIC [/COLOR]TheMessage AS LONG 
    
       SELECT CASE AS LONG wMSg
            CASE %WM__CREATE
               TheMessage =  RegisterWindowMessage (....) 
    
            CASE TheMessage
                   do something, because you just received the registered message
    
    .....
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      ah, just a hidden window? easy enough. thanks.
      -don
      Don Dickinson
      www.greatwebdivide.com

      Comment


      • #4
        Or create a GRAPHICS WINDOW and subclass it. It is hidden by default.

        Comment


        • #5
          Related: Actually does RegisterWindowmessage and processes same:

          Add a 'Favorite Files' menu to your application 10-25-07

          That does it in a dialog procedure, but the principle is the same. (DragListMsg)
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            I know you know this, Don, but newer members may not...

            Given this is a PB/CC program, I am guessing that program is actually "doing something else" whilst waiting for this message.

            Therefore, you probably want to run the either the message loop or the 'something else' in a separate thread of execution.

            You could build on GUI + Worker Thread + Abort Demo 11-24-07, launching the "something else" as a separate thread of execution on WM_CREATE .

            When "something else" is done, it can post a message (WM_CLOSE comes to mind) back to the same (invisible?) window, and on WM_CLOSE in the WndProc you can Unregister the message (thou shalt clean up) before allowing the default processing, which is to destroy the window.

            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment

            Working...
            X