Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   was beduetet {$IFDEF RWFPCHOICE}? (https://www.delphipraxis.net/35643-beduetet-%7B%24ifdef-rwfpchoice%7D.html)

Alex_ITA01 10. Dez 2004 08:11


was beduetet {$IFDEF RWFPCHOICE}?
 
also wie die frage schon sagt, würde ich gerne wissen, was das RWFPCHOICE bedeutet? Das IFDEF weiß ich...
Hier der Source von Eugen

Delphi-Quellcode:
function RealWindowFromPoint(pt: TPoint{$IFDEF RWFPCHOICE}; swinvis: boolean = true{$ENDIF}): HWND;
(*
  Functionality:
    This will get a windows handle from the position of the mouse, even if it is
    for example inside the area occupied by a groupbox.
    [GENERIC] It may be used as a substitute to "ChildWindowFromPoint" which
    however doesn't work as well as this one ;)

  Featured by Eugen, all credits go to him ...

  Corrected version (by Eugen) - should work on 9x now ;)
  I changed a few things more to have a more consistent behavior
*)
type
  PCHILDS_ENUM = ^CHILDS_ENUM;
  CHILDS_ENUM = record
    nDiff: integer;
    hWndFound: HWND;
    pt: TPoint;
{$IFDEF RWFPCHOICE}
    showinvis: boolean;
{$ENDIF RWFPCHOICE}
  end;

var
  ce: CHILDS_ENUM;

  function EnumProc(hwndChild: HWND; lParam: LPARAM): Boolean; stdcall;
(*
  Functionality:
    This is the core of RealWindowFromPoint. It enumerates child windows of the
    window given by handle.
    [SPECIFIC] only useful in the context of this function.
*)
  var
    rc: TRECT;
  begin
    GetWindowRect(hwndChild, rc);

    with PCHILDS_ENUM(lParam)^, rc do
{$IFDEF RWFPCHOICE}
      case showinvis of
        true:
          if (pt.x >= Left) and (pt.x < Right) and (pt.y >= Top) and (pt.y < Bottom) and
            (nDiff > (Right - Left) + (Bottom - Top)) then
          begin
            hWndFound := hwndChild;
            nDiff := (Right - Left) + (Bottom - Top);
          end;
      else
        if (pt.x >= Left) and (pt.x < Right) and (pt.y >= Top) and (pt.y < Bottom) and
          (nDiff > (Right - Left) + (Bottom - Top)) and IsWindowVisible(hwndChild) then
        begin
          hWndFound := hwndChild;
          nDiff := (Right - Left) + (Bottom - Top);
        end;
      end;
{$ELSE RWFPCHOICE}
      if (pt.x >= Left) and (pt.x < Right) and (pt.y >= Top) and (pt.y < Bottom) and
        (nDiff > (Right - Left) + (Bottom - Top)) then
      begin
        hWndFound := hwndChild;
        nDiff := (Right - Left) + (Bottom - Top);
      end;
{$ENDIF RWFPCHOICE}
    Result := True;
  end;

begin
  ce.nDiff := MAXLONG;
  ce.hWndFound := WindowFromPoint(pt);
  ce.pt.x := pt.x; //scheiss-w9x
  ce.pt.y := pt.y; //scheiss-w9x
{$IFDEF RWFPCHOICE}
  ce.showinvis := swinvis;
{$ENDIF RWFPCHOICE}
  if (ce.hWndFound <> 0) then
  begin
      // Windows 9x does not like NULL for a handle handed over to EnumChildWindows()
      // The NT platform treats this just like EnumWindows()
    if (GetWindowLong(ce.hWndFound, GWL_STYLE) and WS_CHILD <> 0) then
      ce.hwndFound := GetParent(ce.hwndFound);
    EnumChildWindows(ce.hWndFound, @EnumProc, Integer(@ce));
  end;
  Result := ce.hwndFound;
end;
MFG Alex

Sanchez 10. Dez 2004 08:16

Re: was beduetet {$IFDEF RWFPCHOICE}?
 
Hallo.
RWFPCHOICE ist einfach eine Bedingung, die bei den Projektoptionen gesetzt ist, oder halt nicht. Die kannst du (weitgehend) nennen wie du willst.

grüße, daniel

Alex_ITA01 10. Dez 2004 08:27

Re: was beduetet {$IFDEF RWFPCHOICE}?
 
okay danke, ich dachte das wäre eine "feste" Direktive (wie z.B. Ver120 oder so)
danke nochmals.MFG Alex


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:12 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