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. Quick Easy MFC question [modified]

Quick Easy MFC question [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
2 Posts 2 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.
  • B Offline
    B Offline
    bulg
    wrote on last edited by
    #1

    Here's the code, and the important values from stepping through the code:

        CStatic m\_audio\_rate\_text;
        ...
    m\_audio\_rate\_text.Create(T\_AUDIO\_BITRATE\_TEXT, WS\_CHILD|WS\_VISIBLE
    	,move
    	,this,AUDIO\_BITRATE\_TEXT);
    
    CRect t;
    m\_audio\_rate\_text.GetWindowRect(&t);
    

    // step-through watch values:
    // move { top=160 bottom=205 left=500 right=600}
    // t { top=189 bottom=234 left=503 right=603}

    How do I get the right RECT ?? (the same as the one I created it with) Or Why is GetWindowRect() returning a different value?

    modified on Tuesday, March 24, 2009 4:33 PM

    R 1 Reply Last reply
    0
    • B bulg

      Here's the code, and the important values from stepping through the code:

          CStatic m\_audio\_rate\_text;
          ...
      m\_audio\_rate\_text.Create(T\_AUDIO\_BITRATE\_TEXT, WS\_CHILD|WS\_VISIBLE
      	,move
      	,this,AUDIO\_BITRATE\_TEXT);
      
      CRect t;
      m\_audio\_rate\_text.GetWindowRect(&t);
      

      // step-through watch values:
      // move { top=160 bottom=205 left=500 right=600}
      // t { top=189 bottom=234 left=503 right=603}

      How do I get the right RECT ?? (the same as the one I created it with) Or Why is GetWindowRect() returning a different value?

      modified on Tuesday, March 24, 2009 4:33 PM

      R Offline
      R Offline
      Rick York
      wrote on last edited by
      #2

      GetWindowRect returns a rectangle in screen coordinates. Create takes a rectangle that uses client window coordinates. You can use ScreenToClient and ClientToScreen to convert between the two.

      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