Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Caesar

Cast and methods

This topic is 6190 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Now I found the answer a few topis beneath, but an important note : I'd like the method to be virtual I'm writing a little library and badly need to subclass the program's window proc to catch some messages. I got the old Window Proc using GetWindowLong and wanted to set my own using SetWindowLong. But an problem has apeeared. I don't know how to cast the function to long/DWORD. It's probably quite important that it's a method, not a standard function. I've heard that methods have an additional hidden parameter which doesn't allow me to pass a method instead of a standard function, but I'm not sure. Finally, when I tried DefWindowLong instead of my method then, no errors were reported. class A{ long WndProc(HWND a,UINT b,UINT c,LONG d); void SetIt(); }; void A::SetIt() { SetWindowLong(window,GWL_HWN...,(long)WndProc);//error, cannot cast } thanks for help Edited by - Caesar on December 30, 2001 1:25:14 PM

Share this post


Link to post
Share on other sites
Advertisement
The problem is that WndProc is a member of a class. You should be able to do it with static members and passing the this pointer in extra window memory (or how shall I call this?)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!