Microsft Photo Editor hanges when printo verb is used

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • piyusht
    New Member
    • Jan 2010
    • 8

    Microsft Photo Editor hanges when printo verb is used

    Hello,

    I have a small piece of code to launch a file and print it to desired printer. The code is as follows:

    Code:
    objProcess.StartInfo.FileName = "C:\test.jpg";
    objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden | ProcessWindowStyle.Minimized;
    objProcess.StartInfo.UseShellExecute = true;
    objProcess.StartInfo.CreateNoWindow = true;
    objProcess.StartInfo.ErrorDialog = false;
    objProcess.StartInfo.Arguments = "HP Lazer Jet 1010";
    objProcess.StartInfo.Verb = "Printto";
    objProcess.Start();
    This code works perfect will all files extensions except ".jpg". As soon as i try with ".jpg" Microsoft Photo Editor opens and goes to "not responding" mode.

    When I use "print" verb it works well.

    I've verified that proper command is given to printto verb in file association.
    "C:\Program Files\Common Files\Microsoft Shared\PhotoEd\ PHOTOED.EXE" /pt "%1" "%2" "%3" "%4"

    If I manually open a jpg file in Microsoft Photo and print; it works well.

    I've tried reinstalling the photo editor but no luck. I'm unable to figure out what's the problem with printto verb.

    Please help me.

    Regards,
    Piyush
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    So your application isn't actually printing anything?
    You are just trying to cause any file passed to open in its default application and print?
    Is that right?
    If it were a text file you assume it will open in NotePad?
    If it were a jpg file you assume it will open in MS Photo Editor?

    Comment

    • piyusht
      New Member
      • Jan 2010
      • 8

      #3
      That's right tlhintoq. I'm just trying to open the file passed in its default application and print.

      Comment

      • piyusht
        New Member
        • Jan 2010
        • 8

        #4
        Yes my application causes the file passed to open in its default application and print.

        Comment

        • tlhintoq
          Recognized Expert Specialist
          • Mar 2008
          • 3532

          #5
          But you have no way of knowing what program the user has set as the default for a specific type. On your computer the default for a text file might be notepad. For someone else it might be WordPad. For someone else it could be Microsoft word.
          When I use "print" verb it works well.
          I'm unable to figure out what's the problem with printto verb.
          I've never actually tried doing what you are try so please bear with me.
          • If it works with the "print" verb why not go with that?
          • What does "printto" give you that "print" does not?
          • Have you tried changing the default program for that file type to see if a different program will react the way you want to the "printto" command? Maybe it is a bug is that one program.

          Comment

          • piyusht
            New Member
            • Jan 2010
            • 8

            #6
            Hi Tlhintoq,

            My idea here is to shell the file and let the application associated with its file extension open the application. That's how it works in Windows as well. File extensions like ".txt", ".doc" etc are associated with some programs and mainly there are three verbs "Open", "Print" and "Printto".

            Use can view this in Folder Options-->File Types by clicking the advanced button. Please check the attached file.

            I hope it makes it clear.
            Attached Files

            Comment

            • piyusht
              New Member
              • Jan 2010
              • 8

              #7
              My answers to the questions:
              • If it works with the "print" verb why not go with that?
                That's because "print" verb doesn't allow choosing printer. It prints on default printer that can be changed any time.
              • What does "printto" give you that "print" does not?
                The answer is same "printto" allows to print the file to a specified printer.
              • Have you tried changing the default program for that file type to see if a different program will react the way you want to the "printto" command? Maybe it is a bug is that one program.
                Yes this works with other programs but my issue is specific to MS Photo Editor. If I change it to any other program it work fine, but i cannot guaranty that user's machine will not have MS Photo editor as it is quite common program.

              Comment

              Working...