Microsoft KB Archive/102467: Difference between revisions
(importing KB archive) |
m (Text replacement - "&" to "&") |
||
(One intermediate revision by the same user not shown) | |||
Line 58: | Line 58: | ||
<br /> | <br /> | ||
The following sample code calls Microsoft Mail to bring up a Send Note dialog box and attaches the AUTOEXEC.BAT file to the Mail message that is going to be sent: | The following sample code calls Microsoft Mail to bring up a Send Note dialog box and attaches the AUTOEXEC.BAT file to the Mail message that is going to be sent: | ||
<pre class="codesample"> SET LIBRARY TO SYS(2004) + | <pre class="codesample"> SET LIBRARY TO SYS(2004) + "FOXTOOLS.FLL" ADDITIVE | ||
GetSysDir = RegFn( | GetSysDir = RegFn("GetSystemDirectory","@CI","I") | ||
bigstr = REPLICATE(chr(0),144) & | bigstr = REPLICATE(chr(0),144) &&creates a big string | ||
retlen = CallFn(GetSysDir, @bigstr,144) | retlen = CallFn(GetSysDir, @bigstr,144) | ||
winsys = LEFT(bigstr,retlen) | winsys = LEFT(bigstr,retlen) | ||
SendMail=RegFn( | SendMail=RegFn("MAPISendDocuments","L@C@C@CL", ; | ||
"L", winsys+"\MAPI.DLL") | |||
T1= | T1=";" | ||
T2= | T2="C:\AUTOEXEC.BAT" | ||
T3= | T3="" | ||
X=CallFn(SendMail,0,@T1,@T2,@T3,0) | X=CallFn(SendMail,0,@T1,@T2,@T3,0) | ||
RELEASE LIBRARY SYS(2004) + | RELEASE LIBRARY SYS(2004) + "FOXTOOLS.FLL" | ||
</pre> | </pre> | ||
GetSystemDirectory() is a Microsoft Windows application programming interface (API) function used to retrieve the Windows SYSTEM subdirectory. RegFn() returns a function handle to GetSysDir so that the handle can be accessed by CallFn(). CallFn() is used to determine the length of GetSysDir and assigns the numeric value to retlen. It also puts the string value of GetSysDir in the variable bigstr. At this point, the location of the MAPI.DLL file is known, and the MAPISendDocuments() function is used to send a standard Microsoft Mail message.<br /> | GetSystemDirectory() is a Microsoft Windows application programming interface (API) function used to retrieve the Windows SYSTEM subdirectory. RegFn() returns a function handle to GetSysDir so that the handle can be accessed by CallFn(). CallFn() is used to determine the length of GetSysDir and assigns the numeric value to retlen. It also puts the string value of GetSysDir in the variable bigstr. At this point, the location of the MAPI.DLL file is known, and the MAPISendDocuments() function is used to send a standard Microsoft Mail message.<br /> | ||
<br /> | <br /> | ||
Now that MAPISendDocuments() has been registered, the SendMail variable can be used to start Mail. T1 refers to the delimiter between filenames. T2 is the list of files that you would like to send. T3 is a null character and is not necessary for this program. Therefore, if you want to send both the AUTOEXEC.BAT and CONFIG.SYS files in your Mail message, you would use T2= | Now that MAPISendDocuments() has been registered, the SendMail variable can be used to start Mail. T1 refers to the delimiter between filenames. T2 is the list of files that you would like to send. T3 is a null character and is not necessary for this program. Therefore, if you want to send both the AUTOEXEC.BAT and CONFIG.SYS files in your Mail message, you would use T2="C:\AUTOEXEC.BAT;C:\CONFIG.SYS". For more information on the MAPISendDocuments() function, see the Microsoft Mail "Technical Reference" manual. | ||
</div> | </div> | ||
Line 82: | Line 82: | ||
FOXTOOLS.WRI file<br /> | FOXTOOLS.WRI file<br /> | ||
<br /> | <br /> | ||
Microsoft Mail | Microsoft Mail "Technical Reference," version 3.0, pages 76-81 | ||
</div> | </div> |
Latest revision as of 12:24, 21 July 2020
Article ID: 102467
Article Last Modified on 7/13/2004
APPLIES TO
- Microsoft Visual FoxPro 3.0 Standard Edition
- Microsoft Visual FoxPro 5.0 Standard Edition
- Microsoft Visual FoxPro 6.0 Professional Edition
- Microsoft FoxPro 2.5b
- Microsoft FoxPro 2.5a
This article was previously published under Q102467
SUMMARY
In FoxPro for Windows, you can use FOXTOOLS.FLL with MAPI.DLL to invoke Microsoft Mail version 3.0 so that you can send Mail messages while running your FoxPro program.
MORE INFORMATION
By using the RegFn() and CallFn() functions in FOXTOOLS.FLL to access the MAPI.DLL from Mail 3.0, you can send attachments or messages from within a FoxPro for Windows application.
The following sample code calls Microsoft Mail to bring up a Send Note dialog box and attaches the AUTOEXEC.BAT file to the Mail message that is going to be sent:
SET LIBRARY TO SYS(2004) + "FOXTOOLS.FLL" ADDITIVE GetSysDir = RegFn("GetSystemDirectory","@CI","I") bigstr = REPLICATE(chr(0),144) &&creates a big string retlen = CallFn(GetSysDir, @bigstr,144) winsys = LEFT(bigstr,retlen) SendMail=RegFn("MAPISendDocuments","L@C@C@CL", ; "L", winsys+"\MAPI.DLL") T1=";" T2="C:\AUTOEXEC.BAT" T3="" X=CallFn(SendMail,0,@T1,@T2,@T3,0) RELEASE LIBRARY SYS(2004) + "FOXTOOLS.FLL"
GetSystemDirectory() is a Microsoft Windows application programming interface (API) function used to retrieve the Windows SYSTEM subdirectory. RegFn() returns a function handle to GetSysDir so that the handle can be accessed by CallFn(). CallFn() is used to determine the length of GetSysDir and assigns the numeric value to retlen. It also puts the string value of GetSysDir in the variable bigstr. At this point, the location of the MAPI.DLL file is known, and the MAPISendDocuments() function is used to send a standard Microsoft Mail message.
Now that MAPISendDocuments() has been registered, the SendMail variable can be used to start Mail. T1 refers to the delimiter between filenames. T2 is the list of files that you would like to send. T3 is a null character and is not necessary for this program. Therefore, if you want to send both the AUTOEXEC.BAT and CONFIG.SYS files in your Mail message, you would use T2="C:\AUTOEXEC.BAT;C:\CONFIG.SYS". For more information on the MAPISendDocuments() function, see the Microsoft Mail "Technical Reference" manual.
REFERENCES
FOXTOOLS.WRI file
Microsoft Mail "Technical Reference," version 3.0, pages 76-81
Keywords: kbhowto kbinterop KB102467