-->>Now I have managed to go through some codes that creates a System Tray Icon...
-->>I've managed to create it but something is wrong here that disturbs Me...
-->>When I Click on the Tray Icon of My Software it wont Load My Application...
-->>That is Say if it was Minimized it wont Show up...
-->>May I get some sample code that may help Me on this?
-->>Regards...

Recommended Answers

All 8 Replies

What code do you have at the moment?

-->>On the Module I have this:

Option Explicit
'******************************************************************'
'* THESE VARIABLE WILL BE USED IN FORM CREATES OUR NOTIFYICONDATA *'
'******************************************************************'
Public Retrieve_Value As Integer
Public Note_ID As NOTIFYICONDATA

Public Type NOTIFYICONDATA
    cbSize As Long
    hWnd As Long
    uID As Long
    uFlags As Long
    uCallbackMessage As Long
    hIcon As Long
    szTip As String * 64
End Type

Public Const NIM_ADD = 0
Public Const NIM_DELETE = 2
Public Const NIF_MESSAGE = 1
Public Const NIF_ICON = 2
Public Const NIF_TIP = 4

Public Declare Function Shell_NotifyIconA Lib "SHELL32" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Integer

Public Function setNOTIFYICONDATA(hWnd As Long, ID As Long, _
    Flags As Long, CallbackMessage As Long, Icon As Long, _
    Tip As String) As NOTIFYICONDATA

    Dim nidTemp As NOTIFYICONDATA

    nidTemp.cbSize = Len(nidTemp)
    nidTemp.hWnd = hWnd
    nidTemp.uID = ID
    nidTemp.uFlags = Flags
    nidTemp.uCallbackMessage = CallbackMessage
    nidTemp.hIcon = Icon
    nidTemp.szTip = Tip & Chr$(0)

    setNOTIFYICONDATA = nidTemp
End Function

-->>On My Form Load Event I have this:

    '***********************************************************'
    '*  THIS CODE SHOWS THE APPLICATION IN A SYSTEM TRAY ICON  *'
    '***********************************************************'

    '**********************************************************'
    '*         THIS CREATES MY NOTIFYICONDATA VARIABLE        *'
    '**********************************************************'

    Note_ID = setNOTIFYICONDATA( _
        Me.hWnd, vbNull, _
        NIF_MESSAGE Or NIF_ICON Or NIF_TIP, _
        vbNull, Me.Icon, Me.Caption)

    '**********************************************************'
    '*          NOW WE CALL MY API WITH THIS VARIABLE         *'
    '**********************************************************'

    Retrieve_Value = Shell_NotifyIconA(NIM_ADD, Note_ID)
    '******************************************************************'
    '*  CODES TO SHOW THE APPLICATION IN A SYSTEM TRAY ICON ENDS HERE *'
    '******************************************************************'

-->>That's it Andre...

You are almost there. :)

Have a look at this link. It has all the code you need to shjow the icon, hide the icon, show menus etc.

-->>Thanks Andre I'm on It...
-->>As I can see its true that even when I Close My Appl the Icon stil remain...
-->>But I think I'll just ad the Delet Code on Form Unload Event,I hope that 'll do?...
-->>But My Major Prob was that I cant Interact with the Icon...
-->>Thought alredy I saw some one Commenting on it and provided some solution may be...
-->>I'll give you the Feed back soon when I'm done...
-->>Thanks...

Only a pleasure. Let me know iof you have more problems.

-->>OKAY,STILL GOING THROUGH THE CODES HERE...

-->>This is done and works fine thanks AndreRet...

Only a pleasure. Happy coding. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.