Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.

Creating a simple doc/view control in a dialog box

Skip to first unread message


Jul 6, 2007, 6:20:02 PM7/6/07
Hello everyone and all,

I'm wanna have my own custom control in a dialog box that will be derived
from CView and correlate to an object derived from CDocument.
This dialog box is a part of a regular doc/view MDI app, so I already have a
CView-derived class, and a CDocument-derived one.

1) I'm using the wizard to generate stuff, so what should I do to manually
add another doc/view corelation?

2) How do I add my own custom control (derived from a CView or CScrollView)
to a dialog box??

I've tried adding a custom control to it, specifying the "Class" property as
CView, but that made the prog incapable of showing the dialog box, and the
output pane had some mentioning of the lack of AfxEnableControlContainer() in
the app's InitInstance().

Now, my app isn't ActiveX enabled (didn't specify it in the wizard), and to
the best of my understanding of ActiveX (which frankly is lacking) I do not
need it in my app - because I want to use this control only in this app, and
not export it or register it in the system...
All I want is a custom control - I'll write it's drawing & user input procs.
3) Is that ActiveX?

Anyway, I've tried adding a "custom control" to an ActiveX enabled project,
and it didn't show the dialog box either...
4) Why? what is this "custom control" you can add from VS 2005's dialog
editor toolbox (which offline MSDN tells virtually nothing about) - Is that
the way to go about adding my custom control?

Hope you made it reading this far,
I would appreciate whatever sharing of experience you can offer,

Tom Serface

Jul 6, 2007, 7:16:13 PM7/6/07
Maybe this will help you get started:


"JackSheep" <> wrote in message

Mark Salsbery

Jul 16, 2007, 11:08:02 AM7/16/07
Why do you need to derive from CView? That doesn't fit the doc/view model in

A CView is a window, not a control, so you need to create it and add it to
the dialog at runtime like you would add any other child window to an
existing window.


Mark Salsbery
Microsoft MVP - Visual C++


Jul 18, 2007, 4:26:06 PM7/18/07
Thank you.
0 new messages