Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer API functions

Status
Not open for further replies.

tabhijit

Programmer
Feb 10, 2003
61
HK
Hi all,

I am getting handle of the printer using OpenPrinterA API function with no error.

But if I am using same handle for GetPrinterA. It says that "handle is invalid".

Please help me,

Thanks,
Abhijit.
 
Hi,

Code is as followed.

//opening printer Returns true
lb_success = OpenPrinterA (ls_printer_name, ll_printer, lstr_printer_defaults )

// Return 0 i.e. SUCCESS, no error
ll_error = getlasterror()

Now printer handle is stored in ll_printer and is passed to GEtPrinter function.
// Returns false
lb_success = GetPrinterA (ll_printer,2,lstr_str_printer_Info_2,ll_buffer,ll_pcbNeeded)
// Returns 6 i.e.invalid handle.

Thanks,
Abhijit.
ll_error = getlasterror()
 
i will see what could be your problem ( if i can find it ), but why don't u use PRINTOPEN ?
have u seen it ?

Regards
 
it's difficult to see your problem, 'cause it's very possible that u have a wrong param.

ll_buffer = how long is it ?, 'cause u have to assign memory, example

string ls_dir

ls_dir = space(255)

getcurrentdirectory( ls_dir ) // it's a make up

and did u evaluate lb_success when OpenPrinter is executed ?
ll_printer should be > 0

or your have to take care with your declaration, 'cause there is param with *.






 
hi all,

We had evaluated lb_success and it is true and ll_Printer > 0

We have assigned ll_Buffer = ll_PCBneeded.

Still it is giving problem.

Thanks,
Abhijit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top