Feedback

VB - Anzahl der Desktop Icons ermitteln

Veröffentlicht von am 12.05.2007
(2 Bewertungen)
Wie der Name schon sagt ermittelt diese Funktion wieviel Icons auf dem Desktop liegen.
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String) _
As Int32

Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" ( _
    ByVal hWnd1 As Int32, _
    ByVal hWnd2 As Int32, _
    ByVal lpsz1 As String, _
    ByVal lpsz2 As String) _
As Int32

Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
    ByVal hwnd As Int32, _
    ByVal wMsg As Int32, _
    ByVal wParam As Int32, _
    ByVal lParam As Int32) _
As Int32


Public Function GetDesktopIconsCount()
    Dim LVWHandle As Int32

    'Handle zum Hauptprogramm finden
    LVWHandle = FindWindow(vbNullString, "Program Manager")

    'Handle zum Desktop Fenster ermitteln
    LVWHandle = FindWindowEx(LVWHandle, 0, "shelldll_defview", vbNullString)

    'Handle zur Desktop ListView ermitteln
    LVWHandle = FindWindowEx(LVWHandle, 0, "SysListView32", vbNullString)

    Return SendMessage(LVWHandle, 4100, 0, 0)
End Function
Abgelegt unter Desktop, Icon, Anzahl.

Kommentare zum Snippet

 

Logge dich ein, um hier zu kommentieren!