Changing registry settings is not the supported way to do this.
The correct way is to use the DEVMODE
structure.
The remarks at the bottom of the DocumentProperties
function describe the correct way to merge a new setting (such as paper size) with the existing configuration.
Don't worry that it describes how to change the settings for your application. Replace the last step (CreateDC
) with calling the SetPrinter
function at level 8 to change the global defaults for that printer (or use level 9 to change the per-user defaults).
Doing this would be much easier in C++, since you can use the Windows-provided header files. The structures involved are very complex, and getting the right p/invoke definitions would be extremely difficult.