Discussion:
Dynamic Window and overload functions
(too old to reply)
Todor Atanasov
2013-05-04 21:07:15 UTC
Permalink
Hi guys, it is me again.

I have some questions about creating dynamically windows in MFC and calling functions from it.

I create window with
CWnd chils;
child.CreateEx(...);
child.ShowWindow(SW_SHOW);

But then how to call/overload functions like: OnPaint, OnMouseMove and so on in that window?


T.
ScottMcP [MVP]
2013-05-05 02:04:41 UTC
Permalink
Post by Todor Atanasov
Hi guys, it is me again.
I have some questions about creating dynamically windows in MFC and calling functions from it.
I create window with
CWnd chils;
child.CreateEx(...);
child.ShowWindow(SW_SHOW);
But then how to call/overload functions like: OnPaint, OnMouseMove and so on in that window?
T.
You can't add code to CWnd. You can add code to a class you derive from CWnd. If you use the Visual Studio menu commands to add a class derived from CWnd then it will have some skeletal code and a message map. You can add message handlers by clicking on your class's Properties in the class view tab of solution explorer.
Todor Atanasov
2013-05-05 06:39:45 UTC
Permalink
Post by ScottMcP [MVP]
Post by Todor Atanasov
Hi guys, it is me again.
I have some questions about creating dynamically windows in MFC and calling functions from it.
I create window with
CWnd chils;
child.CreateEx(...);
child.ShowWindow(SW_SHOW);
But then how to call/overload functions like: OnPaint, OnMouseMove and so on in that window?
T.
You can't add code to CWnd. You can add code to a class you derive from CWnd. If you use the Visual Studio menu commands to add a class derived from CWnd then it will have some skeletal code and a message map. You can add message handlers by clicking on your class's Properties in the class view tab of solution explorer.
Of course how stupid of me:D Thanks a lot.



T.

Continue reading on narkive:
Loading...