Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Foxpro icon in system tray?
Message
De
22/06/2005 18:37:58
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP1
Divers
Thread ID:
01025574
Message ID:
01025640
Vues:
9
Borislav --

As it happens, I already know how to put an icon in the system tray, as well as handling events that occur on it.

All I'm looking for is the ICO file for the default FoxPro icon. The one you pointed to (CATGRY.ICO") is similar to, but not identical to, the default FoxPro icon.

Thanks


>>Is there an ICO file around which is the default FoxPro icon? I'd like to be able to use it in the system tray.
>>
>>Thanks,
>
>I don't understand you. You search for an icon or search how to put an icon in system tray?
>If you search for a VFP icon:
HOME(2)+"Tastrade\bitmaps\catgry.ico"
>if second:
>Check Thread #1008997 Message #1009018 or
>try this (taken from Nadya's link posted in Message #1021565)
>
>
> *!************************************************************************
>*!* Programm TRAY.PRG (VFP6) 20.04.2000
>*!* Description - Hide VFP desktop window and placed an icon in TRAYBAR.
>*!* Autor - Orian Zakirov
>*!* Parameters - lcIconNameFile: Icon file name.
>*!* Syntax - TRAY()
>*!* Example, TRAY("с:\temp\globe.ico")
>*!* Function long2str taken from Microsoft KB
>*!* You need FoxTools.FLL
>
>LPARAMETERS lcIconNameFile
>
>if parameters()=0 or empty(lcIconNameFile)
>lcIconNameFile = "point15"
>endif
>IF VARTYPE(lcIconNameFile)="C" AND !EMPTY(lcIconNameFile)
>IF ATC(".ico",lcIconNameFile)=0
>lcIconNameFile = lcIconNameFile + ".ico"
>ENDIF
>_screen.icon = lcIconNameFile
>ELSE
>IF EMPTY(_screen.icon)
>MESSAGEBOX("Не определён файл иконки.",48,"Ошибка")
>RETURN .F.
>ELSE
>lcIconNameFile = _screen.icon
>ENDIF
>ENDIF
>IF !FILE(_screen.icon)
>MESSAGEBOX("Не найден файл иконки.",48,"Ошибка")
>RETURN .F.
>ENDIF
>
>IF !FILE(lcIconNameFile)
>MESSAGEBOX("Не найден файл иконки "+lcIconNameFile+".",48,"Ошибка")
>RETURN .F.
>ENDIF
>
>
>* Объявляем функции WinAPI
>DECLARE INTEGER ShowWindow IN WIN32API INTEGER, INTEGER
>Declare integer GetAsyncKeyState in "user32" Long
>DECLARE INTEGER SetForegroundWindow IN "USER32" INTEGER
>Declare Integer Shell_NotifyIcon IN "SHELL32" Long, String
>Declare Long ExtractIconEx IN "shell32.dll" String lpszFile, Long nIconIndex, Long @phiconLarge, Long @phiconSmall, Long nIcons
>Declare Long DestroyIcon IN "user32" Long hIcon
>
>* открываем библиотеку foxtools.fll
>SET LIBRARY TO foxtools.fll ADDITIVE
>
>
>* инициализация констант
>LOCAL VK_LBUTTON, VK_RBUTTON, NIM_ADD, NIM_MODIFY, NIM_DELETE, NIF_MESSAGE, NIF_ICON, NIF_TIP, ;
>SW_HIDE, SW_SHOW, SW_MINIMIZE, SW_RESTORE
>
>SW_HIDE = 0
>SW_SHOW = 5
>SW_MINIMIZE = 6
>SW_RESTORE = 9
>
>VK_LBUTTON = 1
>VK_RBUTTON = 2
>
>NIM_ADD = 0
>NIM_MODIFY = 1
>NIM_DELETE = 2
>NIF_MESSAGE = 1
>NIF_ICON = 2
>NIF_TIP = 4
>
>
>* инициализация переменных
>local hWnd, phIconLarge, phIconSmall, lcTip, lcStartNotifyString, lcNotifyString, lnKey
>
>* получим дескриптор десктопа FoxPro
>hWnd = MainHWnd()
>
>* содержание всплывающей подсказки
>lcTip = _screen.caption
>
>* переменные для хранения дескрипторов иконок
>phIconLarge=0
>phIconSmall=0
>
>* получим дескрипторы иконок
>ExtractIconEx(lcIconNameFile,0,@phiconLarge,@phiconSmall,1)
>
>* формируем строку параметров (type NOTIFYICONDATA)
>lcStartNotifyString = long2str(hWnd) ;
>+ long2str(0) ;
>+ long2str(BITOR(BITOR(NIF_ICON,NIF_TIP),NIF_MESSAGE)) ;
>+ long2str(0x201)
>
>lcNotifyString = lcStartNotifyString ;
>+ long2str(phiconSmall) ;
>+ ALLTRIM(PADR(LEFT(lcTip,64),64," "))
>lcNotifyString = PADR(long2str(LEN(lcNotifyString)+4),4," ") + lcNotifyString
>
>Shell_NotifyIcon(NIM_ADD, lcNotifyString) && добавляем иконку в TrayBar
>
>* сворачиваем и скрываем десктоп FoxPro
>ShowWindow(hWnd, SW_MINIMIZE)
>ShowWindow(hWnd, SW_HIDE)
>Public hWndPublic
>hWndPublic = hWnd
>
>
>DO WHILE .T.
>inkey(0,"M")
>lnKey = GetAsyncKeyState(VK_LBUTTON)
>IF lnKey<>0
>EXIT
>ENDIF
>ENDDO
>
>* &#1087;&#1077;&#1088;&#1077;&#1085;&#1086;&#1089;&#1080;&#1084; &#1086;&#1082;&#1085;&#1086; FoxPro &#1074;&#1087;&#1077;&#1088;&#1105;&#1076;
>SetForegroundWindow(hWnd)
>
>* &#1092;&#1086;&#1088;&#1084;&#1080;&#1088;&#1091;&#1077;&#1084; &#1089;&#1090;&#1088;&#1086;&#1082;&#1091; &#1087;&#1072;&#1088;&#1072;&#1084;&#1077;&#1090;&#1088;&#1086;&#1074; (type NOTIFYICONDATA)
>lcNotifyString = lcStartNotifyString + long2str(0)
>lcNotifyString = PADR(long2str(LEN(lcNotifyString)+4),4," ") + lcNotifyString
>
>Shell_NotifyIcon(NIM_DELETE, lcNotifyString) && &#1091;&#1076;&#1072;&#1083;&#1103;&#1077;&#1084; &#1080;&#1082;&#1086;&#1085;&#1082;&#1091; &#1080;&#1079; TrayBar
>
>DestroyIcon(phIconLarge)
>DestroyIcon(phIconSmall)
>
>* &#1087;&#1086;&#1082;&#1072;&#1079;&#1099;&#1074;&#1072;&#1077;&#1084; &#1080; &#1088;&#1072;&#1079;&#1074;&#1086;&#1088;&#1072;&#1095;&#1080;&#1074;&#1072;&#1077;&#1084; &#1076;&#1077;&#1089;&#1082;&#1090;&#1086;&#1087; FoxPro
>ShowWindow(hWnd, SW_SHOW)
>ShowWindow(hWnd, SW_RESTORE)
>release hWndPublic
>RETURN
>
>
>********************
>FUNCTION long2str
>********************
>* Passed : 32-bit non-negative numeric value (m.longval)
>* Returns : ASCII character representation of passed
>* value in low-high format (m.retstr)
>* Example :
>* m.long = 999999
>* m.longstr = long2str(m.long)
>
>PARAMETERS m.longval
>
>PRIVATE i, m.retstr
>
>m.retstr = ""
>FOR i = 24 TO 0 STEP -8
>m.retstr = CHR(INT(m.longval/(2^i))) + m.retstr
>m.longval = MOD(m.longval, (2^i))
>NEXT
>RETURN m.retstr
>
Jim Nelson
Newbury Park, CA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform