현재 그래픽카드의 이름을 리턴하는 함수
 
function GetGraphicCard: String
var lpDisplayDevice: TDisplayDevice; 
begin 

lpDisplayDevice.sb:=SizeOf(lpDisplayDevice); 

lpDisplayDevice.StateFlags:=DISPLAY_DEVICE_ATTACHED_TO_DESKTOP; 

EnumDisplayDevices(nil, 0, lpDisplayDevice, 0); 

Result:=lpDisplayDevice.DeviceString; 

end
 
 
 
여기서도 중요한 건 TDisplayDevice 구조체임.
 

type
  PDisplayDeviceA = ^TDisplayDeviceA;
  PDisplayDeviceW = ^TDisplayDeviceW;
  PDisplayDevice = PDisplayDeviceA;
  {$EXTERNALSYM _DISPLAY_DEVICEA}
  _DISPLAY_DEVICEA = packed record
    cb: DWORD; 
    DeviceName: array[0..31] of AnsiChar; 
    DeviceString: array[0..127] of AnsiChar;
    StateFlags: DWORD;
  end;
  {$EXTERNALSYM _DISPLAY_DEVICEW}
  _DISPLAY_DEVICEW = packed record
    cb: DWORD;
    DeviceName: array[0..31] of WideChar;
    DeviceString: array[0..127] of WideChar;
    StateFlags: DWORD;
  end;
  {$EXTERNALSYM _DISPLAY_DEVICE}
  _DISPLAY_DEVICE = _DISPLAY_DEVICEA;
  TDisplayDeviceA = _DISPLAY_DEVICEA;
  TDisplayDeviceW = _DISPLAY_DEVICEW;
  TDisplayDevice = TDisplayDeviceA; 
 
 
간단한 멤버설명문 (볼랜드 헬프 페이지 - Windows GDI 에 있음)
 
cb
Size, in bytes, of the DISPLAY_DEVICE structure. This must be initialized prior to calling EnumDisplayDevices.
DeviceName
An array of characters identifying the device name. This is either the adapter device or the monitor device.
DeviceString
An array of characters containing the device context string. This is either a description of the display adapter or of the display monitor.
StateFlags
Device state flags. It can be any reasonable combination of the following.
Value Meaning
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP The device is part of the desktop.
DISPLAY_DEVICE_MIRRORING_DRIVER Represents a pseudo device used to mirror application drawing for remoting or other purposes. An invisible pseudo monitor is associated with this device. For example, NetMeeting uses it. Note that GetSystemMetrics(SM_MONITORS) only accounts for visible display monitors.
DISPLAY_DEVICE_MODESPRUNED The device has more display modes than its output devices support.
DISPLAY_DEVICE_PRIMARY_DEVICE The primary desktop is on the device. For a system with a single display card, this is always set. For a system with multiple display cards, only one device can have this set.
DISPLAY_DEVICE_REMOVABLE The device is removable; it cannot be the primary display.
DISPLAY_DEVICE_VGA_COMPATIBLE The device is VGA compatible.
 

원래 GDI 포맷에서는 아래의 멤버가 더 있음.
DeviceID
Windows 98/Me: A string that uniquely identifies the hardware adapter or the monitor. This is the Plug and Play identifier.
DeviceKey
Reserved.









 

Posted by bloodguy
,