win32 interface: use listview message instead of macros, prevents range check errors.

git-svn-id: trunk@10890 -
This commit is contained in:
vincents 2007-04-05 21:24:42 +00:00
parent d164f4a8aa
commit 2dbb188fe0
2 changed files with 10 additions and 8 deletions

View File

@ -470,7 +470,7 @@ begin
if not WSCheckHandleAllocated(ALV, 'GetHoverTime')
then Exit;
Result := ListView_GetHoverTime(ALV.Handle);
Result := SendMessage(ALV.Handle, LVM_GETHOVERTIME, 0, 0);
end;
class function TWin32WSCustomListView.GetItemAt(const ALV: TCustomListView; x,y: integer): Integer;
@ -547,7 +547,7 @@ end;
class function TWin32WSCustomListView.GetHeader(const AHandle: THandle): THandle;
begin
Result := ListView_GetHeader(AHandle);
Result := SendMessage(AHandle, LVM_GETHEADER, 0, 0);
if Result <> 0 then Exit;
// probably old version, try the first child
@ -640,7 +640,7 @@ begin
if not WSCheckHandleAllocated(ALV, 'SetHoverTime')
then Exit;
ListView_SetHoverTime(ALV.Handle, AValue);
SendMessage(ALV.Handle, LVM_SETHOVERTIME, 0, AValue);
end;
class procedure TWin32WSCustomListView.SetImageList(const ALV: TCustomListView; const AList: TListViewImageList; const AValue: TCustomImageList);
@ -788,13 +788,13 @@ class procedure TWin32WSCustomListView.UpdateExStyle(const AHandle: THandle; con
var
OldStyle, NewStyle: Integer;
begin
OldStyle := ListView_GetExtendedListViewStyle(AHandle);
OldStyle := SendMessage(AHandle, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
NewStyle := (OldStyle and not AMask) or AStyle;
if OldStyle = NewStyle then Exit;
ListView_SetExtendedListViewStyle(AHandle, NewStyle);
SendMessage(AHandle, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, NewStyle);
//Invalidate Listview, so that changes are made visible
Windows.InvalidateRect(AHandle, nil, true);

View File

@ -218,14 +218,15 @@ Const
// for GetRandomRgn
SYSRGN = 4;
{not used anymore
// missing listview macros
function ListView_GetHeader(hwndLV: HWND): HWND;
function ListView_GetExtendedListViewStyle(hwndLV: HWND): DWORD;
function ListView_SetExtendedListViewStyle(hwndLV: HWND; dw: DWORD): BOOL;
function ListView_GetHoverTime(hwndLV: HWND): DWORD;
function ListView_SetHoverTime(hwndLV: HWND; dwHoverTimeMs: DWORD): DWORD;
}
{ Win32 API functions not included in windows.pp }
@ -296,6 +297,7 @@ Uses SysUtils;
{$PACKRECORDS NORMAL}
{not used anymore
function ListView_GetHeader(hwndLV: HWND): HWND;
begin
Result := SendMessage(hwndLV, LVM_GETHEADER, 0, 0);
@ -324,7 +326,7 @@ end;
procedure ListView_SetCheckState(hwndLV: HWND; iIndex: UINT;fCheck:BOOL);
begin
end;
}
Var
TmpStr: PChar;