mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
added IDispatchEx support for dynamic scripting features
This commit is contained in:
parent
1386c733d8
commit
f7566dc280
@ -20,7 +20,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\plugin;..\..\..\wintools\include;"..\..\..\wintools\sdk\openssl\openssl-0.9.6d\inc32""
|
||||
AdditionalIncludeDirectories="..\plugin;..\..\..\dtool\src\dtoolbase;..\..\..\dtool;..\..\..\wintools\include;"..\..\..\wintools\sdk\openssl\openssl-0.9.6d\inc32""
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
@ -34,7 +34,7 @@
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="tinyxml.lib ssleay32.lib libeay32.lib"
|
||||
AdditionalDependencies="tinyxml.lib ssleay32.lib libeay32.lib mfcs71d.lib"
|
||||
OutputFile="$(OutDir)/P3DActiveX.ocx"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../../wintools/sdk/openssl/openssl-0.9.6d/out32.dbg";../../../wintools/built/lib"
|
||||
@ -84,7 +84,7 @@
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\plugin;..\..\..\wintools\include;"..\..\..\wintools\sdk\openssl\openssl-0.9.6d\inc32""
|
||||
AdditionalIncludeDirectories="..\plugin;..\..\..\dtool\src\dtoolbase;..\..\..\dtool;..\..\..\wintools\include;"..\..\..\wintools\sdk\openssl\openssl-0.9.6d\inc32""
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL"
|
||||
RuntimeLibrary="2"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
@ -96,7 +96,7 @@
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="tinyxml.lib ssleay32.lib libeay32.lib"
|
||||
AdditionalDependencies="tinyxml.lib ssleay32.lib libeay32.lib mfcs71.lib"
|
||||
OutputFile="$(OutDir)/P3DActiveX.ocx"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../../wintools/sdk/openssl/openssl-0.9.6d/out32";../../../wintools/built/lib"
|
||||
@ -212,6 +212,9 @@
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath="..\plugin\mkdir_complete.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveX.h">
|
||||
</File>
|
||||
|
@ -492,7 +492,7 @@ int PPInstance::Start( const std::string& p3dFilename )
|
||||
nout << "Error creating P3D instance: " << GetLastError() << "\n";
|
||||
return 1;
|
||||
}
|
||||
CComPtr<IDispatch> pDispatch;
|
||||
CComPtr<IDispatchEx> pDispatch;
|
||||
PPBrowserObject *pobj = new PPBrowserObject( &m_parentCtrl, pDispatch );
|
||||
P3D_instance_set_browser_script_object( m_p3dInstance, pobj );
|
||||
P3D_OBJECT_DECREF( pobj );
|
||||
|
@ -56,8 +56,19 @@ HRESULT PPInterface::Invoke(int nType, IDispatch* pDisp, CString& ptName, VARIAN
|
||||
DISPPARAMS dp = { NULL, NULL, 0, 0 };
|
||||
DISPID dispidNamed = DISPID_PROPERTYPUT;
|
||||
DISPID dispID;
|
||||
CComPtr<IDispatchEx> pDispEx;
|
||||
|
||||
HRESULT hr = GetIdOfName( pDisp, ptName, &dispID );
|
||||
if ( DISP_E_UNKNOWNNAME == hr )
|
||||
{
|
||||
hr = pDisp->QueryInterface( IID_IDispatchEx, ( void** )&pDispEx );
|
||||
if ( SUCCEEDED( hr ) && pDispEx )
|
||||
{
|
||||
OLECHAR* pElementName = ptName.AllocSysString();
|
||||
hr = pDispEx->GetDispID( pElementName, fdexNameEnsure, &dispID );
|
||||
SysFreeString( pElementName );
|
||||
}
|
||||
}
|
||||
if ( FAILED( hr ) )
|
||||
{
|
||||
return hr;
|
||||
@ -90,9 +101,16 @@ HRESULT PPInterface::Invoke(int nType, IDispatch* pDisp, CString& ptName, VARIAN
|
||||
}
|
||||
|
||||
// Make the call!
|
||||
hr = pDisp->Invoke( dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT,
|
||||
if ( pDispEx )
|
||||
{
|
||||
hr = pDispEx->InvokeEx(dispID, LOCALE_USER_DEFAULT,
|
||||
nType, &dp, pvResult, NULL, NULL);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = pDisp->Invoke( dispID, IID_NULL, LOCALE_USER_DEFAULT,
|
||||
nType, &dp, pvResult, NULL, NULL );
|
||||
}
|
||||
delete [] pArgs;
|
||||
|
||||
return hr;
|
||||
@ -118,6 +136,12 @@ HRESULT PPInterface::GetHtmlDocDispatch( CComPtr<IDispatch>& pDispScript )
|
||||
hr = pHtmlDoc->get_Script( &pDispScript );
|
||||
ASSERT( SUCCEEDED( hr ) && pDispScript );
|
||||
|
||||
CComPtr<IDispatchEx> pDispExScript;
|
||||
hr = pDispScript->QueryInterface( IID_IDispatchEx, ( void** )&pDispExScript );
|
||||
ASSERT( SUCCEEDED( hr ) && pDispExScript );
|
||||
|
||||
pDispScript = pDispExScript;
|
||||
|
||||
CComPtr<ITypeInfo> pTypeInfo;
|
||||
hr = pDispScript->GetTypeInfo( 0, 0, &pTypeInfo );
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "windows.h"
|
||||
#include "PPLogger.h"
|
||||
#include "mkdir_complete.h"
|
||||
|
||||
std::ofstream PPLogger::m_logfile;
|
||||
bool PPLogger::m_isOpen = false;
|
||||
@ -107,7 +108,7 @@ void PPLogger::Open( const std::string &rootDir )
|
||||
if (log_directory.empty()) {
|
||||
log_directory = rootDir + "/log";
|
||||
}
|
||||
mkdir_complete(log_directory, cerr);
|
||||
mkdir_complete(log_directory, std::cerr);
|
||||
|
||||
// Ensure that the log directory ends with a slash.
|
||||
if (!log_directory.empty() && log_directory[log_directory.size() - 1] != '/') {
|
||||
@ -132,8 +133,8 @@ void PPLogger::Open( const std::string &rootDir )
|
||||
log_pathname += ".log";
|
||||
|
||||
m_logfile.clear();
|
||||
m_logfile.open(log_pathname.c_str(), ios::out | ios::trunc);
|
||||
m_logfile.setf(ios::unitbuf);
|
||||
m_logfile.open(log_pathname.c_str(), std::ios::out | std::ios::trunc);
|
||||
m_logfile.setf(std::ios::unitbuf);
|
||||
}
|
||||
|
||||
// If we didn't have a logfile name compiled in, we throw away log
|
||||
|
@ -41,3 +41,5 @@
|
||||
#include <afxdao.h> // MFC DAO database classes
|
||||
#include <afxwin.h>
|
||||
|
||||
#include <dispex.h>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user