Hack Forums
[.NET] Hide the Desktop Icons - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Hide the Desktop Icons (/showthread.php?tid=5739943)



Hide the Desktop Icons - D3n1s1990 - Oct 19, 2017

PHP Code

<?php 
Imports System
.Runtime.InteropServices

Public Class Form1
    
Public Class ToggleDesktopIcon

        
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
        
Private Shared Function FindWindow( _
            ByVal lpClassName 
As String, _
            ByVal lpWindowName 
As String) As IntPtr
        End 
Function

        <
DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
        
Private Shared Function GetWindow( _
            ByVal hWnd 
As IntPtr, _
            ByVal uCmd 
As UInteger) As IntPtr
        End 
Function

        Private Enum 
GetWindowCmd As UInteger
            GW_HWNDFIRST 
= 0
            GW_HWNDLAST 
= 1
            GW_HWNDNEXT 
= 2
            GW_HWNDPREV 
= 3
            GW_OWNER 
= 4
            GW_CHILD 
= 5
            GW_ENABLEDPOPUP 
= 6
        End Enum

        
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
        
Private Shared Function ShowWindow( _
            ByVal hwnd 
As IntPtr, _
            ByVal nCmdShow 
As Int32) As Boolean
        End 
Function

        Private Enum 
SW As Int32
            Hide 
= 0
            Normal 
= 1
            ShowMinimized 
= 2
            ShowMaximized 
= 3
            ShowNoActivate 
= 4
            Show 
= 5
            Minimize 
= 6
            ShowMinNoActive 
= 7
            ShowNA 
= 8
            Restore 
= 9
            ShowDefault 
= 10
            ForceMinimize 
= 11
            Max 
= 11
        End Enum

        
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
        
Private Shared Function IsWindowVisible(ByVal hwnd As IntPtr) As Boolean
        End 
Function

        Public 
Shared Sub Toggle()
            
Dim hWnd As IntPtr = FindWindow("ProgMan", Nothing)
            
hWnd = GetWindow(hWnd, GetWindowCmd.GW_CHILD)

            If 
IsWindowVisible(hWnd) Then
                ShowWindow
(hWnd, SW.Hide)
            Else
                
ShowWindow(hWnd, SW.ShowNoActivate)
            
End If
        
End Sub
    End 
Class

    Private 
Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ToggleDesktopIcon
.Toggle()
    
End Sub
End 
Class 



RE: Hide the Desktop Icons - Mr Slothells - Nov 6, 2017

you need to override the administrator