Failed miserably at external functions
This commit is contained in:
1
Demo.h
1
Demo.h
@@ -5,6 +5,7 @@
|
||||
class Demo { // : public GApp {
|
||||
public:
|
||||
Demo(const GAppSettings& settings,HWND parentWindow);
|
||||
void Boop();
|
||||
virtual ~Demo() {}
|
||||
virtual void exitApplication();
|
||||
virtual void onInit();
|
||||
|
||||
@@ -256,6 +256,10 @@
|
||||
RelativePath=".\Globals.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\IEDispatcher.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="main.cpp"
|
||||
>
|
||||
@@ -341,6 +345,10 @@
|
||||
RelativePath=".\Globals.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\IEDispatcher.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\resource.h"
|
||||
>
|
||||
|
||||
9
IEDispatcher.cpp
Normal file
9
IEDispatcher.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "IEDispatcher.h"
|
||||
|
||||
IEDispatcher::IEDispatcher(void)
|
||||
{
|
||||
}
|
||||
|
||||
IEDispatcher::~IEDispatcher(void)
|
||||
{
|
||||
}
|
||||
13
IEDispatcher.h
Normal file
13
IEDispatcher.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "oaidl.h"
|
||||
|
||||
class IEDispatcher : public IDispatch
|
||||
{
|
||||
public:
|
||||
IEDispatcher(void);
|
||||
~IEDispatcher(void);
|
||||
int IEDispatcher::QueryInterface(const IID &riid, void **ppvObject);
|
||||
ULONG IEDispatcher::AddRef();
|
||||
HRESULT IEDispatcher::GetIDsOfNames(const IID &rrid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
|
||||
ULONG IEDispatcher::Release();
|
||||
};
|
||||
34
main.cpp
34
main.cpp
@@ -16,6 +16,7 @@
|
||||
#define _WIN32_WINNT 0x0400
|
||||
|
||||
#include <G3DAll.h>
|
||||
#include <initguid.h>
|
||||
#include <iomanip>
|
||||
#include "Instance.h"
|
||||
#include "resource.h"
|
||||
@@ -37,6 +38,7 @@
|
||||
#include <comdef.h>
|
||||
#include <comdefsp.h>
|
||||
#include "ax.h"
|
||||
#include "IEDispatcher.h"
|
||||
|
||||
|
||||
#if G3D_VER < 61000
|
||||
@@ -44,6 +46,18 @@
|
||||
#endif
|
||||
HWND hwnd;
|
||||
|
||||
DEFINE_GUID(CLSID_G3d, 0xB323F8E0L, 0x2E68, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6F);
|
||||
HRESULT hresult;
|
||||
IUnknown * punk;
|
||||
IDispatch * pdisp = new IEDispatcher();
|
||||
OLECHAR dat = ((OLECHAR)"SayHello");
|
||||
OLECHAR * szMember = &dat;
|
||||
DISPID dispid;
|
||||
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
|
||||
EXCEPINFO excepinfo;
|
||||
UINT nArgErr;
|
||||
|
||||
|
||||
IWebBrowser2* test;
|
||||
static std::string title = "";
|
||||
static DataModelInstance* dataModel;
|
||||
@@ -86,7 +100,7 @@ Demo::Demo(const GAppSettings& settings,HWND parentWindow) { //: GApp(settings,w
|
||||
0,
|
||||
560,
|
||||
800,
|
||||
50,
|
||||
60,
|
||||
_hWndMain, // parent
|
||||
NULL, // menu
|
||||
hThisInstance,
|
||||
@@ -1340,6 +1354,14 @@ App::~App() {
|
||||
}
|
||||
*/
|
||||
|
||||
void Boop()
|
||||
{
|
||||
OnError(1, "Test");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
Demo *app = (Demo *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||
@@ -1377,6 +1399,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
LRESULT CALLBACK ToolboxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
Demo *app = (Demo *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||
MessageBox(NULL, (LPCSTR)wParam, (LPCSTR)lParam, 1);
|
||||
if (app==NULL)
|
||||
{
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
@@ -1392,6 +1415,7 @@ LRESULT CALLBACK ToolboxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK G3DProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
Demo *app = (Demo *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||
@@ -1543,8 +1567,8 @@ void Demo::resizeWithParent(HWND parentWindow)
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect(parentWindow,&rect);
|
||||
SetWindowPos(_hwndRenderer,NULL,0,0,rect.right,rect.bottom-50,SWP_NOMOVE);
|
||||
SetWindowPos(_hwndToolbox,NULL,0,rect.bottom-50,rect.right,50,SWP_NOACTIVATE | SWP_SHOWWINDOW);
|
||||
SetWindowPos(_hwndRenderer,NULL,0,0,rect.right,rect.bottom-60,SWP_NOMOVE);
|
||||
SetWindowPos(_hwndToolbox,NULL,0,rect.bottom-60,rect.right,60,SWP_NOACTIVATE | SWP_SHOWWINDOW);
|
||||
GetClientRect(_hwndRenderer,&rect);
|
||||
int viewWidth=rect.right;
|
||||
int viewHeight=rect.bottom;
|
||||
@@ -1568,7 +1592,9 @@ void Demo::onCreate(HWND parentWindow)
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
try{
|
||||
OleInitialize(0);
|
||||
hresult = OleInitialize(NULL);
|
||||
hresult = CoCreateInstance(CLSID_G3d, NULL, CLSCTX_SERVER, IID_IUnknown, (void **)&punk);
|
||||
hresult = punk->QueryInterface(IID_IDispatch, &pdisp);
|
||||
if (!AXRegister())
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user