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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC Overview

MFC Overview

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
5 Posts 4 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.
  • E Offline
    E Offline
    E Dyot
    wrote on last edited by
    #1

    Having created lots of mickey mouse applications using the wizard, as well as trying out examples in the half dozen fat books I have bought, I am nowhere nearer to understanding the what where and how of how to structure an application. I have nice examples of how to output text in a window, how to draw lines, OR how to read in data from the keyboard, but there seems to be Jack Beep around on how to tie any two of these obviously mind-boggling concepts into the same app. What I want to do is read and process data from a binary file (done, that was easy) and then use some of that data (actually x-y positional data) to write shapes to the window. Any help or ideas much appreciated.:confused: E Dyot

    D 1 Reply Last reply
    0
    • E E Dyot

      Having created lots of mickey mouse applications using the wizard, as well as trying out examples in the half dozen fat books I have bought, I am nowhere nearer to understanding the what where and how of how to structure an application. I have nice examples of how to output text in a window, how to draw lines, OR how to read in data from the keyboard, but there seems to be Jack Beep around on how to tie any two of these obviously mind-boggling concepts into the same app. What I want to do is read and process data from a binary file (done, that was easy) and then use some of that data (actually x-y positional data) to write shapes to the window. Any help or ideas much appreciated.:confused: E Dyot

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

      This sounds like a good job for an SDI application. Read the data into the document. The document then notifies the view that new data needs to be rendered. In in the view, ask the document for the new data and render it accordingly. Look at the MSDN's Scribble tutorial.


      "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

      PJ ArendsP E 2 Replies Last reply
      0
      • D David Crow

        This sounds like a good job for an SDI application. Read the data into the document. The document then notifies the view that new data needs to be rendered. In in the view, ask the document for the new data and render it accordingly. Look at the MSDN's Scribble tutorial.


        "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

        PJ ArendsP Offline
        PJ ArendsP Offline
        PJ Arends
        wrote on last edited by
        #3

        E Dyot wrote: Look at the MSDN's Scribble tutorial. Scribble, what a great learning tool. When I started with MFC (had used OWL before) I printed out the entire tutorial, followed it from start to end, and then started adding my own stuff. CP was not around at the time, so I don't think I could have figured out so much about MFC without it.

        Within you lies the power for good; Use it!

        1 Reply Last reply
        0
        • D David Crow

          This sounds like a good job for an SDI application. Read the data into the document. The document then notifies the view that new data needs to be rendered. In in the view, ask the document for the new data and render it accordingly. Look at the MSDN's Scribble tutorial.


          "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

          E Offline
          E Offline
          E Dyot
          wrote on last edited by
          #4

          "Read the data into the document" - done. Because it's binary, I thought it needed to be read in and processed byte by byte. To do this I wrote a routine : BOOL CMyDoc::OnOpenDocument(LPCTSTR lpszPathName) { if (!CDocument::OnOpenDocument(lpszPathName)) return FALSE; // lots of my code to convert various doubles, ulongs, ushorts etc into physical numbers and attributes // // all data processed, ready for display// //Now we're stuck. // } Now, the problem I have is, *how* do I pass the data to - and to *which* routine - in order to paint, say, a box on the screen, using that data? Automatically, i.e. no mouse input, no keyboard input. I don't want to draw using the mouse, and it is not a dead text file that I am reading. The whole concept is an automatic process, in which the user is prompted for a path, and then the application processes a bunch of different files, mostly binary, and then *should* output a simple graphical representation of some mechanical items on the window, based on the data that was processed. E Dyot

          J 1 Reply Last reply
          0
          • E E Dyot

            "Read the data into the document" - done. Because it's binary, I thought it needed to be read in and processed byte by byte. To do this I wrote a routine : BOOL CMyDoc::OnOpenDocument(LPCTSTR lpszPathName) { if (!CDocument::OnOpenDocument(lpszPathName)) return FALSE; // lots of my code to convert various doubles, ulongs, ushorts etc into physical numbers and attributes // // all data processed, ready for display// //Now we're stuck. // } Now, the problem I have is, *how* do I pass the data to - and to *which* routine - in order to paint, say, a box on the screen, using that data? Automatically, i.e. no mouse input, no keyboard input. I don't want to draw using the mouse, and it is not a dead text file that I am reading. The whole concept is an automatic process, in which the user is prompted for a path, and then the application processes a bunch of different files, mostly binary, and then *should* output a simple graphical representation of some mechanical items on the window, based on the data that was processed. E Dyot

            J Offline
            J Offline
            Jack Puppy
            wrote on last edited by
            #5

            E Dyot wrote: Now, the problem I have is, *how* do I pass the data to - and to *which* routine - in order to paint, say, a box on the screen, using that data? Handle the OnDraw function in your CView based class. From OnDraw, you can call GetDocument() to retrieve a pointer to your document.

            CMyView::OnDraw(CDC* pDC)
            {
            // Grab the doc
            CMyDoc* pDoc = GetDocument();
            ASSERT_VALID(pDoc);

            // Get the doc data
            pDoc->GetDataUsedToDrawStuff();

            // You can use clipping functions to help eliminate unnecessary drawing
            if (pDC->RectVisible(blah))

            // Draw as you see fit using the various CDC GDI/drawing functions
            pDC->SelectObject(brush/font/pen);
            pDC->FrameRect(blah);
            pDC->TextOut(blah);
            etc...
            }

            :suss: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!

            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