Results 1 to 8 of 8

Thread: use qprocess like shellexecute

  1. #1
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default use qprocess like shellexecute

    Hi all!

    Is it possible to use QProcess like the WinAPI Shellexecute?
    I would like to print several Documents and i do this with

    ShellExecute(NULL, (LPWSRT)"print", (LPWSTR)doc.utf16(), NULL,NULL,SW_HIDE);
    But i have to wait until the process is finished, but i can't do this with ShellExecute and
    ShellExecuteEx doesn't work really?

    Now can i do the same like ShellExecute with qprocess?
    THX

  2. #2
    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: use qprocess like shellexecute

    Yes, of course. Just call cmd.exe as the program to start and communicate with its stdin/stdout if you need the shell (it's possible that you don't). If you don't need the shell, call the application you want directly from QProcess.

  3. #3
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use qprocess like shellexecute

    i want to print the document directly.
    i can do this with

    ShellExecute(NULL, (LPWSRT)"print", (LPWSTR)doc.utf16(), NULL,NULL,SW_HIDE);

    can i do this with the cmd and qprocess, isn't it possible to do this without cmd?

  4. #4
    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: use qprocess like shellexecute

    If "print" is an application then you can do it without cmd. But if "print" is a command implemented by cmd, then you need cmd to run it. Just try it and see what you get.

  5. #5
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use qprocess like shellexecute

    "print" is a verb, no parameter or program. it says ShellExecute, that it shall say the program(which is bound with the ending, ShellExecute gets a filename and opens the program bound to it bsp test.txt, ShellExecute opens Notepad.exe, which shows the test.txt) "print the document that i give you and close".

  6. #6
    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: use qprocess like shellexecute

    So it needs cmd.exe.

  7. #7
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use qprocess like shellexecute

    please give me an example how i can print my test.txt with the cmd

  8. #8
    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: use qprocess like shellexecute

    You might have searched the forum...
    Check http://www.qtcentre.org/forum/showthread.php?t=3712

Similar Threads

  1. Replies: 8
    Last Post: 28th January 2015, 09:45
  2. Quoting problem with QProcess
    By the_bis in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2006, 11:24
  3. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30
  4. QProcess start automaticaly needed application
    By raphaelf in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2006, 14:11
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 15:52

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.