Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Call the Shell_NotifyIcon function in VFP6
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00585078
Message ID:
00585120
Views:
41
>Thanks for your explanation,
>
>maybe you know how to convert this to VFP,
>This is a VB sample of the code that does the trick
>

You can't do this purely in VFP, as it involves a callback; VFP does not have the capability of providing a callbak address for a piece of VFP code. You can handle this in one of several ways; an ActiveX control can return a callback address as an integer through one of it's methods, and that can be used to generate a callback to the ActiveX which then raises an event that VFP would respond to; you could use the same sort of strategy using an FLL or DLL. IAC, it will involve coding something in some part not in VFP, or using something that someone else wrote in a product other than VFP that supports publishing a callback address and is able to raise an event.

>------------------------------------------------------------
>Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
>Public Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
>
>Public Const WM_LBUTTONDBLCLICK = &H203
>Public Const WM_RBUTTONUP = &H205
>Public Const WM_MOUSEMOVE = &H200
>Public Const NIM_ADD = &H0
>Public Const NIM_MODIFY = &H1
>Public Const NIM_DELETE = &H2
>Public Const NIF_MESSAGE = &H1
>Public Const NIF_ICON = &H2
>Public Const NIF_TIP = &H4
>
>Public CIAsystray As NOTIFYICONDATA
>
>Public Type NOTIFYICONDATA
> cbSize As Long
> hwnd As Long
> uId As Long
> uFlags As Long
> ucallbackMessage As Long
> hIcon As Long
> szTip As String * 64
>End Type
>
>Public Sub SystemTrayAddIcon(Form As Form)
> CIAsystray.cbSize = Len(CIAsystray)
> CIAsystray.hwnd = Form.hwnd
> CIAsystray.uId = vbNull
> CIAsystray.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
> CIAsystray.ucallbackMessage = WM_MOUSEMOVE
> CIAsystray.hIcon = Form.Icon
> CIAsystray.szTip = Form.Caption & vbNullChar
> Call Shell_NotifyIcon(NIM_ADD, CIAsystray)
>
> App.TaskVisible = False
> Form.Hide
>End Sub
>------------------------------------------------------------
>
>Many thanks
>Jacques Herweijer
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform