Reputation: 1353
As I written in the title, I was looking for a way to retrieve available sheets format of a specific printer in C++. At the moment I can only retrieve the current settings in this way:
LPWSTR pName = L"My Printer Name";
HANDLE _printerHandle;
OpenPrinterW(pName, &_printerHandle, NULL);
LONG size = DocumentPropertiesW(NULL, _printerHandle, pName, NULL, NULL, 0);
PDEVMODEW info = (PDEVMODEW)malloc(size); //here I get/set settings
DocumentPropertiesW(NULL, _printerHandle, pName, info, NULL, DM_OUT_BUFFER);
Any help would be appreciated
Upvotes: 0
Views: 198
Reputation: 47962
Use DeviceCapabilities to query for DC_BINS
. That'll give you an array of WORDs, where each word corresponds to a paper source. (Look at the description of the dmDefaultSource
in the description of the DEVMODE
to interpret the values.)
You can also use DeviceCapabilities to query for DC_PAPERS
or DC_PAPERSIZES
to learn about supported paper sizes.
Upvotes: 2