DeviceMode

2.x

  void DeviceMode(hwnd, hModule, lpszDevice, lpszOutput)    
  HWND hwnd; /* handle of window owning dialog box */
  HANDLE hModule; /* handle of printer-driver module */
  LPSTR lpszDevice; /* address of string for device name */
  LPSTR lpszOutput; /* address of string for output name */

The DeviceMode function sets the current printing modes for a specified device by using a dialog box to prompt for those modes. An application calls DeviceMode to allow the user to change the printing modes of the corresponding device. DeviceMode copies the mode information to the environment block that is associated with the device and maintained by the graphics device interface (GDI).

The ExtDeviceMode function provides a superset of the functionality of the DeviceMode function; new applications should use ExtDeviceMode instead of DeviceMode whenever possible. (Applications can use the DM_IN_PROMPT constant with ExtDeviceMode to duplicate the functionality of DeviceMode.)

Parameters

hwnd

Identifies the window that will own the dialog box.

hModule

Identifies the printer-driver module. The application should retrieve this handle by calling either the GetModuleHandle or LoadLibrary function.

lpszDevice

Points to a null-terminated string that specifies the name of the specific device to be supported (for example, Epson FX-80). The device name is the same as the name passed to the CreateDC function.

lpszOutput

Points to a null-terminated string that specifies the MS-DOS filename or device name for the physical output medium (file or output port). The output name is the same as the name passed to the CreateDC function.

Return Value

This function does not return a value.

Comments

The DeviceMode function is part of the printer's device driver, not part of GDI. To call this function, an application must load the printer driver by calling the LoadLibrary function and retrieve the address of the function by using the GetProcAddress function. The application can then use the address to set up the printer.

DeviceMode is not supported by all printer drivers. If the GetProcAddress function returns NULL, DeviceMode is not supported.

See Also

CreateDC, ExtDeviceMode, GetModuleHandle, LoadLibrary