Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Moving dialog window

Moving dialog window

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestionannouncementworkspace
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    marcomars
    wrote on last edited by
    #1

    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 :)

    D D 2 Replies Last reply
    0
    • M marcomars

      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 :)

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • M marcomars

        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 :)

        D Offline
        D Offline
        Diddy
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups