Jump to content
  • Advertisement

Archived

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

Shadowflare

C++ Windows Programming Question

This topic is 5929 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

I have created a Button on my window, using CreateWindowEx(), and I need to change the WndProc that the Button uses. Is there any way to reset the WndProc? Or to remotely access and change the setting in the "Button" class? Any help is greatly appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Do you mean you want to change the window''s (=button) wndproc, after you''ve created it? Beats me why you want to do that, but anyhoo. What do you mean by how to declare the pointer? If you mean how you should cast it when calling SetWindowLong(), give it what it wants, probably (void *) or (ULONG). Perhaps you could explain better what you''re up to, and provide some code.

Share this post


Link to post
Share on other sites
...Just found something I did once:

oldhandler = (WNDPROC)SetWindowLong( GetDlgItem( hwnd, IDC_PREVIEW ), GWL_WNDPROC, (LONG)thumbnail_2 );

oldhandler was a WNDPROC variable to store the address of the old handler subroutine, and the new handler was thumbnail_2().

In case you''re wondering, I was working with a control in a dialog box to generate a thumbnail preview for a graphics editor (hence the GetDlgItem() call)...

To answer your question more directly, all you''ve gotta do is typecast the function name to LONG.

Hope this helps...

Share this post


Link to post
Share on other sites
quote:
Original post by CWizard
Beats me why you want to do that...

It''s called control subclassing and is standard practice to customize control behavior. VGASteve provides the solution.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!