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.
jojiAsked:
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.

mflamCommented:
Microsoft has a "composite control" which takes from the dialog class.
Please see:
http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/vcconcompositecontrolfundamentals.htm

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,
      Miscelanious
       Dialog)
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.

Moshe
0

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)
{
 USES_CONVERSION;
 CWindow wnd=GetDlgItem(IDC_PROGRESS1);
 CRect rect;
 wnd.GetWindowRect(&rect);
 ScreenToClient(&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) );
 myCtrl.StepIt();
for(int i=1; i<10; i++)
{
  myCtrl.SetStep(10);
  Sleep(200);
  myCtrl.StepIt();
}
return 1;  
}

0
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.