CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Mar 2006
    Posts
    11

    Angry PrintTo command in the ShellExecute

    Hello,

    I'm trying to use the ShellExecute API to print an HTML file to a specified printer passing the "printto" as the command verb.
    My default Internet Explorer is IE 7.0 Beta (I tried this also on IE 6), the problem that also I use the PrintTo verb and I pass the printer name to the ShellExecute, the Print Dialog of the IE.
    Is this a bug in IE? Is there any workaround solution? Please give me a hand.

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: PrintTo command in the ShellExecute

    Quote Originally Posted by mon
    the problem that also I use the PrintTo verb and I pass the printer name to the ShellExecute, the Print Dialog of the IE.
    Is this a bug in IE? Is there any workaround solution? Please give me a hand.
    Maybe it's just me, but could you please rephrase your question?

    - petter

  3. #3
    Join Date
    Mar 2006
    Posts
    11

    Re: PrintTo command in the ShellExecute

    I'm sorry that some text missing....


    The problem that also I use the PrintTo verb and I pass the printer name to the ShellExecute, the Print Dialog of the IE pop ups. I don't want to show this IE print dialog.
    Is this a bug in IE? Is there any workaround solution?
    Please give me a hand.

  4. #4
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: PrintTo command in the ShellExecute

    You can supply "print" in lpOperation argument, I dont think that there is any way to pass printer name from ShellExecute, you will need to write a program which does so.
    Code:
    ShellExecute(handle, "print", "C:\\MyFileToPrint.Doc", NULL, NULL, SW_SHOWNORMAL);
    Regards,
    Ramkrishna Pawar

  5. #5
    Join Date
    Mar 2006
    Posts
    11

    Re: PrintTo command in the ShellExecute

    Thanks Mr. Krishnaa,
    But you can print to a pecified printer using the "printto" as the lpOperation, and passing the printer name as the lpParameters.
    Any way this is not my problem. When you use the "print" verb, and passing as in ur example a DOC file, it will be printed directly to the default printer without showing the print dialog. But this is not the case when trying to print an HTML file, instead, the print dialog will pop ups. And this is my problem.

  6. #6
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: PrintTo command in the ShellExecute

    Quote Originally Posted by mon
    Thanks Mr. Krishnaa,
    But you can print to a pecified printer using the "printto" as the lpOperation, and passing the printer name as the lpParameters.
    Any way this is not my problem. When you use the "print" verb, and passing as in ur example a DOC file, it will be printed directly to the default printer without showing the print dialog. But this is not the case when trying to print an HTML file, instead, the print dialog will pop ups. And this is my problem.
    As I said, printto can not be used with ShellExecute, as it is not any standard operation which ShellExecute can understand. PrintTo is a custom shell menu entry which invokes certain executable/command. It is not available on every computer.
    If you are looking for solution for your local computer or where that entry is available then you can find out what command used to handle PrintTo in registry, it might be under HKEY_CLASSES_ROOT\txtfile\shell, note that txtfile is taken as example you need to use the file extension(like htmlfile, docfile etc) for which PrintTo is available on your system.
    Regards,
    Ramkrishna Pawar

  7. #7
    Join Date
    Mar 2006
    Posts
    11

    Re: PrintTo command in the ShellExecute

    Mr. Krishnaa,

    I don't know why you leave the main idea of the problem and catch the small details.
    I can use the "printto" command and it works fine, and if you want to learn how; I can send you a sample program.

    Now, as I said before, "printto" is not the problem. Try the "print" with DOC files and show the behavior of printing to the deafult printer, and after that try it with HTML file, and notice that the PRINT DIALOG will be SHOWN.............

  8. #8
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: PrintTo command in the ShellExecute

    Quote Originally Posted by mon
    Mr. Krishnaa,

    I don't know why you leave the main idea of the problem and catch the small details.
    I can use the "printto" command and it works fine, and if you want to learn how; I can send you a sample program.

    Now, as I said before, "printto" is not the problem. Try the "print" with DOC files and show the behavior of printing to the deafult printer, and after that try it with HTML file, and notice that the PRINT DIALOG will be SHOWN.............
    Take a look at this thread, similar to your problem,

    http://forums.microsoft.com/MSDN/Sho...58140&SiteID=1
    Regards,
    Ramkrishna Pawar

  9. #9
    Join Date
    Mar 2006
    Posts
    11

    Re: PrintTo command in the ShellExecute

    It is also my thread, no one there can answer my question, and it seems the same here.
    Any way, thanks for your interest and time Mr. Krishnaa.

  10. #10
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: PrintTo command in the ShellExecute

    Looks like I misunderstood you for little while, I was confused with "print to file" menu item added by certain printer application.

    Good luck.
    Regards,
    Ramkrishna Pawar

  11. #11
    Join Date
    Mar 2006
    Posts
    11

    Re: PrintTo command in the ShellExecute

    I hope dealing with you in other problems that may have solutions
    Thanks a lot.

  12. #12
    Join Date
    Aug 2014
    Posts
    1

    Re: PrintTo command in the ShellExecute

    http://connect.microsoft.com/IE/feed...g-print-dialog

    Microsoft has acknowledged this bug and plans to fix it in the next version of IE - probably IE12.

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