FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Bugs report & fixes / Informe de errores y arreglos Bug in TMail [Fixed]
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TMail [Fixed]
Posted: Tue Feb 27, 2018 11:04 AM
In TMail, method Activate, there is

Code (fw): Select all Collapse
cCurPath = CurDrive() + ":\" + CurDir()


But this doesn't work when the current path is a network one (ie. \\myserver\myfolder).

EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in TMail
Posted: Tue Feb 27, 2018 07:57 PM

How to retrieve the current path when it is a network one ? :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Bug in TMail
Posted: Tue Feb 27, 2018 09:18 PM
Enrico

This code is not especially elegant .. and it assumes the .exe is located in the drive or unc you wish to resolve.

Rick Lipkin

Code (fw): Select all Collapse
// where .exe started from is default directory //

cFILE  := GetModuleFileName( GetInstance() )
nSTART := RAT( "\", cFILE )
cDEFA  := SUBSTR(cFILE,1,nSTART-1)

SET DEFA to ( cDEFA )
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TMail
Posted: Tue Feb 27, 2018 09:48 PM
Antonio Linares wrote:How to retrieve the current path when it is a network one ? :-)


Something like:

Code (fw): Select all Collapse
IF CurDrive() = "\"
    cCurPath = CurDir()
ELSE
    cCurPath = CurDrive() + ":\" + CurDir()
ENDIF


EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TMail
Posted: Tue Feb 27, 2018 09:48 PM
Rick Lipkin wrote:Enrico

This code is not especially elegant .. and it assumes the .exe is located in the drive or unc you wish to resolve.

Rick Lipkin

Code (fw): Select all Collapse
// where .exe started from is default directory //

cFILE  := GetModuleFileName( GetInstance() )
nSTART := RAT( "\", cFILE )
cDEFA  := SUBSTR(cFILE,1,nSTART-1)

SET DEFA to ( cDEFA )


Better fix TMail.

EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in TMail
Posted: Wed Feb 28, 2018 08:40 AM
Enrico,

Here you have your changes, please try them :-)

Included for FWH 18.02

Code (fw): Select all Collapse
METHOD Activate() CLASS TMail

   local cCurPath

   if ::nRetCode != -1
      IF CurDrive() = "\"
         cCurPath = CurDir()
      ELSE
         cCurPath = CurDrive() + ":\" + CurDir()
      ENDIF

      ::nRetCode = MAPISendMail( ::cSubject, ::cNoteText, ::cMsgType,;
                   DToS( ::dDate ) + " " + ::cTime,;
                   ::cConversationID, ::lReceipt, ::lFromUser,;
                   ::aOrigin, ::aRecipients, ::aFiles )
      lChDir( cCurPath )
   else
      MsgStop( "Error initializing mail" )
   endif

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TMail
Posted: Thu Mar 01, 2018 07:56 AM
It doesn't work. This is look as the right way:

Code (fw): Select all Collapse
METHOD Activate() CLASS TMail

   local cCurPath

   // ::nRetCode = MAPILogOn()

   if ::nRetCode != -1
      if CurDrive() = "\"
         cCurPath = "\" + CurDir()
      else
         cCurPath = CurDrive() + ":\" + CurDir()
      endif

      ::nRetCode = MAPISendMail( ::cSubject, ::cNoteText, ::cMsgType,;
                   DToS( ::dDate ) + " " + ::cTime,;
                   ::cConversationID, ::lReceipt, ::lFromUser,;
                   ::aOrigin, ::aRecipients, ::aFiles )
      lChDir( cCurPath )
   else
      MsgStop( "Error initializing mail" )
   endif

return nil


EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in TMail
Posted: Thu Mar 01, 2018 10:23 AM

many thanks :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion