[SOLVED] type conversion (LONG) GameState::SubClassProc?

Get answers to all your basic programming questions. No Ogre questions, please!
iblues1976
Gnome
Posts: 379
Joined: Fri Sep 16, 2011 4:54 pm
x 10

[SOLVED] type conversion (LONG) GameState::SubClassProc?

Post by iblues1976 »

Hi,
I'm getting the following error when I try to convert to long GameState::SubClassProc , which is a method I created. However, if I create a method outside of the class, it works fine, for example, just (long) SubclassProc
I try adding an & before GameState::SubClassProc, but it doesn't help.
The error for my code

Code: Select all

 
g_ogreWinProc = (WNDPROC) SetWindowLong(hwnd, GWL_WNDPROC, (LONG) GameState::SubClassProc); 
is

Code: Select all

Error	3	error C2440: 'type cast' : cannot convert from 'LRESULT (__stdcall GameState::* )(HWND,UINT,WPARAM,LPARAM)' to 'LONG'	
The codes comes from a post that kojack made. The post is here

To gamestate from advanced framework , I have added:

GameState.h

Code: Select all

//Only changes are shown.
//Windows Only
	LRESULT APIENTRY SubClassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

private:
	//for windows only
	WNDPROC						g_ogreWinProc;
	HWND						hwnd;
	//
GameState.cpp

Code: Select all

OgreFramework::getSingletonPtr()->m_pRenderWnd->getCustomAttribute("WINDOW", (void*)&hwnd);
g_ogreWinProc = (WNDPROC) SetWindowLong(hwnd, GWL_WNDPROC, (LONG) GameState::SubClassProc); 
So, a class method is different from a non-class method for what I can gather now.

thanks
Last edited by iblues1976 on Fri Mar 02, 2012 5:06 pm, edited 2 times in total.
iblues1976
Gnome
Posts: 379
Joined: Fri Sep 16, 2011 4:54 pm
x 10

Re: type conversion (LONG) GameState::SubClassProc?

Post by iblues1976 »

I have read some stuff online

Anyways, my whole approach is wrong... I should not make this part of the class...

Either do a friend of a method outside of the class or use some event handling and have my class register for one of those...

more will be revealed !!!
iblues1976
Gnome
Posts: 379
Joined: Fri Sep 16, 2011 4:54 pm
x 10

Re: type conversion (LONG) GameState::SubClassProc?

Post by iblues1976 »

While I'm taking a different approach in how to get my 3D connexion Navigator to interact with the "Advanced Framework" I still think it is important to close this thread with an answer.

I will be posting in another thread soon (Maybe tomorrow or next week) some listener that I'm working on for the 3DX Navigator to be used with OGRE. This at some point will go into the tutorial that I want to contribute...

This link explains in detail what I originally wanted to do http://www.newty.de/fpt/fpt.html
haimat
Halfling
Posts: 52
Joined: Tue Mar 05, 2013 1:44 am

Re: [SOLVED] type conversion (LONG) GameState::SubClassProc?

Post by haimat »

Hi, I am also trying to get Kojack's code working for the advanced framework.
I want to read window events/messages directly.

Have you been successful with your implmentation by now?
If so, would you mind sharing some code to explain how you solved it?

Thanks!