Link to home
Start Free TrialLog in
Avatar of ocsscott
ocsscott

asked on

Hot spots to trigger a program

How in vb6 do i create hot spots on the screen that can trigger my app?  What I mean is this say My app is running in the system tray and nothing is on the screen  if I move my mouse to one of the corners of the screen I want to activate my app and maximize it.  Ive seen this done with screensaves and a toolbar once.
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Erick37 is correct, but to hide your app in the system tray you have to use the Shell_NotifyIcon API:

Public Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias " Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long

D'Mzzl!
RoverM
Avatar of ocsscott
ocsscott

ASKER

ok a question or 2 about this method.

1) since it uses a times and checks every 2 seconds or so does this use a lots of cpu?  My app is for a menu system and will be hidden in the system tray most of the time.

2) since my app will be minimized to the system tray do i need to do anything to keep it active or is a program in the system tray always active and recieving events and timer events?  thanks for the code I'll put it in and test it today and let you know.  thanks
1) The CPU overhead is minimal, as the code only executes at the Timer event.  There would be a significant performance hit if you used a mouse hook scheme, and this would be hard to implement in VB.

2)  Yes, the code will still run as long as the form with the timer is loaded in memory.  The system tray icon will be used only to hide or show the application.
Great thanks for the help and info.

Scott