Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Closing cc:Mail
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00052384
Message ID:
00052431
Views:
36
>In my application I use 'Run /n7 wmail' to start cc:mail. I then use dde to communicate with it.
>
>Is there any way to close this application once I'm done? I can't seem to get a handle for this app.

We switched over to outlook/exchange, but here is my old code from ccmail days, just cut after the ####'s and
put it into a foxpro .prg and beautify to study it. Hope it helps


############CODE#########
PARAMETERS towhomid, ccid, attachfile, subject, textbody

*
* Initialize the ddechannel to -1
*
m.ddechan = -1

m.ccmailup = .F.

exe_path = logfiles("CCMAIL","SYSDIR")
exe_path = exe_path + "\wmail.exe SendMail"
exe_dir = logfiles("CCMAIL","DRIVE")
exe_data = exe_dir+"\CCDATA"
exe_username = '"'+ALLTRIM(rtninfo(1,GETENV('userid')))+'"'

*
* Donot show message if system is not up
*
=ddesetoption("SAFETY",.F.)
*
* Attempt to start a DDE conversation with Workflo for Windows
*
m.ddechan = DDEINITIATE(exe_path,"SendMail")
IF m.ddechan = -1 then
=waitmsg("Calling CCMAIL login program Please wait...",0)
*
* Lets get the exe path from the log_syst table for MYRIAD
*
RUN /N7 &exe_path &exe_data &exe_username password
*
* Do while CCMAIL is initializing
*
DO WHILE m.ddechan = -1
m.ddechan = DDEINITIATE(exe_path,"SendMail")
ENDDO
ELSE
*
* CCMAIL was already up and running
*
m.ccmailup = .T.
ENDIF

RELEASE WINDOW waitmsg
* Start a new message
mrtn = DDEEXECUTE(m.ddechan,"NewMessage")
IF NOT mrtn
=errormsg("Could not perform a CCMAIL function. Please inform Bret Hobbs..")
RETURN
ENDIF
DO WHILE .T.
IF NOT DDEEXECUTE(m.ddechan,"BusyCheck")
EXIT
ENDIF
ENDDO
* Format the TO line in CCMAIL
mtoname = '"TO '+ALLTRIM(rtninfo(1,towhomid))+'"'
mrtn = DDEEXECUTE(m.ddechan,&mtoname)
IF NOT mrtn
=errormsg("Could not perform a CCMAIL function. Please inform Bret Hobbs..")
RETURN
ENDIF
DO WHILE .T.
IF NOT DDEEXECUTE(m.ddechan,"BusyCheck")
EXIT
ENDIF
ENDDO
*
* IF we need a Carbon Copy sent AND the person the mail is going to is different
* than the carbon copy
*
IF NOT EMPTY(ccid) AND towhomid # ccid
* Format the CC line in CCMAIL
mccname = '"CC '+ALLTRIM(rtninfo(1,ccid))+'"'
mrtn = DDEEXECUTE(m.ddechan,&mccname)
IF NOT mrtn
=errormsg("Could not perform a CCMAIL function. Please inform Bret Hobbs..")
RETURN
ENDIF
DO WHILE .T.
IF NOT DDEEXECUTE(m.ddechan,"BusyCheck")
EXIT
ENDIF
ENDDO
ENDIF
* Set up the subject line
msubject = '"Subject '+subject+'"'
mrtn = DDEEXECUTE(m.ddechan,&msubject)
IF NOT mrtn
=errormsg("Could not perform a CCMAIL function. Please inform Bret Hobbs..")
RETURN
ENDIF
DO WHILE .T.
IF NOT DDEEXECUTE(m.ddechan,"BusyCheck")
EXIT
ENDIF
ENDDO
* Set up the text body informing them of any special messages
mtextbody = '"Text '+textbody+'"'
mrtn = DDEEXECUTE(m.ddechan,&mtextbody)
IF NOT mrtn
=errormsg("Could not perform a CCMAIL function. Please inform Bret Hobbs..")
RETURN
ENDIF
DO WHILE .T.
IF NOT DDEEXECUTE(m.ddechan,"BusyCheck")
EXIT
ENDIF
ENDDO
* Set up the attach file to send
mattachfile = '"AttachFile '+attachfile+'"'
mrtn = DDEEXECUTE(m.ddechan,&mattachfile)
IF NOT mrtn
=errormsg("Could not perform a CCMAIL function. Please inform Bret Hobbs..")
RETURN
ENDIF
DO WHILE .T.
IF NOT DDEEXECUTE(m.ddechan,"BusyCheck")
EXIT
ENDIF
ENDDO
* Send the mail
mrtn = DDEEXECUTE(m.ddechan,"Send")
IF NOT mrtn
=errormsg("Could not perform a CCMAIL function. Please inform Bret Hobbs..")
RETURN
ENDIF
DO WHILE .T.
IF NOT DDEEXECUTE(m.ddechan,"BusyCheck")
EXIT
ENDIF
ENDDO
* Terminate the DDE channel
mrtn = DDETERMINATE(m.ddechan)
IF NOT mrtn
=errormsg("Could not perform a CCMAIL function. Please inform Bret Hobbs..")
RETURN
ENDIF
DO WHILE .T.
IF NOT DDEEXECUTE(m.ddechan,"BusyCheck")
EXIT
ENDIF
ENDDO
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Previous
Reply
Map
View

Click here to load this message in the networking platform