Moving dialog window
-
Hello I have a MFC dialog based app. I need the user to move it by dragging in any point. I tried with this code, but didn't work: UINT CMainMenu::OnNcHitTest(CPoint point) { CRect r; GetClientRect(&r); ClientToScreen(&r); if(r.PtInRect(point)) return HTCAPTION ; return CDialog::OnNcHitTest(point); } Any suggestion about? Thanks, Marco. by the way do you know why (only in release configuration) i get an error from the application when executing the line fscanf(fp,"%s",s); when the line in the file is 9 chars or longer ????? :confused: Thanks again :)
-
Hello I have a MFC dialog based app. I need the user to move it by dragging in any point. I tried with this code, but didn't work: UINT CMainMenu::OnNcHitTest(CPoint point) { CRect r; GetClientRect(&r); ClientToScreen(&r); if(r.PtInRect(point)) return HTCAPTION ; return CDialog::OnNcHitTest(point); } Any suggestion about? Thanks, Marco. by the way do you know why (only in release configuration) i get an error from the application when executing the line fscanf(fp,"%s",s); when the line in the file is 9 chars or longer ????? :confused: Thanks again :)
marcomars wrote: Any suggestion about? I assume you've seen this article. marcomars wrote: by the way do you know why (only in release configuration) i get an error from the application when executing the line fscanf(fp,"%s",s); when the line in the file is 9 chars or longer ????? Not without knowing at least what
s
is.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
-
Hello I have a MFC dialog based app. I need the user to move it by dragging in any point. I tried with this code, but didn't work: UINT CMainMenu::OnNcHitTest(CPoint point) { CRect r; GetClientRect(&r); ClientToScreen(&r); if(r.PtInRect(point)) return HTCAPTION ; return CDialog::OnNcHitTest(point); } Any suggestion about? Thanks, Marco. by the way do you know why (only in release configuration) i get an error from the application when executing the line fscanf(fp,"%s",s); when the line in the file is 9 chars or longer ????? :confused: Thanks again :)
It should :confused: This: UINT CSssDlg::OnNcHitTest(CPoint point) { CRect rc; GetClientRect(&rc); ClientToScreen(&rc); return rc.PtInRect(point) ? HTCAPTION : CDialog::OnNcHitTest(point); } Does. In the dialog its self - with ON_WM_NCHITTEST() added to the dialogs messgae map