FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Strange error while quitting application
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Strange error while quitting application
Posted: Tue Dec 02, 2008 04:38 PM
Hello,

I changed my errsysw.prg a little bit, so that the error.log is automatically mailed to me if a customer gets an error.

To do this, I use this code :
      TRY
         oOutLook := CreateObject("Outlook.Application")
         EmSend := .T.
      CATCH
         TRY
            oOutLook := CreateObject("Outlook.Application")
            EmSend := .T.
         CATCH
            EmSend := .F.
         END
      END

		TRY
         IF EmSend
            oMail         := oOutLook:CreateItem(olMailItem)
            oMail:Subject := ALLTRIM("Juda(32)-foutmelding - " + ALLTRIM(PAR->GKANTOOR))
            oMail:Body    := "Datum : " + DTOC(DATE()) + CRLF + "Uur : " + TIME()
            oMail:Recipients:Add("info@ma-consult.be")
            oMail:Attachments:Add("Error.log")
            oMail:Send()
            MsgAlert("Error.log has been send !!!","Error")
         ENDIF
      CATCH
      	EmSend := .F.
      END

      CLOSE ALL

      SET RESOURCES TO
      ErrorLevel( 1 )
      QUIT


If I use this function, it always ends with :
Premature Array/Object Release detected 013440ec (the closing number changes each time)


I remarked (*) all the lines, starting with "oMail:", but the error still occurs. But if I also remark (*) the lines with "CreateObject()", the error does not occur.

What does this error mean ?
How can this problem be solved ?

Thanks a lot in advance for any help.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Strange error while quitting application
Posted: Tue Dec 02, 2008 10:41 PM

Michel,

Try putting a sysrefresh() in after oMail:send(). If that doesn't solve it, add a delay after oMail:send().

waitSeconds(3)

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Strange error while quitting application
Posted: Tue Dec 02, 2008 11:10 PM

Michel,

Try these lines before calling QUIT:

oMail = nil
oOutLook = nil

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
PROBLEM SOLVED !!!
Posted: Wed Dec 03, 2008 09:08 AM

Thanks, guys, for your help.

Antonio, your suggestion solved my problem.

Have a nice day.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Strange error while quitting application
Posted: Wed Dec 03, 2008 04:23 PM

Driessen:
Is the code you posted the full code for the errsys email function. I think its a great idea and i will be trying it in my app. If its not the complete code please post the entire code or email it to me. I'm using harbour will it work in harbour.

Thanks

Thank you

Harvey
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Strange error while quitting application
Posted: Wed Dec 03, 2008 05:37 PM

Apart from the remarks by Antonio, that is indeed the source I added to the errorsysw.prg.

Good luck.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Strange error while quitting application
Posted: Wed Dec 03, 2008 05:42 PM

Thanks I'll let you know how it works.

Thank you

Harvey
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Strange error while quitting application
Posted: Thu Dec 04, 2008 06:02 AM
Driessen:
I gave it a try and i get the following dialog message

A program is trying to access e-mail addresses stored in Outlook. Do you want to do allow this?

If I say yes nothing happens.

Do you have any idea what my problem is?
I'm using the code you entered here.
Thank you

Harvey
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Strange error while quitting application
Posted: Thu Dec 04, 2008 06:31 AM

Driessen
Its stops running at oMail:Attachments:Add("Error.log"). If I remove this line it works.

Any suggestions?

Thank you

Harvey
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Strange error while quitting application
Posted: Thu Dec 04, 2008 08:50 AM

Harvey,

Maybe you need to add the full pathname of error.log ?

It's working fine here.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Strange error while quitting application
Posted: Thu Dec 04, 2008 06:03 PM

Driessen:

Path worked. Thanks for the help.

Thank you

Harvey
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Strange error while quitting application
Posted: Thu Dec 04, 2008 06:11 PM

Harvey,

This will automatically get you the current path of the EXE so you don't have to hard code the path.

cPath:= cFilePath( GetModuleFileName( GetInstance() ) )

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Strange error while quitting application
Posted: Thu Dec 04, 2008 06:12 PM

Thanks James.

Thank you

Harvey
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Strange error while quitting application
Posted: Thu Dec 04, 2008 06:20 PM

James,

Indeed, you are right but only if the data-files and the EXE-files are in the same directory.

In my case, they aren't.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Strange error while quitting application
Posted: Thu Dec 04, 2008 06:25 PM

Michel,

Then just add your data directory name to the path, something like this:

cPath:= cFilePath( GetModuleFileName( GetInstance() ) ) + "\data"

But I am not sure where the error.log is going to be written--in the default directory or in the EXE's directory.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10