Change screen orientation programmatically??

Discussion in 'Code Samples & Tips' started by HARRY, May 14, 2007.

  1. HARRY

    HARRY Active Member Licensed User

    Hi,

    I want to set at the start of my program the screen orientation to landscape and to portrait when closing the form.

    Does somebody know about code to realize that?

    Harry
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    There were small applications in the old forum that did this.
    I hope that one of the users who downloaded it will upload it again :sign0163:.
     
  3. PatrikL

    PatrikL Member Licensed User

    Hello, i have it on my desktop :)
     

    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

    Thanks PatrikL :)

    You need to use the Shell keyword with one of the programs to rotate the screen.
     
  5. Put Claude

    Put Claude Active Member Licensed User

    Hi,
    I upload again the orientation programs, you have to use them with the
    shell function:
    If isppc = True Then Shell("Lndsc270.exe", "")

    On the title you recognise where the pda-buttons are : BtnsR270.exe
    means the buttons are on the right in this landscape mode.

    You wil have automaticly scrollbars if the window do not fitt.
    Did not think it was a handy thing to some people, enjoy it....

    Put Claude Belgium
     

    Attached Files:

  6. HARRY

    HARRY Active Member Licensed User

    Thanks guys,

    That is exactly what I needed.

    Harry
     
  7. alfcen

    alfcen Well-Known Member Licensed User

    Quick'n sweet: are these freeware?
     
  8. Put Claude

    Put Claude Active Member Licensed User

    Hi alfcen,

    Of coarse its free to use...

    Put Claude Belgium
     
  9. alfcen

    alfcen Well-Known Member Licensed User

    Thanks a lot, Put

    Thanks to you, I have successfully incorporated the orientation switchers in combination with dzt's HTML Viewer and formlib.dll (full screen) for the purpose of replaying Flash (.swf) files on maximum possible screen area.

    Cheers
    Robert
     
  10. Put Claude

    Put Claude Active Member Licensed User

    hi alfcen'

    Y 'are Welcome...

    Put Claude Belgium
     
  11. taximania

    taximania Well-Known Member Licensed User

    And, as usual for my device, the 'orientation programs' don't work. :sign0137:
    I am programming on the device.

    Code:
    Sub Globals
       
    'Declare the global variables here.

    End Sub

    Sub App_Start
       Form1.Show
    End Sub


    Sub Button1_Click
    if isppc = true then Shell("Lndsc270.exe""")

    End Sub
    If 'isppc' is invalid, you mean cPPC. Which still doesn't work on my device.
    I will post more tomorrow after work.
    I get the time to program the device at work :sign0060:
     
  12. Put Claude

    Put Claude Active Member Licensed User

    hi taxmania,

    Sorry if not understandable, this is a piece from the code, an I did not mentioning the variable 'isppc'...
    Sub global

    isppc=0

    End Sub

    Sub App_Start 'POINT to start

    isppc = CPPC 'returns False or True=PPC, check if running on desktop or PPC
    If isppc = True Then Shell("Lndsc270.exe", "")

    work with variable, so I have not togo trough the cPPC function all the time...
    Works with me on 4 different Pockets WM3 SE, WM 5, WM6 Pro....
    Good luc....

    Put Claude Belgium
     
    Last edited: Oct 9, 2007
  13. SonicSue

    SonicSue Member Licensed User

    How do I detect change in screen orientation and have my form switch/adjust? I have an application that when the user slides out the keyboard and the screen rotates, the buttons do not rotate with the rest of the controls (labels and text boxes), and they (the buttons) cease to function. Thanks in advance. Please provide as much detail as possible because I am quite the newbie.
    :sign0104:
     
  14. agraham

    agraham Expert Licensed User

    If you are using WM5.0 or later then you could try using my http://www.basic4ppc.com/forum/additional-libraries/3346-systemstate-library-wm-5-0-later.html to see if you can get a StateChanged event when the system DisplayRotation state changes. I've just noticed that there is a typo in the help :(. The second description titled GetState that returns a reference should be titled GetValue.

    Also the Device object in my http://www.basic4ppc.com/forum/additional-libraries/1995-controlsexdevice-library.html#post10811 lets you get and set the display rotation.
     
  15. mjcoon

    mjcoon Well-Known Member Licensed User

    I think that Andrew meant the "Display" object (I can't find a Device object).

    If you (anyone!) is using Basic4ppc - Windows Mobile programming and Pocket PC Development to get quick access to the documentation of library functions, note that it is well out of date. For instance the ControlsExDevice is shown there as having seven embedded objects whereas I count fifteen in version 1.8. The details are also correspondingly out of date too.

    Mike.
     
  16. agraham

    agraham Expert Licensed User

    Thanks Mike. I did mean Display, this old memory is getting worse :( I should have checked!
     
  17. corwin42

    corwin42 Expert Licensed User

    The easiest way to detect a screen rotation is the Resize event of the formlib.
    See formlib helpfile for a small example.

    There are several ways for adjusting the controls to screen resolution changes. I'm currently writing a small tutorial for adjusting applications for several screen resolutions. I hope to post it in a few days.

    Greetings
     
  18. SonicSue

    SonicSue Member Licensed User

    I will definitely be looking forward to your tutorial, since what I have is not working...:BangHead:
     
  19. SonicSue

    SonicSue Member Licensed User

    The help file opens but all I get is the menu and no details...:confused:
     
  20. agraham

    agraham Expert Licensed User

    It's a security "feature" because it's a downloaded file. Right click on the file name, select Properties and there's a checkbox to unblock it somewhere.
     
Loading...