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;

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?
Who is Participating?
abdijConnect With a Mentor Commented:
 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
 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

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.
All Courses

From novice to tech pro — start learning today.