Page 1 of 1

Printing in landscape using WebGadget

Posted: Mon Jul 04, 2005 6:53 pm
by johnnyutah
Hi,

I just can't find a way to automatically change the page aspect from portrait to landscape. According to Microsoft you can change the following in the registry:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

PageOrientation : REG_DWORD

Specifies page orientation. Valid settings are 1=portrait, 2=landscape.

However, the registry tweak doesn't work. Am I doing something wrong?

Posted: Wed Aug 10, 2005 3:26 pm
by johnnyutah
I didn't get a response to this question but I really need an answer. If anyone has any suggestions please let me know!

Re: Printing in landscape using WebGadget

Posted: Wed Aug 10, 2005 8:27 pm
by Trond
johnnyutah wrote:However, the registry tweak doesn't work. Am I doing something wrong?
Obviously you are, if it doesn't work.










Hint: Maybe showing the code you are using to set the registry? :)

Posted: Sat Aug 13, 2005 12:46 pm
by johnnyutah

Code: Select all

Procedure.s ReadRegKey(OpenKey.l, SubKey.s, ValueName.s)
    hKey.l = 0
    KeyValue.s = Space(255)
    Datasize.l = 255
    If RegOpenKeyEx_(OpenKey, SubKey, 0, #KEY_READ, @hKey)
        KeyValue = "Error Opening Key"
    Else
        If RegQueryValueEx_(hKey, ValueName, 0, 0, @KeyValue, @Datasize)
            KeyValue = "Error Reading Key"
        Else 
            KeyValue = Left(KeyValue, Datasize - 1)
        EndIf
        RegCloseKey_(hKey)
    EndIf
    ProcedureReturn KeyValue
EndProcedure

Procedure.l WriteRegKey(OpenKey.l, SubKey.s, KeySet.s, KeyValue.s)
    hKey.l = 0 
    If RegCreateKey_(OpenKey, SubKey, @hKey) = 0
        Result = 1
        Datasize.l = Len(KeyValue)
        If RegSetValueEx_(hKey, KeySet, 0, #REG_SZ, @KeyValue, Datasize) = 0
            Result = 2
        EndIf
        RegCloseKey_(hKey)
    EndIf
    ProcedureReturn Result
EndProcedure

Code: Select all

WriteRegKey(#HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Internet Settings", "PageOrientation", 2)
The code works but the registry tweak doesn't - I tried it manually as well. Apparently there are lots of problems getting Internet Explorer to automatically print landscape as it doesn't support certain features of css which allow you to control print aspect. There may be some way to do this through javascript?

On a completely separate note, if anyone knows how to use the "browseforfolder" object through the Windows API can you point me in the right direction because I can't find anything about it by searching the forums. :D