Click here to Skip to main content
15,887,350 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GetClassName - Determine if "Edit" window class Pin
Richard Andrew x6430-Jul-09 12:15
professionalRichard Andrew x6430-Jul-09 12:15 
GeneralRe: GetClassName - Determine if "Edit" window class Pin
bob1697231-Jul-09 3:40
bob1697231-Jul-09 3:40 
AnswerRe: GetClassName - Determine if "Edit" window class Pin
«_Superman_»30-Jul-09 14:35
professional«_Superman_»30-Jul-09 14:35 
QuestionSize Of Control Objects Pin
ForNow30-Jul-09 6:34
ForNow30-Jul-09 6:34 
AnswerRe: Size Of Control Objects Pin
Bacon Ultimate Cheeseburger1-Aug-09 17:57
Bacon Ultimate Cheeseburger1-Aug-09 17:57 
GeneralRe: Size Of Control Objects Pin
ForNow1-Aug-09 19:39
ForNow1-Aug-09 19:39 
GeneralRe: Size Of Control Objects (Part 1) Pin
Bacon Ultimate Cheeseburger1-Aug-09 23:57
Bacon Ultimate Cheeseburger1-Aug-09 23:57 
GeneralRe: Size Of Control Objects (part 2) Pin
Bacon Ultimate Cheeseburger1-Aug-09 23:58
Bacon Ultimate Cheeseburger1-Aug-09 23:58 
This leads us to another question. Is subclassing absolutely required? The answer is no. If you are not implementing any custom functionality for a window or control calling Attach() can work just as well. This allows you to associate the window handle with a specific object and access that window via the objects methods rather than calling SendMessage(). The object will not receive any of the messages intended for the window but you will still be able to access it in a much more friendly manner. The difference however is that you must call Detach() when the controls parent window is destroyed.

There are a few other details that I haven't touched on here but I'll let you digest this first and if necessary we can move on to them. They mainly deal DDX_Control() and what it does above simply attaching or subclassing a window.




Hope this helps.


Bonus time:
ForNow wrote:
I unnderstand the button cotrol can't have data


Actually that's not true. All windows can have additional data associated with them by using the GetProp() and SetProp() API calls.

In MFC you can create a class derived from say CButton that contains data and then subclass the button control with an object of your new class. Since that window is now associated with your custom object that data is also associated with it.

1300 calories of pure beef goodness can't be wrong!

GeneralRe: Size Of Control Objects (part 2) Pin
ForNow2-Aug-09 1:31
ForNow2-Aug-09 1:31 
GeneralRe: Size Of Control Objects (part 2) Pin
Bacon Ultimate Cheeseburger2-Aug-09 3:02
Bacon Ultimate Cheeseburger2-Aug-09 3:02 
GeneralRe: Size Of Control Objects (part 2) Pin
ForNow2-Aug-09 5:02
ForNow2-Aug-09 5:02 
GeneralRe: Size Of Control Objects (part 2) Pin
Bacon Ultimate Cheeseburger2-Aug-09 14:57
Bacon Ultimate Cheeseburger2-Aug-09 14:57 
GeneralRe: Size Of Control Objects (part 2) Pin
ForNow2-Aug-09 5:15
ForNow2-Aug-09 5:15 
GeneralRe: Size Of Control Objects (part 2) Pin
Bacon Ultimate Cheeseburger2-Aug-09 15:04
Bacon Ultimate Cheeseburger2-Aug-09 15:04 
GeneralRe: Size Of Control Objects (part 2) Pin
ForNow2-Aug-09 15:17
ForNow2-Aug-09 15:17 
GeneralRe: Size Of Control Objects (part 2) Pin
Bacon Ultimate Cheeseburger2-Aug-09 15:38
Bacon Ultimate Cheeseburger2-Aug-09 15:38 
GeneralRe: Size Of Control Objects Pin
ForNow1-Aug-09 20:49
ForNow1-Aug-09 20:49 
GeneralRe: Size Of Control Objects Pin
Bacon Ultimate Cheeseburger1-Aug-09 21:36
Bacon Ultimate Cheeseburger1-Aug-09 21:36 
GeneralRe: Size Of Control Objects Pin
ForNow1-Aug-09 21:49
ForNow1-Aug-09 21:49 
Questionvoid pointer? Pin
sam_psycho30-Jul-09 6:21
sam_psycho30-Jul-09 6:21 
AnswerRe: void pointer? Pin
molesworth30-Jul-09 7:49
molesworth30-Jul-09 7:49 
GeneralRe: void pointer? Pin
sam_psycho30-Jul-09 8:06
sam_psycho30-Jul-09 8:06 
GeneralRe: void pointer? [modified] Pin
Joe Woodbury30-Jul-09 8:20
professionalJoe Woodbury30-Jul-09 8:20 
GeneralRe: void pointer? Pin
sam_psycho30-Jul-09 8:30
sam_psycho30-Jul-09 8:30 
GeneralRe: void pointer? Pin
Joe Woodbury30-Jul-09 8:35
professionalJoe Woodbury30-Jul-09 8:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.