program seems freezed

Moderator: Rathinagiri

Post Reply
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

program seems freezed

Post by l3whmg »

Hello everyone.
I noticed something strange.
I made a transcoding program that reads data from a table and writes them to a new one.
The program has only one main form, from which you perform some tasks (in particular the problem occurs with "p006_A ()" the bigger table) and, for each record read, update a counter on the form.
Problem: if I move the mouse outside the form, the program seems to stop, actually continues to run.
The title bar, after a few minutes, shows "non risponde" (not responding). I repeat: the program continues to run.

The source table has a size of 7.772KB and 4.749KB new one, both containing 6,544 records.
(If it's exist and it's not only my problem!) For me, it's not a big problem because it is an operation to be performed only one time, but could be a problem for very long processes.
I attach the source( but since it contains some features that are part of a library that I wrote for me, you can not compile it) and an image.

I compile and run on M$ XP-SP3 (all update), HMG 3.0.27 (2010.03.27)
Best regards
Attachments
NotRespond.zip
(11.22 KiB) Downloaded 265 times
Luigi from Italy
www.L3W.it
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: program seems freezed

Post by esgici »

l3whmg wrote: ...
the program seems to stop, actually continues to run.
The title bar, after a few minutes, shows "non risponde" (not responding). I repeat: the program continues to run.
...
Ciao Luigi, how are you ?

I'd add a line ( DO EVENTS ) to your p003_B FUNCTION; I hope that this is the correct place (since your data files is missing, I can't test :( ) .

This is a "magic" command that solve such problems, I hope will help to you too.

Code: Select all

STATIC FUNCTION p003_B()
LOCAL nRecord := 0, nRecadd := 0, nRecupd := 0
LOCAL nX := 0
olddbf->(DBGOTOP())
DO WHILE !olddbf->(EOF())
 nRecord += 1
 IF l3w_fAddrec("tlanguag") == .T.
  tlanguag->adminproc := "trasco01"
  tlanguag->adminuser := l3w_fGetaini("usrlogin")
  tlanguag->admintstp := HB_TTOS( HB_DATETIME() )
  tlanguag->tlangcode := olddbf->tlangcode
  tlanguag->tlangdesc := olddbf->tlangdesc
  tlanguag->(DBCOMMIT())
  nRecadd += 1
 ELSE
  MSGSTOP("Impossibile aggiungere" + HB_OSNEWLINE() + "0" + olddbf->tlangcode)
 ENDIF

 DO EVENTS           // <--------------------------------

 olddbf->(DBSKIP(+1))
ENDDO
MSGSTOP("Finito" + HB_OSNEWLINE() + "Record Letti "+ STR(nRecord) + HB_OSNEWLINE() + "Record Aggiunti "+ STR(nRecadd) + HB_OSNEWLINE() + "Record Update "+ STR(nRecupd))
RETURN NIL
Saluti

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: program seems freezed

Post by l3whmg »

Hi Esgici!!
Good, very good my friend and You?
Many thanks for your suggestion: you are very fast!
During your replay I've tested my program and I can add this note to my previous post: in any case the program it's freezed.
Any way I'll try your suggestion.

Best regards
Luigi from Italy
www.L3W.it
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: program seems freezed

Post by Roberto Lopez »

l3whmg wrote:Hello everyone.
I noticed something strange.
I made a transcoding program that reads data from a table and writes them to a new one.
The program has only one main form, from which you perform some tasks (in particular the problem occurs with "p006_A ()" the bigger table) and, for each record read, update a counter on the form.
Problem: if I move the mouse outside the form, the program seems to stop, actually continues to run.
The title bar, after a few minutes, shows "non risponde" (not responding). I repeat: the program continues to run.

The source table has a size of 7.772KB and 4.749KB new one, both containing 6,544 records.
(If it's exist and it's not only my problem!) For me, it's not a big problem because it is an operation to be performed only one time, but could be a problem for very long processes.
I attach the source( but since it contains some features that are part of a library that I wrote for me, you can not compile it) and an image.

I compile and run on M$ XP-SP3 (all update), HMG 3.0.27 (2010.03.27)
Best regards
I've not downloaded your sample, but I'll make a question:

Had you used DO EVENTS command inside your process?
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: program seems freezed

Post by l3whmg »

Hi my friends,
I've applied Esgici's suggestion and now my program works fine. It's still running while I'm writing this replay :mrgreen:

Many thanks to everybody.
Best regards
Luigi from Italy
www.L3W.it
Post Reply