printing - WinAPI call to DeviceCapabilities(DC_ENUMRESOLUTIONS) for Epson P50 always report error -


i'm faced strange behaviour - seems impossible enum resolutions epson ink printers in windows. in particular code reports error:

int r, err; char szbuffer[0x4000]; string prnname = "epson p50 series"; string portname = "usb002";  r = devicecapabilities(prnname.c_str(), portname.c_str(), dc_enumresolutions, null, null); err = getlasterror(); printf("\n 1.devcap.result = %d, err = %d", r, err);  r = devicecapabilities(prnname.c_str(), portname.c_str(), dc_enumresolutions, szbuffer, null); err = getlasterror(); printf("\n 2.devcap.result = %d, err = %d", r, err); 

in output see following:

1.devcap.result = -1, err = 0 2.devcap.result = -1, err = 13 

note: windows error 13 error_invalid_data.

could please me understand - how interpret correcly? mean drivers epson ink printers not provide information on supported print resolutions? or there invalid parameters passed? if yes, 1 be?

thank in advance.

ps. please note following:

1) printer , port names correct. obtaines enumprinters() winapi call. in code sample cut off irrelevant code, keep functions fail.

2) printer working fine, can print documents , photos it.

3) have added "epson stylus 300" printer configured use "file:" port printing. , interesting thing - call devicecapabilities(dc_enumresolutions) such printer reports error# 13. why incline think epson ink printers not provide info on print resolution...

4) other calls devicecapabilities() function (for dc_papers, dc_papersize, dc_papernames, etc) works fine these printers (epson p50 , epson stylus 300). so, printer name , port name correct, problem exists devicecapabilities(dc_enumresolutions) call.

that seem error epson printers. resolution values device dependent , shouldn't need anyway.

you may want obtain printer resolution through devmode , report user:

printdlg pdlg = { sizeof printdlg }; pdlg.flags = pd_returndefault | pd_returndc; printdlg(&pdlg);  devmode* dm = (devmode*)::globallock(pdlg.hdevmode); cout << "dm->dmdevicename: " << dm->dmdevicename << endl;  if (dm->dmfields & dm_printquality) {     cout << "dm->dmprintquality: " << dm->dmprintquality << endl; }  ::globalunlock(pdlg.hdevmode); 

dmprintquality either printer resolution or 1 of these device independent values:

#define dmres_draft         (-1) #define dmres_low           (-2) #define dmres_medium        (-3) #define dmres_high          (-4) 

if user wants change value it's better give access printer's own setup dialog.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -