Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

Default orientation of the paper, for printer

andriasoa
Beginner
876 Views
Print graph on a printer, I use structure T_PRINTDLG and the
PrintDlg function. See the PrintFile_1.f90 file attached.

By Default, the orientation is in portrait.
Could you please tell me. How to change (in the program) the orientation
by Default into landscape?

I am using Compaq Visual Fortran 6.6.

Thank you for your help.
Andriasoa
0 Kudos
5 Replies
nijhuis
Beginner
876 Views

subroutine

test

use

ifwin

implicit none

type

(T_PRINTDLG) pd

type

(T_DEVMODE) devm

integer

ldevm, alloc_stat

integer

, allocatable :: idevm(:)

devm%field1.dmOrientation= DMORIENT_LANDSCAPE

devm%dmFields = DM_ORIENTATION

! Indication of filled orientation field

ldevm = sizeof(devm)

allocate(idevm(ldevm), stat=alloc_stat)

call CopyMemory(loc(idevm), loc(devm), ldevm)

pd%hDevMode =

loc(idevm)

! fill other pd fields

!.....

deallocate(idevm) ! after pd has been used

end program test

I am not sure about the used allocation. I have used T_DEVMODE to retrieve some information in an already filled structure. In that case an integer handle is known and the following code is used:

Code part:

type(T_DEVNAMES) devname

type(T_DEVMODE) devmode

integer idevn, idevm, jdevm, ldevm

! call subroutine to retrieve a T_DEVNAME and a T_DEVMODE structure.

! the integers idevn and idevm arehandles to the structures

call getpr(idevn, idevm)

ldevm = sizeof(devmode)

jdevm= GlobalLock(idevm)

call CopyMemory(loc(devmode), jdevm, ldevm)

! Get number of copies

ncopy = devmode%dmCopies

! Get orientation

orient = devmode%field1%dmOrientation

retval = GlobalUnlock(idevm)

retval = GlobalFree(idev m)


subroutine

test

use

ifwin

implicit none

type

(T_PRINTDLG) pd

type

(T_DEVMODE) devm

integer

ldevm, alloc_stat

integer

, allocatable :: idevm(:)

devm%field1.dmOrientation= DMORIENT_LANDSCAPE

devm%dmFields = DM_ORIENTATION

! Indication of filled orientation field

ldevm = sizeof(devm)

allocate(idevm(ldevm), stat=alloc_stat)

call CopyMemory(loc(idevm), loc(devm), ldevm)

pd%hDevMode =

loc(idevm)

! fill other pd fields

!.....

deallocate(idevm) ! after pd has been used

end program test

I am not sure about the used allocation. I have used T_DEVMODE to retrieve some information in an already filled structure. In that case an integer handle is known and the following code is used:

Code part:

type(T_DEVNAMES) devname

type(T_DEVMODE) devmode

integer idevn, idevm, jdevm, ldevm

! call subroutine to retrieve a T_DEVNAME and a T_DEVMODE structure.

! the integers idevn and idevm arehandles to the structures

call getpr(idevn, idevm)

ldevm = sizeof(devmode)

jdevm= GlobalLock(idevm)

call CopyMemory(loc(devmode), jdevm, ldevm)

! Get number of copies

ncopy = devmode%dmCopies

! Get orientation

orient = devmode%field1%dmOrientation

retval = GlobalUnlock(idevm)

retval = GlobalFree(id evm)

I am not sure if in the first example also GlobalLock etc. has to be used, but I hope you have with these examples enough information to make a working piece of software.

Guus


0 Kudos
nijhuis
Beginner
876 Views
Oh!The first part ofmy message has disappeared.
I believeit looks like this:
The orientation can be set in a derived type T_DEVMODE of which the handle can be set in hte hDevMode field of the T_PRINTDLG structure.
I will illustrate the use of it with the following example:
(See the prior message for the rest of the story)
Guus
0 Kudos
Steven_L_Intel1
Employee
876 Views
Look at the provided MISCFORPRINT sample to see how this is done. You may want to use the code provided here instead of writing your own.
0 Kudos
nijhuis
Beginner
876 Views
Sorry for the mash of code in my first reply , butsomething went wrongwhen using the "SRC" button.
Guus
0 Kudos
andriasoa
Beginner
876 Views
Thank you!
0 Kudos
Reply