Strange error while quitting application

Strange error while quitting application

Postby driessen » Tue Dec 02, 2008 4: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 :
Code: Select all  Expand view
      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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

PROBLEM SOLVED !!!

Postby driessen » Wed Dec 03, 2008 9: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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby hag » Wed Dec 03, 2008 4: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
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby driessen » Wed Dec 03, 2008 5: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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby hag » Wed Dec 03, 2008 5:42 pm

Thanks I'll let you know how it works.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby hag » Thu Dec 04, 2008 6: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
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby hag » Thu Dec 04, 2008 6:31 am

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

Any suggestions?
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby driessen » Thu Dec 04, 2008 8: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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby hag » Thu Dec 04, 2008 6:03 pm

Driessen:

Path worked. Thanks for the help.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby James Bott » Thu Dec 04, 2008 6: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby hag » Thu Dec 04, 2008 6:12 pm

Thanks James.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby driessen » Thu Dec 04, 2008 6: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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby James Bott » Thu Dec 04, 2008 6: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 112 guests