` Printed Icetips Article

Icetips Article



Windows API: Change or detect screen resolution (2)
2003-01-26 -- Arnor Baldvinsson
 
Newsgroups: comp.lang.clarion

Hi Chris,

On Sun, 26 Jan 2003 05:28:24 GMT, arnor@icetips.com (Arnor
Baldvinsson) wrote:

>some Delphi code from:

And some VB code from:

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvbtips/html/msdn_msdn204.asp

Using www.google.com searching for "changing screen resolution in
code" without quotation marks, results in about 238,000 results and
the first page of results looks pretty good to me:)

The VB code is very easy to follow and converts easily to Clarion.

Const CCDEVICENAME = 32
etc.

would become:

CCDEVICENAME  EQUATE(32)
CCFORMNAME    EQUATE(32)
DM_PELSWIDTH  EQUATE(80000h)
DM_PELSHEIGHT EQUATE(100000h)

Private Type DEVMODE
    dmDeviceName As String * CCDEVICENAME
    dmSpecVersion As Integer
    dmDriverVersion As Integer
...

would become:

DEVMODE         GROUP,Type
dmDeviceName      CString(CCDEVICENAME) ! Or Byte,Dim(CCDEVICENAME)
dmSpecVersion     Word
dmDriverVersion   Word
...

Private Sub Command1_Click()
    Dim a As Boolean
    Dim i&
    i = 0
    Do
        a = EnumDisplaySettings(0&, i&, DevM)
        i = i + 1
    Loop Until (a = False)
End Sub

would become something like this:

DevM  DEVMODE
i     DWORD
a     BOOLEAN
S     CString(1)
b     Long
 Code
 i = 0
 Loop Until (a = False)
   a = EnumDisplaySettings(S, i, DevM)
   i =+ 1
 End

And this:

Private Sub Command2_Click()
    Dim b&
    DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT

    DevM.dmPelsWidth = 800
    DevM.dmPelsHeight = 600

    b = ChangeDisplaySettings(DevM, 0)
End Sub

would be added to the above Clarion code like this:

 DevM.dmFields     = BOR(DM_PELSWIDTH,DM_PELSHEIGHT) ! I Think...
 DevM.dmPelsWidth  = 800
 DevM.dmPelsHeight = 600
 b = ChangeDisplaySettings(DevM, 0)

I think the prototypes for the functions are in the API viewer thingy
that comes with Clarion.

Best regards,

ArnĂ³r Baldvinsson



Printed November 21, 2024, 7:32 am
This article has been viewed/printed 35312 times.
Google search has resulted in 217 hits on this article since January 25, 2004.