SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    SQA Council
    Join Date
    Mar 2001
    Posts
    14,438
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Help with environments

    User Carvill, George (george.carvill@unisys.com.nospam) posted:

    We need to run the same GUI scripts on workstations with both NT and W2K and
    with both 800x600 and 1024x768 resolution. The verification points,
    especially the images, are different on the different machines.

    I'm looking for a slick way to have the scripts determining the o/s and
    screen resolution so I can do some If ... Then or Case statements to check
    the right verification points for the workstation running the test.

    I am playing with seeding the Windows environment with my own environmental
    variables and then testing for them. However, I thought someone might have
    encountered this before and have a slick solution.

    George Carvill
    Unisys
    Work 603-629-0537
    Net 241-0537
    Home 603-672-0620

    ---

  2. #2
    SQA Council
    Join Date
    Mar 2001
    Posts
    14,438
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Help with environments

    User Aidy Rutter (AidyR@TrustMarque.com.nospam) posted:

    This gets the OS, dunno about screen resolution

    Sub GetOsString ()


    Dim strOS As String
    Dim OS As Long

    OS = SQAGetSystemLong (SQA_OS)

    Select Case OS
    Case SQA_OS_Win95
    If SQAGetSystemLong(SQA_OS_MinorVersion) = 10 Then
    strOS = "Win98"
    Else
    strOS = "Win95"
    End If
    If SQAGetSystemLong(SQA_OS_MinorVersion)= 90 Then
    strOS = "WinME"
    End If
    Case SQA_OS_WinNT
    If SQAGetSystemLong(SQA_OS_MajorVersion) = 5 Then
    strOS = "Win2000"
    Else
    strOS = "NT4"
    End If
    Case Else
    strOS = "Cannot discern your OS"
    End Select

    g_OS = strOS ' assign the value of the string to the global variable - g_OS

    End Sub

  3. #3
    SQA Council
    Join Date
    Mar 2001
    Posts
    14,438
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Help with environments

    User Dimitar S. Grozev (Dimitar.Grozev@rila.com.nospam) posted:

    Try to use Environ$ function


  4. #4
    Points for Confirmed Friends
    Guest

    Re: Help with environments

    a solution posted by Michael Harris in the windows scripting host newsgroup. this is vbscript.

    with createobject("internetexplorer.application")
    .navigate "about:blank"
    with .document.parentWindow.screen
    msgbox .width & " by " & .height
    end with
    end with

    AFAIK you can get the os name via the win32 api.



    ------------------

  5. #5
    SQA Council
    Join Date
    Mar 2001
    Posts
    14,438
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Help with environments

    User (MMcNaughton@STSSystems.com.nospam) posted:

    This message is in MIME format. Since your mail reader does not understand
    this format, some or all of this message may not be legible.

    ------_=_NextPart_000_01C171E5.02724FE0
    Content-Type: text/plain;
    charset="iso-8859-1"

    I created this once upon a time, variables x and y being 800 and 600 or 1024
    and 768 for instance..
    I'll attached the library and header file... I don't have time to check
    them to ensure everything is still right as rain, if you have problems let
    me know.

    Max

    Function SetScreenResolution(x As Integer, y As Integer) As Integer

    Dim DevM As DEVMODE
    Dim CurM As DEVMODE
    Dim rc As Long
    Dim i As Long
    Dim result As Long
    Dim Colours As Long
    Dim hdc As Long
    Dim currX As Integer
    Dim currY As Integer

    SetScreenResolution = 0

    rc = GetDisplaySettings(CurM)

    GetScreenResolution currX,currY
    If currX=x And currY=y Then Exit Function

    hdc=GetDC(GetActiveWindow())
    Colours = GetDeviceCaps(hdc, PLANES) * 2 ^ GetDeviceCaps(hdc, BITSPIXEL)
    i = 0
    Do
    rc = EnumDisplaySettings(0&, i, DevM)
    i = i + 1
    If rc And Colours = 2 ^ DevM.dmBitsPerPel And x = DevM.dmPelsWidth
    And y = DevM.dmPelsHeight Then
    DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
    result = ChangeDisplaySettings(DevM, CDS_UPDATEREGISTRY OR
    CDS_RESET)
    Exit Do
    End If
    Loop Until (rc = False)

    Call ReleaseDC(GetActiveWindow(),hdc)

    If (rc <> 0) AND (result = DISP_CHANGE_SUCCESSFUL) Then
    SetScreenResolution = 1

    End Function 'SetScreenResolution


    Max


  6. #6
    SQA Council
    Join Date
    Mar 2001
    Posts
    14,438
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Help with environments

    User (MMcNaughton@STSSystems.com.nospam) posted:

    Oh well i think both files are repetitions... Sorry, i wish i had time to
    have them in proper order (

  7. #7
    SQA Council
    Join Date
    Mar 2001
    Posts
    14,438
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Help with environments

    User Tim Gerrells (tim@intellocity.com.nospam) posted:

    Also, if you don't want to use the registry or some UI-based text VP to find
    out the color resolution, the following API returns it. Go ahead and package
    it in your library as you deem best. Note that I've left some "debugging"
    lines in the .sbl which result in display of a messagebox with information
    on it. Can remove those for production testing.

    ' *** UnitTest-SysUtils extract ***

    '$Include "SysUtils"

    Sub Main
    Dim Result As Integer
    Dim lNumColors As Long

    'Initially Recorded: 11/20/2001 10:39:29 AM
    'Script Name: UT-GetNumColors
    lNumColors = GetNumScrColors()
    MsgBox "UnitTest-GetNumScrColors(): " + CStr(lNumColors)
    End Sub

    ' *** SysUtils.sbh extract ***
    Declare Function GetNumScrColors BasicLib "SysUtils.sbl" () As Long

    ' *** SysUtils.sbl extract ***

    ' Values for GetSystemMetrics
    Const SM_CYSCREEN = 1 ' screen width
    Const SM_CXSCREEN = 0 ' screen height

    ' Values for DEVMODE structure:
    Const CCHDEVICENAME = 32
    Const CCHFORMNAME = 32

    ' Values for GetDeviceCaps
    Const BITSPIXEL = 12

    ' DEVMODE is used in CreateDC(), GetDeviceCaps(), etc.
    Type DEVMODE
    dmDeviceName As String * CCHDEVICENAME
    dmSpecVersion As Integer
    dmDriverVersion As Integer
    dmSize As Integer
    dmDriverExtra As Integer
    dmFields As Long
    dmOrientation As Integer
    dmPaperSize As Integer
    dmPaperLength As Integer
    dmPaperWidth As Integer
    dmScale As Integer
    dmCopies As Integer
    dmDefaultSource As Integer
    dmPrintQuality As Integer
    dmColor As Integer
    dmDuplex As Integer
    dmYResolution As Integer
    dmTTOption As Integer
    dmCollate As Integer
    dmFormName As String * CCHFORMNAME
    dmUnusedPadding As Integer
    dmBitsPerPel As Integer
    dmPelsWidth As Long
    dmPelsHeight As Long
    dmDisplayFlags As Long
    dmDisplayFrequency As Long
    End Type
    Declare Function GetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" (ByVal hdc
    As Long, ByVal nIndex As Long) As Long
    Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName
    As String, ByVal lpDeviceName As String, ByVal lpOutput As String,
    lpInitData As DEVMODE) As Long
    Declare Function DeleteDC Lib "gdi32" Alias "DeleteDC" (ByVal hdc As Long)
    As Long

    Function GetNumScrColors() As Long
    ' declare and init local variables:
    Dim lhDC As Long
    Dim t As DEVMODE
    Dim lVal As Long
    Dim lNumColors As Long

    Const VERTRES = 10
    Const VERTSIZE = 6
    Const HORZRES = 8
    Const HORZSIZE = 4
    Const PLANES = 14
    Const COLORRES = 108

    ' create a display device context handle:
    lhDC = CreateDC("DISPLAY" + Chr$(0), "", "", t)

    If lhDC = 0 Then
    ' think we have an error situation:
    ' put in error handling and reporting logic here...
    GetNumScrColors = 0
    Exit Function
    End If

    lVal = GetDeviceCaps(lhDC, BITSPIXEL)
    lNumColors = 2 ^ lVal

    ' DEBUG:
    Dim s As String

    ' height in raster lines of display device:
    s = s + "Vertical res: " + CStr(GetDeviceCaps(lhDC, VERTRES)) + Chr$(10)

    ' width in number of pixels:
    s = s + "Horizontal res: " + CStr(GetDeviceCaps(lhDC, HORZRES)) +
    Chr$(10)

    ' height in mm of display
    Dim dVal AS Double
    lVal = GetDeviceCaps(lhDC, VERTSIZE)
    dVal = lVal / 25.4
    s = s + "Vertical size: " + CStr(lVal) + _
    "(" + CStr(Format$(dVal, "Fixed")) + " in.)"+ Chr$(10)

    ' width in mm of display
    lVal = GetDeviceCaps(lhDC, HORZSIZE)
    dVal = lVal / 25.4
    s = s + "Horizontal size: " + CStr(lVal) + _
    "(" + CStr(Format$(dVal, "Fixed")) + " in.)"+ Chr$(10)

    's = s + "Num color planes: " + CStr(GetDeviceCaps(lhDC, PLANES)) +
    Chr$(10)

    ' display's color resolution capability: (useful in graphics intense
    AUTs)
    lVal = 2 ^ GetDeviceCaps(lhDC, COLORRES)
    s = S + "Color resolution: " + CStr(lVal)

    MsgBox s

    lVal = DeleteDC(lhDC)

    If lVal <> 1 Then
    ' put in some error handling and reporting logic here:
    'MsgBox "DeleteDC() result: " + CStr(lVal)
    End If

    GetNumScrColors = lNumColors

    End Function


  8. #8
    SQA Council
    Join Date
    Mar 2001
    Posts
    14,438
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Help with environments

    User Carvill, George (george.carvill@unisys.com.nospam) posted:

    Yeah, that's what I use to read it. And I see the suggestion below to write
    it. I'll try it. Resolution could be a problem.

    Hey, is there a way to "capture" the entire screen and then ask a question
    about this size of what you captured?

    George


 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 13.64%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:52 AM.

Copyright BetaSoft Inc.