CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2004
    Posts
    13

    Hang on send WM_COPYDATA

    I want to encapsulate IPC into a dll, so I dont want to import a handle from other window. Instead, I created a window in the dll to receive message, but when i send WM_COPYDATA from other process, the process hung on SendMessage. What's matter?
    appreciate for any advice.

    BTW: the window I created is CWindow and it's parent is NULL.
    endless song

  2. #2
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: Hang on send WM_COPYDATA

    How are you calling SendMessage ?

  3. #3
    Join Date
    Apr 2004
    Posts
    13

    Re: Hang on send WM_COPYDATA

    This way.
    ::SendMessage(hWnd, WM_COPYDATA, (WPARAM)m_hWnd, (LPARAM)&copydata);

    I think the problem is no thread call GetMessage.
    but how can i create a thread to call?
    endless song

  4. #4
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: Hang on send WM_COPYDATA

    I am kinda confused. I understand your theory of not having messagepump.. but SendMessage shouldn't be needing the queue at all. It should directly call the wndproc. I am trying to find any info on MSDN that says if it is necessary for a message pump to be there for the wndproc to be called

  5. #5
    Join Date
    Apr 2004
    Posts
    13

    Re: Hang on send WM_COPYDATA

    When a worker thread sends a message to a window, the SendMessage function queues up the message for the window.
    If SendMessage is called from the same thread that owns the window, the message is never queued;
    Obviously, I call SendMessage from diffrent thread.
    endless song

  6. #6
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: Hang on send WM_COPYDATA

    As one of the jobs of the dll , you could spawn a thread and create a window and a message pump in it..

    BTW, have you thought about other forms of IPC ?

  7. #7
    Join Date
    Apr 2004
    Posts
    13

    Re: Hang on send WM_COPYDATA

    I have found some other way to do the same thing.
    thanks. : )
    endless song

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