vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
vb@rchiv Offline-Reader - exklusiv auf der vb@rchiv CD Vol.4  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB & Windows API
Re: Ich habe was gefunden 
Autor: planetULTRA
Datum: 08.09.03 19:05

also gut, muss ich es eben machen...

So das hier funzt nur unter WinXP

Option Explicit
 
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal _
  lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx& Lib "user32" Alias "FindWindowExA" ( _
ByVal hWndParent As Long, ByVal hWndChildAfter As Long, ByVal lpClassName As _
String, ByVal lpWindowName As String)
 
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As _
  Long, lpdwProcessId As Long) As Long
 
Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" (ByVal _
  hWnd&, ByVal wMsg&, ByVal wParam&, lParam As Any)
 
Private Type POINTAPI
    X As Long
    Y As Long
End Type
 
'''''''''''''LISTVIEW KONSTANTEN''''''''''''''''
Private Const LVM_FIRST = &H1000
 
Private Const LVM_GETITEMCOUNT = LVM_FIRST + 4
Private Const LVM_GETITEMPOSITION& = LVM_FIRST + 16
 
''''''''''WINDOWS NT/2K/XP Memory Zeugs'''''''''''''''''''
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As _
  Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
 
Const PROCESS_VM_OPERATION = &H8
Const PROCESS_VM_READ = &H10
Const PROCESS_VM_WRITE = &H20
Const PROCESS_ALL_ACCESS = 0
 
Private Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Long, _
  ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flAllocationType As _
  Long, ByVal flProtect As Long) As Long
Private Declare Function VirtualFreeEx Lib "kernel32" (ByVal hProcess As Long, _
lpAddress As Any, ByVal dwSize As Long, ByVal dwFreeType As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As _
Long
 
Const MEM_COMMIT = &H1000
Const MEM_RESERVE = &H2000
Const MEM_DECOMMIT = &H4000
Const MEM_RELEASE = &H8000
Const MEM_FREE = &H10000
Const MEM_PRIVATE = &H20000
Const MEM_MAPPED = &H40000
Const MEM_TOP_DOWN = &H100000
 
Private Const PAGE_NOACCESS = &H1&
Private Const PAGE_READONLY = &H2&
Private Const PAGE_READWRITE = &H4&
Private Const PAGE_WRITECOPY = &H8&
Private Const PAGE_EXECUTE = &H10&
Private Const PAGE_EXECUTE_READ = &H20&
Private Const PAGE_EXECUTE_READWRITE = &H40&
Private Const PAGE_EXECUTE_WRITECOPY = &H80&
Private Const PAGE_GUARD = &H100&
Private Const PAGE_NOCACHE = &H200&
 
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As _
  Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, _
  lpNumberOfBytesWritten As Long) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As _
Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, _
lpNumberOfBytesWritten As Long) As Long
 
Private pIcPos() As POINTAPI
 
Private Function GetIconPositions() As Variant
    Dim pid As Long, tid As Long, lStyle As Long
    Dim hProcess As Long, lpSysShared As Long, dwSize As Long
    Dim lWritten As Long
    Dim lCount As Long
    Dim lHwnd As Long
    Dim l As Long
 
 
    lHwnd = FindWindow("Progman", vbNullString)
    lHwnd = FindWindowEx(lHwnd, 0, "SHELLDLL_defVIEW", vbNullString)
    lHwnd = FindWindowEx(lHwnd, 0, "SysListView32", vbNullString)
 
    lCount = SendMessage(lHwnd, LVM_GETITEMCOUNT, 0, 0&)
 
    ReDim pIcPos(lCount - 1)
 
    tid = GetWindowThreadProcessId(lHwnd, pid)
 
    dwSize = Len(pIcPos(0))
 
        lpSysShared = GetMemSharedNT(pid, dwSize, hProcess)
        WriteProcessMemory hProcess, ByVal lpSysShared, pIcPos(0), dwSize, _
          lWritten
 
        For l = 0 To lCount - 1
            SendMessage lHwnd, LVM_GETITEMPOSITION, l, ByVal lpSysShared
            ReadProcessMemory hProcess, ByVal lpSysShared, pIcPos(l), dwSize, _
              lWritten
 
        Next l
 
        FreeMemSharedNT hProcess, lpSysShared, dwSize
End Function
 
Public Function GetMemSharedNT(ByVal pid As Long, ByVal memSize As Long, _
  hProcess As Long) As Long
    hProcess = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or _
    PROCESS_VM_WRITE, False, pid)
    GetMemSharedNT = VirtualAllocEx(ByVal hProcess, ByVal 0&, ByVal memSize, _
    MEM_RESERVE Or MEM_COMMIT, PAGE_READWRITE)
End Function
 
Public Sub FreeMemSharedNT(ByVal hProcess As Long, ByVal MemAddress As Long, _
  ByVal memSize As Long)
   Call VirtualFreeEx(hProcess, ByVal MemAddress, memSize, MEM_RELEASE)
   CloseHandle hProcess
End Sub
 
Private Sub Command1_Click()
Dim l As Long
 
   GetIconPositions
 
   For l = LBound(pIcPos) To UBound(pIcPos)
        MsgBox "Icon Nr." & l + 1 & " X=" & pIcPos(l).X & " Y=" & pIcPos(l).Y
   Next l
End Sub

For VB Tools visit :: www.planetultra.de ::

alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
DesktopListwiewItems Postion auslesen/setzen2.848--Florian--26.08.03 16:53
Re: DesktopListwiewItems Postion auslesen/setzen1.774--Florian--27.08.03 19:50
Re: DesktopListwiewItems Postion auslesen/setzen1.552E728.08.03 11:27
Re: DesktopListwiewItems Postion auslesen/setzen1.637--Florian--28.08.03 11:53
Re: DesktopListwiewItems Postion auslesen/setzen1.669E728.08.03 12:21
Re: DesktopListwiewItems Postion auslesen/setzen1.890planetULTRA28.08.03 21:47
Re: DesktopListwiewItems Postion auslesen/setzen1.596--Florian--28.08.03 21:55
Ich habe was gefunden1.670--Florian--31.08.03 02:46
Weiß denn keiner wie das bei XP Funktioniert???2.007--Florian--08.09.03 01:06
Re: Ich habe was gefunden1.729planetULTRA08.09.03 13:25
Re: Ich habe was gefunden1.624--Florian--08.09.03 14:05
Re: Ich habe was gefunden3.073planetULTRA08.09.03 19:05
Re: Ich habe was gefunden1.583planetULTRA08.09.03 19:07
Re: Ich habe was gefunden1.475--Florian--08.09.03 19:44
Bin Fertig Hier der Code Teil: 12.483--Florian--08.09.03 20:51
Bin Fertig Hier der Code Teil: 22.716--Florian--08.09.03 20:52
Re: Bin Fertig Hier der Code Teil: 21.798Urs17.03.04 16:49
Re: Bin Fertig Hier der Code Teil: 21.524CyberDreams01.04.04 12:46
Re: Bin Fertig Hier der Code Teil: 21.490planetULTRA01.04.04 14:08
Re: Bin Fertig Hier der Code Teil: 21.727planetULTRA01.04.04 14:29
Re: Bin Fertig Hier der Code Teil: 21.403CyberDreams01.04.04 14:36
Re: Bin Fertig Hier der Code Teil: 21.620--Florian--05.04.04 15:17

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel