Skip to main content
gamedev.net
🔒 Locked

Edit Control Procedure

Started by CD579 2 replies 550+ views
Original Post
CD579
CD579
Hey guys, I''ve been trying for quite a while to implement a callback function for an edit control, so I can do stuff on mouse clicks and key presses, just like you use when you create a window[LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)]. The problem is that the edit class is already registered, and so you can''t set the callback function. (I''m using CreateWindowEx to create the edit box with the classname as "EDIT") I''ve tried sub/superclassing, but it''s too messy and too dangerous(could crash the system if you don''t get to "un"subclass). I''ve tried getting the EDIT class info, and registering my own class based off of it, but was getting errors that didn''t make sense("The system cannot find the file specified" when calling CreateWindowEx with the new registered class). Does anyone know of a better way to go about doing this? I don''t want to use MFC as I am learning the Windows API, and want to stick with it. I am using Dev-c++ if that makes a difference(don''t think so). Thanks a bunch! CD Jesus is Lord!!
Jesus is Lord!!
Kippesoep
Kippesoep
Subclassing is quite safe, if you do instance subclassing. Just use SetWindowLong (windowHandle, GWL_WNDPROC, myWindowProcedure);.

Global subclassing (using SetClassLong) is more difficult and may hook into other aspects of your app that you don't expect.

For more info: check msdn.



[edited by - Kippesoep on October 15, 2003 5:47:42 AM]
Kippesoep
CD579
CD579
Thanks a bunch guys. I had already checked out MSDN, but not that article. Had me stumped for a while. Thanks again!

CD

Jesus is Lord!!
Jesus is Lord!!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.