Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Hiding Application from Task List (Win 3.11)

Posted on 1997-09-13
1
Medium Priority
?
191 Views
Last Modified: 2006-11-17
I need an answer on how I can hide the current running VB 3 app from appearing in the Windows Task Bar. To put it simple how do I switch it on and off from appearing in the Task List.

I know that in VB4 you can do it with the app.taskvisible property. Is there an equivalent API call to do this.
0
Comment
Question by:pcorreya
1 Comment
 
LVL 9

Accepted Solution

by:
cymbolic earned 100 total points
ID: 1434951
Micrswift sez:
All Visual Basic applications have a background window that handles all messages for the application and all calls to the VBRUN???.DLL. This background window is also the owner and parent of all non-MDI child forms. You can use the GetWindow and ShowWindow Windows API functions to hide this background window.

To be eligible for removal from the ALT+TAB order, an application cannot have any visible forms. The background window is visible, but you can use GetWindow to return the background or owner window's handle, and then use the handle and ShowWindow to make the window invisible.

Step-by-Step Example

This example hides itself from the Windows Task List and ALT+TAB order.

1.Start a New Project in Visual Basic. Form1 is created by default.

2.Add a timer control (Timer1) to the form.

3.Add the following declarations to the general declarations section:


   ' Enter each of the following Declare statements as one, single line:
   Declare Function ShowWindow Lib "User" (ByVal hWnd As Integer,
      ByVal nCmdShow As Integer) As Integer
   Declare Function GetWindow Lib "User" (ByVal hWnd As Integer,
      ByVal wCmd As Integer) As Integer
   Const SW_HIDE = 0
   Const GW_OWNER = 4

4.Add the following code to the load event of Form1:

   Sub Form_Load ()

      Dim OwnerhWnd As Integer
      Dim ret As Integer

      ' Make sure the form is invisible:
      form1.Visible = False

      ' Set interval for timer for 5 seconds, and make sure it is enabled:
      timer1.Interval = 5000
      timer1.Enabled = True

      ' Grab the background or owner window:
      OwnerhWnd = GetWindow(Me.hWnd, GW_OWNER)
      ' Hide from task list:
      ret = ShowWindow(OwnerhWnd, SW_HIDE)

   End Sub

5.Add the following code to the Timer event of the Timer1 control to verify that the program is running and to allow you to exit the program:

   Sub Timer1_Timer ()

      Dim ret As Integer

      ' Display a message box:
    ret = MsgBox("Visible by Alt+Tab. Cancel to Quit", 1, "Invisible Form")
      ' If cancel clicked, end the program:
      If ret = 2 Then
         timer1.Enabled = False
         Unload Me
         End
      End If

   End Sub

6.Save the project as INVIS.MAK and create an executable entitled INVIS.EXE.

7.Run the program by double-clicking INVIS.EXE in File Manager or by using the Run option in Program Manager. When you run the program, there should be no visible forms and the program title should not appear in the Task List or in the ALT+TAB order. After five seconds, the application should display the message box. Then the program should be visible to the ALT+TAB order, but not the Task List. Click the Cancel button to exit the application, or click OK to allow it to continue to run.

Hope this helps!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month20 days, 18 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question