Printers Object Not Exposed on Server

Posted on 2004-11-10
Last Modified: 2008-02-01
I have developed an application in Visual Basic 6 that will spawn multiple instances of the printing our company's billing statements.  It works great from a PC, but it fails when executed as a service through vb scripting.

When it fails, my error log shows that that the exe was uable to view the printers object.  The error number returned is #484 "Problem getting printer information from the system.  Make sure the printer is set up correctly."

The ap was developed on a Windows 200 PC, and the Server is Windows 2000, sp 4.

The really odd thing about this is that it will execute fine if I log into the server remotely and execute it using "Start | Run".

Question by:dgorden
    LVL 28

    Expert Comment

    Is the service set to interact with the desktop?Have you tried setting the service to run under the administrator account or an account that has the printers set-up in the profile.

    Author Comment

    No, the service is not supposed to interact with the desktop.  It does however read and write to an MS SQL database with no issues.

    We have set up an NT account just for this process, and given the account Admin rights.  Rights to the printers have been given to the account.  The default printer is the Acrobat PDF Writer, and it has even been shared and set to "use printer off line".  

    LVL 2

    Accepted Solution

    The underlying API to enumerate the printers cannot be called from a service.  You need to hard code the name of the printer (in a ini file?) or pass it in some other way.

    Author Comment

    Well, thanks for the help.  
    It's not the answer I hoped for, but I will put this in an ini file.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now