Change WordPad PageMargin registry value

timspratt
timspratt used Ask the Experts™
on
I need to understand how to know what the registry stores the page margin info for wordpad as. I know the location is:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Wordpad\Options\PageMargin

I am writing a application to change the pagemargin values (using Autoit3)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014
Commented:
Hi, the page margin is a Binary value, which is difficult to interpret what it actually represents.

If you want to change the page margin for all users, you would be best to set it manually in Wordpad, then export the above value from the registry to a .reg file, then use

regedit /s \\server\share\WordpadMargin.reg

Regards,

Rob.
The key contains sixteen bytes, four for each margin. The margin is stored as a four-byte number (a long integer) and the units of measure is the twip (1440 twips is one inch).

With the margins left, right, top, bottom of 1", 2", 3", 4", the setting becomes:

    hex:a0,05,00,00,e0,10,00,00,40,0b,00,00,80,16,00,00

0x5a0 = 1440 = 1"; 0x10e0 = 4320 = 3"; 0xb40 = 2880 = 2"; 0x1680 = 5760 = 4"

So the order is left, top, right, bottom.

Cheers!
(°v°)
Top Expert 2014

Commented:
@timspratt

To expound on the Harfang comment...
These are long integer values store in the same byte sequence as found in a (VB) long integer variable stored in memory.  Since Windows/Intel is a 'little endian' environment, it means the least significant byte is the left-most byte.

'twip' stands for TWentieth of a Point or TWentieth of an Imperial Point.  It is a typographical measurement related to font sizes.  I try to use 12 point fonts for better legibility of my documents.  Since there are 72 such points to an inch, the 20 multiplier gives the 1440 twips/inch calculation.
Most Valuable Expert 2012
Top Expert 2014

Commented:
angelIII, I recommend that all of the above comments be accepted.  My solution is easy enough, as long as the page margin is to be the same, otherwise harfang and aikimark have provided good guidance on how to modify the registry value accordingly.

Rob.
Top Expert 2014

Commented:
I don't think my comment qualifies.  It serves as clarification for current and future readers.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial