Results 1 to 2 of 2

Thread: Borderless form with Systray icon

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    25

    Thumbs up

    I haven't seen this mentioned on here so I thought I'd post it in case it was useful to anyone..

    The code given elsewhere on this site for setting up a system tray icon uses a form menu for it's context menu when you right click on the icon. One problem can be that VB doesn't allow a form with a menu on it to be borderless.

    The way I found around this is to have a second form which contains all the tray icon code. In the form load of Form1 you use Load Form2 to setup the tray icon and in the unload code of Form1 use Unload Form2 and then the code in the unload section of Form2 will take care of cleaning up after the tray icon.

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Haven't tried this for systray but it works for taskbar
    Code:
    'Show the icon of a titleless form in taskbar tray 
    
    Private Declare Function SetWindowLong Lib "user32" _ 
    Alias "SetWindowLongA" (ByVal hwnd As Long, _ 
    ByVal nIndex As Long, ByVal dwNewLong As Long) _ 
    As Long 
    
    Private Const GWL_STYLE = (-16) 
    Private Const WS_SYSMENU = &H80000 
    
    '<<<<<< Form load >>>>>> 
    
    Private Sub Form_Load() 
    Call SetWindowLong(Me.hwnd, GWL_STYLE, WS_SYSMENU) 
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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