////////////////////////////////////////////////////////////////////////////////
//
// GetDesktopListView
// Desktop Listview Handle ermitteln
// Author: Nico Bendlin
function GetDesktopListView: HWND;
var
Progman: HWND;
DefView: HWND;
function EnumDefViewProc(Wnd: HWND;
out DefView: HWND): BOOL;
stdcall;
var
ClassName:
array[0..255]
of Char;
begin
DefView := Wnd;
ClassName[0] := #0;
GetClassName(Wnd, ClassName, 255);
Result := lstrcmp(ClassName, '
SHELLDLL_DefView') <> 0;
end;
begin
Result := HWND(
nil);
Progman := FindWindow('
Progman',
nil);
if Progman <> HWND(
nil)
then
begin
DefView := FindWindowEx(Progman, HWND(
nil), '
SHELLDLL_DefView',
nil);
if DefView <> HWND(
nil)
then
begin
if IsActiveDesktopActive
then
EnumChildWindows(DefView, @EnumDefViewProc, LPARAM(@DefView));
Result := FindWindowEx(DefView, HWND(
nil), '
SysListView32',
nil);
end;
end;
if Result = HWND(
nil)
then
MessageBox(HWND(
nil), PChar(ERROR_GETDESKTOPHANDLE), APPNAME,
MB_ICONERROR);
end;
const
ItemBufferBlockSize = $1000;
type
PLvItemBuffer = ^TLvItemBuffer;
TLvItemBuffer =
packed record
case Integer
of
0: (
LvItem32:
packed record
mask: LongWord;
iItem: LongInt;
iSubItem: LongInt;
state: LongWord;
stateMask: LongWord;
pszText: LongWord;
cchTextMax: LongInt;
iImage: LongInt;
lParam: LongWord;
iIndent: LongInt;
iGroupId: LongInt;
cColumns: LongWord;
puColumns: LongWord
end);
1: (
LvItem64:
packed record
mask: LongWord;
iItem: LongInt;
iSubItem: LongInt;
state: LongWord;
stateMask: LongWord;
_align1: LongWord;
pszText: Int64;
cchTextMax: LongInt;
iImage: LongInt;
lParam: Int64;
iIndent: LongInt;
iGroupId: LongInt;
cColumns: LongWord;
_align2: LongWord;
puColumns: Int64;
end);
2: (LvItemBuff:
array[0..ItemBufferBlockSize - 1]
of Byte;
case Integer
of
0: (AnsiText:
array[0..ItemBufferBlockSize - 1]
of AnsiChar);
1: (WideText:
array[0..ItemBufferBlockSize
div 2 - 1]
of WideChar);
2: (ItemText:
array[0..ItemBufferBlockSize
div SizeOf(Char) - 1]
of
Char));
end;
type
TFNIsWow64Process =
function(hProcess: THandle;
out Wow64Process: BOOL):
BOOL;
stdcall;
var
FNIsWow64Process: TFNIsWow64Process;