Einzelnen Beitrag anzeigen

Razor
(Gast)

n/a Beiträge
 
#4

Re: Monitor Name via Enumdisplaydevices

  Alt 20. Feb 2009, 16:41
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;
  Mit Zitat antworten Zitat