Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Moose Taylor
  Where is Moose Taylor?
 Oxford
 United Kingdom
 Moose Taylor
 To: Allan Sabo
  Where is Allan Sabo?
 Flushing
 New York - United States
 Allan Sabo
 Tags
Subject: RE: Foxpro calling Outlook XP on WinXP
Thread ID: 33704 Message ID: 33729 # Views: 3 # Ratings: 0
Version: Unknown Category: Microsoft Office Automation
Date: Tuesday, December 02, 2003 4:18:44 PM         
   


This could be a security patch from Microsoft, I know that you now can't use Office automation to send an email using code without getting a messagebox saying something like..."Some process is rtrying to send mail on your behalf...do you want to permit this".

Why not use Jmail to send the e-mails?

Have they tried doing a shellexec to launch the email? (I've included the code below.)

John Taylor MCP
(You can't polish a turd)


From the command window
******************************
shellexec("mailto:john@datadaysolutions.com&subject=Test&body=The quick brown fox jumped over the lazy C# programmer")
******************************

ShellExec program Code:
******************************
** Program Name : ShellExec.prg
** Created by : JohnT
** Create date : Tuesday, 22nd April 2003 09:41:14 AM
** PRG Overview / Description : Wrapper round the Shell Execute api
**
**
** Variables Used:
** 1) pcFilename : The file or exe
** 2) pcAction : What to do with it
** 3) pcParams : Any additional paramters
** 4) pcDefDir : Default directory for the exe
** 5) pnShowWindow : How to open the window (defaults to 1) 0=Hidden,1=Normal,2=Min,3=Max,>3=same as 1
**
** Output:
** 1) .T. or .F.
** 2)
**
** DLLs / Classes Used:
** 1) shell32.Dll
** 2)
**
** Examples
******************************************************
** Launching a program by specifying the exe
******************************************************
** pcFileName = "c:\Program Files\Winzip\Winzip32.Exe"
** pcAction = "open"
** pcParams = ""
**
******************************************************
** Launching a program by specifying a file
******************************************************
** pcFileName = "f:\Data\Archive.Zip"
** pcAction = "open"
** pcParams = ""
**
**
******************************************************
** Printing a document (The action can be anything that's registered against the filetype)
******************************************************
** pcFileName = "d:\MyDocs\Chase.Doc"
** pcAction = "print"
** pcParams = ""
**
**
******************************************************
** Open a webpage
******************************************************
** pcFileName = "www.broadsystem.com"
** pcAction = "open"
** pcParams = ""
**
**
******************************************************
** Launch the default Email client
******************************************************
** pcFileName = "mailto:john.taylor@broadsystem.com"
** pcAction = "open"
** pcParams = ""
**
******************************************************
** Launch Explorer at a specified folder
******************************************************
** pcFileName = "g:\production\lib"
** pcAction = "open"
** pcParams = ""
**
**
******************************************************
** Play a wav file (without knowing what program needs to do it.)
******************************************************
** pcFileName = "c:\music\Mozart.Wav"
** pcAction = "play"
** pcParams = ""
**
******************************************************
** Look at a files properties
******************************************************
** pcFileName = "c:\Windows\Desktop\Word.Lnk"
** pcAction = "properties"
** pcParams = ""
**
******************************************************
** Look at a file without editing it (An example of passing parameters)
******************************************************
** pcFileName = "quikview.exe"
** pcAction = "open"
** pcParams = "d:\MyDocs\myDoc.doc"
**
****************************************************
****************************************************
Lparameters pcFileName,pcAction,pcParams,pcDefDir,pnShowWindow

* Filename
If Vartype(pcFileName) <> "C"
? "Need a file to open!"
Return .F.
Endif

* Action
If Vartype(pcAction) <> "C"
pcAction = "open"
Endif

* Parameters
If Vartype(pcParams) <> "C"
pcParams = ""
ENDIF

* Default Directory
If Vartype(pcDefDir) <> "C"
pcDefDir = ADDBS(SYS(5)+CURDIR())
ENDIF

* Show Window (min / Max etc)
If Vartype(pnShowWindow) <> "N"
pnShowWindow = 1
Endif

#Define SE_ERR_FNF 2
#Define SE_ERR_PNF 3
#Define SE_ERR_ACCESSDENIED 5
#Define SE_ERR_OOM 8
#Define SE_ERR_DLLNOTFOUND 32
#Define SE_ERR_SHARE 26
#Define SE_ERR_ASSOCINCOMPLETE 27
#Define SE_ERR_DDETIMEOUT 28
#Define SE_ERR_DDEFAIL 29
#Define SE_ERR_DDEBUSY 30
#Define SE_ERR_NOASSOC 31
#Define ERROR_BAD_FORMAT 11

Declare Integer ShellExecute In shell32.Dll ;
INTEGER hndWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin

cFileName = pcFileName
cAction = pcAction
cParams = pcParams
cDir = pcDefDir
nShowWin = pnShowWindow

Local lnRetVal
lnRetVal = 0
lnRetVal = ShellExecute(0,cAction,cFileName,cParams,cDir,nShowWin)

If lnRetVal <= 32
Local msg
msg = ""
*There was an error
Do Case
Case lnRetVal = SE_ERR_FNF
msg = "File not found"
Case lnRetVal = SE_ERR_PNF
msg = "Path not found"
Case lnRetVal = SE_ERR_ACCESSDENIED
msg = "Access denied"
Case lnRetVal = SE_ERR_OOM
msg = "Out of memory"
Case lnRetVal = SE_ERR_DLLNOTFOUND
msg = "DLL not found"
Case lnRetVal = SE_ERR_SHARE
msg = "A sharing violation occurred"
Case lnRetVal = SE_ERR_ASSOCINCOMPLETE
msg = "Incomplete or invalid file association"
Case lnRetVal = SE_ERR_DDETIMEOUT
msg = "DDE Time out"
Case lnRetVal = SE_ERR_DDEFAIL
msg = "DDE transaction failed"
Case lnRetVal = SE_ERR_DDEBUSY
msg = "DDE busy"
Case lnRetVal = SE_ERR_NOASSOC
msg = "No association for file extension"
Case lnRetVal = ERROR_BAD_FORMAT
msg = "Invalid EXE file or error in EXE image"
Otherwise
msg = "Unknown error"
Endcase

? msg
Return .F.
Else
Return .T.
Endif


ENTIRE THREAD

Foxpro calling Outlook XP on WinXP Posted by Allan Sabo @ 12/2/2003 5:54:36 AM
RE: Foxpro calling Outlook XP on WinXP Posted by Moose Taylor @ 12/2/2003 4:18:44 PM
RE: Foxpro calling Outlook XP on WinXP Posted by Ronald de Jesus @ 12/4/2003 11:36:10 AM
RE: Foxpro calling Outlook XP on WinXP Posted by Moose Taylor @ 12/4/2003 3:01:24 PM
RE: Foxpro calling Outlook XP on WinXP Posted by Ronald de Jesus @ 12/5/2003 1:17:15 AM
RE: Foxpro calling Outlook XP on WinXP Posted by Moose Taylor @ 12/5/2003 3:55:36 PM