Overriding MFC event receiver

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
yellowfever13
Posts: 34
Joined: Thu Aug 17, 2006 10:32 pm

Overriding MFC event receiver

Post by yellowfever13 »

I have made my own WindowProc.

I have tried code from another thread in order to send the messages to Irrlicht. I included CIrrDeviceWin32.h but I get the following errors...
after adding CIrrDeviceWin32.cpp to my project it complained something about accessing the DLL.

error C2065: 'SEnvMapper' : undeclared identifier
error C2065: 'envm' : undeclared identifier
error C3861: 'getEnvMapperFromHWnd': identifier not found
error C2227: left of '->irrDev' must point to class/struct/union/generic type
pe''
error C2227: left of '->getWin32CursorControl' must point to class/struct/union/generic type
error C2227: left of '->isVisible' must point to class/struct/union/generic type
error C3861: 'getDeviceFromHWnd': identifier not found

What am I doing wrong? Thanks!
Fashizzle
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The EnvMapper is from Irrlicht code, so you either have to provide your own solution for it, or make the functions accessible from your app (it's in CIrrDeviceWin32.cpp)
yellowfever13
Posts: 34
Joined: Thu Aug 17, 2006 10:32 pm

Post by yellowfever13 »

Ok I added everything in from CIrrDeviceWin32.cpp but for some reason I'm getting these linker errors. I recompiled the DLL and LIB with the _IRR_USE_WINDOWS_DEVICE_ flag defined in IrrCompileConfig.h.

Why is it not seeing them?

unresolved token (0A0007DF) "public: void __thiscall irr::video::CVideoModeList::setDesktop(int,class irr::core::dimension2d<int> const &)" (?setDesktop@CVideoModeList@video@irr@@$$FQAEXHABV?$dimension2d@H@core@3@@Z) refe
unresolved token (0A0007E0) "public: void __thiscall irr::video::CVideoModeList::addMode(class irr::core::dimension2d<int> const &,int)" (?addMode@CVideoModeList@video@irr@@$$FQAEXABV?$dimension2d@H@core@3@H@Z) referenced
unresolved token (0A0007EC) "protected: void __thiscall irr::CIrrDeviceStub::createGUIAndScene(void)" (?createGUIAndScene@CIrrDeviceStub@irr@@$$FIAEXXZ) referenced in function "public: __thiscall irr::CIrrDeviceWin32::CIr
unresolved token (0A0007F4) "public: static void __cdecl irr::os::Printer::log(char const *,enum irr::ELOG_LEVEL)" (?log@Printer@os@irr@@$$FSAXPBDW4ELOG_LEVEL@3@@Z) referenced in function "private: bool __thiscall irr::CI
unresolved token (0A0007F5) "public: __thiscall irr::COSOperator::COSOperator(char const *)" (??0COSOperator@irr@@$$FQAE@PBD@Z) referenced in function "public: __thiscall irr::CIrrDeviceWin32::CIrrDeviceWin32(enum irr::vi
unresolved token (0A0007F6) "public: virtual __thiscall irr::CIrrDeviceStub::~CIrrDeviceStub(void)" (??1CIrrDeviceStub@irr@@$$FUAE@XZ) referenced in function "public: virtual __thiscall irr::CIrrDeviceWin32::~CIrrDeviceWi
unresolved token (0A0007F7) "public: __thiscall irr::CIrrDeviceStub::CIrrDeviceStub(char const *,class irr::IEventReceiver *)" (??0CIrrDeviceStub@irr@@$$FQAE@PBDPAVIEventReceiver@1@@Z) referenced in function "public: __th
unresolved token (0A000A26) "public: static void __cdecl irr::os::Timer::tick(void)" (?tick@Timer@os@irr@@$$FSAXXZ) referenced in function "public: virtual bool __thiscall irr::CIrrDeviceWin32::run(void)" (?run@CIrrDevice
unresolved external symbol "public: static void __cdecl irr::os::Printer::log(char const *,enum irr::ELOG_LEVEL)" (?log@Printer@os@irr@@$$FSAXPBDW4ELOG_LEVEL@3@@Z) referenced in function "private: bool __thiscall irr::CIr
unresolved external symbol "public: void __thiscall irr::video::CVideoModeList::setDesktop(int,class irr::core::dimension2d<int> const &)" (?setDesktop@CVideoModeList@video@irr@@$$FQAEXHABV?$dimension2d@H@core@3@@Z) refer
unresolved external symbol "public: void __thiscall irr::video::CVideoModeList::addMode(class irr::core::dimension2d<int> const &,int)" (?addMode@CVideoModeList@video@irr@@$$FQAEXABV?$dimension2d@H@core@3@H@Z) referenced
unresolved external symbol "public: virtual __thiscall irr::CIrrDeviceStub::~CIrrDeviceStub(void)" (??1CIrrDeviceStub@irr@@$$FUAE@XZ) referenced in function "public: virtual __thiscall irr::CIrrDeviceWin32::~CIrrDeviceWin
unresolved external symbol "public: virtual class irr::video::IVideoDriver * __thiscall irr::CIrrDeviceStub::getVideoDriver(void)" (?getVideoDriver@CIrrDeviceStub@irr@@UAEPAVIVideoDriver@video@2@XZ)
unresolved external symbol "public: virtual class irr::io::IFileSystem * __thiscall irr::CIrrDeviceStub::getFileSystem(void)" (?getFileSystem@CIrrDeviceStub@irr@@UAEPAVIFileSystem@io@2@XZ)
unresolved external symbol "public: virtual class irr::gui::IGUIEnvironment * __thiscall irr::CIrrDeviceStub::getGUIEnvironment(void)" (?getGUIEnvironment@CIrrDeviceStub@irr@@UAEPAVIGUIEnvironment@gui@2@XZ)
unresolved external symbol "public: virtual class irr::scene::ISceneManager * __thiscall irr::CIrrDeviceStub::getSceneManager(void)" (?getSceneManager@CIrrDeviceStub@irr@@UAEPAVISceneManager@scene@2@XZ)
unresolved external symbol "public: virtual class irr::gui::ICursorControl * __thiscall irr::CIrrDeviceStub::getCursorControl(void)" (?getCursorControl@CIrrDeviceStub@irr@@UAEPAVICursorControl@gui@2@XZ)
unresolved external symbol "public: virtual class irr::ILogger * __thiscall irr::CIrrDeviceStub::getLogger(void)" (?getLogger@CIrrDeviceStub@irr@@UAEPAVILogger@2@XZ)
unresolved external symbol "public: virtual class irr::IOSOperator * __thiscall irr::CIrrDeviceStub::getOSOperator(void)" (?getOSOperator@CIrrDeviceStub@irr@@UAEPAVIOSOperator@2@XZ)
unresolved external symbol "public: virtual class irr::ITimer * __thiscall irr::CIrrDeviceStub::getTimer(void)" (?getTimer@CIrrDeviceStub@irr@@UAEPAVITimer@2@XZ)
unresolved external symbol "public: virtual char const * __thiscall irr::CIrrDeviceStub::getVersion(void)const " (?getVersion@CIrrDeviceStub@irr@@UBEPBDXZ)
unresolved external symbol "public: virtual void __thiscall irr::CIrrDeviceStub::setEventReceiver(class irr::IEventReceiver *)" (?setEventReceiver@CIrrDeviceStub@irr@@UAEXPAVIEventReceiver@2@@Z)
unresolved external symbol "public: virtual class irr::IEventReceiver * __thiscall irr::CIrrDeviceStub::getEventReceiver(void)" (?getEventReceiver@CIrrDeviceStub@irr@@UAEPAVIEventReceiver@2@XZ)
unresolved external symbol "public: virtual void __thiscall irr::CIrrDeviceStub::postEventFromUser(struct irr::SEvent const &)" (?postEventFromUser@CIrrDeviceStub@irr@@UAEXABUSEvent@2@@Z)
unresolved external symbol "public: virtual void __thiscall irr::CIrrDeviceStub::setInputReceivingSceneManager(class irr::scene::ISceneManager *)" (?setInputReceivingSceneManager@CIrrDeviceStub@irr@@UAEXPAVISceneManager@s
unresolved external symbol "public: static void __cdecl irr::os::Timer::tick(void)" (?tick@Timer@os@irr@@$$FSAXXZ) referenced in function "public: virtual bool __thiscall irr::CIrrDeviceWin32::run(void)" (?run@CIrrDeviceW
unresolved external symbol "protected: void __thiscall irr::CIrrDeviceStub::createGUIAndScene(void)" (?createGUIAndScene@CIrrDeviceStub@irr@@$$FIAEXXZ) referenced in function "public: __thiscall irr::CIrrDeviceWin32::CIrr
unresolved external symbol "public: __thiscall irr::COSOperator::COSOperator(char const *)" (??0COSOperator@irr@@$$FQAE@PBD@Z) referenced in function "public: __thiscall irr::CIrrDeviceWin32::CIrrDeviceWin32(enum irr::vid
unresolved external symbol "public: __thiscall irr::CIrrDeviceStub::CIrrDeviceStub(char const *,class irr::IEventReceiver *)" (??0CIrrDeviceStub@irr@@$$FQAE@PBDPAVIEventReceiver@1@@Z) referenced in function "public: __thi
Fashizzle
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Use GetWindowLong(hwnd, GWL_WNDPROC) to get a handle to Irrlicht's window procedure, then call it at the end of your custom one with CallWindowProc instead of using DefWindowProc (Irrlicht will call DefWindowProc).
No need to #include anything from /source/
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
yellowfever13
Posts: 34
Joined: Thu Aug 17, 2006 10:32 pm

Post by yellowfever13 »

Finally figured it out! Thanks much to bitplane!

FYI: There was some crazy stuff going on, as in when trying to move the parent window it would move my irrlicht window. Finally realized it was sending all messages to irrlicht( such as movewindow etc ).

I put a conditional statement in my custom windowproc, if the mouse cursor is within the coordinates of my irrlicht window then it sends the messages to it, otherwise sends it to the parent MFC window.
Fashizzle
Post Reply