[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ProgSoc] Min. VB application to system tray



Okies All,

Here it is...!

From: Cuong Huy Nguyen <chnguyen@nospam.tig.com.au>

>Thanks heaps mate, Don't worry about forgetting this. I'll keep reminding
>you until you send me the code hehehe.


<GRIN>  This made me hurry (^8

>I tried the one on the web but as you said, it's not very friendly.


mmm.  _Hopefully_ my code will be easier to read.
Remember that I based it on the code on the web, so you may recognise some
of it.

Oh, and I have *heavily* commented it.  Some people will not like this
(myself included) but at least it caters for everyone (it's easier to remove
comments than work out what some really messy/brilliant code does (^8)

>AWAITING FOR YOUR LOVELY FRIENDLY PIECE OF CODE.


Ok, ok, I'll send this already!

The files that are important but you don't have to look at are: Tray.bas and
TrayClass.cls
The three TrayClassDemo.* files are a sample VB5 project that I wrote in 5
mins (comments excluded (^8)
You can base you project on this or start from scratch.

These are the important lines to have in your project:

'  This lets you store a TrayClass object in Tray
Dim Tray As TrayClass

' This actually creates the object and puts it in Tray
Set Tray = New TrayClass

' This lets the tray class know what "owns" it and where to send events
Tray.SetHWnd form.hwnd

' This sets up call back to the MouseMove event of the form set above
Tray.SetCallBackMessage WM_MOUSEMOVE

Oh, and of course:

' This displays the icon
Tray.ShowNow

' and this removes it
Tray.HideNow

Have fun!

heatWave

Tray.bas

TrayClass.cls

TrayClassDemo.frm

TrayClassDemo.vbp

TrayClassDemo.vbw