Log in

View Full Version : assgin custom callback function to an edit field


OHPen
February 5th, 2008, 10:46
hey guys,

again i have to bother you with another gui question. i have an edit field which resides on my window. i try to capture WM_LMOUSEBUTTONDOWN message in order to active the edit field by double clicking on it.

the problem is now that the event is not triggered if i click on the edit field, only if i click somewhere on the dialog where no component is placed.

therefore i thought about makeing my own windowproc for the edit field.

i searched msdn and the api which i found is SetWindowLong

http://msdn2.microsoft.com/en-us/library/ms633591.aspx

If i use GWL_WNDPROC is it possible to assign a pointer to my own windowproc ????

i have never done this before so before i refactor my code i want to know if it works.

thx in advance,

OHPen

Maximus
February 5th, 2008, 12:46
...you forgot to google ...or to read the goold old Petzold guide to windows

this is exactly your problem btw
http://www.pluralsight.com/articlecontent/cpprep0797.htm

this you should also learn too about:
http://win32assembly.online.fr/tut22.html

OHPen
February 5th, 2008, 15:57
@maximus: thx, but i would be interested in your google search tokens by using the problem discription

PS: Don't spend to much time on that

Maximus
February 5th, 2008, 16:02
mmh... was the technical name of the stuff you requested, if i remember
subclassing windows control

evlncrn8
February 5th, 2008, 16:42
yup SetWindowLong

Silver
February 7th, 2008, 15:17
FWIW I had a similar problem and came to the conclusion it was easier to write my own edit control than to subclass and try to hack in the functionality I wanted (although my issue was to do with drawing in an edit control too).