Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This structure is used to specify information about the target device for which data is being composed.

Syntax

typedef struct tagDVTARGETDEVICE{
  DWORD 
tdSize;
  WORD 
tdDriverNameOffset;
  WORD 
tdDeviceNameOffset;
  WORD 
tdPortNameOffset;
  WORD 
tdExtDevmodeOffset;
  BYTE 
tdData;
} DVTARGETDEVICE;

Members

tdSize

Size, in bytes, of the DVTARGETDEVICEstructure.

The initial size is included so the structure can be copied more easily.

tdDriverNameOffset

Offset, in bytes, from the beginning of the structure to the device driver name, which is stored as a null-terminated string in the tdDatabuffer.

tdDeviceNameOffset

Offset, in bytes, from the beginning of the structure to the device name, which is stored as a null-terminated string in the tdDatabuffer.

This value can be zero to indicate no device name.

tdPortNameOffset

Offset, in bytes, from the beginning of the structure to the port name, which is stored as a null-terminated string in the tdDatabuffer.

This value can be zero to indicate no port name.

tdExtDevmodeOffset

Offset, in bytes, from the beginning of the structure to the DEVMODEstructure retrieved by calling ExtDeviceMode.

tdData

Array of bytes containing data for the target device.

It is not necessary to include empty strings in tdData(for names where the offset value is zero).

Remarks

Some OLE 1 client applications incorrectly construct target devices by allocating too few bytes in the DEVMODEstructure for the OLETARGETDEVICE. They typically only supply the number of bytes in the DEVMODE.dmSizemember. The number of bytes to be allocated should be the sum of DEVMODE.dmSizeand DEVMODE.dmDriverExtra.

When a call is made to the CreateDCfunction with an incorrect target device, the printer driver tries to access the additional bytes and unpredictable results can occur.

To help protect against a crash and make the additional bytes available, OLE pads the size of OLE 2 target devices created from OLE 1 target devices.

Requirements

Header objidl.h
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later