CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2001
    Location
    India, Bangalore
    Posts
    14

    Problem in Printing

    I have a VB executable which simply prints a form when executed. When I run
    it from the command line it prints the form to the printer correctly.
    My requirement is to shell this EXE from a web page. The web server is the
    same machine on which the VB executable resides. I use the WScript object to
    shell it, as shown below:

    "Dim WshShell
    Set WshShell = Server.CreateObject("WScript.Shell")
    WshShell.Run "c:\inetpub\scripts\PrintTest.exe"
    Set WshShell = Nothing"

    The EXE shells, but the print does not take place and I get an error called
    "Printer Error". I have checked up Microsoft's article on this and have
    changed registry settings so that the printer is available under the SYSTEM
    user identity
    (http://support.microsoft.com/support.../Q184/2/91.asp).
    However, I still get the same error.
    Incidently, the above does not work even if I shell the EXE through an
    intervening DLL, instead of shelling it directly from an ASP page using
    Wscript.
    My web server is IIS 5.0 running on Windows 2000.

    Any help or suggestions will be appreciable..

    Regards
    Praveen


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Problem in Printing

    The printer isn't available from an ASP page (or from any process started by the ASP page). I'm not sure why they done this, but I can think of some reasons. To work around this program, you will need to run a program on the server that will do the shell. This program just needs to know when to shell it. You will have to figure out a way to do that, but I'll give some possibilities.

    1) Create a file on a specific location. The program then checks for that file every 5 seconds. If the file exists, the program deletes it, and does the shell.

    2) Write a value to the registry, although I'm not 100% sure this can be done from ASP. Same as above, check to see if the value is there, if so, delete it and do the shell.

    3) DDE, this is a way to comunicate with other programs, but is a bit unstable, but it's a possibility.

    I just named three, but there are more possibilities, probably even better.

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    May 2001
    Location
    India, Bangalore
    Posts
    14

    Re: Problem in Printing

    Hi Cakkie,
    Thanks for your suggestion. I could able to fix the problem.
    Thanks a lot

    Regards
    Praveen


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