win32 interface: 64 bit fixes from Florian

git-svn-id: trunk@9920 -
This commit is contained in:
vincents 2006-09-17 20:47:15 +00:00
parent 0e8e873507
commit 436f4fbaef
4 changed files with 94 additions and 74 deletions

View File

@ -265,12 +265,12 @@ Var
if PopupMenu<>nil then //processing popup menu if PopupMenu<>nil then //processing popup menu
begin begin
WindowInfo^.PopupMenu := nil; WindowInfo^.PopupMenu := nil;
Result := PopupMenu.FindItem(Lo(WParam), fkCommand); Result := PopupMenu.FindItem(LOWORD(WParam), fkCommand);
end; end;
if Result=nil then //if Result is still nil, process main menu if Result=nil then //if Result is still nil, process main menu
begin begin
MainMenuHandle := GetMenu(Window); MainMenuHandle := GetMenu(Window);
if GetMenuItemInfo(MainMenuHandle, Lo(WParam), false, @MenuInfo) then if GetMenuItemInfo(MainMenuHandle, LOWORD(WParam), false, @MenuInfo) then
Result := TObject(MenuInfo.dwItemData); Result := TObject(MenuInfo.dwItemData);
end; end;
end; end;
@ -580,13 +580,13 @@ Var
with LMScroll do with LMScroll do
begin begin
Msg := LMsg; Msg := LMsg;
ScrollCode := SmallInt(Lo(WParam)); ScrollCode := LOWORD(WParam);
SmallPos := 0; SmallPos := 0;
ScrollBar := ScrollbarHandle; ScrollBar := ScrollbarHandle;
Pos := 0; Pos := 0;
end; end;
if not (Lo(WParam) in [SB_THUMBTRACK, SB_THUMBPOSITION]) if not (LOWORD(WParam) in [SB_THUMBTRACK, SB_THUMBPOSITION])
then begin then begin
WindowInfo^.TrackValid := False; WindowInfo^.TrackValid := False;
Exit; Exit;
@ -615,17 +615,17 @@ Var
ScrollInfo.cbSize := SizeOf(ScrollInfo); ScrollInfo.cbSize := SizeOf(ScrollInfo);
if Lo(WParam) = SB_THUMBTRACK if LOWORD(WParam) = SB_THUMBTRACK
then begin then begin
ScrollInfo.fMask := SIF_TRACKPOS; ScrollInfo.fMask := SIF_TRACKPOS;
// older windows versions may not support trackpos, so fill it with some default // older windows versions may not support trackpos, so fill it with some default
if WindowInfo^.TrackValid if WindowInfo^.TrackValid
then ScrollInfo.nTrackPos := (WindowInfo^.TrackPos and $FFFF0000) or Hi(WParam) then ScrollInfo.nTrackPos := (WindowInfo^.TrackPos and $FFFF0000) or HIWORD(WParam)
else ScrollInfo.nTrackPos := Hi(WParam); else ScrollInfo.nTrackPos := HIWORD(WParam);
end end
else begin else begin
ScrollInfo.fMask := SIF_POS; ScrollInfo.fMask := SIF_POS;
ScrollInfo.nPos := Hi(WParam); ScrollInfo.nPos := HIWORD(WParam);
end; end;
if ScrollbarHandle <> 0 if ScrollbarHandle <> 0
@ -640,7 +640,7 @@ Var
else GetScrollInfo(Window, SB_VERT, ScrollInfo); else GetScrollInfo(Window, SB_VERT, ScrollInfo);
end; end;
if Lo(WParam) = SB_THUMBTRACK if LOWORD(WParam) = SB_THUMBTRACK
then begin then begin
LMScroll.Pos := ScrollInfo.nTrackPos; LMScroll.Pos := ScrollInfo.nTrackPos;
WindowInfo^.TrackPos := ScrollInfo.nTrackPos; WindowInfo^.TrackPos := ScrollInfo.nTrackPos;
@ -648,8 +648,8 @@ Var
end end
else begin else begin
if WindowInfo^.TrackValid if WindowInfo^.TrackValid
then LMScroll.Pos := (WindowInfo^.TrackPos and $FFFF0000) or Hi(WParam) then LMScroll.Pos := (WindowInfo^.TrackPos and $FFFF0000) or HIWORD(WParam)
else LMScroll.Pos := (ScrollInfo.nPos and $FFFF0000) or Hi(WParam); else LMScroll.Pos := (ScrollInfo.nPos and $FFFF0000) or HIWORD(WParam);
end; end;
if LMScroll.Pos < High(LMScroll.SmallPos) if LMScroll.Pos < High(LMScroll.SmallPos)
@ -663,7 +663,7 @@ Var
BoundsOffset: TRect; BoundsOffset: TRect;
begin begin
if (lWinControl <> nil) and not (csDesigning in lWinControl.ComponentState) if (lWinControl <> nil) and not (csDesigning in lWinControl.ComponentState)
and (Lo(LParam) = HTCLIENT) then and (LOWORD(LParam) = HTCLIENT) then
begin begin
Windows.GetCursorPos(Windows.POINT(P)); Windows.GetCursorPos(Windows.POINT(P));
Windows.ScreenToClient(Window, Windows.POINT(P)); Windows.ScreenToClient(Window, Windows.POINT(P));
@ -921,12 +921,12 @@ begin
Assert(False, 'Trace:WindowProc - Getting Callback Object'); Assert(False, 'Trace:WindowProc - Getting Callback Object');
Assert(False, 'Trace:WindowProc - Checking Proc'); Assert(False, 'Trace:WindowProc - Checking Proc');
Assert(False, Format('Trace:WindowProc - Window Value: $%S-%d; Msg Value: %S; WParam: $%S; LParam: $%S', [IntToHex(Window, 4), Window, WM_To_String(Msg), IntToHex(WParam, 4), IntToHex(LParam, 4)])); Assert(False, Format('Trace:WindowProc - Window Value: $%S-%d; Msg Value: %S; WParam: $%S; LParam: $%S', [IntToHex(Window, 4), Window, WM_To_String(Msg), IntToHex(WParam, sizeof(WParam)*4), IntToHex(LParam, sizeof(LParam)*4)]));
Case Msg Of Case Msg Of
WM_ACTIVATE: WM_ACTIVATE:
Begin Begin
Case Lo(WParam) Of Case LOWORD(WParam) Of
WA_ACTIVE, WA_CLICKACTIVE: WA_ACTIVE, WA_CLICKACTIVE:
Begin Begin
LMessage.Msg := LM_ACTIVATE LMessage.Msg := LM_ACTIVATE
@ -993,7 +993,7 @@ begin
End; End;
WM_MENUCHAR: WM_MENUCHAR:
Begin Begin
PLMsg^.Result := FindMenuItemAccelerator(chr(lo(WParam)), LParam); PLMsg^.Result := FindMenuItemAccelerator(chr(LOWORD(WParam)), LParam);
WinProcess := false; WinProcess := false;
End; End;
WM_CLOSE: WM_CLOSE:
@ -1016,7 +1016,7 @@ begin
TargetObject := GetMenuItemObject; TargetObject := GetMenuItemObject;
if TargetObject is TMenuItem then if TargetObject is TMenuItem then
begin begin
if (Hi(WParam) = 0) or (Hi(WParam) = 1) then if (HIWORD(WParam) = 0) or (HIWORD(WParam) = 1) then
begin begin
LMessage.Msg := LM_ACTIVATE; LMessage.Msg := LM_ACTIVATE;
TargetObject.Dispatch(LMessage); TargetObject.Dispatch(LMessage);
@ -1029,29 +1029,29 @@ begin
if lWinControl = nil then if lWinControl = nil then
lWinControl := GetWindowInfo(LParam)^.AWinControl; lWinControl := GetWindowInfo(LParam)^.AWinControl;
if lWinControl is TCustomButton then if lWinControl is TCustomButton then
case Hi(WParam) of case HIWORD(WParam) of
BN_CLICKED: LMessage.Msg := LM_CLICKED; BN_CLICKED: LMessage.Msg := LM_CLICKED;
BN_KILLFOCUS: LMessage.Msg := LM_EXIT; BN_KILLFOCUS: LMessage.Msg := LM_EXIT;
end end
else if (lWinControl is TCustomEdit) then else if (lWinControl is TCustomEdit) then
case Hi(WParam) of case HIWORD(WParam) of
EN_CHANGE: LMessage.Msg := CM_TEXTCHANGED; EN_CHANGE: LMessage.Msg := CM_TEXTCHANGED;
end end
else if (lWinControl is TCustomFloatSpinEdit) then else if (lWinControl is TCustomFloatSpinEdit) then
case Hi(WParam) of case HIWORD(WParam) of
EN_CHANGE: HandleSpinEditChange(TCustomFloatSpinEdit(lWinControl)); EN_CHANGE: HandleSpinEditChange(TCustomFloatSpinEdit(lWinControl));
end end
else if (lWinControl is TCustomMemo) then else if (lWinControl is TCustomMemo) then
case Hi(WParam) of case HIWORD(WParam) of
// multiline edit doesn't send EN_CHANGE, so use EN_UPDATE // multiline edit doesn't send EN_CHANGE, so use EN_UPDATE
EN_UPDATE: LMessage.Msg := CM_TEXTCHANGED; EN_UPDATE: LMessage.Msg := CM_TEXTCHANGED;
end end
else if (lWinControl is TCustomListBox) then else if (lWinControl is TCustomListBox) then
case Hi(WParam) of case HIWORD(WParam) of
LBN_SELCHANGE: LMessage.Msg := LM_SELCHANGE; LBN_SELCHANGE: LMessage.Msg := LM_SELCHANGE;
end end
else if lWinControl is TCustomCombobox then else if lWinControl is TCustomCombobox then
case Hi(WParam) of case HIWORD(WParam) of
CBN_EDITCHANGE: LMessage.Msg := LM_CHANGED; CBN_EDITCHANGE: LMessage.Msg := LM_CHANGED;
{ CBN_EDITCHANGE is only sent after the user changes the edit box. { CBN_EDITCHANGE is only sent after the user changes the edit box.
CBN_SELCHANGE is sent when the user changes the text by CBN_SELCHANGE is sent when the user changes the text by
@ -1117,10 +1117,12 @@ begin
Windows.SetTextColor(HDC(WParam), Windows.COLORREF(ColorToRGB(ChildWinControl.Font.Color))); Windows.SetTextColor(HDC(WParam), Windows.COLORREF(ColorToRGB(ChildWinControl.Font.Color)));
Windows.SetBkColor(HDC(WParam), Windows.COLORREF(ColorToRGB(ChildWinControl.Brush.Color))); Windows.SetBkColor(HDC(WParam), Windows.COLORREF(ColorToRGB(ChildWinControl.Brush.Color)));
LMessage.Result := LResult(ChildWinControl.Brush.Handle); LMessage.Result := LResult(ChildWinControl.Brush.Handle);
DebugLn(['WindowProc ', ChildWinControl.Name, ' Brush: ', LMessage.Result]);
// Override default handling // Override default handling
WinProcess := false; WinProcess := false;
end; end;
end; end;
if (Msg = WM_CTLCOLORSCROLLBAR) then WinProcess := true;
end; end;
WM_CLEAR: WM_CLEAR:
begin begin
@ -1344,8 +1346,8 @@ begin
With LMMouse Do With LMMouse Do
Begin Begin
Msg := LM_LBUTTONDBLCLK; Msg := LM_LBUTTONDBLCLK;
XPos := SmallInt(Lo(LParam)); XPos := GET_X_LPARAM(LParam);
YPos := SmallInt(Hi(LParam)); YPos := GET_Y_LPARAM(LParam);
Keys := WParam; Keys := WParam;
End; End;
@ -1374,8 +1376,8 @@ begin
With LMMouse Do With LMMouse Do
Begin Begin
Msg := LM_LBUTTONDOWN; Msg := LM_LBUTTONDOWN;
XPos := SmallInt(Lo(LParam)); XPos := GET_X_LPARAM(LParam);
YPos := SmallInt(Hi(LParam)); YPos := GET_Y_LPARAM(LParam);
Keys := WParam; Keys := WParam;
End; End;
@ -1396,8 +1398,8 @@ begin
With LMMouse Do With LMMouse Do
Begin Begin
Msg := LM_LBUTTONUP; Msg := LM_LBUTTONUP;
XPos := SmallInt(Lo(LParam)); XPos := GET_X_LPARAM(LParam);
YPos := SmallInt(Hi(LParam)); YPos := GET_Y_LPARAM(LParam);
Keys := WParam; Keys := WParam;
End; End;
End; End;
@ -1408,8 +1410,8 @@ begin
With LMMouse Do With LMMouse Do
Begin Begin
Msg := LM_MBUTTONDBLCLK; Msg := LM_MBUTTONDBLCLK;
XPos := SmallInt(Lo(LParam)); XPos := GET_X_LPARAM(LParam);
YPos := SmallInt(Hi(LParam)); YPos := GET_Y_LPARAM(LParam);
Keys := WParam; Keys := WParam;
End; End;
End; End;
@ -1420,8 +1422,8 @@ begin
With LMMouse Do With LMMouse Do
Begin Begin
Msg := LM_MBUTTONDOWN; Msg := LM_MBUTTONDOWN;
XPos := SmallInt(Lo(LParam)); XPos := GET_X_LPARAM(LParam);
YPos := SmallInt(Hi(LParam)); YPos := GET_Y_LPARAM(LParam);
Keys := WParam; Keys := WParam;
End; End;
End; End;
@ -1432,8 +1434,8 @@ begin
With LMMouse Do With LMMouse Do
Begin Begin
Msg := LM_MBUTTONUP; Msg := LM_MBUTTONUP;
XPos := SmallInt(Lo(LParam)); XPos := GET_X_LPARAM(LParam);
YPos := SmallInt(Hi(LParam)); YPos := GET_Y_LPARAM(LParam);
Keys := WParam; Keys := WParam;
End; End;
End; End;
@ -1454,8 +1456,8 @@ begin
With LMMouseMove Do With LMMouseMove Do
Begin Begin
Msg := LM_MOUSEMOVE; Msg := LM_MOUSEMOVE;
XPos := SmallInt(Lo(LParam)); XPos := GET_X_LPARAM(LParam);
YPos := SmallInt(Hi(LParam)); YPos := GET_Y_LPARAM(LParam);
Keys := WParam; Keys := WParam;
// check if this is a spurious WM_MOUSEMOVE message, pos not actually changed // check if this is a spurious WM_MOUSEMOVE message, pos not actually changed
if (XPos = WindowInfo^.MouseX) and (YPos = WindowInfo^.MouseY) then if (XPos = WindowInfo^.MouseX) and (YPos = WindowInfo^.MouseY) then
@ -1478,8 +1480,8 @@ begin
PLMsg:=@LMMouseEvent; PLMsg:=@LMMouseEvent;
With LMMouseEvent Do With LMMouseEvent Do
Begin Begin
X := SmallInt(Lo(LParam)); X := GET_X_LPARAM(LParam);
Y := SmallInt(Hi(LParam)); Y := GET_Y_LPARAM(LParam);
// check if mouse cursor within this window, otherwise send message to window the mouse is hovering over // check if mouse cursor within this window, otherwise send message to window the mouse is hovering over
P.X := X; P.X := X;
P.Y := Y; P.Y := Y;
@ -1503,8 +1505,8 @@ begin
if lWinControl.FCompStyle <> csComboBox then if lWinControl.FCompStyle <> csComboBox then
begin begin
Msg := LM_MOUSEWHEEL; Msg := LM_MOUSEWHEEL;
Button := Lo(WParam); Button := LOWORD(WParam);
WheelDelta := SmallInt(Hi(WParam)); WheelDelta := SmallInt(HIWORD(WParam));
State := GetShiftState; State := GetShiftState;
UserData := Pointer(GetWindowLong(Window, GWL_USERDATA)); UserData := Pointer(GetWindowLong(Window, GWL_USERDATA));
WinProcess := false; WinProcess := false;
@ -1604,8 +1606,8 @@ begin
With LMMouse Do With LMMouse Do
Begin Begin
Msg := LM_RBUTTONDBLCLK; Msg := LM_RBUTTONDBLCLK;
XPos := SmallInt(Lo(LParam)); XPos := GET_X_LPARAM(LParam);
YPos := SmallInt(Hi(LParam)); YPos := GET_Y_LPARAM(LParam);
Keys := WParam; Keys := WParam;
End; End;
End; End;
@ -1616,8 +1618,8 @@ begin
With LMMouse Do With LMMouse Do
Begin Begin
Msg := LM_RBUTTONDOWN; Msg := LM_RBUTTONDOWN;
XPos := SmallInt(Lo(LParam)); XPos := GET_X_LPARAM(LParam);
YPos := SmallInt(Hi(LParam)); YPos := GET_Y_LPARAM(LParam);
Keys := WParam; Keys := WParam;
End; End;
End; End;
@ -1629,8 +1631,8 @@ begin
With LMMouse Do With LMMouse Do
Begin Begin
Msg := LM_RBUTTONUP; Msg := LM_RBUTTONUP;
XPos := SmallInt(Lo(LParam)); XPos := GET_X_LPARAM(LParam);
YPos := SmallInt(Hi(LParam)); YPos := GET_Y_LPARAM(LParam);
Keys := WParam; Keys := WParam;
Result := 0; Result := 0;
End; End;
@ -2086,7 +2088,7 @@ function WindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
LParam: Windows.LParam): LResult; stdcall; LParam: Windows.LParam): LResult; stdcall;
begin begin
DebugLn(MessageStackDepth, 'WindowProc called for window=', IntToHex(Window, 8),' msg=', DebugLn(MessageStackDepth, 'WindowProc called for window=', IntToHex(Window, 8),' msg=',
WM_To_String(msg),' wparam=', IntToHex(WParam, 8), ' lparam=', IntToHex(lparam, 8)); WM_To_String(msg),' wparam=', IntToHex(WParam, sizeof(WParam)*4), ' lparam=', IntToHex(lparam, sizeof(lparam)*4));
MessageStackDepth := MessageStackDepth + ' '; MessageStackDepth := MessageStackDepth + ' ';
Result := RealWindowProc(Window, Msg, WParam, LParam); Result := RealWindowProc(Window, Msg, WParam, LParam);

