Einzelnen Beitrag anzeigen

Benutzerbild von Aphton
Aphton

Registriert seit: 31. Mai 2009
1.198 Beiträge
 
Turbo Delphi für Win32
 
#7

AW: Bildschirm-Groesse in mm auslesen

  Alt 14. Apr 2011, 17:18
Warum eine andere Methode?

EDIT:
Delphi-Quellcode:
{1}
DC := GetDC(Form1.Handle);
{2}
Edit1.Text := FloatToStr(Round( (StrToInt('1024')*10) / cm));
Edit2.Text := FloatToStr(Round( (StrToInt('768')*10) / cm));
{1}
Warum das Handle der Form?
{2}
*facepalm

Weiters: Ich denke mal, deine Auflösung ist nicht 1024x768 und deshalb werden falsche Werte angezeigt?! Falls ja, dann gugg doch mal genauer hin -.-'

EDIT2:
LOGPIXELSX liefert dir folgendes zurück
Zitat von http://msdn.microsoft.com/en-us/library/dd144877%28v=vs.85%29.aspx:
Number of pixels per logical inch along the screen width. In a system with multiple display monitors, this value is the same for all monitors.
Ansonten, hier
Delphi-Quellcode:
procedure GetDisplaySize(var mm: TPoint);
asm
  xchg eax, esi
  mov [esi], -1
  mov [esi+4], -1
  call GetDesktopWindow
  xchg edi, eax
  push edi
  call GetDC
  test eax, eax
  jnz @continue
  ret
  @continue:
  push ebp
  mov ebp, esp
  sub esp, $10
  push eax
  push edi
  push $5A
  push eax
  push $58
  push eax
  call GetDeviceCaps
  mov ecx, 100
  mul ecx
  mov [ebp-$10], eax
  call GetDeviceCaps
  mov ecx, 100
  mul ecx
  mov [ebp-$0C], eax
  push 1
  push 0
  call GetSystemMetrics
  mov [ebp-$08], eax
  call GetSystemMetrics
  mov [ebp-$04], eax
  mov eax, [ebp-$08]
  mov ecx, 2540
  push ecx
  mul ecx
  cdq
  mov ecx, [ebp-$10]
  idiv ecx
  mov [esi], eax
  mov eax, [ebp-$04]
  pop ecx
  mul ecx
  cdq
  mov ecx, [ebp-$0C]
  idiv ecx
  mov [esi+$04], eax
  call ReleaseDC
  mov esp, ebp
  pop ebp
  xchg eax, esi
end;
das Erkennen beginnt, wenn der Erkennende vom zu Erkennenden Abstand nimmt
MfG

Geändert von Aphton (14. Apr 2011 um 20:10 Uhr)