CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    20

    Pointers to views/calling class functions

    One of the things I've found most difficult about learning this strange new language is getting pointers to the instances of the classes being used so as to call their member functions! (Am I just thick, or is this generally a problem for beginners? For example, I've got a basic class-wizard generated MDI app. I've created a static splitter wnd and then a second splitter wnd from one-half of the first one. (3 panes total). I've derived my own classes (2 list views and form view). All fine and well thus far... In the class-wizard generated "Doc" class, I've mapped ID_FILE_OPEN to a "OnFileOpen" function which works fine. Once I get the name of the file though, I want to call a member function of one of the views I created to do some processing on the file. How do I get a pointer to the view so I can call the member function?

    Any general tips greatly appreciated!

    I'm a veteran ANSI C programmer, but this is my first stint with "event-driven" programming. I know what I want to do, but getting it done in this windows environment is proving to be very frustrating!

    Thanks!
    -Dan


  2. #2
    Join Date
    Apr 1999
    Posts
    21

    Re: Pointers to views/calling class functions

    Hi, you don't need a pointer to a view. Each time the document is modified you should call CDocument::UpdateAllViews, and you should implement CView::OnUpdate on all the views in your application.
    lHint contains information about t

  3. #3
    Join Date
    May 1999
    Posts
    69

    Re: Pointers to views/calling class functions

    Or you can enumerate the views of your document.
    use GetFirstViewPosition, GetNextView and CRuntimeClass information to determine which view you have...

    G'things

    chrislaw

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured