Trouble with OpenPrinter API and HP JetDirect 500X print server

Posted on 2005-03-31
Medium Priority
Last Modified: 2012-06-27
I am trying to address each of the three separate ports on a HP JetDirect 500X print server using the OpenPrinter API (Private Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, ByVal pDefault As Long) As Long) The phPrinter variable keeps returning 0 which indicates an unsuccessful connection. I am passing the IP address of the print server to the pPrinterName parameter. Can anyone tell me what I am doing wrong?
Question by:gbzhhu
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

BenBuck earned 2000 total points
ID: 13671519
I have had almost exactly the same problem. You can treat each port as an individual printer. The trick is to pass the port number along with the IP address when calling the API. Depending on the number of ports on the print server you need to add a number to the following connection string HTTP://xxx.xxx.xxx.xxx/ipp/port


HTTP://xxx.xxx.xxx.xxx/ipp/port1 to access port number 1 or HTTP://xxx.xxx.xxx.xxx/ipp/port2 to access port number 2.

Hope this helps.
LVL 12

Author Comment

ID: 13671562
I know our printer has 2 ports.  I will check this out

LVL 12

Author Comment

ID: 13671722

Thanks for that and contrary to my last post there are three ports (just a typo).  The API now works but only for two ports.  I expect it is either my syntax on port name or the port itself has a problem.  Either way I am happy to figure it out myself

Cheers for the quick solution

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

765 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