Results 1 to 10 of 10

Thread: How to use Qt inner process communication to return value to native win32 application

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    61
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use Qt inner process communication to return value to native win32 applica

    You can also use the name pipe like squidge said, it's a easy solution too and I recommend using it, but I don't know how, I never used it ^^.

    -

    About the name of the memory, it's in the tutorial, in the constructor:

    Qt Code:
    1. Dialog::Dialog(QWidget *parent)
    2. : QDialog(parent), sharedMemory("QSharedMemoryExample")
    To copy to clipboard, switch view to plain text mode 

    And from the tutorial:

    "Note that "QSharedMemoryExample" is passed to the QSharedMemory() constructor to be used as the key. This will be used by the system as the identifier of the underlying shared memory segment."

    The "QSharedMemoryExample" is the name that they are using as the name.
    Use the same name that you're using in your win32 app.

    And you question about the signal the changes you can use the CreateEvent function.
    http://msdn.microsoft.com/en-us/libr...(v=VS.85).aspx

    edit:
    How to do:

    - CreateEvent in the launcher; CreateEvent Function

    - Create a thread to wait the event using WaitForSingleObject; WaitForSingleObject Function

    - In the Qt Process use OpenEvent to get the handle of the event; OpenEvent Function

    - Write data to the SharedMemory.

    - Use SetEvent in the handle, so the WaitForSingleObject will return now; SetEvent Function

    * If you're using a "single-shot" read, in the launcher call CloseHandle in the event.

    * If you want a two-way communication you can set two events and use Wait to monitor the changes, and using Set and Reset Event (ResetEvent Function) to notify that some work was done or need to wait before reading/writing.
    Last edited by rsilva; 6th May 2011 at 23:55.

Similar Threads

  1. Replies: 3
    Last Post: 6th January 2010, 16:55
  2. Native QFileDialog position under Win32
    By no_ghost in forum Qt Programming
    Replies: 0
    Last Post: 28th May 2009, 14:07
  3. Replies: 0
    Last Post: 10th April 2009, 15:28
  4. Open File /w Native Application
    By bpetty in forum Newbie
    Replies: 4
    Last Post: 27th October 2006, 22:19
  5. Inter Process Communication
    By yellowmat in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2006, 11:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.