Results 1 to 14 of 14

Thread: Need help with systray app

  1. #1

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172

    Need help with systray app

    I've tried to get my systray app to work, but i haven't managed in 4 hours, so i'm kinda tired at it. If anyone could take a look at it, I would be grateful.

    if you want any more info, just tell me
    Attached Files Attached Files


  2. #2
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236
    So what do you want to happen? It shows the icon in the systray, if the form had an icon.
    Last edited by Keithuk; May 1st, 2004 at 05:44 AM.

  3. #3

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    oh yeah, i was just about to write it;
    first, i can't click the systray icon (neither left or right), the systray class comes from an example i downloaded, i've attached it if you want to look at it...
    Attached Files Attached Files


  4. #4
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236
    You will have to put a menu on your form. The systray icon will then be your form. Code the Form_Activate and Form_MouseMove events to bring up your menu. A little example is attached.

    Attached Files Attached Files

  5. #5

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    i'll check the dl soon, but the thing is that i have a menu, but the actions which should occur when the trayicon is clicked, doesn't seem to work...


  6. #6

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    the example you submitted used the form for all code, i'm not very good at VB, so i can't make an module/class for it, which i want...


  7. #7

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    also, i doesn't seem to be able to switch the borderstyle of the form, i can't turn of borderstyle (set it to none), it still shows a border. Does anyone know how to fix this?


  8. #8

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    somehow, the menu and handling of mosue actions for the systray have gotten to work, but i still have the problem with the form having a titlebar, even when i turn it off (set borderstyle to '0 - None'). i've compiled the app, and tested on another computer, and the titlebar also shows on it, so i don't think it's my computer, but VB who's the bad guy here..

    Any advices?


  9. #9
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Here is a perfect systray example.
    This doesn'r "hijack" the form for mouse movements. This creates it's own window.
    This example allows you to have an animated icon in the systray, also it has the ability to add dynamic menus at runtime.

    Hope this of some use.
    A demo project is included.

    http://www.vbforums.com/showthread.p...ka+and+systray

    Woka

  10. #10

  11. #11

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    does anyone know a good systray module/class that supports tooltips, icon-changing, mouse-clicking actions and is kinda simple (so you don't have to have much code in the form that has the systray)? I've looked at PSC, but couldn't find any advanced, but still simple code...


  12. #12
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    OK...here's a rough example I have knocked up.
    Systray is NEVER easy as it involves API and subclassing

    Right this example, DOESN'T use a form for the systeay.
    It creates it's own window. this is a much better way.
    This example handles icon changing...to do this just change the Icon property of the sytray object.
    It also handles tooltip text for you systray icon, plus ALL mouse events.

    The demo app is a bit lacking, but I am sure you can change this tomscroll the icon etc. The code is there in the systray class, but I just didn't add the code into the form, you'll learn faster if you do this.
    To scroll the icon do:
    VB Code:
    1. Private mlngIcon As Long
    2.  
    3. Private Sub Timer1_Timer()
    4.    mlngIcon = mlngIcon + 1
    5.    If mlngIcon > 10 Then
    6.       mlngIcon = 1
    7.    End If
    8.    Woof.Icon = mlngIcon
    9. End Sub
    Where mlngIcon is the position of the icon in the image list.
    Setting the timer interval speeds/slows down the icon animation.

    Hope this helps.

    Woka
    Attached Files Attached Files

  13. #13

    Thread Starter
    Addicted Member vigge89's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    172
    thanks, i'll try it out soon


  14. #14
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    U have to know that when subclassing in the VB ide, things can go wrong and when they do, VB will terminate
    This is one of the problems with subclassing.
    To get around this, what you can do is add those classes and modules to an activeX DLL, and compile the sytray code into a DLL.
    This make using it way easier in VB as the VB IDE won't deal with the subclassing anymore.
    When you add them to the new project you will have to set the Systray Class to be PUBLIC. Then compile.

    Woka

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