| Mit dieser INC kann die Position eines Icons innerhalb einer Listview ausgelesen und gesetzt werden. Arbeitet auch im Zusammenhang mit der Listview.dll von Frank Abbing.
Auch besonderen Dank an Herrn Andreas Miethe und Herrn Uwe Niemeier. KompilierenMarkierenSeparierenDeclare ptOriginal1#,ptOriginal2#
Declare lpSysShard95#
Def FindWindowEx(4) ! user32,FindWindowExA
Def GetWindowThreadProcessId(2) !user32,GetWindowThreadProcessId
Def ReadProcessMemory(5) ! kernel32,ReadProcessMemory
Def WriteProcessMemory(5) ! kernel32,ReadProcessMemory
Def CopyMemory(3) ! kernel32,RtlMoveMemory
Def XFindWindow(2) ! user32,FindWindowA
Declare _dsk_lv&,lpSysShared&,tid&,pid&,dwSize&,lWritten&,hProcess&,hFileMapping&
Struct OSVERSIONINFO = dwOSVersionInfoSize&,dwMajorVersion&,dwMinorVersion&,dwBuildNumber&,dwPlatformId&,szCSDVersion$(128)
Def GetVersionEx(1) ! kernel32 ,GetVersionExA
Def CreateFileMapping(6) ! kernel32,CreateFileMappingA
Def MapViewOfFile(5) ! kernel32,MapViewOfFile
Def UnmapViewOfFile(1) ! kernel32,UnmapViewOfFile
Def &STANDARD_RIGHTS_REQUIRED $F0000
Def &SECTION_QUERY $1
Def &SECTION_MAP_WRITE $2
Def &SECTION_MAP_READ $4
Def &SECTION_MAP_EXECUTE $8
Def &SECTION_EXTEND_SIZE $10
Def OpenProcess(3) ! kernel32,OpenProcess
Def &PROCESS_VM_OPERATION $8
Def &PROCESS_VM_READ $10
Def &PROCESS_VM_WRITE $20
Def &PROCESS_ALL_ACCESS $0
Def VirtualAllocEx(5) ! kernel32,VirtualAllocEx
Def VirtualFreeEx(4) ! kernel32,VirtualFreeEx
Def CloseHandle(1) ! kernel32,CloseHandle
Def &MEM_COMMIT $1000
Def &MEM_RESERVE $2000
Def &MEM_DECOMMIT $4000
Def &MEM_RELEASE $8000
Def &MEM_FREE $10000
Def &MEM_PRIVATE $20000
Def &MEM_MAPPED $40000
Def &MEM_TOP_DOWN $100000
Def &PAGE_NOACCESS $1
Def &PAGE_READONLY $2
Def &PAGE_READWRITE $4
Def &PAGE_WRITECOPY $8
Def &PAGE_EXECUTE $10
Def &PAGE_EXECUTE_READ $20
Def &PAGE_EXECUTE_READWRITE $40
Def &PAGE_EXECUTE_WRITECOPY $80
Def &PAGE_GUARD $100
Def &PAGE_NOCACHE $200
declare ptOriginal3#
declare glob_x&,glob_y&
Dim ptOriginal1#,8
Dim ptOriginal2#,8
Dim ptOriginal3#,256
Proc GetMemShared95
Parameters memSize&
hFileMapping& = CreateFileMapping($FFFFFFFF, 0, &PAGE_READWRITE, 0, memSize& ,0)
Return MapViewOfFile(hFileMapping&,&PAGE_READONLY, 0, 0, 0)
EndProc
Proc FreeMemShared95
Parameters lpMem&,memsize&
UnmapViewOfFile(lpMem&)
CloseHandle(hFileMapping&)
EndProc
Proc GetMemSharedNT
Parameters pid&,memSize&
hProcess& = OpenProcess( OR(OR(&PROCESS_VM_OPERATION,&PROCESS_VM_READ),&PROCESS_VM_WRITE), 0, pid&)
Return VirtualAllocEx(hProcess&,0,memSize&,OR(&MEM_RESERVE,&MEM_COMMIT),&PAGE_READWRITE )
EndProc
Proc FreeMemSharedNT
Parameters hProcess&,MemAddress&,memSize&
VirtualFreeEx(hProcess&,MemAddress&,memSize&,&MEM_RELEASE)
CloseHandle(hProcess&)
EndProc
Proc IsWindowsNT
Declare verinfo#
Dim verinfo#,OSVERSIONINFO
verinfo#.dwOSVersionInfoSize& = 148
GetVersionEx(verinfo#)
If verinfo#.dwPlatformId& = 2
Return 1
Else
Return 0
Endif
EndProc
Proc GetSysLVHwnd
Declare h&
h& = XFindWindow(Progman,0)
h& = FindWindowEx(h&, 0, SHELLDLL_defVIEW,0)
Return FindWindowEx(h&, 0, SysListView32,0)
EndProc
proc getanz
return SendMessage(_dsk_lv&,4100,0,0)
endproc
proc seticnpos
parameters itm%,x%,y%
SendMessage(_dsk_lv&,4111,itm%,y%*65536+x%)Icon-Position setzen
endproc
proc geticnpos
parameters item%
add item%,-1
If IsWindowsNT()
tid& = GetWindowThreadProcessId(_dsk_lv&,addr(pid&))
lpSysShared& = GetMemSharedNT(pid&, dwSize&)
WriteProcessMemory(hProcess&,lpSysShared&,ptOriginal1#, dwSize&,addr(lWritten&))
SendMessage(_dsk_lv&,4112,item%,lpSysShared&)Icon-Position holen
ReadProcessMemory(hProcess&,lpSysShared&,ptOriginal2#, dwSize& ,addr(lWritten&))
glob_x&=long(ptOriginal2#,0)
glob_y&=long(ptOriginal2#,4)
FreeMemSharedNT(hProcess&,lpSysShared&,dwSize&)
Else
lpSysShared& = GetMemShared95(dwSize&)
CopyMemory(lpSysShared&,ptOriginal1#,dwSize&)
SendMessage(_dsk_lv&,4112,item%,lpSysShared&)verursacht Fehlermeldung unter ME
CopyMemory(ptOriginal2#,lpSysShared&,dwSize&)
glob_x&=long(ptOriginal2#,0)
glob_y&=long(ptOriginal2#,4)
FreeMemShared95(lpSysShared&,dwSize&)
Endif
endproc
|
|