I hope this is an easy question. I need to get the mfgr, driver version and resolution for the Video Card installed.
Is there a way to do this in Delphi or DelphiX? If so, how.
I have Delphi 6 and the latest DelphiX installed.
I hope this is an easy question. I need to get the mfgr, driver version and resolution for the Video Card installed.
Is there a way to do this in Delphi or DelphiX? If so, how.
I have Delphi 6 and the latest DelphiX installed.
Chris Iverson
<br />http://mywebpages.comcast.net/civerson
The TDirectDraw.IDraw[/4/7].GetDeviceIdentifier method (in dxdraws.pas and DirectX.pas of the DelphiX source) looks promising, though there may be a simpler way (I've not had time to check). You should know the resolution if using fullscreen mode (you set it!), else you can use the GetDeviceCaps API function (with HORZRES and VERTRES if memory serves).
"All paid jobs absorb and degrade the mind."
<br />-- Aristotle
How do I implenet the GetDeviceIdentifier method? Do you have some sample code?
Chris Iverson
<br />http://mywebpages.comcast.net/civerson
I've never actually use DelphiX myself, but I'll try to post some example code soon (in a couple of hours since I'm still at work ). The example might not compile exactly but it'll be close enough to get you started.
I'll throw two pages at MSDN your way to begin with so you can read about them. Keep in mind that the docs are C++ based...
IDirectDraw7.GetDeviceIdentifier
DeviceIdentifier2 structure
But yeah, the example should be coming sometime after about 5:30 UK time.
"All paid jobs absorb and degrade the mind."
<br />-- Aristotle
The following _should_ do the trick (based solely on looking at the DelphiX source and trying a non-DelphiX test...)
You want to declare a variable of type TDDDeviceIdentifier. You then call the appropriate function...
[pascal]var
ID: TDDDeviceIdentifier;
begin
DirectDraw1.IDraw7.GetDeviceIdentifier(ID, 0);
// todo: use stuff in ID record however you want
end;[/pascal]
That's it, as far as I can see. I'm not sure where the TDirectDraw-based component comes from (what I called DirectDraw1) since I've not used DelphiX. I'd be surprised if it wasn't a visual thing, easily available, though! You can also use IDraw4 instead of IDraw7 I think.
I'll quote from the relevant header so you know what ID will contain after calling the above function. Lots of info for you...
TDDDeviceIdentifier = record
//
// These elements are for presentation to the user only. They should not be used to identify particular
// drivers, since this is unreliable and many different strings may be associated with the same
// device, and the same driver from different vendors.
//
szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char;
szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char;
//
// This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
// on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
// drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
//
// This version has the form:
// wProduct = HIWORD(liDriverVersion.HighPart)
// wVersion = LOWORD(liDriverVersion.HighPart)
// wSubVersion = HIWORD(liDriverVersion.LowPart)
// wBuild = LOWORD(liDriverVersion.LowPart)
//
liDriverVersion: TLargeInteger; // Defined for applications and other 32 bit components
//
// These elements can be used to identify particular chipsets. Use with extreme caution.
// dwVendorId Identifies the manufacturer. May be zero if unknown.
// dwDeviceId Identifies the type of chipset. May be zero if unknown.
// dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown.
// dwRevision Identifies the revision level of the chipset. May be zero if unknown.
//
dwVendorId: DWORD;
dwDeviceId: DWORD;
dwSubSysId: DWORD;
dwRevision: DWORD;
//
// This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
// driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
// reprofile the graphics subsystem.
// This element can also be used to identify particular problematic drivers.
//
guidDeviceIdentifier: TGUID;
end;
"All paid jobs absorb and degrade the mind."
<br />-- Aristotle
How do I define DirectDraw1. I tried this:
var
DD : TDirectDraw;
But I think I have to initialize it with a value, or create it. Doing this:
dd.Create(GUID);
Needs a GUID and I don't know what it is.
Chris Iverson
<br />http://mywebpages.comcast.net/civerson
There should already be one, and it will be created automatically (I'd assume). Check the TDXDraw component, actually -- it looks like it has a DDraw property, meaning the previous example would be something like this:
[pascal]DXDraw1.DDraw.IDraw7.GetDeviceIdentifier(ID, 0);[/pascal]
(I think!)
"All paid jobs absorb and degrade the mind."
<br />-- Aristotle
Maybe it would be better to use the DirectX SDK from Microsoft. Have you ever used it?
Chris Iverson
<br />http://mywebpages.comcast.net/civerson
YepOriginally Posted by civerson
The problem I'm having helping you is simply that I've never used DelphiX, have no idea of what classes it contains and have no way to compile any test code using it. Aside from that, it's been a cinch so far! But seriously, did the last thing I suggested not work? I can't think why it wouldn't have (you should have a TDXDraw object, and all the properties tally up from the source code).
"All paid jobs absorb and degrade the mind."
<br />-- Aristotle
I've got a feeling this isn;t what you want but I thought I'd post if anyway:
Code:procedure TForm1.ShowDrivers; Var S : String; I : Integer; begin For I := 0 to DXDraw1.DDraw.Drivers.Count - 1 do S := S + IntToStr(I) +': '+ DXDraw1.DDraw.Drivers[I].Description+ #10#13; ShowMessage(S); // todo: use stuff in ID record however you want end;
William Cairns
My Games: http://www.cairnsgames.co.za (Currently very inactive)
MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)
Bookmarks