Click here to Skip to main content
Click here to Skip to main content

CWindowImpl ATL Object Wizard

By , 24 Apr 2001
 
  • Download Source Files (MSI)- 175 Kb
  • Download Source Files (FLAT)- 29 Kb
  • Logo - RBCWindowImpl.gif

    Introduction

    This whole project came about after writing numerous CWindowImpl derived classes. I was tired of tracking down a CWindowImpl derived class that I could use as a base. Then from that derived class copy and pasting code segments from it to my newly derived CWindowImpl class implementation. I decided that instead of doing this repeatitive process every time I needed it, I would let an ATL Object Wizard do it for me with just a few clicks and key presses. I hope it eases your development and allows you to be more productive.

    Installation

    • Extract the MSI (Microsoft Installer) file from the source zip file above.
    • Run the RBCWindowImpl MSI file. It will install the files to the correct location as long as you set the install directory to be the drive and directory of Visual Studio.

    Examples of <DEVSTUDIO>:

    • D:\Program Files\Microsoft Visual Studio
    • C:\MyDevEnv

    It will then install the files to <DEVSTUDIO>\Common\MSDev98\Template\ATL.

    Usage

    To create a CWindowImpl derived implementation, do the following:

    1. Start the ATL Object Wizard using the 'New ATL Object' option avalable from the Insert menu.

      Logo - RBCWindowImpl1.gif

    2. Select the "CWindowImpl" ATL Object Wizard component from the "RadBytes" category.

      Logo - RBCWindowImpl2.gif

    3. Fill in the Names Dialog page with your CWindowImpl derived class name information.
    4. Select CWindowImpl Property Page to Customize CWindowImpl derived class information (optional).

      CWindowImpl Property Page (class view) - RBCWindowImpl3.gif
      Options available when DECLARE_WND_CLASS is selected.

      CWindowImpl Property Page (classex view) - RBCWindowImpl4.gif
      Options available when DECLARE_WND_CLASS_EX is selected.

      CWindowImpl Property Page (superclass view) - RBCWindowImpl5.gif
      Options available when DECLARE_WND_SUPERCLASS is selected.

    5. Click Ok
    6. Implement your derived CWindowImpl class.

    Generated Code And Output

    Your project has now been fitted with the CWindowImpl derived class you have named and is ready for use. It gives a basic implementation without any message handlers added. The output created is a Source and Header files from the Short Name supplied in the ATL Object Wizard property page. The only existing file that gets modified by the wizard is your Project file (.DSP).


    Unicode

    The code generated will compile both under UNICODE and ANSI.


    History

    31 Jul 2000 - Initial Release
    15 Aug 2000 - Fixed bug in template header file for Message map name.
    - Fixed MSI install for correct placement of files.
    - Fixed DECLARE_WND_SUPERCLASS original class name bug for common controls.
    - Removed Debug condition from ctl file for wizard.
    25 Apr 2001 - Packaged for deployment in plain old ZIP file with install instructions.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    About the Author

    Erik Thompson
    Web Developer
    United States United States
    Member
    Erik lives in Redmond, Washington. He works as a Senior Software Engineer specializing in C++, COM, ATL and the middle-tier and now .NET. When he isn't coding for work, he can be found trying to extend Internet Explorer with yet another Desk band or simplifying his development process with ATL Object Wizards.
     
    He spends his free time snowboarding, mountain biking, and online gaming.

    Sign Up to vote   Poor Excellent
    Add a reason or comment to your vote: x
    Votes of 3 or less require a comment

    Comments and Discussions

     
    You must Sign In to use this message board.
    Search this forum  
        Spacing  Noise  Layout  Per page   
    GeneralHellosussAnonymous26 Apr '05 - 2:28 
    i am a programmer how i can help you
    Generalwizard choise BUTTON no picturemembermargus19 Nov '03 - 3:40 
    Created window with ATL Object wizard( Original Class Name Button). I got button to display, but i can't now matter i try to draw anything on it. I can add all the window elements to that button like scrollbar and it responds to pressing. But i can't display image or text. Primary would to display image. But i can add other elements like combos and editboxes in that window. I create that class on toolbar like so:
     
    RECT rect2 = {150,0,300,100};
     
    mLogo.Create(m_hWnd, rect2, NULL, WS_CHILD|WS_VISIBLE|BS_FLAT| BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_SHOWTEXT , 0,IDM_HOMEPAGE_WIN);
     
    Any ideas ?
    GeneralRe: wizard choise BUTTON no picturesitebuilderErik Thompson19 Nov '03 - 10:19 
    BTNS_BUTTON |BTNS_AUTOSIZE | BTNS_SHOWTEXT are all for toolbar buttons, you have created a button not a toolbar button that resides on a toolbar. If you want to draw on it try the BS_OWNERDRAW and respond to WM_DRAWITEM or try BS_BITMAP and just set the bitmap for the button to use after it's created.
     
    Cheers,
    -Erik
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    My thoughts are my own and reflect on no other.
    QuestionCan i pass the window message from ...memberSaeed A. Siddiqui9 Nov '02 - 16:00 
    Hi!
     
    i m facing a problem while building a control in ATL with events.
    i use a MFC-CWnd derived class in a ATL-Full Control class.
    The call of the MFC-CWnd derived class is within the MFC-CWinThread derived class. The MFC-CWnd derived class also have a paability to recieve window messages like OnPaint(), OnClick(), OnLButtonDown() etc...
    I want to transfer the OnLButtonDown message to ATL-control class's some event Smile | :)
    But i couldn't do that i don't know how is pass this message to ATL class while there is no relation b/w all classes Cry | :((
    Means ATL call MFC-CWinThread class which further call MFC-CWnd class
    Also how i get the HWND of the window that contains the control? Confused | :confused:
     

    AnswerRe: Can i pass the window message from ...sitebuilderErik Thompson13 Nov '03 - 7:07 
    Saeed,
     
    I am not sure that I am following what you are trying to ask but here is what I think you are trying to do. You have 2 classes one ATL and one MFC derived. They are both "window" classes and you want them to communicate with each other. The easiest way is to make them know about each other and call methods on each. If they are on different threads then information will likely need to be thread protected. If they are in the same thread and just want to chat through the window messages you have stated then you could just make each class know about the others HWND and post messages to each other when needed.
     
    For your last question I don't have any context information. I dont' know where the window got the control or what you are trying to do with it. If the control has a HWND and is parented to the window that it is in and is the only window that is parented to then you could enum the child windows in the window that contains the control which would result you in the HWND of that control.
     
    Cheers,
    -Erik
     
    Cheers,
    -Erik
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    My thoughts are my own and reflect on no other.
    QuestionVS.NET support?memberJörgen Sigvardsson30 Aug '02 - 22:48 
    Will you port your excellent wizard for VS.NET/ATL7?
     
    Preferred storyline:
    - I am your father. Search your feelings and you'll know it's the truth. Together we can rule this galaxy like father and son.
    - Ok dad. Let's kick some butt!
    AnswerRe: VS.NET support?sitebuilderErik Thompson13 Nov '03 - 6:45 
    I'll look into it.
     
    Cheers,
    -Erik
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    My thoughts are my own and reflect on no other.
    GeneralRe: VS.NET support?memberbramp26 May '04 - 6:58 
    I would also like this supported in .Net... Has any progress been made?
     
    oh and thanks for making so many useful tutorials Smile | :)
    Generalabout Toolbarmemberomid daghdar23 Aug '02 - 23:12 
    Confused | :confused:
    Dear Erik
     
    I download your source code for adding an IE Toolbar.
    It's a great and perfect sample code that I found so far.
    I visit one problem:
    - When I unregistered dll, "Motley Fool” Button on the standard Buttons toolbar exist and
    don't removed. why?
     
    1- I have an idea to create an IEToolbar for us. I know your source code is free,
    can I use from your source code to create an IEToolbar for myself?
     
    2- I am a beginner in C++ programming and would like to go a professional programmer
    like you. Can u know any good tutorial for visual c++ focused on ATL, COM, ISAPI and so?
     
    3- Can you help me to any change on your code?
    1-1 I want to add drop down menu on button like google and yahoo bar.
    1-2 I want to create toolbar for my language (Persian) but I do it on your code
    and don't work as well as? Do you have any idea to change language of text?
     

     
    omid
    http://www.shygunsys.com
    GeneralRe: about ToolbarsitebuilderErik Thompson13 Nov '03 - 6:59 
    Omid,
     
    The unregistering of the DLL isn't completely correct, it doesn't clean up the toolbar button upon release. Also unregistering it only removes the toolbar on future instances of IE; so if you have a instance of IE running prior to unregistering it, the toolbar button will exists until the next fresh instance of IExplore.exe is run.
     
    1. yup the code is free, use it as you wish.
    2. I don't know of any good tutorials online but there are a load of books; there may be other tutorials online about some of the areas you are looking for on this site. For ISAPI look at ATL Servers, and Michael Dunn has written a collection of COM related articles if I recall.
     
    3. (1-1) Just turn on the TB_STYLE so that it is a dropdown and respond to messages from the toolbar button accordingly. (1-2) Language changes just require using Wide-Char's and correct character codes with a resulting Language in Regional settings. Internationalization is always tedious and haven't done a lot with it.
     
    Cheers,
    -Erik
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    My thoughts are my own and reflect on no other.

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

    Permalink | Advertise | Privacy | Mobile
    Web01 | 2.6.130523.1 | Last Updated 25 Apr 2001
    Article Copyright 2000 by Erik Thompson
    Everything else Copyright © CodeProject, 1999-2013
    Terms of Use
    Layout: fixed | fluid