CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Location
    Dodge City Kansas
    Posts
    23

    How to call an icon to the systray.

    I am trying to call two different icons to the systray. When you DblClick on the current icon in the systray, it changes the icon. Right now I am calling them from the apps directory, but I would rather call them from inside the app. I.E. picture control.

    Private Function ChangeState()
    If blnEnabled Then
    blnEnabled = False
    cmd_Enable.Caption = "Enable"
    mnuEnable.Caption = "Enable"
    Set Me.Icon = LoadPicture(App.Path & "\Images\disabled.ico") <----
    ByPass = True
    Else
    blnEnabled = True
    cmd_Enable.Caption = "Disable"
    mnuEnable.Caption = "Disable"
    Set Me.Icon = LoadPicture(App.Path & "\Images\enabled.ico") <---
    ByPass = False
    End If
    UpdateIcon
    End Function

  2. #2
    Join Date
    Apr 2003
    Posts
    1,755

    Smile

    You may add 2 image controls and place the icons on them at design time. At run time just set the form's icon to the image picture depending upon the state.
    Code:
    Private Function ChangeState()
       If blnEnabled Then
          blnEnabled = False
          cmd_Enable.Caption = "Enable"
          mnuEnable.Caption = "Enable"
          Set Me.Icon = imgDisabled.Picture
          ByPass = True
       Else
          blnEnabled = True
          cmd_Enable.Caption = "Disable"
          mnuEnable.Caption = "Disable"
          Set Me.Icon = imgEnabled.Picture
          ByPass = False
       End If
       UpdateIcon
    End Function
    Hope it will help you

  3. #3
    Join Date
    Apr 2003
    Location
    Dodge City Kansas
    Posts
    23
    Thanks rxbagain, It worked great. I thought for sure I had tried that, but I guess not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured