Small TTray enhancement

Small TTray enhancement

Postby Davide » Sat May 24, 2008 1:29 pm

Hello guys,

on some systems I've noticed that explorer crashes (for external reasons). When that happens, the trayed icon is not refreshed (as well as other trayed icons of other programs) and the user can no more click it to access the program's menu (for example)

So, I made the small changes below in TTray.prg:
Code: Select all  Expand view
14. CLASS TTrayIcon
15.
16.   DATA oTray
17.   DATA oWnd
18.   DATA oIcon
19.   DATA cCaption
       DATA lSuccess     // <--
20.
21.   DATA bLClicked
....
124.  c := oTray:cBuffer
125.
126.  ::lSuccess := Shell_NotifyIcon( If( lAdd, NIM_ADD, NIM_MODIFY ), @c )   // <--
127.
128.  oTray:cBuffer := c

This allow me to perform an oTray:SetIcon() from time to time. If oTray:lSuccess is .F., then I can oTray:End() and oTray:New() again to have the icon reappearing

If you've already found a better solution, please let me know, otherwise, Antonio, could you please add those changes to the standard TTray.prg ?

Thanks,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Antonio Linares » Sat May 24, 2008 1:53 pm

Davide,

Added, many thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby concentra » Mon Aug 25, 2008 1:10 pm

After upgrading xHarbour.com builder and FiveWin to current version, an application that minimizes to tray stopped showing the tray icon.
Trying to fix the problem I called ::Refresh() and tested ::lSuccess but I am getting an erro "Argument error conditional" with ::lSuccess.
Wasn´t it to be logical ?
Any ideia of what happened after the upgrade to the tray functions ?

Maurício Faria
User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Postby Antonio Linares » Tue Aug 26, 2008 8:07 am

Maurício,

Please post here the error.log contents, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby concentra » Tue Aug 26, 2008 11:25 am

Application
===========
Path and name: C:\WORK\5imp.exe (32 bits)
Size: 1,430,016 bytes
Time from start: 0 hours 0 mins 5 secs
Error occurred at: 08/26/08, 08:23:47
Error description: Error BASE/1066 Argument error: conditional
Args:
[ 1] = U

Stack Calls
===========
Called from: 5IMP.PRG => F_PRINT(288)
Called from: 5IMP.PRG => (b)MAIN(167)
Called from: timer.prg => TIMEREVENT(73)
Called from: window.prg => (b)TWINDOW:TWINDOW(593)
Called from: => TWINDOW:TIMER(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: window.prg => _FWH(3300)
Called from: => WINRUN(0)
Called from: window.prg => TWINDOW:ACTIVATE(951)
Called from: 5IMP.PRG => MAIN(174)

System
======
CPU type: 1800 Mhz
Hardware memory: 2048 megs

Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %

Compiler version: xHarbour build 1.0.0 Intl. (SimpLex)
Windows version: 5.1, Build 2600 Service Pack 3

Windows total applications running: 0

Variables in use
================
Procedure Type Value
==========================
F_PRINT
Param 1: O Class: TWINDOW
Param 2: O Class: TTRAYICON
Local 1: A Len: 0
Local 2: U
Local 3: U
Local 4: N 0
(b)MAIN
TIMEREVENT
Param 1: N 1
Local 1: N 1
(b)TWINDOW:TWINDOW
Param 1: O Class: TWINDOW
Param 2: N 1
Param 3: N 0
TWINDOW:TIMER
Param 1: N 1
Param 2: N 0
TWINDOW:HANDLEEVENT
Param 1: N 275
Param 2: N 1
Param 3: N 0
_FWH
Param 1: N 0
Param 2: N 275
Param 3: N 1
Param 4: N 0
Param 5: N 1
Local 1: O Class: TWINDOW
WINRUN
Param 1: N 1967426
TWINDOW:ACTIVATE
Param 1: C "NORMAL"
Param 2: U
Param 3: U
Param 4: U
Param 5: B {|| ... }
Param 6: U
Param 7: U
Param 8: B {|| ... }
Param 9: U
Param 10: U
Param 11: U
Param 12: U
Param 13: U
Param 14: U
Param 15: U
Param 16: U
Param 17: U
Param 18: U
Param 19: U
Local 1: O Class: TWINDOW
Local 2: U
Local 3: U
MAIN
Local 1: U
Local 2: U
Local 3: U
Local 4: O Class: TTRAYICON
Local 5: O Class: TINI
Local 6: O Class: TIMAGE
Local 7: O Class: TICON
Local 8: O Class: TMENU
Local 9: U
Local 10: L .F.
Local 11: C ".\5IMP.INI"

Linked RDDs
===========

DataBases in use
================

Classes in use:
===============
1 HASHENTRY
2 HBCLASS
3 HBOBJECT
4 TINI
5 TWINDOW
6 TCONTROL
7 TICON
8 TBRUSH
9 TMENU
10 TMENUITEM
11 TFONT
12 TBITMAP
13 TIMAGE
14 TTRAYICON
15 TSTRUCT
16 TTIMER
17 ERROR
18 TREG32

Memory Analysis
===============
124 Static variables

Dynamic memory consume:
Actual Value: 0 bytes
Highest Value: 0 bytes

User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Postby Antonio Linares » Tue Aug 26, 2008 2:15 pm

Mauricio,

> Called from: 5IMP.PRG => F_PRINT(288)

What source code do you have in line 288 ?

Please post it here, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby concentra » Tue Aug 26, 2008 8:48 pm

Antônio, the lines 287 and 288 are:

oTray:Refresh()
IF !oTray:lSuccess


The program is a small application that reads a file that contains HP´s PCL laser printer control codes and "translate" into a Windows printing so I can print to any printer. I use it to send my reports to printers that do not understand PCL.
The sources are in http://200.207.51.31/5imp.zip

Maurício Faria
User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Postby concentra » Wed Aug 27, 2008 12:55 pm

Antônio, I found something weird...
Another application, a big one, goes to the tray correctly !
Inspecting that application I noticed that I use an older, modifyed version, of TTRAY.PRG.
Seems that the new TTRAY.PRG that came with the latest version do not function properly and I used that PRG to generate the FiveHMX.lib .
Can you confirm ?

Maurício Faria
User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Postby Silvio » Wed Aug 27, 2008 1:22 pm

IDEA :

Why not create a new COMMAND to window or dialog class
as
DEFINE WINDOW oWnd
TITLE .....
TRAY
TRAYICON
ON TRAYMENU functraymenu()
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests