Printing in landscape using WebGadget

Just starting out? Need help? Post your questions and find answers here.
johnnyutah
User
User
Posts: 27
Joined: Sat Oct 16, 2004 1:25 pm

Printing in landscape using WebGadget

Post 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?
johnnyutah
User
User
Posts: 27
Joined: Sat Oct 16, 2004 1:25 pm

Post 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!
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Printing in landscape using WebGadget

Post 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? :)
johnnyutah
User
User
Posts: 27
Joined: Sat Oct 16, 2004 1:25 pm

Post 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
Post Reply