Notify Icon problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cylix

    #1

    Notify Icon problem

    I am going to make an application in monitor and do something on time.
    A part of it is an Notify icon(System Tray Icon),
    Which project type can I be used for Just showing the notify icon
    without any form?

    What I mean is something like When you minimize the MSN Messager as a
    tray icon.

    I have tried a service project and application project, all these seems
    cannot meet the goal.

    Thank you for any advance.

  • rowe_newsgroups

    #2
    Re: Notify Icon problem

    For a service, there is an option called something like
    InteractWithDes ktop that must be set in order for it to show a
    notifyicon. But in order to show a form (remember, service = no UI)
    then you'll probably have to use the System.Diagnost ics.Process.Sta rt()
    method to show an external form (one that you pre-built).

    Or you could try this - Start a windows application and build a blank
    form (for demo purposes). Add a notifyIcon to the form and set the
    appropriate settings, I would highly recommend adding some sort of
    close method here, be it on a click or using a context menu - you'll
    see why later. Then, add a module with a sub main block and set that
    sub main as the startup object. Then do something like this:

    Sub Main()
    ' Do whatever here first
    Dim f as new BlankFormWithNo tifyIcon()
    Application.Run ()
    ' Do shut down methods here
    End Sub

    When you instantiate your form (I believe) it will automagically show
    the notify icon in the taskbar - if not you could just show the form
    and set it's visibility to false. Just be sure to call
    Application.Exi t() somewhere in the app (like in the close method I
    told you to add earlier) to abort/stop the Application.Run () call in
    the sub main.

    Let us know how this works,

    Thanks,

    Seth Rowe


    On Jan 24, 9:43 pm, "Cylix" <cylix2...@gmai l.comwrote:
    I am going to make an application in monitor and do something on time.
    A part of it is an Notify icon(System Tray Icon),
    Which project type can I be used for Just showing the notify icon
    without any form?
    >
    What I mean is something like When you minimize the MSN Messager as a
    tray icon.
    >
    I have tried a service project and application project, all these seems
    cannot meet the goal.
    >
    Thank you for any advance.

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: Notify Icon problem

      "Cylix" <cylix2000@gmai l.comschrieb:
      >I am going to make an application in monitor and do something on time.
      A part of it is an Notify icon(System Tray Icon),
      Which project type can I be used for Just showing the notify icon
      without any form?

      Create a new project that contains a reference to
      "System.Windows .Forms.dll". Add a component class to the project and place
      a notifyicon component on it. Then add a 'Sub Main' that looks like this:

      \\\
      Public Sub Main()
      Dim c As New Component1()
      Application.Run ()
      End Sub
      ///

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

      Comment

      • Cylix

        #4
        Re: Notify Icon problem

        It works great!

        Comment

        Working...