From: senhortomas on
The following program compiled with CVF 6.5 determines the screen
resolution hval X vval:

use dfwin
integer hval, vval
integer hdc
hdc = GetDC (0)
hval = GetDeviceCaps (hdc , 8)
vval = GetDeviceCaps (hdc , 10)
write(*,*) hdc, hval, vval
end

The program works on Windows XP but I don’t quite understand the
called functions. Variable hdc taken on a different value with each
execution. The CVF sample program GETDEV contains the statement

val = GetDeviceCaps (hdc , DevCap(i)%val)

I am not able to compile a short program with the function having
input in the form of DevCap(i)%val. Although my own program works on
my system I would like to know if I could rely on it for general
systems.
From: e p chandler on
On Feb 11, 1:03 pm, senhortomas <corrugraph...(a)hotmail.com> wrote:
> The following program compiled with CVF 6.5 determines the screen
> resolution hval X vval:
>
> use dfwin
> integer     hval, vval
> integer     hdc
>    hdc = GetDC (0)
>    hval = GetDeviceCaps (hdc ,  8)
>    vval = GetDeviceCaps (hdc , 10)
>    write(*,*) hdc, hval, vval
> end
>
> The program works on Windows XP but I don’t quite understand the
> called functions.  Variable hdc  taken on a different value with each
> execution. The CVF sample program GETDEV contains the statement
>
>             val = GetDeviceCaps (hdc , DevCap(i)%val)
>
> I am not able to compile a short program with the function having
> input in the form of DevCap(i)%val.  Although my own program works on
> my system I would like to know if I could rely on it for general
> systems.

hdc is a "handle" to a device context.

-- e

From: Dr Ivan D. Reid on
On Thu, 11 Feb 2010 10:03:28 -0800 (PST), senhortomas
<corrugraphics(a)hotmail.com>
wrote in <0525b0d4-1997-4c5a-ac60-22367f7004e7(a)g27g2000yqh.googlegroups.com>:
> The following program compiled with CVF 6.5 determines the screen
> resolution hval X vval:

> use dfwin
> integer hval, vval
> integer hdc
> hdc = GetDC (0)
> hval = GetDeviceCaps (hdc , 8)
> vval = GetDeviceCaps (hdc , 10)
> write(*,*) hdc, hval, vval
> end

> The program works on Windows XP but I don?t quite understand the
> called functions. Variable hdc taken on a different value with each
> execution.

A bit of googling shows this to be a Windows API call. hdc is
a device-context handle by the looks of it, and need not be the same
for each call (probably something like an index into a table).
http://msdn.microsoft.com/en-us/library/dd144877(VS.85).aspx

> The CVF sample program GETDEV contains the statement

> val = GetDeviceCaps (hdc , DevCap(i)%val)

> I am not able to compile a short program with the function having
> input in the form of DevCap(i)%val. Although my own program works on
> my system I would like to know if I could rely on it for general
> systems.

Well, it won't work on Linux or MacOS... I'm not sure what the
DevCap(i)%val is all about. You should probably look in dfwin.f90 to
see if the values HORZRES etc defined in the above link are defined (probably
as parameters) and use them rather than hard-wired constants.

--
Ivan Reid, School of Engineering & Design, _____________ CMS Collaboration,
Brunel University. Ivan.Reid@[brunel.ac.uk|cern.ch] Room 40-1-B12, CERN
KotPT -- "for stupidity above and beyond the call of duty".
From: Phred Phungus on
senhortomas wrote:
> The following program compiled with CVF 6.5 determines the screen
> resolution hval X vval:
>
> use dfwin
> integer hval, vval
> integer hdc
> hdc = GetDC (0)
> hval = GetDeviceCaps (hdc , 8)
> vval = GetDeviceCaps (hdc , 10)
> write(*,*) hdc, hval, vval
> end
>
> The program works on Windows XP but I don�t quite understand the
> called functions. Variable hdc taken on a different value with each
> execution. The CVF sample program GETDEV contains the statement
>
> val = GetDeviceCaps (hdc , DevCap(i)%val)
>
> I am not able to compile a short program with the function having
> input in the form of DevCap(i)%val. Although my own program works on
> my system I would like to know if I could rely on it for general
> systems.

I think fortran is a prohibitively-clumsy tool for this.
--
fred
From: Leclerc on
Hi,


> hdc = GetDC (0)
This acquires a handle to the window with "identifier" 0, which in turn
returns drawing context associated to the root window, i.e. screen

> hval = GetDeviceCaps (hdc , 8)
> vval = GetDeviceCaps (hdc , 10)

GetDeviceCaps is a call into gdi32.dll, and it returns various
information about Drawing Context. Constants 8, and 10, represent
HORSIZE, and VERTSIZE; definition can be found wingdi.h header file (I'm
c++ developer :)


> called functions. Variable hdc taken on a different value with each
Don't bother about the value of hdc; what you need to know is that it
represents handle to DC; nothing more

> Although my own program works on
> my system I would like to know if I could rely on it for general
> systems.

These are *very* M$ specific calls, and will *not* work on any other system.

cheers,
Gordan