Просмотр исходного кода

adjusted code to load P3D data file location relative to the ActiveX hosting page

Arkady Trestman 16 лет назад
Родитель
Сommit
93d5012ebe

+ 32 - 21
direct/src/plugin_activex/P3DActiveX.sln

@@ -1,21 +1,32 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "P3DActiveX", "P3DActiveX.vcproj", "{74451B00-2D87-412B-9359-B5CA2C2FEC2A}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Global
-	GlobalSection(SolutionConfiguration) = preSolution
-		Debug = Debug
-		Release = Release
-	EndGlobalSection
-	GlobalSection(ProjectConfiguration) = postSolution
-		{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Debug.ActiveCfg = Debug|Win32
-		{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Debug.Build.0 = Debug|Win32
-		{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Release.ActiveCfg = Release|Win32
-		{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Release.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-	EndGlobalSection
-	GlobalSection(ExtensibilityAddIns) = postSolution
-	EndGlobalSection
-EndGlobal
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "P3DActiveX", "P3DActiveX.vcproj", "{74451B00-2D87-412B-9359-B5CA2C2FEC2A}"
+	ProjectSection(ProjectDependencies) = postProject
+		{1278896B-1978-40CC-B1A0-2D6A7450A32C} = {1278896B-1978-40CC-B1A0-2D6A7450A32C}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml", "..\..\..\wintools\sdk\tinyxml\tinyxml_lib_mfc_static.vcproj", "{1278896B-1978-40CC-B1A0-2D6A7450A32C}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfiguration) = preSolution
+		Debug = Debug
+		Release = Release
+	EndGlobalSection
+	GlobalSection(ProjectDependencies) = postSolution
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Debug.ActiveCfg = Debug|Win32
+		{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Debug.Build.0 = Debug|Win32
+		{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Release.ActiveCfg = Release|Win32
+		{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Release.Build.0 = Release|Win32
+		{1278896B-1978-40CC-B1A0-2D6A7450A32C}.Debug.ActiveCfg = Debug|Win32
+		{1278896B-1978-40CC-B1A0-2D6A7450A32C}.Debug.Build.0 = Debug|Win32
+		{1278896B-1978-40CC-B1A0-2D6A7450A32C}.Release.ActiveCfg = Release|Win32
+		{1278896B-1978-40CC-B1A0-2D6A7450A32C}.Release.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal

+ 259 - 260
direct/src/plugin_activex/P3DActiveX.vcproj

@@ -1,260 +1,259 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="P3DActiveX"
-	ProjectGUID="{74451B00-2D87-412B-9359-B5CA2C2FEC2A}"
-	Keyword="MFCActiveXProj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
-			ConfigurationType="2"
-			UseOfMFC="2"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\plugin;..\..\..\wintools\sdk\tinyxml"
-				PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="2"
-				TreatWChar_tAsBuiltInType="TRUE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="tinyxml_d.lib"
-				OutputFile="$(OutDir)/P3DActiveX.ocx"
-				LinkIncremental="1"
-				AdditionalLibraryDirectories="../../../wintools/built/lib"
-				IgnoreDefaultLibraryNames="LIBCI.LIB MSVCRTD.LIB MSVCRT.LIB"
-				ModuleDefinitionFile=".\P3DActiveX.def"
-				GenerateDebugInformation="TRUE"
-				SubSystem="2"
-				ImportLibrary="$(OutDir)/P3DActiveX.lib"
-				TargetMachine="1"
-				FixedBaseAddress="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="FALSE"
-				TypeLibraryName="$(IntDir)/$(ProjectName).tlb"
-				HeaderFileName="$(ProjectName)idl.h"/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				Description="Performing registration"
-				CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-				AdditionalIncludeDirectories="$(IntDir)"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
-			ConfigurationType="2"
-			UseOfMFC="2"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\plugin;..\..\..\wintools\sdk\tinyxml"
-				PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL"
-				RuntimeLibrary="2"
-				TreatWChar_tAsBuiltInType="TRUE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="tinyxml.lib"
-				OutputFile="$(OutDir)/P3DActiveX.ocx"
-				LinkIncremental="1"
-				AdditionalLibraryDirectories="../../../wintools/built/lib"
-				IgnoreDefaultLibraryNames="LIBCI.LIB MSVCRTD.LIB MSVCRT.LIB"
-				ModuleDefinitionFile=".\P3DActiveX.def"
-				GenerateDebugInformation="TRUE"
-				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				ImportLibrary="$(OutDir)/P3DActiveX.lib"
-				TargetMachine="1"
-				FixedBaseAddress="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="FALSE"
-				TypeLibraryName="$(IntDir)/$(ProjectName).tlb"
-				HeaderFileName="$(ProjectName)idl.h"/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				Description="Performing registration"
-				CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-				AdditionalIncludeDirectories="$(IntDir)"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-			<File
-				RelativePath=".\P3DActiveX.cpp">
-			</File>
-			<File
-				RelativePath=".\P3DActiveX.idl">
-			</File>
-			<File
-				RelativePath=".\P3DActiveXCtrl.cpp">
-			</File>
-			<File
-				RelativePath=".\P3DActiveXPropPage.cpp">
-			</File>
-			<File
-				RelativePath=".\PPBrowserObject.cpp">
-			</File>
-			<File
-				RelativePath=".\PPDownloadCallback.cpp">
-			</File>
-			<File
-				RelativePath=".\PPDownloadRequest.cpp">
-			</File>
-			<File
-				RelativePath=".\PPInstance.cpp">
-			</File>
-			<File
-				RelativePath=".\PPInterface.cpp">
-			</File>
-			<File
-				RelativePath=".\PPLogger.cpp">
-			</File>
-			<File
-				RelativePath=".\PPPandaObject.cpp">
-			</File>
-			<File
-				RelativePath=".\stdafx.cpp">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						UsePrecompiledHeader="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						UsePrecompiledHeader="1"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-			<File
-				RelativePath=".\P3DActiveX.h">
-			</File>
-			<File
-				RelativePath=".\P3DActiveXCtrl.h">
-			</File>
-			<File
-				RelativePath=".\P3DActiveXPropPage.h">
-			</File>
-			<File
-				RelativePath=".\PPBrowserObject.h">
-			</File>
-			<File
-				RelativePath=".\PPDownloadCallback.h">
-			</File>
-			<File
-				RelativePath=".\PPDownloadRequest.h">
-			</File>
-			<File
-				RelativePath=".\PPInstance.h">
-			</File>
-			<File
-				RelativePath=".\PPInterface.h">
-			</File>
-			<File
-				RelativePath=".\PPLogger.h">
-			</File>
-			<File
-				RelativePath=".\PPPandaObject.h">
-			</File>
-			<File
-				RelativePath=".\Resource.h">
-			</File>
-			<File
-				RelativePath=".\stdafx.h">
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-			<File
-				RelativePath=".\P3DActiveX.rc">
-			</File>
-			<File
-				RelativePath=".\P3DActiveXCtrl.bmp">
-			</File>
-		</Filter>
-		<File
-			RelativePath=".\ReadMe.txt">
-		</File>
-	</Files>
-	<Globals>
-		<Global
-			Name="RESOURCE_FILE"
-			Value="P3DActiveX.rc"/>
-	</Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="P3DActiveX"
+	ProjectGUID="{74451B00-2D87-412B-9359-B5CA2C2FEC2A}"
+	Keyword="MFCActiveXProj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="2"
+			UseOfMFC="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\plugin;..\..\..\wintools\sdk\tinyxml"
+				PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="0"
+				TreatWChar_tAsBuiltInType="TRUE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/P3DActiveX.ocx"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="../../../wintools/built/lib"
+				IgnoreDefaultLibraryNames="LIBCI.LIB MSVCRTD.LIB MSVCRT.LIB"
+				ModuleDefinitionFile=".\P3DActiveX.def"
+				GenerateDebugInformation="TRUE"
+				SubSystem="2"
+				ImportLibrary="$(OutDir)/P3DActiveX.lib"
+				TargetMachine="1"
+				FixedBaseAddress="1"/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="FALSE"
+				TypeLibraryName="$(IntDir)/$(ProjectName).tlb"
+				HeaderFileName="$(ProjectName)idl.h"/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				Description="Performing registration"
+				CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="2"
+			UseOfMFC="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\plugin;..\..\..\wintools\sdk\tinyxml"
+				PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL"
+				RuntimeLibrary="0"
+				TreatWChar_tAsBuiltInType="TRUE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="tinyxml.lib"
+				OutputFile="$(OutDir)/P3DActiveX.ocx"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="../../../wintools/built/lib"
+				IgnoreDefaultLibraryNames="LIBCI.LIB MSVCRTD.LIB MSVCRT.LIB"
+				ModuleDefinitionFile=".\P3DActiveX.def"
+				GenerateDebugInformation="TRUE"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				ImportLibrary="$(OutDir)/P3DActiveX.lib"
+				TargetMachine="1"
+				FixedBaseAddress="1"/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="FALSE"
+				TypeLibraryName="$(IntDir)/$(ProjectName).tlb"
+				HeaderFileName="$(ProjectName)idl.h"/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				Description="Performing registration"
+				CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath=".\P3DActiveX.cpp">
+			</File>
+			<File
+				RelativePath=".\P3DActiveX.idl">
+			</File>
+			<File
+				RelativePath=".\P3DActiveXCtrl.cpp">
+			</File>
+			<File
+				RelativePath=".\P3DActiveXPropPage.cpp">
+			</File>
+			<File
+				RelativePath=".\PPBrowserObject.cpp">
+			</File>
+			<File
+				RelativePath=".\PPDownloadCallback.cpp">
+			</File>
+			<File
+				RelativePath=".\PPDownloadRequest.cpp">
+			</File>
+			<File
+				RelativePath=".\PPInstance.cpp">
+			</File>
+			<File
+				RelativePath=".\PPInterface.cpp">
+			</File>
+			<File
+				RelativePath=".\PPLogger.cpp">
+			</File>
+			<File
+				RelativePath=".\PPPandaObject.cpp">
+			</File>
+			<File
+				RelativePath=".\stdafx.cpp">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+			<File
+				RelativePath=".\P3DActiveX.h">
+			</File>
+			<File
+				RelativePath=".\P3DActiveXCtrl.h">
+			</File>
+			<File
+				RelativePath=".\P3DActiveXPropPage.h">
+			</File>
+			<File
+				RelativePath=".\PPBrowserObject.h">
+			</File>
+			<File
+				RelativePath=".\PPDownloadCallback.h">
+			</File>
+			<File
+				RelativePath=".\PPDownloadRequest.h">
+			</File>
+			<File
+				RelativePath=".\PPInstance.h">
+			</File>
+			<File
+				RelativePath=".\PPInterface.h">
+			</File>
+			<File
+				RelativePath=".\PPLogger.h">
+			</File>
+			<File
+				RelativePath=".\PPPandaObject.h">
+			</File>
+			<File
+				RelativePath=".\Resource.h">
+			</File>
+			<File
+				RelativePath=".\stdafx.h">
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+			<File
+				RelativePath=".\P3DActiveX.rc">
+			</File>
+			<File
+				RelativePath=".\P3DActiveXCtrl.bmp">
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt">
+		</File>
+	</Files>
+	<Globals>
+		<Global
+			Name="RESOURCE_FILE"
+			Value="P3DActiveX.rc"/>
+	</Globals>
+</VisualStudioProject>

+ 27 - 3
direct/src/plugin_activex/P3DActiveXCtrl.cpp

@@ -23,6 +23,7 @@
 
 #include "Mshtml.h"
 #include "atlconv.h"
+#include "comutil.h"
 
 #include <strstream>
 
@@ -284,15 +285,38 @@ int CP3DActiveXCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
     {
         return ( error = -1 );
     }
-    std::string p3dDllFilename, p3dFilename;
-    error = m_instance.DownloadP3DComponents( p3dDllFilename, p3dFilename );
+    CComPtr<IOleContainer> pOleContainer; 
+    HRESULT hr = m_spClientSite->GetContainer( &pOleContainer ); 
+    if ( FAILED( hr ) || !pOleContainer )
+    {
+        return ( error = -1 );
+    }
+    CComPtr<IHTMLDocument2> pHtml2Doc; 
+    hr = pOleContainer->QueryInterface( IID_IHTMLDocument, ( void** )&pHtml2Doc ); 
+    if ( FAILED( hr ) || !pHtml2Doc ) 
+    {
+        return ( error = -1 );
+    }
+    BSTR url;
+    hr = pHtml2Doc->get_URL( &url );
+    if ( FAILED( hr ) ||  !url ) 
+    {
+        return ( error = -1 );
+    }
+    m_hostingPageUrl = url;
+    m_hostingPageUrl.Replace( '\\', '/' );
+
+    ::SysFreeString( url );
+
+    std::string p3dDllFilename;
+    error = m_instance.DownloadP3DComponents( p3dDllFilename );
     if ( !error && !( p3dDllFilename.empty() ) )
     {
         error = m_instance.LoadPlugin( p3dDllFilename );
         if ( !error )
         {
             m_pPandaObject = new PPandaObject( this, NULL );
-            m_instance.Start( p3dFilename );
+            m_instance.Start( m_instance.GetP3DFilename( ) );
         }
     }
     return 0;

+ 2 - 0
direct/src/plugin_activex/P3DActiveXCtrl.h

@@ -80,6 +80,8 @@ public:
     // ActiveX properties <PARAM NAME="name" VALUE="value">
     std::vector< std::pair < CString, CString > > m_parameters; 
 
+    CString m_hostingPageUrl;
+
 protected:
     HRESULT ExchangeProperties( CPropExchange* pPropBag );
 

+ 21 - 27
direct/src/plugin_activex/PPInstance.cpp

@@ -33,14 +33,12 @@
 #include "PPBrowserObject.h"
 #include "PPDownloadRequest.h"
 
-#include "p3d_plugin_config.h"
 #include "get_tinyxml.h"
 
 #define P3D_CONTENTS_FILENAME "contents.xml"
 
-//#define P3D_FILE_BASE_URL "http://www.ddrose.com/~drose/plugin/"
-//#define P3D_FILE_BASE_URL "file:///C:/temp/"
-#define P3D_FILE_BASE_URL "file:///C:/cygwin/home/drose/"
+#define P3D_BASE_URL "http://www.ddrose.com/~drose/p3d_7/"
+//#define P3D_BASE_URL "file:///C:/p3dstage/"
 
 #define P3D_DEFAULT_PLUGIN_FILENAME "p3d_plugin.dll"
 
@@ -160,7 +158,7 @@ int PPInstance::ReadContents( const std::string& contentsFilename, std::string&
     return error;
 }
 
-int PPInstance::DownloadP3DComponents( std::string& p3dDllFilename, std::string& p3dFilename  )
+int PPInstance::DownloadP3DComponents( std::string& p3dDllFilename )
 {
     int error(0);
 
@@ -170,10 +168,7 @@ int PPInstance::DownloadP3DComponents( std::string& p3dDllFilename, std::string&
     std::string localContentsFileName( tempFolderName, pathLength );
     localContentsFileName += P3D_CONTENTS_FILENAME;
 
-    std::string hostUrl( PANDA_PACKAGE_HOST_URL );
-    if (!hostUrl.empty() && hostUrl[hostUrl.size() - 1] != '/') {
-      hostUrl += '/';
-    }
+    std::string hostUrl( P3D_BASE_URL );
 
     std::string remoteContentsFilename( hostUrl );
     remoteContentsFilename += P3D_CONTENTS_FILENAME;
@@ -196,19 +191,6 @@ int PPInstance::DownloadP3DComponents( std::string& p3dDllFilename, std::string&
             if ( !error )
             {
                 p3dDllFilename = p3dLocalModuleFileName;
-
-                std::string p3dLocalFilename( tempFolderName );
-                p3dLocalFilename += GetP3DFilename( );
-
-                std::string p3dRemoteFilename( P3D_FILE_BASE_URL );
-                p3dRemoteFilename += GetP3DFilename( );
-
-                // Check for existance
-                if ( ::GetFileAttributes( p3dLocalFilename.c_str( ) ) == INVALID_FILE_ATTRIBUTES )
-                {
-                    error = DownloadFile( p3dRemoteFilename, p3dLocalFilename );
-                }
-                p3dFilename = p3dLocalFilename;
             }
         }
     }
@@ -360,8 +342,12 @@ int PPInstance::Start( const std::string& p3dFilename  )
     
     P3D_instance_setup_window( m_p3dInstance, P3D_WT_embedded, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, parent_window );
 
-    nout << "Starting new P3D instance " << p3dFilename << "\n";
-    if ( !P3D_instance_start( m_p3dInstance, true, p3dFilename.c_str() ) )
+    std::string p3dRemoteFilename( GetHostUrl() );
+    p3dRemoteFilename += p3dFilename;
+
+    nout << "Starting new P3D instance " << p3dRemoteFilename << "\n";
+
+    if ( !P3D_instance_start( m_p3dInstance, false, p3dRemoteFilename.c_str() ) )
     {
         nout << "Error starting P3D instance: " << GetLastError() << "\n"; 
     }
@@ -369,13 +355,21 @@ int PPInstance::Start( const std::string& p3dFilename  )
     return 1;
 }
 
-CString PPInstance::GetP3DFilename( )
+std::string PPInstance::GetHostUrl( )
+{
+    CString hostingPageLocation = m_parentCtrl.m_hostingPageUrl.Left( m_parentCtrl.m_hostingPageUrl.ReverseFind( '/' ) );;
+    std::string p3dRemoteFilename( hostingPageLocation );
+    p3dRemoteFilename += "/"; 
+    return p3dRemoteFilename; 
+}
+
+std::string PPInstance::GetP3DFilename( )
 {
-    CString p3dFilename;
+    std::string p3dFilename;
     for ( UINT i = 0; i < m_parentCtrl.m_parameters.size(); i++ )
     {
         std::pair< CString, CString > keyAndValue = m_parentCtrl.m_parameters[ i ];
-        if ( keyAndValue.first == "src" )
+        if ( keyAndValue.first == "data" )
         {
             p3dFilename = keyAndValue.second;
         }

+ 4 - 2
direct/src/plugin_activex/PPInstance.h

@@ -43,13 +43,16 @@ public:
     PPInstance( CP3DActiveXCtrl& parentCtrl );
     virtual ~PPInstance( );
 
-    int DownloadP3DComponents( std::string& p3dDllFilename, std::string& p3dFileName );
+    int DownloadP3DComponents( std::string& p3dDllFilename );
 
     int LoadPlugin( const std::string& dllFilename );
     int UnloadPlugin( void );
 
     int Start( const std::string& p3dFileName );
 
+    std::string GetHostUrl( );
+    std::string GetP3DFilename( );
+
     static void HandleRequestLoop();
 
     HWND m_parentWnd;
@@ -63,7 +66,6 @@ protected:
     int DownloadFile( const std::string& from, const std::string& to );
     int ReadContents( const std::string& contentsFilename, std::string& p3dDllFilename );
 
-    CString GetP3DFilename( );
     void HandleRequest( P3D_request *request );
     static void HandleRequestGetUrl( void *data );
 

+ 7 - 1
direct/src/plugin_activex/PPPandaObject.cpp

@@ -16,7 +16,7 @@
 #include "PPPandaObject.h"
 
 PPandaObject::PPandaObject( PPInterface* interfac, P3D_object* p3dObject ) : 
-    m_interface( interfac), m_p3dObject( p3dObject ), m_refs( 0 ), m_ptinfo( NULL )
+    m_interface( interfac ), m_p3dObject( p3dObject ), m_refs( 0 ), m_ptinfo( NULL )
 {
     if ( m_p3dObject )
     {
@@ -64,7 +64,9 @@ STDMETHODIMP PPandaObject::GetIDsOfNames(
     UNUSED(lcid);
 
     if(!IsEqualIID(riid, IID_NULL))
+    {
       return DISP_E_UNKNOWNINTERFACE;
+    }
 
     for ( UINT i = 0; i < cNames; i++ )
     {
@@ -137,6 +139,10 @@ STDMETHODIMP PPandaObject::Invoke(
     {
         return DISP_E_UNKNOWNINTERFACE;
     }
+    if ( !m_interface )
+    {
+        return E_FAIL;
+    }
 
     CString& name( m_idsOfNames[dispidMember] );
     HRESULT hr( S_OK );