Void CMFCFunnyDlg: : OnBnClicked ()
{
//TODO: add the control notification handler code
Srand ((int) time (0));
Int x=rand () % 400;
Int y=rand () % 200;
GetDlgItem (IDCANCEL) - & gt; SetWindowPos (NULL, x, y, 0, 0,
SWP_NOZORDER | SWP_NOSIZE);
//CDialogEx: : OnCancel ();
}
Insert a few times a breakpoint, nor because of two random Numbers produced by the same cause,,,,
CodePudding user response:
Novice,Just a guess,
May need to obtain first dialog high and wide, before moving to judge whether will exceed the dialog,
CodePudding user response:
Covered by other controls?CodePudding user response:
Sure is a random number is not the same? One random number print display