Positioning a dialog in Visual C++

As I am just starting out in the world of C++ I have encountered a problem. I use Visual C++.

I create a dialog in the resource editor and create a class for it. When pressing a button I am to show the dialog with:

CTestDialog dlg;
dlg.m_Amount = 0;
dlg.m_Price = 0;
dlg.DoModal();

The problem I have is how to position the dialog. I would like to position the dialog in the top left corner of the screen. I have tried overriding the CDialog based class with the virtual fuction 'PreCreateWindow' but apparently this function is not used when showing a dialog this way.

How can I position a dialog that I want to show?
MDHAsked:
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.

abdijCommented:
Hi,
 In the properties of the Dialog, there are two edit boxes for X and Y positions. Set them to -1, -1 each. The dialog will start in the Top Left corner of the screen

Hope this is what you wanted
Bye
Abdij
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
abdijCommented:
Hi,
 I think you know how to do it, yet, just to be sure.
Go to the resorce tab, and Dialogs, and select the dialog.

On the dialog right-click and select properties . You will find the X Pos and Y Pos there

Bye
Abdij
0
MDHAuthor Commented:
Hmm.. I am QUITE sure I looked at the property page before and didn't see it *blush*. Ok, that solved it at least. Hmm.. But the 'x' and 'y' values were '0' until I changed them into -1. Why didn't the dialog show at the {0,0} position already??

Thanks anyway.
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
C++

From novice to tech pro — start learning today.