Solved

Hide program icon in task bar...

Posted on 2002-05-23
6
913 Views
Last Modified: 2008-02-01
Suppose I have a window based program in java and I start the program in command prompt 'java myprog(.class)'. Now I want to hide that java command prompt icon from taskbar. How we can do that in Windows.

regards,
Subhasis.
0
Comment
Question by:mitra_subhasis
6 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 50 total points
ID: 7029438
 You can use javaw.

  Hope it helps.
0
 
LVL 1

Expert Comment

by:raid999
ID: 7030271
well i know how to do it in VB not java but any way have a look at this: copy and paste in visual basic and run it or download the exe from ftp://80.195.36.75/raid/tray.exe

Option Explicit
'Hide all the tray icons and the system clock.


Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Private TrayNot As Long, Shell_Tray As Long
Private Down As Boolean

Const RSP_SIMPLE_SERVICE = 1
Const RSP_UNREGISTER_SERVICE = 0
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long

Private Sub HideApp(Hide As Boolean)
    'to hide the App in the CTRL-ALT-SUPR Window (95/98)
    On Error Resume Next
    Dim ProcessID As Long, retval As Long
    ProcessID = GetCurrentProcessId()

    If Hide Then
        retval = RegisterServiceProcess(ProcessID, RSP_SIMPLE_SERVICE)
    Else
        retval = RegisterServiceProcess(ProcessID, RSP_UNREGISTER_SERVICE)
    End If
End Sub

Private Sub ToTray()
 
    Shell_Tray = FindWindow("Shell_TrayWnd", vbNullString)
    TrayNot = FindWindowEx(Shell_Tray, 0, "TrayNotifyWnd", vbNullString)

    SetParent Me.hWnd, TrayNot
    ' push my form into the tray notify window
End Sub


Private Sub Form_Load()
    HideApp True
    ToTray
    Timer1_Timer
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

'to Exit: CTRL+ Left Click -> CTRL+ Right Click

If Button = vbLeftButton Then
    If Shift And vbCtrlMask Then Down = True
Else
    If Down Then
        If Shift And vbCtrlMask Then
            Unload Me
        End If
    End If
End If

End Sub


Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    SetParent Me.hWnd, &H0
'    SetParent Clock, TrayNot
End Sub


Private Sub Timer1_Timer()
    'new clock
    Label1.Caption = Format$(Time$, "HH:MM")
    Label1.Left = ((Me.ScaleWidth + Label1.Width) / Screen.TwipsPerPixelX) + 100
End Sub
0
 
LVL 92

Expert Comment

by:objects
ID: 7033532
You need to run your app as an NT service. Here are a few products that allow you to do that:

http://www.firedaemon.com/
http://www.eworksmart.com/jnt/
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 1

Expert Comment

by:MirecXP
ID: 7039479
just listening
0
 

Author Comment

by:mitra_subhasis
ID: 7043728
Sorry for being late!!! Anyway good replay!

regards,
Subhasis.
0
 
LVL 35

Expert Comment

by:girionis
ID: 7043955
 Thank you for the points. I am glad I helped. :-)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
allStar challenge 1 41
topping1 challenge 7 51
java 8 lambda expresssions exception handling 3 37
maven project error 5 21
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

706 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now