DEFINE CLASS MyOLEMapi AS OLEControland then instantiate that in object
DEFINE CLASS SendMail AS CUSTOMFailure to read carefully strikes again... thanks for the help.
>>******************************************************************************* >>* MAPI E-Mail >>* >>* Class: sendmail >>* ParentClass: custom >>* BaseClass: custom >>* Include file: email.h >>******************************************************************************* >> >>#include email.h >> >>define class sendMail as custom >> height = 0 >> width = 0 >> name = "mapimail" >> >> cSubject = '' && e-mail subject >> cMessageBody = '' && e-mail body text >> lSignoffAfterSend = .T. && sign off MAPI session after send if true >> lLogonUI = .F. && display e-mail login dialog if true >> lNewSession = .F. && use an existing Mapi session if available if false >> >> protected aAttachments[1] && e-mail attachment(s) >> protected aRecipients[1] && e-mail addressee - semicolon seperated list >> protected lSession && true if MAPI session established >> protected oSession && reference to MAPI Session object >> protected oMessage && reference to MAPI Message object >> protected lCanceled && user canceled send if true >> >> * ProgIDs of MAPI message and session and registry info for MAPI >> protected cMAPImessageProgID >> protected cMAPIsessionPROGID >> protected cMAPIdll >> protected cMAPIsubkey >> protected cDLLname >> protected cMAPIProfileSubkey >> >> cMAPImessageProgID = "MSMAPI.MAPIMESSAGES" >> cMAPIsessionPROGID = "MSMAPI.MAPISESSION" >> cMAPIdll = "MAPI32.dll" >> cMAPIsubkey = "Software\Microsoft\Windows Messaging Subsystem" >> cDLLname = "CMCDLLNAME32" >> cMAPIProfileSubkey = "Software\Microsoft\Windows NT\CurrentVersion\" + ; >> "Windows Messaging Subsystem\Profiles" >> >> >> * ensure mapi dll is available, instantiate the MAPI session and >> * message objects, and signon to MAPI >> procedure init >> dodefault() >> >> with this >> * initilize parameters >> .reset() >> >> * ensure MAPI dll is available >> if (not .mapiExists()) >> Cs_Raise_errhand("Cannot find " + .cMAPIdll, .T.) >> return .F. >> endif >> >> * instantiate the MAPI session object >> .oSession = createobject(.cMAPIsessionPROGID) >> if vartype(.oSession) != 'O' >> Cs_Raise_errhand("Cannot instatiate MAPI Session: " + .cMAPIsessionPROGID, .T.) >> return .F. >> endif >> >> * instantiate the MAPI message object >> .oMessage = createobject(.cMAPImessageProgID) >> if vartype(.oMessage) != 'O' >> Cs_Raise_errhand("Cannot instatiate MAPI MEssage: " + .cMAPImessageProgID, .T.) >> .oSession = .NULL. >> return .F. >> endif >> >> * signon to MAPI >> .signOn() >> if not .lSession >> Cs_Raise_errhand("Cannot signon to MAPI", .T.) >> .oSession = .NULL. >> .oMessage = .NULL. >> return .F. >> endif >> endwith >> endproc >> >> *!* Code Truncated For Message Space *!* >> . >> . >> . >> . >> >>enddefine >> >>>>>In a later reply to this thread, I've said that the subclass is a viable option...
>>>>Add the control you want to use into a class that is saved in a Visual Class library or into a class created with the DEFINE CLASS command >>>>>>>>to mean that if you put the MS Mapi object inside any DEFINE CLASS including CUSTOM you were okay.
>>>>>>80040112: Class is not licensed for use >>>>>>>>>>>>The error occurs at the point where a Mapi Session or Message is being created with one of these two lines:
>>>>>>.oSession = createobject("MSMAPI.MAPISESSION") >>>>>>.oMessage = createobject("MSMAPI.MAPIMESSAGES") >>>>>>>>>>>>Anyone have any thoughts? I'll continue below with what I've tried so far.