BOOL export jfwLoad () { dhAutoInit(); if (jfw) SAFE_RELEASE(jfw); if (!jfw) dhCreateObject( L"FreedomSci.JawsApi", NULL, &jfw); if (!jfw) dhCreateObject( L"JFWApi", NULL, &jfw); if (!jfw) dhCreateObject( L"JFWApi.1", NULL, &jfw); return !!jfw; }
/* ************************************************************************** * EmailOutlook: * Demonstrates sending an email using Outlook. Note that the user will be * prompted as a security measure. * ============================================================================ */ HRESULT EmailOutlook(LPCTSTR szTo, LPCTSTR szSubject, LPCTSTR szBody) { DISPATCH_OBJ(olApp); DISPATCH_OBJ(olMsg); HRESULT hr; if (SUCCEEDED(hr = dhCreateObject(L"Outlook.Application", NULL, &olApp) ) && SUCCEEDED(hr = dhGetValue(L"%o", &olMsg, olApp, L".CreateItem(%d)", 0) ) ) /* olMailItem */ { dhPutValue(olMsg, L".Subject = %T", szSubject); dhPutValue(olMsg, L".To = %T", szTo); dhPutValue(olMsg, L".Body = %T", szBody); /* To add an attachment: * dhCallMethod(olMsg, L".Attachments.Add(%T)", "FilePath.ext"); */ /* Display and attempt to send email */ dhCallMethod(olMsg, L".Display"); hr = dhCallMethod(olMsg, L".Send"); } SAFE_RELEASE(olMsg); SAFE_RELEASE(olApp); return hr; }
/* ************************************************************************** * EmailCDO: * Demonstrates sending an email using CDO for Windows 2000. Requires * Windows 2000/XP+. * See http://www.microsoft.com/technet/community/scriptcenter/entscr/scrent16.mspx * ============================================================================ */ HRESULT EmailCDO(LPCTSTR szServer, LPCTSTR szFrom, LPCTSTR szTo, LPCTSTR szSubject, LPCTSTR szBody) { DISPATCH_OBJ(cdoMsg); HRESULT hr; if (FAILED(hr = dhCreateObject(L"CDO.Message", NULL, &cdoMsg))) return hr; dhPutValue(cdoMsg, L".Configuration.Fields(%S) = %d", L"http://schemas.microsoft.com/cdo/configuration/sendusing", 2); /* cdoSendUsingPort */ dhPutValue(cdoMsg, L".Configuration.Fields(%S) = %T", L"http://schemas.microsoft.com/cdo/configuration/smtpserver", szServer); dhCallMethod(cdoMsg, L".Configuration.Fields.Update"); dhPutValue(cdoMsg, L".MimeFormatted = %b", TRUE); dhPutValue(cdoMsg, L".Sender = %T", szFrom); dhPutValue(cdoMsg, L".To = %T", szTo); dhPutValue(cdoMsg, L".Subject = %T", szSubject); dhPutValue(cdoMsg, L".TextBody = %T", szBody); /* Use .HTMLBody if needed. */ /* To add an attachment: * dhCallMethod(cdoMsg, L".AddAttachment(%T)", TEXT("file://C:\\my file.zip")); */ hr = dhCallMethod(cdoMsg, L".Send"); SAFE_RELEASE(cdoMsg); return hr; }
BOOL export cbrLoad (void) { dhAutoInit(); if (cbr) return TRUE; IDispatch *broker=NULL, *cobra=NULL, *procobj=NULL; dhCreateObject(L"CBR_Broker.cBroker", NULL, &broker); if (!broker) goto end; dhGetValue(L"%o", &cobra, broker, L".GetCobra()"); if (!cobra) goto end; dhGetValue(L"%o", &procobj, cobra, L".ProcObj()"); if (!procobj) goto end; cbr = procobj; end: SAFE_RELEASE(cobra); SAFE_RELEASE(broker); return !!cbr; }
/* ************************************************************************** * EmailEudora: * Demonstrates sending an email using Eudora. Automation must be enabled in * Eudora's options. See http://www.scripting.com/specials/eudoraAutomation.html * ============================================================================ */ HRESULT EmailEudora(LPCTSTR szTo, LPCTSTR szSubject, LPCTSTR szBody) { DISPATCH_OBJ(euApp); HRESULT hr; if (SUCCEEDED(hr = dhCreateObject(L"Eudora.EuApplication.1", NULL, &euApp))) { /* Note: Empty arguments are CC, BCC and Attachments respectively. */ hr = dhCallMethod(euApp, L".QueueMessage(%T,%T,%T,%T,%T,%T)", szTo, szSubject, TEXT(""), TEXT(""), TEXT(""), szBody); dhCallMethod(euApp, L"SendQueuedMessages"); dhCallMethod(euApp, L"CloseEudora"); SAFE_RELEASE(euApp); } return hr; }
BOOL export weLoad () { dhAutoInit(); if (we) SAFE_RELEASE(we); dhCreateObject(L"GWSpeak.Speak", NULL, &we); return !!we; }