Rubrik: System/Windows · Desktop/Bildschirm/Display | VB-Versionen: VB4, VB5, VB6 | 25.04.01 |
Desktop-Icons ein/ausblenden Mit nur zwei API-Funktionen lassen sich die Symbole auf dem Windows-Desktop aus- und auch wieder einblenden. | ||
Autor: Maximilian Marx | Bewertung: | Views: 27.200 |
www.mmmw.my100megs.com | System: Win9x, WinNT, Win2k, WinXP, Win7, Win8, Win10, Win11 | Beispielprojekt auf CD |
Mit nur zwei API-Funktionen lassen sich die Symbole auf dem Windows-Desktop aus- und auch wieder einblenden.
' zunächst die benötigten API-Deklarationen Declare Function FindWindow Lib "user32" _ Alias "FindWindowA" ( _ ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Declare Function ShowWindow Lib "user32" ( _ ByVal hWnd As Long, _ ByVal nCmdShow As Long) As Long Const SW_HIDE = 0 Const SW_RESTORE = 9 ' Desktop-Symbole ausblenden Public Sub DesktopIconsHide() Dim hWnd As Long hWnd = FindWindow(vbNullString, "Program Manager") If Not hWnd = 0 Then ShowWindow hWnd, SW_HIDE End If End Sub ' Desktop-Symbole wieder anzeigen Public Sub DesktopIconsShow() Dim hWnd As Long hWnd = FindWindow(vbNullString, "Program Manager") If Not hWnd = 0 Then ShowWindow hWnd, SW_RESTORE End If End Sub
Beispielsaufruf:
Private Sub Command1_Click() ' Symbole ausblenden DesktopIconsHide End Sub Private Sub Command2_Click() ' Symbole wieder anzeigen DesktopIconsShow End Sub