Entwickler-Ecke

Windows API - GetClientRect screen minus Taskbar usw. [erledigt]


MaxiTB - So 18.01.04 21:32
Titel: GetClientRect screen minus Taskbar usw. [erledigt]
Habe zwar nach mehreren Stichwort gesucht, gefunden hab ich nix.

Ich hab in Erinnerung, daß es eine Win32-API Funktion gibt, welche die Koordinaten des aktuellen client Bereichs des screens ohne Taskbar zurückliefert (und Office-Leiste, ICQ usw).

Jetzt hab ich die leider verschwitzt - hat einer einen schnellen Blitzgedanken, wie die hies ... ?


MaxiTB - So 18.01.04 22:58

Okay, habs mal so gelöst ...


Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
function TfTicker.GetDesktopClient(): TRect;
var
 lHelp: TRect;
 lHandle: HWND;
begin
 lHandle:=GetDesktopWindow();
 Windows.GetWindowRect(lHandle,Result);

 lHandle:=FindWindow('Shell_TrayWnd''');
 if lHandle<>0 then
 begin
  Windows.GetWindowRect(lHandle,lHelp);
  if Result.Right<lHelp.Right then
   Result.Left:=lHelp.Right-1;
  if Result.Bottom<lHelp.Bottom then
   Result.Top:=lHelp.Bottom-1;
  if lHelp.Left>Result.Right then
   Result.Right:=lHelp.Left+1;
  if lHelp.Top>Result.Top then
   Result.Bottom:=lHelp.Top+1;
 end;

end;


Zufrieden bin ich zwar noch lange nicht damit, aber okay, muß mal reichen.

Ich überlege gerade, ob ich nicht alle Windows enumeriere und dann jene, welche AlwaysTop sind, ebenfalls einbeziehe. Aber okay, später dann mal *g*.

Moderiert von user profile iconPeter Lustig: Code- durch Delphi-Tags ersetzt


Motzi - Mo 19.01.04 11:09

-> SystemParametersInfo mit SPI_GETWORKAREA:
MSDN hat folgendes geschrieben:
SPI_GETWORKAREA

Retrieves the size of the work area on the primary display monitor. The work area is the portion of the screen not obscured by the system taskbar or by application desktop toolbars. The pvParam parameter must point to a RECT structure that receives the coordinates of the work area, expressed in virtual screen coordinates.
To get the work area of a monitor other than the primary display monitor, call the GetMonitorInfo function.


MaxiTB - Mo 19.01.04 11:12
Titel: ::Motzi
TNX - ich wußte doch, irgendwo hatte ichs schon mal her :wink: .

'MSDN hat folgendes geschrieben' - *lol* Ich hasse diesen bösen Humor. :twisted: