コード例 #1
0
///////////////////////////////////////////////////////////////////////////////
// GetMethodsName: Get methods name list
bool CScriptObject::GetMethodsName()
{
	bool bResult = false;
	if (m_pScript != NULL)
	{
		IScriptProcedureCollectionPtr pIProcedures = m_pScript->GetProcedures();

		// empty list...
		m_FunctionList.clear();

		try{
			long count = pIProcedures->GetCount();
			for(long index=1; index <= count; index++)
			{
				IScriptProcedurePtr pIProcPtr = pIProcedures->GetItem( _variant_t(index) );
				_bstr_t name = pIProcPtr->GetName();
				m_FunctionList.insert(m_FunctionList.end(), (LPCTSTR) name );
				pIProcPtr = NULL;
			}

			bResult = true;
		}
		catch(...)
		{
			// Just catch the exception, call GetErrorString()
			// to retreive last error
		}

		pIProcedures = NULL;
	}
	return bResult;
}
コード例 #2
0
	bool ScriptEngine::GetMethodsName()
	{
		bool bResult = false;
		if (_ptr != NULL)
		{
			ComPtr<IScriptProcedureCollection> pProcedures(_ptr->GetProcedures());

			// empty list...
			_FunctionList.RemoveAll();

			try{
				long count = pProcedures->GetCount();
				for (long index = 1; index <= count; index++)
				{
					IScriptProcedurePtr pIProcPtr = pProcedures->GetItem(_variant_t(index));
					_bstr_t name = pIProcPtr->GetName();
					_FunctionList.AddTail((LPCTSTR)name);
					pIProcPtr = NULL;
				}

				bResult = true;
			}
			catch (...)
			{
			}

			pProcedures = NULL;
		}
		return bResult;
	}