Change header and footer of Internet Explorer for printing

Share your advanced PureBasic knowledge/code with the community.
yabune
User
User
Posts: 65
Joined: Mon Aug 22, 2005 2:31 pm

Change header and footer of Internet Explorer for printing

Post by yabune »

Code updated For 5.20+

Here's a way to change the header and footer of Internet Explorer printings:

- Install Droopy's Lib (for the Registry Functions)

and code like this:

Code: Select all

#REG_PAGE_SETUP = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup"

header_new.s = "New Header"
footer_new.s = "New Footer"

; do a backup of the current header and footer
header_old.s = RegGetValue(#REG_PAGE_SETUP,"header",".")
footer_old.s = RegGetValue(#REG_PAGE_SETUP,"footer",".")

; set the new header and footer
RegSetValue(#REG_PAGE_SETUP,"header",header_new,#REG_SZ,".")
RegSetValue(#REG_PAGE_SETUP,"footer",footer_new,#REG_SZ,".")

; ..
; Do your printings
; ..

; restore the old header and footer
RegSetValue(#REG_PAGE_SETUP,header_old,#REG_SZ,".")
RegSetValue(#REG_PAGE_SETUP,"footer",footer_old,#REG_SZ,".")
In the new header and footer strings you can include the following variables:
&w Window title
&u Page address (URL)
&d Date in short format
&D Date in long format
&t Time
&T Time in 24-hour format
&p Current page number
&P Total number of pages
&b Right-aligned text (following &b)
&b&b Centered text (between &b&b)
&& A single ampersand (&)

Yabune
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

Cool! thanks!
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
Post Reply