Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tray App 1

Status
Not open for further replies.

jmcswain

Programmer
May 30, 2001
16
0
0
US
Hey, does anybody know how to write a FoxPro app that appears in the system tray? (Next to the Clock and speaker icons?)
 
That works perfectly to get the app into the system tray. However, I also need to be able to add a (dynamic) menu to the system tray icon. Any other ideas?
 
I desperately need this. Anybody know how to write FLLs, if that would work? Anyone know how I can get a handle for the tray icon, so I can try to DO MENU WITH the handle? Aything at all will be appreciated.
 
If you've downloaded the .fll mentioned, you can probably find the window's api it calls pretty easily. There's a utility which comes with MSDN which will find the dependencies in a .dll or .fll and you could use it to find what you need. I wish I could remember the name of the utility, but I'll try to look it up tonight and get back to you if someone doesn't chime in with something better before then. --Dave
 
I don't know if this helps or not, but opening the bbControls.fll file in QuickView offers the following list of API functions used:

Import Table

KERNEL32.dll

Ordinal Function Name
--------------------------------
0299 IstrcpynA
0144 GetTickCount
014b GetVersion
0161 GlobalReAlloc
015b GlobalFree
0154 GlobalAlloc
015f GlobalLock
0165 GlobalUnlock
0245 TlsGetValue
0246 TlsSetValue
0244 TlsFree
0243 TlsAlloc

USER32.dll

0178 LoadImageA
0088 DestroyIcon
01bd RegisterClassA
016d KillTimer
0080 DefWindowProcA
024b UnregisterClassA
0167 IsWindow
0055 CreateWindowExA
008a DestroyWindow

SHELL32.dll

0065 Shell_NotifyIconA

MSVCRT.dll

01a3 _setjmp3
028b longjmp
028c malloc
0259 free
009a _adjust_fdiv
010b _initterm
0293 memmove


For some reason, Quick View does not allow you to copy to the clipboard, so I had to type this out myself. I don't think I made any mistakes, but you never know...
 
Hi!

That control do not allow to respond to the events for tray icon.

There is ctTray control from the DBI-Tech ActiveX control. This control allows to catch mouse events for tray icon. I managed to organize the RightClick menu for the tray icon in VFP application using that control.
Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Actually Vlad, Bela's FLL does provide a callback mechanism for both the double-click and right-click events of the icon in the systray.

The problem, AISI, is jmcswain is asking for a windows shortcut menu (outside the foxpro application). Any menu displayed with ACTIVATE POPUP will display within the specified VFP defined window, hence if his app is minimized, the menu will not be visible.

Jmcswain, if you are truly prepared to explore the road-less-traveled, research the following Win APIs:
CreatePopupMenu
InsertMenuItem
TrackPopupMenu

FWIW, I'd take the easy route and just activat/restore/show the application when the user double/right clicks the systray icon because examples of creating a windows shortcut menu are few and far between. Jon Hawkins
 
You could use the API function Shell_NotifyIcon.
If you cannot find a way to use the structure PNOTIFYICONDATA it requires, I propose you to make a DLL in Visual C++ that will export a function to handle the call.

Anyway this function call cann add a popup menu on the icon from the systray, I had used it in VB with succes.

Good luck,s-)
Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
Hi!

Jon, I did made the menu by quite simple way - define a window on the desktop without cation, position it, than define a shortcut in it and activate both. No API calls. Just a mess to resize the form properly so it will be exact the same size as the shortcut menu.

There is another problem - menu do not functioning properly until ActiveX or FLL event finished. This requires a workaround with use of timer:
- in event activate the timer
- in timer event deactivate timer and show the menu.

Well, I will look to the FLL to see it in action.

Hope this helps.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Hi,

the built-in shortcut menu will be available in the next release. Many of the users asked for this feature.
Official launch will be on the aug issue of FoxPro Advi.or CD.

It will be available in ocx version also.
Thank you for using any of my controls.

bb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top