How to obatin screen size and o/s info?

Discussion in 'Questions (Windows Mobile)' started by alfcen, Mar 15, 2008.

  1. alfcen

    alfcen Well-Known Member Licensed User

    Hi Gang,

    Two issues:

    1. Suppose you have an application compiled without optimization.
    Form1.Width shows 240 on both QVGA and VGA devices, on the
    latter because pixel doubling is performed.
    Is anyone aware of a method to determine the true native screen
    size without crawling in the registry and additional library?

    2. Has anyone come across a method of reading the operating
    system version (PPC 2003/WM5/WM6) in the registry of a device?

    Both items could eventually be added to a wishlist for an updated

    Thanks and cheers
  2. brathbone

    brathbone Member Licensed User

    Hi Robert,

    I was wanting this functionality as well. It seemed like a good time to create my first library, and here it is :sign0060:

    The zip file includes the dll, a B4PPC test project, and the VB.NET source.

    bDeviceInfo.GetOSVersionString returns the OS name and version number as a string. Let me know if you need to get access to just the version as integer; it would not be hard to add.

    bDeviceInfo.GetDisplayWidth returns screen width as integer
    bDeviceInfo.GetDisplayheight returns screen height as integer

    Let me know what you think of this.

    Best wishes,

    Attached Files:

  3. alfcen

    alfcen Well-Known Member Licensed User

    Hi Brian,

    I'm speechless, a library in response.

    The device, an iPAQ hx210 comes up with these responses:

    GetOSVersionString: Microsoft Windows CE 5.2.1711.
    It is supposed to be WM 6, but I assume that is Microsoft's
    nomenclature for WM6(?)

    GetDisplayWidth/Height: In an application compiled w/o optimization
    the result is 240x320 (the form dims), although the physical resolution
    is VGA. Is there any means of quering the LCD dimensions?

    Anyway, your approch is awesome. Thanks so much!

  4. brathbone

    brathbone Member Licensed User

    Hi Robert,

    I was hoping for better results with the screen size, but I'll see if I can find another way to get the actual screen size.

    Regarding the OS Version, I found this list on MSDN:

    Platform Release Windows CE kernel version
    Windows Mobile 6 5.2
    Wndows Mobile 5.0 5.1
    Windows Mobile 2003 SE 4.21

    I think I will add access to MajorVersion and MinorVersion from the library, that way you can detect the OS version without having to parse the OS Version string. That way we can say if MajorVersion = 5 and MinorVersion = 2 then we are on WM6 :)

    I'll probably get a chance to look at this later tonight. Until then . . .

    All the best,
  5. alfcen

    alfcen Well-Known Member Licensed User

    Hi Brian,

    I thought it might be difficult to retrieve LCD pixel array dimensions.
    Unfortunately, I can't assist without having VS, but I feel you are
    on the right way towards a solution :cool:

    Regarding the o/s version, I believe your current method is great.
    Parsing is no big issue, it is as simple as this:

    If StrIndexOf(bDeviceInfo.GetOSVersionString,"5.2",0) > -1 Then WM6

    Perhaps something like bDeviceInfo.GetOSVersionCode which returns
    0, 1 or 2, respectively, would be nice but only if it is not too much

    Thank you so much!
  6. brathbone

    brathbone Member Licensed User

    Hi Steve,

    Thanks for checking, but you can use the dll and source in any way you like. As far as I'm concerned, it's in the public domain. Just a little gift to the community.

    I wouldn't object to the credit, just don't feel obligated in any way :).

    I'd still like to figure out Robert's VGA question and post a new version, but my workload has been a bit overwhelming lately. Hopefully I'll get back to it soon.

    Anyway . . . I'm glad you found it helpful.

    All the best,


    P.S. good luck with the game, I look forward to checking it out.
  7. alfcen

    alfcen Well-Known Member Licensed User

    Hi Steve,
    Thanks a lot for your thoughts. You are right, you never can tell :)

    Hi Brian
    No hurry, I am presently working with Mort Script to query the bits and pieces.
    It's a hard nut to crack anyway.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice