Windows 3.1 Device Drivers (ddag31qh.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GetEnvironment
                                                     Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
int GetEnvironment(lpszPort, lpvEnviron, cbMaxCopy)
LPCSTR lpszPort;        /* address of port name              */
void FAR* lpvEnviron;   /* address of buffer for environment */
UINT cbMaxCopy;         /* maximum number of bytes to copy   */
 
The GetEnvironment function retrieves the current environment that is
associated with the device attached to the specified system port and copies
it into the specified DEVMODE structure. The environment, maintained by
graphics device interface (GDI), contains binary data that GDI uses whenever
a device context is created for the device on the given port.
 
Parameter   Description
────────────────────────────────────────────────────────────────────────────
 
 
lpszPort    Points to the null-terminated string that specifies the name of
            the desired port.
 
lpvEnviron  Points to the DEVMODE structure that will receive the
            environment.
 
cbMaxCopy   Specifies the maximum number of bytes to be copied to the
            structure.
 
Return Value
 
The return value specifies the number of bytes copied to the DEVMODE
structure pointed to by the lpvEnviron parameter, if the function is
successful. If lpvEnviron is NULL, the return value is the number of bytes
required to hold the environment. It is zero if the environment cannot be
found.
 
Comments
 
The GetEnvironment function is used by drivers only.
 
The GetEnvironment function fails if there is no environment for the given
port.
 
An application can call this function with the lpvEnviron parameter set to
NULL to determine the size of the structure required to hold the
environment. It can then allocate the required number of bytes and call the
GetEnvironment function a second time to retrieve the environment. The first
member in the block pointed to by the lpEnviron parameter should be an atom
that the printer driver has added to the global atom table.
 
See Also
 
SetEnvironment, DEVMODE