NotifyIcon :-(

Discussion in 'Questions (Windows Mobile)' started by taximania, Jan 30, 2009.

  1. taximania

    taximania Well-Known Member Licensed User

    This is PSUEDO code:

    Namespace MyNotify

    Public Class MyNotify
       Implements IDisposable
    private withevents noti as System.Windows.Forms.NotifyIcon

    Public Sub New()
    End Sub
    Public Property Visible() as Boolean
    return noti.Visible
    End Get
              noti.Visible = value
    End Set
    End Property
    Public Property Text() As String
    Return noti.Text
    End Get
              noti.Text = Value
    End Set
    End Property
    Public ReadOnly Property About() As String
    return "By Taximania"
    End Get
    End Property

    Public Property Icon() As String
    return noti.IconPath
    End Get
              noti.IconPath = Value
    End Set
    End Property
    Public ReadOnly Property DllVer() As String
    return "Ver 1.00"
    End Get
    End Property  
    Public Sub Dispose() Implements System.IDisposable.Dispose
    If Not noti Is Nothing Then
    End If
    End Sub
    End Class

    End Namespace

    Icon.Text should be Icon.ContextMenu etc.
    Icon.Click (not shown above) toggle's the icon image.

    I want to have an app running in the background and toggle it's
    on/off status by clicking the NotifyIcon.
    (Don't we all)

    I've googled and looked into this for the past 2 weeks but
    can't get a compiled dll to work :sign0137:

    Anyone :sign0085:
  2. agraham

    agraham Expert Licensed User

    Tke a look at this little app written in Basic4ppc which uses NotifyIcon from my ControlsExDesktop to run in the background and pop-up at set times.

    Look at the .cs source file for ControlsExDesktop to see how to implement NotifyIcon in a library. It's in C# but hopefully you will get the idea. Basically you need to hook into at least the NotifyIcon Click event, there are others as well, to know when the user interacts with the NotifyIcon. Ignore the Form Resize event code in the source, it is there for convenience for use with a FormEx and is not necessary to use a NotifyIcon although it is useful to be able to know when a forms state changes.

    For VB code that shows how to catch a ScrollBar control event and pass it to Basic4ppc see post #3 here There is a C# version in post #1 so if you compare the ScrollBar VB and C# code you should be able to understand my NotifyIcon C# code for the Click event. Essentially the difference is that VB declares a control "WithEvents" then uses "Handles" to attach the event procedures. C# has no equivalen to "WithEvents", you add each individual event to the required event property of the control.
  3. taximania

    taximania Well-Known Member Licensed User

    I can't get Visual studio 2005 Pro to accept that NotifyIcon
    is a member of System.Windows.Forms it's just not there :sign0137:

    SharpDevelop 'C# Build finished successfully. .dll's' won't work on my device.
    File or assembly bla bla bla Sys Wins Forms Ver not found etc

    I've attached my C# SharpDevelop project.
    Anyone want to have a look and see if it works, ha ha ha, for them.
    If it does, post the .dll please.

    Other people's .dll's 'DO' work on my system.

    TIA :sign0085:

    Attached Files:

  4. agraham

    agraham Expert Licensed User

    Thar's because NotifyIcon is a desktop only control and doesn't exist on the device. The somewhat limited device "equivalent" (it's not really) is Notifier.
  5. taximania

    taximania Well-Known Member Licensed User

    Mmm, that sort of explains me wasting my time :sign0148:

    But, due to no work today, 'snowed in' :(

    I've managed to knock up a proper system notification popup window .dll written with C# and Vis Studio 2005 pro ;)
    I'm impressed with myself :) and will post it on a new thread when I've
    sorted a couple of bugs.

    Cheers Agraham :sign0188:
  6. taximania

    taximania Well-Known Member Licensed User

    It also means I've just spent the last week trying to do something
    that has already been done by Agraham. :signOops:

    I wasn't aware the notification bubble was already available in B4ppc.

    I think, the next time I have an idea, I'll ask Agraham first,
    before I start spending time on it :cool:

    Thankyou Agraham, I now see where I was going wrong :sign0188:
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice