Results 1 to 7 of 7

Thread: Is possible to change the parameters of an external application using Qt?

  1. #1
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Is possible to change the parameters of an external application using Qt?

    Hi all, In my application I need to generate a PDF document using Qt4.1. Before generating the document, the aplication allow the user to configure some issues of the final document: if it can be printed or not, block copy/paste of the text and images, enable/disable it's modification,... To print (generate) the document I use PDFCreator on WindowsXp that let specify all these options to generate the PDF file in a configuration menu. My question is: anybody knows how could I change/set these settings of PDFCreator using Qt? Thanks.
    Last edited by SkripT; 12th April 2006 at 18:42.

  2. #2
    Join Date
    Feb 2006
    Posts
    24
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Is possible to change the parameters of an external application using Qt?

    I am also interested in the reply on this thred.

    Can any one reply - Is possible to change the parameters of an external application using Qt?

    Thanks.

  3. #3
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Is possible to change the parameters of an external application using Qt?

    Well I tried this once...and the only way that i could figure out was if to pass command line arguments to the app using QProcess - but this is true only for apps which provide the command line options ...... sounds imbecile but this is the advantage of Unix!

  4. #4
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is possible to change the parameters of an external application using Qt?

    Thanks nupul. I've been asking it in a forum of PDFCreator and the answer is that is possible to change it's configuration using COM. The problem is that I've never used it, so anyone could tell me if Qt supports COM and where could I find some examples of its usage? I've seen in the PDFCreator manual that exists public classes, properties, methods and events for working with COM but I don't know how to use them with Qt I only want to set these properties in the creation of the COM object (i don't know if it's exactly in this way):
    Quote Originally Posted by PDFCreator COM Manual
    Public PDFDisallowCopy As Long
    Public PDFDisallowModifyAnnotations As Long
    Public PDFDisallowModifyContents As Long
    Public PDFDisallowPrinting As Long


    Thanks.
    Last edited by SkripT; 13th April 2006 at 10:42.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Is possible to change the parameters of an external application using Qt?

    Quote Originally Posted by SkripT
    so anyone could tell me if Qt supports COM
    Yes.
    and where could I find some examples of its usage?
    In the ActiveQt section of the docs

  6. The following user says thank you to wysota for this useful post:

    SkripT (13th April 2006)

  7. #6
    Join Date
    Apr 2006
    Location
    Minsk, Belarus
    Posts
    33
    Thanks
    2
    Thanked 6 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Is possible to change the parameters of an external application using Qt?

    This is the example code which shows how Adobe Distiller can be used via COM using QAxObject. Distiller performs its work in a separate thread. This allows not to block UI while distiller is working

    Qt Code:
    1. void MyThread::run()
    2. {
    3. OleInitialize(NULL);
    4. QAxObject* distiller = new QAxObject();
    5. bool result = distiller->setControl("{1CD675B2-ECD1-11D1-B976-00600802DB86}");
    6. QObject::connect(distiller, SIGNAL(OnPercentDone(int)), m_pParentDialog, SLOT(onpercentdone(int)));
    7. QObject::connect(distiller, SIGNAL(OnPageNumber(int)), m_pParentDialog, SLOT(onpagenumber(int)));
    8. QObject::connect(distiller, SIGNAL(OnLogMessage(const QString&)), m_pParentDialog, SLOT(onlogmessage(const QString&)));
    9. QValueList<QVariant> params;
    10. params << inputfile;
    11. params << outfile;
    12. params << joboptions;
    13. int res = distiller->dynamicCall( "FileToPDF(const QString&,const QString&,const QString&)", params ).toInt();
    14. delete distiller;
    15. OleUninitialize();
    16. }
    To copy to clipboard, switch view to plain text mode 

    Distiller converts PostScript files into PDF. It has some signals that can be handled by my own objects.

    If you want to get some help info about using COM object you can generate HTML file using dumpdoc utility from Qt package. Example:

    dumpdoc.exe "{1CD675B2-ECD1-11D1-B976-00600802DB86}" > helpDistiller.html

    Parameter for this utility should be CLSID of the COM server

  8. The following user says thank you to Conel for this useful post:

    SkripT (13th April 2006)

  9. #7
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is possible to change the parameters of an external application using Qt?

    Hi all, today I've been reading the ActiveQt section from the docs. I've never worked with COM and I've found it a bit hard. But I think that finally I have understood how it works (the code that Conel has posted has been very helpful too, thanks):

    1) Declare a QAxObject or a QAxWidget
    2) Set the name of the COM object wrapped by the object with "setControl"
    3) Call the methods of the COM object using "dynamicCall".
    My question is, in the PDFCreator docs COM section defines the class "clsPDFCreatorOptions" with the members that I need to use:
    Public PDFDisallowCopy As Long
    Public PDFDisallowModifyAnnotations As Long
    Public PDFDisallowModifyContents As Long
    Public PDFDisallowPrinting As Long
    Are these members avaible using dynamicCall if I create a QAxObject with control "clsPDFCreatorOptions" or I have to use the "QObject::setProperty"? I think that I haven't understand at all this part...
    Another question is: should I have to manage the generation of the PDF file using the QAxObject or, if I use QPrinter, it will mantain the properties fixed in QAxObject for the generation of the PDF doc?
    Last edited by SkripT; 14th April 2006 at 00:08.

Similar Threads

  1. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 17:50
  2. Using Qt in an application with lots of parameters
    By Bookmarc in forum Qt Programming
    Replies: 1
    Last Post: 3rd November 2008, 21:52
  3. shared vs static
    By alisami in forum Installation and Deployment
    Replies: 3
    Last Post: 4th October 2008, 13:04
  4. Replies: 16
    Last Post: 23rd May 2008, 10:12
  5. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 22:04

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.