locked
GetPrinter error and question RRS feed

  • Question


  • I'm having a problem with the GetPrinter call and wondered if anybody had a solution or suggestion. 

    Here are the specifics:

    The function being called is:

    Function boolean GetPrinter(ulong hPrinter, long Level, REF STRUCTURE pPrinter, long cbBuf, REF long  pcbNeeded ) Library "winspool.drv" Alias For "GetPrinterA;Ansi"

    The input values:

    ulong hPrinter                              - the value returned from a previous OpenPrinterA function call.  No problem here
    long Level                                   - default to 2
    Structure pPrinter                        - the PRINTER_INFO_2 input structure
    long cbBuf                                  - size of PRINTER_INFO_2 defaults to 84
    reference var long pcbNeeded      - the amount of memory needed, returned by reference.  Here is where I run into trouble

    I get varying results from different workstations when getting the pcbNeeded return variable.  I don't know if it is RAM related or what, but when the code ultimately succeeds, I get a larger return value for pcbNeeded, such as 10540.

    When the code ultimately fails, from a different workstation, I get a smaller return value of 576.

    The code in both cases references an HP LaserJet 4345mfp printer, the exact same printer in both cases, with the exact same settings.

    Could this problem be RAM related?  The PC that works has 1G and the one that does not has 512MB.

    Though before assuming this is the problem, the REALLY weird part is that my 1G RAM PC that is working now was failing earlier just like the other PC, though I made no changes and have no idea why it suddenly started working.

    Any idea on how to remedy the situation?

    Thanks in advance.

      
    • Moved by Kevin Woley Wednesday, August 5, 2009 8:41 PM to find the right forum (From:Windows Events)
    Wednesday, July 29, 2009 9:06 PM

Answers

All replies