Hide Desktop Applications using VB.NET

This tutorial will teach you how to create a program that will hide all your desktop applications using visual basic.net. Now, let's start this tutorial! 1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application. 2. Add only a button named Button1 and a Timer named Timer1. You must design your interface like this: output 3. Import the shell32 go to Project|Add Reference|COM|MIcrosoft Shell Control. Then let's do the coding.
  1. Imports Shell32
We will create a shell out of the shell32 library.
  1. Dim shel As New Shell
Create a structure named LPoint to locate the left position of the desktop.
  1. Structure LPoint
  2. Dim x, y As Int64
  3. End Structure
Create also an Enum named status if the app is hidden or showed.
  1. Enum Status
  2. Hide = 0
  3. Show = 1
  4. End Enum
Declare functions to access the user32 library for showing window and its position.
  1. Declare Function WindowFromPoint Lib "user32" (ByVal X As Int32, ByVal h As Int32) As Int32
  2. Declare Function ShowWindow Lib "user32" (ByVal hwnd As Int64, ByVal st As Status) As Int32
Now, code for the Timer1 for ticking the time to hide the desktop app.
  1. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  2. Dim hwnd As Int64
  3. Dim lpoint2 As LPoint
  4. hwnd = WindowFromPoint(CInt(lpoint2.x), CInt(lpoint2.y))
  5. ShowWindow(hwnd, Status.Hide)
  6. 'disable the timer so that other applications wont be affected
  7. Timer1.Enabled = False
  8. End Sub
Lastly, we will code for clicking of the button. We will only enable the time and minimize our shell.
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. 'minimize all applications so that the desktop will be hiden
  3. shel.MinimizeAll()
  4. Timer1.Enabled = True
  5. End Sub

Output:

output Download the code and try it. For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below. Best Regards, Engr. Lyndon Bermoy IT Instructor/System Developer/Android Developer/Freelance Programmer Mobile: 09488225971 Landline: 826-9296 E-mail:[email protected] Add and Follow me on Facebook: https://www.facebook.com/donzzsky Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

Add new comment