Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MFC programming help

  1. Feb 27, 2005 #1


    User Avatar
    Staff Emeritus
    Science Advisor

    Are there any good sites for MFC programming help? (THat's Microsoft Foundation Classes - C++ version 6.0 to be specific).

    In case anyone here can help:

    I'm trying to find the width of a MFC CView window, so I can do line-breaking in the ondraw() function, so that my displayed text lines fit the window.

    Unfortunately taking the device context pointer pDC and evaulating pDC->GetWindowExtent() gives me a size of 1,1. Since I was in the default mode MM_TEXT, I thought I should get a window size in pixels. I don't know if I'm using the wrong function, or have set anything up wrong in the window (but most everything about the window the APPwizard default for SDI (single document) application).
  2. jcsd
  3. Mar 4, 2005 #2
    Try this:

    RECT rect;
    int width = rect.right - rect.left;
    int height = rect.bottom - rect.top;
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook