Registering custom controls in MFC

Registering custom controls in MFC

Post by Adrian Frid » Sat, 15 Mar 1997 04:00:00



Dear all,

     I've built a custom control which I'm trying to integrate into a
     dialog in an SDI app.  We get the MSDN, but I can't seem to find a
     sample which illustrates how this is done (there's one
     illustrating subclassing of common controls in MFC, and the rotary
     control one which doesn't use MFC much).

     Based on the samples I've found, I have the control working, but
     it creates the instance of the control during the initial
     registration instead of when the dialog is created.  This means I
     can't pass useful parameters to the constructor :-(

     What I'd like to be able to do is use the class wizard, add a
     variable of the control type (or hack one in) and use DDX_Control
     to attach it to a variable as with the standard controls.
     If I try this - it moans that the control is already attached to
     the window.

     Can anyone point me in the direction of a sample, or pass on some
     useful tips about integrating your own controls?

     I'd appreciate any help, thanks,

  Adrian.
-------------------------------------------------------------------------------
Adrian Friday        | Homepage :                     | Telephone :
Computing Department |   http://www.comp.lancs.ac.uk/ |   01524-65201x3807
SECAMS               |    computing/staff/adrian.html |------------------------
Lancaster University | E-mail :                       | Facsimile :

-------------------------------------------------------------------------------

 
 
 

1. MFC ActiveX control inside another MFC ActiveX control - MFC Bug

Hi.
I have to ActiveX Controls created using the AppControl Wizard
provided by Visual C++ 5. I want to create the first control inside
the second control , and here is what happens.

I create the first control in the OnCreate method of the second object
using a wrapper class created using the Component Wizard. When I
create the (first) control I get an assertion in Wincore.cpp in
CWnd::Attach saying that the window is already mapped (was attached
already), everything works fine if I ignore but when the application
closes it raises an exception and dies (sometimes taking the whole
system with it). I traced inside MFC code and found out that when I
call create and finally Windows creates the window, MFC's hook
function that hooks windows creations attaches the windows before
COleControlSite has a chance to do so, and that's why it asserts.
Didn't the guys at Microsoft think about this situation ?

What do I do ?

Another question : Is there any mechanism to show dialog templates
inside a control - something like COleFormControl ???

   Thanks a buch,
      - Dror Kremer

P.S.

Please reply both by post and e-mail. Thank you !
-----------------------------------------------------------------
Dror Kremer                                 | Oh Margie you came
Team OS/2                                   | and you found me a    
                                            | turkey, on my
  E-mail:                                   | vacation away from

  Fidonet:                                  |                    
    97:200/118.3                            |    - Homer Simpson
                                            |                    
* Finger for PGP Key, Accepting VoiceChat/2 |
  Calls.                                    |
-----------------------------------------------------------------

2. I want to setup a printer server

3. MFC does not support custom controls

4. CD labelling

5. Animate Control / Custom resource / MFC 4.2

6. The minimal settings to get the GUI window?

7. INET (telnet & ftp daemon)

8. Sharing data between custom Plug-ins

9. Custom Authentication Plug-Ins

10. Plug-ins not able to get custom information from contexts

11. OLE Custom Control Subclassing Window control

12. Edit control like in VB Custom Controls