Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT Inter Process Communication between softwares
QtWS25 Last Chance

QT Inter Process Communication between softwares

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 3.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aniljoby
    wrote on last edited by
    #1

    I have a application software developed in qt with my side in windows. What i want to do is, i want to control another 3rd party application software like Microsoft power-point. The control functions i need is simple and for example

    1. To change the slide when i press a button in my qt app.
    2. Zoom the slide area when i press another button.
      I read about IPC accessibility in windows and i don't which one should we use and how to use to transfer functions between qt and power-point
      https://msdn.microsoft.com/en-us/library/windows/desktop/aa365574(v=vs.85).aspx
      Hope you guys will help me to figure out this problem. Thanks in advance
    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      if you want control a 3rdparty software you have to verify if and what kind of IPC protocol the software supports.
      I mean that, if you want control PowerPoint, you have to read in the PowerPoint documentation if it can be controlled via IPC (IIRC MS Office provide a developer library)

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by Chris Kawa
        #3

        An easy way to control Microsoft Office applications "remotely" is through OLE Automation.

        Here's an example (in C, but should be easy to port to C++) how to open/close Excel: OLE Automation and here's more details and examples in the form of Q&A.

        Also, Qt provides QAxObject to ease the COM stuff involved with the above.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          aniljoby
          wrote on last edited by
          #4

          After some google search I think we can create keyboard events, since Powerpoint have some keyboard shortcuts...
          So now i want to develop my Qt app with a button.. on pressing that some keyboard events should generate and Powerpoint will accept that..
          But how highlighting two apps at the same time... ?
          Whether Powerpoint will get that keyboard events?

          1 Reply Last reply
          0
          • Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            You can't. Only one app can have focus, but that's really not a good idea even if it was possible. What would happen if something changed the currently focused app or moves a mouse while your program runs?

            Automation is your best bet here and it's easier than it might seem.
            Here's a little demo I did some time ago that opens PowerPoint, starts a slideshow, switches every slide after 3s and then closes.

            #include <Windows.h>
            #include <QCoreApplication>
            #include <QAxObject>
            #include <QThread>
            
            int main(int argc, char *argv[])
            {
                QCoreApplication a(argc, argv);
                QString pptFile = "C:/some_file.pptx";
                CoInitialize(NULL);
                {
                    QAxObject pp("PowerPoint.Application", nullptr);
                    auto presentations = pp.querySubObject("Presentations");
                    auto presentation =  presentations->querySubObject("Open(QString)", pptFile);
                    auto slides = presentation->querySubObject("Slides");
            
                    auto sliseshowsettings = presentation->querySubObject("SlideShowSettings");
                    sliseshowsettings->dynamicCall("Run()");
                    auto slideshowwindow = presentation->querySubObject("SlideShowWindow");
                    auto slideshowview = slideshowwindow->querySubObject("View");
            
                    int numSlides = slides->property("Count").toInt();
                    for(int i = 1; i < numSlides; ++i) {
                            QThread::currentThread()->sleep(3);
                            slideshowview->dynamicCall("Next()");
                    }
                    QThread::currentThread()->sleep(3);
                    pp.dynamicCall("Quit()");
                }
                CoUninitialize();
            }
            
            1 Reply Last reply
            0
            • A Offline
              A Offline
              aniljoby
              wrote on last edited by aniljoby
              #6

              But virtual keyboard in windows works..
              We can create keyboard events with mouse clicks which will get accepted by the software just focused back with the help of this on screen keyboard..
              In short i think i need to develop one like virtual keyboard with qtbuttons.

              void MainWindow::on_pushButton_clicked()
              {
                  keybd_event(VK_SPACE, 0x20, 0, 0);
                  keybd_event(VK_SPACE, 0x20, KEYEVENTF_KEYUP, 0);
              
              } 
              

              But it doesn't doing anything ...
              Please help me to figure out this

              1 Reply Last reply
              0
              • Chris KawaC Offline
                Chris KawaC Offline
                Chris Kawa
                Lifetime Qt Champion
                wrote on last edited by
                #7

                When you click a button the focus is on that button and the active app is the one with the button. If you create a keyboard event at that time it will be sent to the active app (the one with the button) and then to the button itself. It goes nowhere near PowerPoint or any other app this way.

                If you wanted to pass the keyboard messages to another app in the background you would have to get a handle to it (e.g. using FindWindow and then post keyboard messages directly to it using PostMessage. This has some serious limitations and side effects though, as described well here by one of the MS guys.

                As I said earlier - it's a very bumpy road to do it this way and extremely error prone.
                I'd really reconsider automation.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  aniljoby
                  wrote on last edited by
                  #8

                  Automation is good...
                  But my ultimate aim is to develop a qt app which responds to hand gestures using image processing. And that section is ok.
                  I want to control powerpoint using my hand gestures.
                  I think virtual keyboard is capable of sending keyboard signals to another application.
                  So how to transfer the control signals to Powerpoint from my qt app.??

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved