Hello, I am really not sure if this is right place for posting question like I want, but I'll try. I am working on one application which handle also printing and I store all printing settings to my data file (by saving whole DEVMODE structure also with whole driver extra data). The problem is, that I received one file from customer, which seems old and it contains dmDriverVersion set to 1282. I have installed on my computer latest PDFCreator (1.3.2) and I see version there set to 1536. I tried to install also older versions of the PDFCreator (like 1.2.1 qand 1.1.0) but both of them reports me driver version 1536 in DEVMODE so I suppose it is not directly related to the PDFCreator. Has someone some information about this? What influence this version? I tried also different versions of Ghostscript (8.15 and 8.64) but it doesn't influence the driver version. The main problem about this is, that I want to migrate DEVMODE from older version to newer version for the same printer, but I am not able to do this by calling DocumentProperties function, so I am trying to analyze it little bit. The reason for doing this is found problem related to custom page size - with dmDriverVersion set to 1282 the page size is not saved (when I display printer properties twice, the custom page size is reset) and problem is fixed with the 1536 version.
Hello, thanks for quick reply. I don't have any problem with this 'public' part of the DEVMODE (which is described on the link, which you sent). Let me explain the problem in more details ;-) I have DEVMODE structure from DocumentProperties from the user (using PDFCreator - but I don't know the version which he used - the file is realtively old) - this structure with all extra data has 864 bytes (dmDriverVersion = 1282). If I setup the PDFCreator on my computer I get DEVMODE with size 1016bytes (dmDriverVersion = 1536). The problem is, that if I use user's DEVMODE for displaying printer properties, everything looks fine, but returned DEVMODE is still in old version. And with this version there is a problem with saving Postscript custom page size - when I go to the properties dialog and close it with 'ok' button and then open the properties again, custom paper sizes are reset to A4 sizes. This doesn't happen with the dmDriverVersion = 1536. So I am looking for some possibility how to migrate the DEVMODE loaded from the file to the current version which is available on the computer but I want to keep all extra settings in the dialog which are not described by the public part of the DEVMODE.
I tried the recommendation from this link: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183576(v=vs.85).aspx (To make changes to print settings that are local to an application, an application should follow these steps).
But the problem is, that the custom user setting are lost in this case. So I tried adding those lines:
``` // copy settings from m_pDevMove to pDevMode size_t devModePublicDataOffset = reinterpret_cast(&pMigratedDevMode->dmFields) - reinterpret_cast(pMigratedDevMode);
size_t devModePublicDataSize = sizeof(DEVMODE) - devModePublicDataOffset;
size_t devModePrivateDataSize = std::min(pMigratedDevMode->dmDriverExtra, pUserOldDevMode->dmDriverExtra);
memcpy(&pMigrateDevMode->dmFields, &pUserOldDevMode->dmFields, devModePublicDataSize + devModePrivateDataSize);
<div>just before the last call of the DocumentProperties - for the PDFCreator it is working .. but it really looks not very safe, because it is not clear, what is stored in driver extra data part (private part of the DEVMODE) so it is hard to say if I can just simply copy the data from older version to the newer.</div><div> </div><div>If my questions are beyond the scope of this forum, let me know ;-)</div><div> </div><p> </p>
according to MSDN (http://msdn.microsoft.com/en-us/library/windows/desktop/dd183565(v=vs.85).aspx) the dmDriverVersion is set by the driver developer, so this number related to the printer driver used and is not comparable between different drivers.
The specification should also give you a hint for the direction to extract the paper size information.
At least they are beyond my scope, I am afraid ;-)
I have too few insight in the DEVMODE structure to give a good recommendation here, but maybe someone else can help?