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:
00585113
Views:
36
Hi!

As I said, VB and VFP objects model is very different, so you will require to do some effort to get the hIcon - the handle to the Icon. As you see from below code, icon handle is taken from the For object in VB (as well as HWND). In VFP you cannot do oit such simple way. As a result you require to find a way to load the icon into the memory and get it hIcon handle by other API functions or by using some other code samples. Really I do not know how to do it, bu\t I guess samples could be found somewhere.

As you see, it is not that simple. That is why I suggested to use some ready for use library or ActiveX.

>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
>
>------------------------------------------------------------
>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
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform