|
1) When using ActiveScript in my app, is it okay to have one class implement both IActiveScript and IActiveScriptSite if only one active script site is to be used?
2) Can I have one class factory create both objects if I can't do the above?
I'm looking for a good explanation if possible from someone who has used Active Scripting before, so that I can get started with it.
- Roman -
|
|
|
|
|
Q1. You don't need to have any implementation of IActiveScript. It means that you have made own script language engine.
Because you are a client of some script engine, you need to implement only a site-object with IActiveScriptSite interface.
Q2. You aren't obliged to need any class factory for a site-object. You can create it internally by CComObject<cactscrsit>::CreateInstance or CActScrSit::_CreatorClass::CreateInstance. Or you can create through original COM way with the coclass of your site-object.
Some example for which CActScrSit class must implement the IActiveScriptSite's function (isn't submitted)
HRESULT hr;
CComPtr<IActiveScriptSite> spScriptSite;
hr = CActScrSit::_CreatorClass::CreateInstance(NULL,IID_IActiveScriptSite, (void**)&spScriptSite);
if( FAILED(hr) )
return E_FAIL;
CComPtr<IActiveScript> spScript;
hr = spScript.CoCreateInstance( OLESTR("VBScript") );
if( SUCCEEDED(hr) )
{
CComQIPtr<IActiveScriptParse> spParser( spScript );
if( spParser )
{
hr = spScript->SetScriptSite( spScriptSite );
hr = spParser->InitNew();
hr = spScript->SetScriptState( SCRIPTSTATE_STARTED );
hr = spScript->AddTypeLib( CComModule::m_libid, 1, 0, 0L );
hr = spScript->AddNamedItem( OLESTR("Me"), SCRIPTITEM_ISVISIBLE );
EXCEPINFO exErr;
DWORD flags = SCRIPTTEXT_ISEXPRESSION;
hr = spParser->ParseScriptText( bstrFormula, OLESTR("Me"),
(IUnknown*)this, NULL,0, 0,flags, pVal, & exErr );
spScript->Close();
}
}
spScriptSite = (IActiveScriptSite*) NULL;
With best wishes,
Vita
|
|
|
|
|
hey thanks for the reply,
what's a "coclass" i am still not to clear about what that is
also, i am not using MFC, so I will have to somehow use CoCreateInstance... or maybe i can just create a new instance like MyScriptSite* pSite = new MyScriptSite with MyScriptSite being derived from IActiveScriptSite
- Roman -
|
|
|
|
|
"MyScriptSite* pSite = new MyScriptSite" is possible if you make the right ref-counting with your MyScriptSite class. So ATL will create this class with ref-counter is equal 0. Therefore you must provide a way to increase it to 1 by AddRef().
The "coclass" is a term which designates a created class outside the server.
With best wishes,
Vita
|
|
|
|
|
i am implementing each method of IUnknown manually, e.g. i have my own ref-count variable and AddRef and Release work properly
- Roman -
|
|
|
|
|
Hi,
Does making a window disabled, make it disappear from the"Alt+Tab" list?
If I do a EnableWindow(FALSE) in a dialog based application, I cannot see it in the Alt+Tab list.
Can this be prevented?
Thanks....
|
|
|
|
|
Loop through and disable all the controls, but leave the window enabled.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
The windows in the task list, as it's more correctly called, meet the following criteria:
- No parent
- Visible
- No owner and WS_EX_TOOLWINDOW, OR Owner and WS_EX_APPWINDOW
- At least one character of text
Peter O.
|
|
|
|
|
|
is it possible for me to create a function with 3 return values?
|
|
|
|
|
|
or you could have it return a struct:
struct MyFuncReturnType
{
int one;
std::string two;
void* three;
};
- Roman -
|
|
|
|
|
|
1. Read a C/C++ book.
2. If you really wanna do it you can use assembly to push the values onto the stack and than pop them when the function returns.
3. I really do think u need a C/C++ book
bibamus, edamus, cras moriemur [eat, drink, for tomorrow we die]
|
|
|
|
|
I have a sample of win2k ddk's netcfg.I want to write the same program.But when I use there include file there are many errors.
d:\program files\ntddk\inc\rpcndr.h(880) : error C2146: syntax error : missing ';' before identifier 'MaxCount'
d:\program files\ntddk\inc\rpcndr.h(880) : error C2501: 'ULONG_PTR' : missing storage-class or type specifiers
d:\program files\ntddk\inc\rpcndr.h(880) : error C2501: 'MaxCount' : missing storage-class or type specifiers
what's wrong with the program.I have set the include file path in Vc.
Please help me.
Friends who have written ddk program help me please.
I want to ask a question.^_^
|
|
|
|
|
someone help me?
|
|
|
|
|
|
i installed the platform sdk.But there is the same question.What's wrong with it?
I want to ask a question.^_^
|
|
|
|
|
This may seem like and odd question, but why do most people prefix some of their variables with "m"? Does it help distinguish member variables or somthing of the sort?
|
|
|
|
|
|
Yes, the prefix helps the reader to recognize a member variable, one that isn't declared right there in the function. Other prefixes are g_ for globals (pretty common), and s_ for statics in a function (less common, although I use it). I've also seen one or two people use c_ for controls (such as a CListCtrl in a dialog) but I prefer using m_wnd for those.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I like the c_ for control.
Always I use the first letter in lower case to show the type.
eg int m_iCount, CSize m_zBox, Point m_pDot. etc.
Especially in larger apps I find it makes Life easier with the intellisense stuff.
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining.
Said byRoger Wright about me.
|
|
|
|
|
|
Thank you.
|
|
|
|
|