Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

Password continued

Hi all, specifically Nietod and Alexo...

I placed this in the Init part of my dialog based MFC and I am getting all sorts of errors... how do I get this create function to work?

CEdit* editCtrl = (CEdit*) GetDlgItem(IDC_EDITBOX);
rect passwordbox;
editCtrl->GetRect(&passwordbox);
CWnd* pParentWnd = GetParent();
editCtrl->Create(ES_PASSWORD,passwordbox,
pParentWnd,IDC_EDIT5_PASSWORD);  
0
rose3377
Asked:
rose3377
  • 3
1 Solution
 
Answers2000Commented:
Why don't you simply set the password style on the edit control at design time in the resource editor ?
0
 
Answers2000Commented:
If you don't want to do that, then use ModifyStyle instead of Create - if the window already exists as part of the dialog
0
 
jhanceCommented:
GetRect doesn't work in the initialize (OnInitDialog) as the window you are trying to get the rect of doesn't exist yet.  Try doing this in the constructor for your dialog instead.
0
 
Answers2000Commented:
This is back 2 front jhance

To me the problem seems to be that rose is creating a window which is _already_ created
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now