View File

@ -96,7 +96,7 @@ const
Type Type
PInitCommonControlsEx = ^TInitCommonControlsEx; PInitCommonControlsEx = ^TInitCommonControlsEx;
TInitCommonControlsEx = packed record TInitCommonControlsEx = record
dwSize: dword; dwSize: dword;
dwICC: dword; dwICC: dword;
end; end;

View File

@ -157,7 +157,7 @@ const
(bsDisabled, bsUp); (bsDisabled, bsUp);
type type
BUTTON_IMAGELIST = packed record BUTTON_IMAGELIST = record
himl: Windows.HIMAGELIST; himl: Windows.HIMAGELIST;
margin: Windows.RECT; margin: Windows.RECT;
uAlign: UINT; uAlign: UINT;

View File

@ -236,6 +236,11 @@ Function Replace(Const Str, OrigStr, ReplStr: String; Const Global: Boolean): St
Str into substrings around SplitStr } Str into substrings around SplitStr }
Function Split(Const Str: String; SplitStr: String; Count: Integer; Const CaseSensitive: Boolean): TStringList; Function Split(Const Str: String; SplitStr: String; Count: Integer; Const CaseSensitive: Boolean): TStringList;
{$ifdef VER2_0}
function GET_X_LPARAM(lp : Windows.LParam) : longint;
function GET_Y_LPARAM(lp : Windows.LParam) : longint;
{$endif VER2_0}
Implementation Implementation
Uses SysUtils; Uses SysUtils;
@ -333,6 +338,19 @@ Begin
End; End;
End; End;
{$ifdef VER2_0}
function GET_X_LPARAM(lp : Windows.LParam) : longint;
begin
result:=smallint(LOWORD(lp));
end;
function GET_Y_LPARAM(lp : Windows.LParam) : longint;
begin
result:=smallint(HIWORD(lp));
end;
{$endif VER2_0}
Initialization Initialization
TmpStr := StrNew(''); TmpStr := StrNew('');