Hide Desktop Applications using VB.NET
Submitted by donbermoy on Saturday, May 23, 2015 - 22:41.
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:
3. Import the shell32 go to Project|Add Reference|COM|MIcrosoft Shell Control.
Then let's do the coding.
We will create a shell out of the shell32 library.
Create a structure named LPoint to locate the left position of the desktop.
Create also an Enum named status if the app is hidden or showed.
Declare functions to access the user32 library for showing window and its position.
Now, code for the Timer1 for ticking the time to hide the desktop app.
Lastly, we will code for clicking of the button. We will only enable the time and minimize our shell.
- Imports Shell32
- Dim shel As New Shell
- Structure LPoint
- Dim x, y As Int64
- End Structure
- Enum Status
- Hide = 0
- Show = 1
- End Enum
- Declare Function WindowFromPoint Lib "user32" (ByVal X As Int32, ByVal h As Int32) As Int32
- Declare Function ShowWindow Lib "user32" (ByVal hwnd As Int64, ByVal st As Status) As Int32
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- Dim hwnd As Int64
- Dim lpoint2 As LPoint
- hwnd = WindowFromPoint(CInt(lpoint2.x), CInt(lpoint2.y))
- ShowWindow(hwnd, Status.Hide)
- 'disable the timer so that other applications wont be affected
- Timer1.Enabled = False
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- 'minimize all applications so that the desktop will be hiden
- shel.MinimizeAll()
- Timer1.Enabled = True
- End Sub
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/BermzISwareAdd new comment
- 426 views