Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Timer w/menu problems
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Timer w/menu problems
Divers
Thread ID:
00466034
Message ID:
00466034
Vues:
50
I have a project with a form and a menu. The menu is the 'main' object. When the exe is ran, the menu displays and the executes a 'do form formname noshow'.

In the form exists nothing but two timers. The interval is every few seconds, but is a user defined preference set in the init event of each timer. The code on the timer event for these timers appears below.

My problem is this. Several applications run off the menu, and in the middle of them I receive such errors as 'File is in use.' and 'Alias aimsg2 does not exist.' The most notable part of this is that it only happens when there is a volume of users. Just testing locally with two to three instances of the application, I cannot reproduce these errors. I have disabled the timers, and these problems no longer occur, so it has to exist somewhere in this code, and I don't know much about timers and how they operate relative to other objects.

----
Code for Timer 1:

if empty(zoprid)
return
endif

set talk off
olddb = select()
use (db_msg) in 0 alias aimsg2 share again
select aimsg2

i = 0
count for empty(received) and aimsg2.to = zoprid to i

if i > 0
msg = 'You have ' + alltrim(transform(i)) + ' unread messages. Press F5 to view.'
if _vfp.statusbar <> msg
set status bar on
set message to msg
set bell to progpath+'ainotify.wav'
do aibeeper
set bell to
endif
else
set status bar off
endif

select aimsg2
use
select (olddb)


-----
Code for Timer 2

if this.interval = 30000
wait window 'You have been forced off the system!' timeout 3
close data
do shutdown
endif

if empty(zoprid) or zsecurity = 0
return
endif

olddb2 = select()
set talk off

use (db_user) in 0 alias aioperdbx share again
select aioperdbx
set order to op_id
seek(zoprid)
if alltrim(op_id) = alltrim(zoprid)
if op_logoff <> {^0001-01-01, 12:00:00 A}
if op_logoff = {^0002-02-02, 12:00:00 A}
wait window 'System maintainence is begin ran. You will be forced off in 30 seconds.' nowait noclear timeout 30
this.interval = 30000
else
wait window 'You have been forced off the system!' timeout 3
close data
do shutdown
endif
endif
endif

select aioperdbx
use
select (olddb2)

----

As you can see I store the work area of any currently selected database
and reselect that at the end of each timer, which I thought would of
solved any problems.

Any help would be appretiated.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform