Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Monitor Name via Enumdisplaydevices (https://www.delphipraxis.net/129466-monitor-name-via-enumdisplaydevices.html)

Razor 19. Feb 2009 16:40


Monitor Name via Enumdisplaydevices
 
Ive tried many variations of it.Also Muetze's version.But that can only be used in a listbox.

Is it possible to get a name of monitor based on how many Video cards you have.

( eg. 1: generic monitor on ATI HD 3870 )
( eg. 2: generic monitor on ATI HD 3870 )

Muetze1 19. Feb 2009 21:41

Re: Monitor Name via Enumdisplaydevices
 
Zitat:

Zitat von Razor
Ive tried many variations of it.Also Muetze's version.But that can only be used in a listbox.

You are unable to modify that source? You are unable to post or link that code here that anybody else can modify it for you?

The source is definitly not written to just use a TStrings descendant, it was just one possible way to ouptput all informations.

All the months or years it is still annoying to see, how your learning process goes (on).

Razor 20. Feb 2009 14:56

Re: Monitor Name via Enumdisplaydevices
 
You are still the same Muetze i can concur to that :P

Razor 20. Feb 2009 16:41

Re: Monitor Name via Enumdisplaydevices
 
I only needed string not so much as you showed.But tell me if its ok what i modifyed.


Delphi-Quellcode:
function tform4.monitorname(numberof:integer):string; //does cntr control wich outputs is it for couse i have 2 video DVI outputs.
Var
  Cntr       : Cardinal;
  Info       : TDisplayDevice;
  AdapterName : PChar;
  OldPos ,j,i    : Integer;
  a:tstringlist;
Begin

  a:=tstringlist.create;
  Cntr := numberof;
  Info.cb := SizeOf(Info);
  While EnumDisplayDevices(Nil, Cntr, Info, 0) Do
  Begin


    AdapterName := StrAlloc(SizeOf(Info.DeviceName));
    StrCopy(AdapterName, Info.DeviceName);
    EnumDisplayDevices(AdapterName, 0, Info, 0);

    a.add(info.DeviceString);
   for I := 1 to a.count - 1 do  begin
    a.Delete(i);

    result:=a.Strings[0];
    StrDispose(AdapterName);

    Inc(Cntr);

  End;

End;
End;


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:07 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz