Article ID: 184977
Article Last Modified on 8/8/2007
// Import Type Info from Script OCX - point path to the
// location of the Script Control on your development computer.
#import "C:\Program Files\Microsoft Script Control\msscript.ocx"
void CScrptctrlView::OnInitialUpdate()
{
CView::OnInitialUpdate();
OleInitialize(NULL); // Only if you haven't done this already
// or called AfxOleInit.
using namespace MSScriptControl;
try // Make sure exception handling is turned on.
{
_bstr_t bstrLanguage(L"VBScript");
_bstr_t bstrCode(L"MsgBox \"Hello World\"");
// Create the Script Control, initialize Language, and
// add code for processing.
IScriptControlPtr spScriptCtl(__uuidof(ScriptControl));
spScriptCtl->put_Language(bstrLanguage);
spScriptCtl->AddCode(bstrCode);
}
catch(_com_error e)
{
TRACE(_T("Error (%08x) in %s: %s\n"), e.Error(),
e.Source(), e.Description());
}
}
// Import Type Info from Script OCX - point path to the
// location of the Script Control on your development computer.
#import "C:\Program Files\Microsoft Script Control\msscript.ocx"
void CScrptctrlView::OnInitialUpdate()
{
CView::OnInitialUpdate();
OleInitialize(NULL); // Only if you haven't done this already
// or called AfxOleInit.
using namespace MSScriptControl;
try // Make sure exception handling is turned on.
{
_bstr_t bstrLanguage(L"VBScript");
_bstr_t bstrCode(L"MsgBox \"Hello World\"");
// Create the Script Control, initialize Language, and
// add code for processing.
IScriptControlPtr spScriptCtl(__uuidof(ScriptControl));
spScriptCtl->put_Language(bstrLanguage);
spScriptCtl->AddCode(bstrCode);
}
catch(_com_error e)
{
TRACE(_T("Error (%08x) in %s: %s\n"), e.Error(),
e.Source(), e.Description());
}
}
184904 FILE: MSSCPCTL.EXE Script Control Header File MSSCPCTL.H
Additional query words: ScriptControl Script Control kbScript
Keywords: kbbug kbfix kbie500fix KB184977