Made IEBrowser handle externals

This commit is contained in:
andreja6
2020-03-10 00:17:03 -07:00
parent 4f415cf98b
commit 8003bee5f6
7 changed files with 69 additions and 46 deletions

View File

@@ -30,7 +30,7 @@
#include "DeleteListener.h"
#include "CameraButtonListener.h"
#include "RotateButtonListener.h"
//#define LEGACY_LOAD_G3DFUN_LEVEL
#define LEGACY_LOAD_G3DFUN_LEVEL
Ray testRay;
static int cursorid = 0;
static int cursorOvrid = 0;
@@ -113,7 +113,7 @@ Application::Application(HWND parentWindow) : _propWindow(NULL) { //: GApp(setti
Win32Window* window = Win32Window::create(_settings.window,_hwndRenderer);
ShowWindow(_hwndRenderer, SW_SHOW);
ShowWindow(_hWndMain, SW_SHOW);
quit=false;
rightButtonHolding=false;
mouseOnScreen=false;
@@ -135,6 +135,8 @@ Application::Application(HWND parentWindow) : _propWindow(NULL) { //: GApp(setti
SetWindowLongPtr(_hwndRenderer,GWL_USERDATA,(LONG)this);
_propWindow = new PropertyWindow(0, 0, 200, 640, hThisInstance);
webBrowser = new IEBrowser(_hwndToolbox);
SetWindowLongPtr(_hwndToolbox,GWL_USERDATA+1,(LONG)webBrowser);
//webBrowser->navigateSyncURL(L"http://androdome.com/res/ClientToolbox.php");
navigateToolbox(GetFileInPath("/content/page/controller.html"));
@@ -342,7 +344,7 @@ void eject(PartInstance * colliding, PartInstance * collider)
if(colliding == collider || !colliding->canCollide || !collider->canCollide)
return;
if(G3D::CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(collider->getBox(), colliding->getBox()))
collider->setVelocity(collider->getVelocity().reflectionDirection(colliding->cFrame.upVector())/1.3);
collider->setVelocity(collider->getVelocity().reflectionDirection(colliding->cFrame.upVector())/1.3F);
}

View File

@@ -7,11 +7,54 @@
#include "IEBrowser.h"
#include "Globals.h"
#pragma once
#include "ax.h"
void IEBrowser::Boop(char* test)
HRESULT IEBrowser::doExternal(std::wstring funcName,
DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS FAR* pDispParams,
VARIANT FAR* pVarResult,
EXCEPINFO FAR* pExcepInfo,
unsigned int FAR* puArgErr)
{
// External functions may end up here in the future
if (funcName==L"Insert")
{
MessageBoxW(NULL, pDispParams->rgvarg->bstrVal,L"Add insert here...",MB_OK);
return S_OK;
}
else if (funcName==L"Boop")
{
MessageBox(NULL, "BOOP", "Boopity boop",MB_OK);
}
else if (funcName==L"SetController")
{
bool ding = false;
//int len = SysStringLen(pDispParams->rgvarg->bstrVal)+1;
//char * args = new char[len];
//WideCharToMultiByte(CP_ACP, 0, pDispParams->rgvarg->bstrVal, len, args, len, NULL, (LPBOOL)TRUE);
if(pDispParams->rgvarg->intVal < 0 || pDispParams->rgvarg->intVal > 7)
return S_OK;
Enum::Controller::Value cont = (Enum::Controller::Value)pDispParams->rgvarg->intVal;
for(size_t i = 0; i < g_selectedInstances.size(); i++)
{
if(PVInstance* part = dynamic_cast<PVInstance*>(g_selectedInstances.at(i)))
{
ding = true;
part->controller = cont;
}
}
if(ding)
AudioPlayer::playSound(dingSound);
return S_OK;
}
else
{
return E_NOTIMPL;
}
}
IEBrowser::IEBrowser(HWND attachHWnd) {
@@ -39,7 +82,7 @@ IEBrowser::~IEBrowser(void) {
bool IEBrowser::navigateSyncURL(wchar_t* url)
{
MSG messages;
//MSG messages;
if (webBrowser)
{

View File

@@ -1,16 +1,27 @@
//#include "WindowFunctions.h"
#pragma once
#include "Globals.h"
#pragma once
#include <mshtml.h>
#include <exdisp.h>
#include <Mshtmhst.h>
#include "IEDispatcher.h"
#include "AudioPlayer.h"
class IEBrowser {
public:
IEBrowser(HWND attachHWnd);
~IEBrowser(void);
bool navigateSyncURL(wchar_t* url);
void Boop(char* test);
HRESULT doExternal(std::wstring funcName,
DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS FAR* pDispParams,
VARIANT FAR* pVarResult,
EXCEPINFO FAR* pExcepInfo,
unsigned int FAR* puArgErr);
private:
IWebBrowser2* webBrowser;
HWND hwnd;

41
ax.cpp
View File

@@ -505,43 +505,10 @@ HRESULT _stdcall AXClientSite :: Invoke(
EXCEPINFO FAR* pExcepInfo,
unsigned int FAR* puArgErr)
{
if (m_lastExternalName==L"Insert")
{
MessageBoxW(NULL, pDispParams->rgvarg->bstrVal,L"Add insert here...",MB_OK);
return S_OK;
}
else if (m_lastExternalName==L"Boop")
{
MessageBox(NULL, "BOOP", "Boopity boop",MB_OK);
}
else if (m_lastExternalName==L"SetController")
{
bool ding = false;
//int len = SysStringLen(pDispParams->rgvarg->bstrVal)+1;
//char * args = new char[len];
//WideCharToMultiByte(CP_ACP, 0, pDispParams->rgvarg->bstrVal, len, args, len, NULL, (LPBOOL)TRUE);
if(pDispParams->rgvarg->intVal < 0 || pDispParams->rgvarg->intVal > 7)
return S_OK;
Enum::Controller::Value cont = (Enum::Controller::Value)pDispParams->rgvarg->intVal;
for(size_t i = 0; i < g_selectedInstances.size(); i++)
{
if(PVInstance* part = dynamic_cast<PVInstance*>(g_selectedInstances.at(i)))
{
ding = true;
part->controller = cont;
}
}
if(ding)
AudioPlayer::playSound(dingSound);
return S_OK;
}
else
{
return E_NOTIMPL;
}
return S_OK;
IEBrowser * browser = (IEBrowser *)GetWindowLongPtr(Window,GWL_USERDATA+1);
return browser->doExternal(m_lastExternalName,dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
//return S_OK;
}

3
ax.h
View File

@@ -3,6 +3,8 @@
#include "Globals.h"
#include <mshtmhst.h>
#include <string>
#pragma once
#include "IEBrowser.h"
// messages
#define AX_QUERYINTERFACE (WM_USER + 1)
@@ -40,7 +42,6 @@ class AXClientSite :
bool CalledCanInPlace;
class AX* ax;
// MyClientSite Methods
AXClientSite();
virtual ~AXClientSite();

Binary file not shown.

View File

@@ -176,7 +176,6 @@ int main(int argc, char** argv) {
try{
hresult = OleInitialize(NULL);
HRESULT hr;
/* IInternetSecurityManager *pSecurityMgr;
IInternetZoneManager *pZoneMgr;
LPCWSTR site1 = SysAllocString(L"http://www.androdome.com");