Results 1 to 19 of 19

Thread: Annimated systray icon...

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Annimated systray icon...

    This code allows you to have your app represented in the systray by any icon.
    The following functionality is available:
    • Annimated Icon
    • Create, delete and edit systray icon menus at runtime.
    • Tooltip text on the systray icon
    • All systray mouse events are trapped and triggered.
    • The systray icon DOESN'T hijack a form, it creats it's own window. more stable, and easier code.

    Think that's it.

    WOOOOF
    Attached Files Attached Files

  2. #2
    Addicted Member SpeedyDog's Avatar
    Join Date
    Feb 2004
    Location
    Missouri, USA
    Posts
    189
    well, it works great with your images in the ImageListControl, but when ever I put mine it it just doesn't work at all(just no icon in systray), I'm not sure what image format to use...

    I've tried GIF, JPG, BMP, and it won't let me put ICO format in there, says: "invalid format"

    EDIT: I fixed that... it was umm the wrong FORMAT of ICO, I was using Icon Forge, and told it to make a "32 bit 16.7 million" instead of just a normal 16.7 million color ICON, and apparenlty that 32bit version doesn't work

    -SpeedyDog
    Last edited by SpeedyDog; Oct 10th, 2004 at 11:43 PM.

  3. #3
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    Yup, the new Windows XP icon format won't work.

  4. #4

  5. #5
    Addicted Member SpeedyDog's Avatar
    Join Date
    Feb 2004
    Location
    Missouri, USA
    Posts
    189
    yeah, well I changed the format and things work....

    Ya know, I did a test, and the animation runs fine when ever I do say umm a loop and have a doevents in there.. but somethings that the applicaiton does, like API calls or "MESSING WITH EXCEL" and having excel calculate will cause the animation not to move... Is there an easy way to get around this?... like I was actually thinking :-P I mean I know this is silly, but have a 2nd EXE, that just looks at a text file ever 2 seconds to see if it has a value of 1 and if it does, (start animated icon)... and if it doesn't then don't and the MAIN APP would set this text file every time it wanted to turn on/off the sys tray animated... Is there a more effecient way than this?...

    I mean, It's not 100% important to have it animated, but I spent 3 hours on:

    http://s90039293.onlinehome.us/lh.gif


    well if you have any suggestions just reply..

    -Speedy Dog

  6. #6

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Yes. The animation is done by the timer, which will be in the same thread as your calculations.

    Figure out how to use a timer while executing other code.
    Or you can combine this with my multithreading demo

    Woka

  7. #7
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: Annimated systray icon...

    I have tried to add icon on the menu in system tray but is not working, does anyone how know how to write that to show icon on the menu!

  8. #8

  9. #9
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Annimated systray icon...

    woka, how easy would it be to use this app to access a text file on form load, using inet control. if the app version is higher in the text file, to show the popup notification, if not, then to not show it. similar to the way msn informs of new "updates available" for their software.

  10. #10

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Annimated systray icon...

    Well if you look in my sig the code for MSN popups is already written, again just some dlls you can add to your app.

    Then in your form load event, or where ever do something like:
    Code:
    Dim intAppVersion As Integer
    Dim intNewVersion As Integer
       
         'Get app and new version numbers
    
        If intNewVersion > intAppVersion Then
             'code to show popup
        End If
    This will have nothing to do with the systray component what so ever and must be coded seperatly using my popup message component.

    Woka

  11. #11
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Annimated systray icon...

    Woka,
    If I wanted to compile your code into my project to make one .exe file without having to reference the dll file, how do I replace this line:
    Code:
    Public WithEvents mobjSysTray As vbSysTrayTools.SysTray
    Compile-Error. User defined type not defined.
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  12. #12
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Annimated systray icon...

    This is resolved now. I took away the dll name and used the following:
    Code:
    Public WithEvents mobjSysTray As SysTray
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  13. #13
    Lively Member
    Join Date
    Sep 2008
    Posts
    73

    Re: Annimated systray icon...

    Hello...

    This example is really great.

    I have combined this example with my working program, but i have a problem when i try to get my program work on other computer, I get error.

    I think it has something to do with library and dll, but anyway I need hellp because i can't get it out...

    I have copied my exe file on other computer, and vbSysTrayTools.dll , *.exp , *.lib .

    But still i get error and it says :

    Run-time error '429'
    Activex component can't create object

  14. #14

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Annimated systray icon...

    First rule when deploying to another PC is use an installer.
    You cannot simply copy files to another PC and expect them to work.
    You need to register all DLLs and OCXs with windows.
    You can do this manually by running the following from a cmd prompt:

    To register a DLL:
    RegSvr32 C:\MyPath\DllName.dll

    To unregister a DLL:
    Regsvr32 -u c:\MyPath\DLLName.dll

    Alternatively you can learn how to use the Package and Deployment Wizard supplied with VB6. This will create an installer setup package that will install all requied files onto the target PC and register the DLLs and OCXs.
    Do a search on VBF for Package and Deployment, loads of posts on how to do it.

    Woof

  15. #15
    Lively Member
    Join Date
    Sep 2008
    Posts
    73

    Re: Annimated systray icon...

    I tried to write regsvr32 c:\example\vbsystraytools.dll, and it was confirmed,
    but the program still dont work...
    It is still same error as before...

  16. #16
    Lively Member
    Join Date
    Sep 2008
    Posts
    73

    Re: Annimated systray icon...

    Ok, I've manage to create package and I have some trouble with it.

    One of error that i get when i try to install that package is that everytime i want to install package on other computer i get message that some files are old and need to be updated and restart computer. When i did that and i confirm the update and restart, it updates and restarts computer and after that, the same message apears and I canot get it to work or complete instalation.

    Second error is on same computer that Im testing the program . I tried to install package here and I get error message that i have invalid line in setup information file ... c:\windows\setup.lst
    Last edited by alessy; Jan 26th, 2009 at 06:04 AM.

  17. #17
    Lively Member
    Join Date
    Sep 2008
    Posts
    73

    Re: Annimated systray icon...

    I tried some stuff, but noting works.

    Is it maybe a problem because i have created package in windows vista and now I want to run the package in windows xp ?

    I don't know what else to do ...

  18. #18

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Annimated systray icon...

    The project reference to the vbSysTray project is referenced by project compatibility and not Binary compatibility.

    So...for this to work you need to do the following.

    1) Build the vbSysTray assembly
    2) Remove the reference to the vbSysTray project from the UI project references and then add a new reference to the new vbSysTray.dll DLL assembly.
    3) rebuild the UI EXE project.
    4) Copy both the UI EXE and the vbSysTray DLL Assembly to the target machine
    5) RegSvr32 "C:\MyFolder\vbSysTray.dll"
    6) Run the UI EXE

    Woof

  19. #19
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Annimated systray icon...

    Quote Originally Posted by Wokawidget
    Like Merri said, I don't think it's possible to place XP icons in the systray using VB6

    Woka
    Maybe not via an Image list, but you can put XP icons on the system tray for XP & above. All you need is a valid icon handle which can be created from APIs (LoadIcon, CreateIconFromResourceEx, & others for example). A valid 32bpp icon can even be made into a stdPic via the often used PictureFromHandle function posted below if you can't lay your hands on a ready copy. Anyway, anything less than XP will attempt to display it, but obviously it won't display correctly.
    Code:
    Private Function PictureFromHandle(Handle As Long, picType As PictureTypeConstants) As IPicture
    
        ' Purpose: Create a standard picture object from a valid image handle
        
        Dim lpPictDesc As PICTDESC
        Dim aGUID(0 To 3) As Long
            ' convert memory icon to stdPicture
            With lpPictDesc
                .Size = Len(lpPictDesc)
                .Type = picType
                .hHandle = Handle
                .hPal = 0
            End With
            '--- fill in magic IPicture GUID {7BF80980-BF32-101A-8BBB-00AA00300CAB}
            aGUID(0) = &H7BF80980
            aGUID(1) = &H101ABF32
            aGUID(2) = &HAA00BB8B
            aGUID(3) = &HAB0C3000
            '--- create picture from bitmap handle
            Call OleCreatePictureIndirect(lpPictDesc, aGUID(0), True, PictureFromHandle)
    
    End Function
    Example. The Heart is a 32x32 XP, alphablended icon
    Name:  systrayXPicon.bmp
Views: 3144
Size:  13.2 KB
    Last edited by LaVolpe; Jan 27th, 2009 at 08:46 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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