Using Windows Control in ATL

How can i create and call a dialog box in ATL.
I found that the way i create & call a dialog box in ATL is different than in VC++. VC++ method doesn't work in ATL.
Anybody knows, help me.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Microsoft has a "composite control" which takes from the dialog class.
Please see:

The follwing is a simple way to add an ATL dialog to a simple ATL object.
(RMB is Right Mouse Button):
Make ATL proj, add simple obj.

Now Add ATL Dialog
   (RMB on ClassView project,
     Add New ATL object,
Add a button, and double click it.
Choose IDC_BUTTON1 and press
  Add and Edit.
Now open the class view and notice the class for this object.

You start the dialog, just like you start any other ATL COM object.
Any of the following:
1. Using the C++ code, instantiating a CComObjectEx.
2. Using the #import directive and ATL smart pointers.
3. Using C calls (CoCreateInstance)
4. Using containers like VB or DHTML.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jojiAuthor Commented:
I manage to create the DialogBox, but my main intention is to create and display a progress bar, i did the following way , but doesn't recognise the CProgressBarCtrl Object.It gives an error gor that.

LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 CWindow wnd=GetDlgItem(IDC_PROGRESS1);
 CRect rect;
 CProgressBarCtrl myCtrl; //Gives an  
        error in this line saying, un
        recognised object
 myCtrl.Create( WS_VISIBLE | WS_CHILD |  PBS_SMOOTH, rect, this,  IDC_PROGRESS1);
 myCtrl.SetRange( static_cast<short>(0), static_cast<short>(100) );
for(int i=1; i<10; i++)
return 1;  

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.