home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 26 / CD_ASCQ_26_1295.iso / vrac / mfcfaq12.zip / MFCFAQ12.TXT < prev   
Text File  |  1995-08-03  |  164KB  |  3,996 lines

  1.  
  2.  
  3.  
  4.                   Microsoft Foundation Classes (MFC)
  5.                       Frequently Asked Questions
  6.                    Scot Wingo (scot_wingo@msn.com)
  7.                               Version 1.2
  8.                           Last updated: 7/29/95
  9.  
  10. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  11.                            *Version 1.2 Note*
  12.  
  13. Welcome to version 1.2 of the world famous MFC FAQ! This version has
  14. lots of new material.  Some of my favs->
  15.  
  16. 2.4.2 - Lots of new book reviews
  17. 2.4.3 - Cool MFC articles
  18. 6.6   - Windows Common Controls - a HOT topic on Usenet/Cserve
  19. 11.17 - Learn MFC today, or some suggestions on how to. (good mfc-l thread)
  20.  
  21. Finally, I'm starting a fancy new "Instant-FAQ (TM)" service, where I
  22. keep a list of email addresses and when a new version of the FAQ is
  23. ready, it is automatically blasted out to you via email.  This way you
  24. won't have to search for announcements of the new FAQ, they will be
  25. mailed to you before the rest of the world gets them!
  26.  
  27. To participate in the "Instant-FAQ (TM)" program for the next release,
  28. just send your email to me at: scot_wingo@msn.com and I'll add you for
  29. free.  We at MFC FAQ headquarters aim to please!!  (In other words,
  30. it's like a free MFC FAQ subscription, this is NOT a mailing list or
  31. listserver.)
  32.  
  33. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  34.  
  35. Copyright
  36. ---------
  37.   This document is compilation Copyright (c) 1995 by Scot Wingo.  It
  38.   may be freely copied and/or distributed in its entirety as long as this
  39.   copyright notice is not removed.  It may not be sold for profit or
  40.   incorporated into commercial products without the author's written
  41.   permission.  [Compilation copyright means that you can freely use
  42.   individual sections of this document, but any significant collection of
  43.   sections is subject to the copyright. Hey, I may want to turn this
  44.   into a book or a movie some day!]
  45.  
  46.   This FAQ is in no way connected with Microsoft.  It contains some
  47.   answers to frequently asked questions about their products.  The
  48.   author in no way guarantees that any of these answers are correct.
  49.   This is just a collection of information posted to public on-line
  50.   forums to help the average MFC programmer. [In other words, please
  51.   don't sue me. ]
  52.  
  53.   [Note: If you are not using a fixed font, the tables and other
  54.    formatting of this FAQ will not look correct.  Courier 12 works well
  55.    for me.] 
  56.  
  57.                           Table of Contents
  58.                           =================
  59.  
  60. Key:
  61.    % - Indicates serious revision since version 1.1
  62.    * - Indicates something entirely new and exciting since version 1.1
  63.  
  64. 1.  MFC FAQ Info and Credits
  65.   1.1.  How do I get this FAQ?
  66.         - "Instant-FAQ (TM)"
  67.   1.2.  What's the goal of this FAQ?
  68.   1.3.  Why are you doing this?
  69.   1.4.  How can I contribute!?!
  70.   1.5.  Credits
  71.   1.6.  How is this different than the MSVC MFC FAQ?
  72.   1.7.  What other languages is this FAQ translated to?
  73.     1.7.1.  Japanese version of MFC FAQ
  74.  
  75. 2.  Where to go for Juicy MFC Information
  76.   2.1.  Microsoft
  77.     2.1.1.  MSVC and MSVC Subscription
  78.    %2.1.2.  Microsoft Developers Network (MSDN)
  79.    %2.1.3.  Knowledge databases
  80.     2.1.4.  Microsoft Software Library 
  81.   2.2.  Internet
  82.    %2.2.1.  World Wide Web pages
  83.     2.2.2.  Mailing lists
  84.     2.2.3.  Usenet news groups
  85.     2.2.4.  Other FAQs of interest
  86.     2.2.5.  FTP sites
  87.   2.3.  CompuServe
  88.   2.4.  Printed matter
  89.     2.4.1.  Magazines and journals
  90.    %2.4.2.  Books on MFC
  91.    *2.4.3.  Cool MFC Articles
  92.   2.5.  Trade shows
  93.   2.6.  User's groups
  94.   2.7.  Technical Support
  95.  
  96. 3. A Brief History of MFC (Answers to questions about MFC/MSVC versions)
  97.   3.1.  How do I know what version of MFC I have?
  98.   3.2.  Pre-MFC 1.0
  99.   3.3.  MFC 1.0
  100.   3.4.  MFC 2.0
  101.   3.5.  MFC 2.1
  102.   3.6.  MFC 2.5
  103.     3.6.1.  MFC 2.51
  104.     3.6.2.  MFC 2.52
  105.     3.6.3.  MFC 2.52b
  106.   3.7.  MFC 3.0
  107.   3.8.  MFC 3.1
  108.   3.9.  MFC 3.2
  109.   3.10.  MFC 4.0
  110.   3.11.  Table of MFC releases
  111.  
  112. 4.  Generic Class Questions
  113.   4.1.  CException - Exceptions and exception handling.
  114.     4.1.1.  How do I throw a CUserExeception derived exception?
  115.  
  116. 5.  GDI Class Questions
  117.   5.1.  CDC
  118.     5.1.1.  How to I create a CDC from a HDC?
  119.   5.2.  CBitmap
  120.     5.2.1.  How do I read a 256-color bitmap file from disk?
  121.  
  122. 6.  Window, Control, and Dialogs Class Questions
  123.   6.1.  Windows
  124.     6.1.1.  How can I use a custom icon for a window?
  125.     6.1.2.  How do I change the styles for a window that's created by MFC?
  126.     6.1.3.  How do I get the minimal size of a window using MFC?
  127.    *6.1.4.  How do I change a Window's title?
  128.    *6.1.5.  How do I get rid of 'Untitled' in my main window caption?
  129.   6.2.  Controls 
  130.     6.2.1.  How do I get a CControl pointer from a Dialog Template?
  131.     6.2.2.  How do I subclass a control using MFC?
  132.     6.2.3.  Why do I get an ASSERT when I subclass a control?
  133.     6.2.4.  How do I validate the contents of a control when it loses focus?
  134.    *6.2.5.  How do I enable/disable a bank of checkboxes?
  135.    *6.2.6.  How do I change the background color of a control?
  136.   6.3.  Dialogs
  137.     6.3.1.  How do I center my dialog?
  138.     6.3.2.  How do I get the 'old style' common dialogs on win95?
  139.     6.3.3.  How do I subclass a win95 common dialog?
  140.     6.3.4.  CDialog::Create fails, what could be wrong?
  141.     6.3.5.  How do I create a toolbar/statusbar in a dialog?
  142.    *6.3.6.  Why isn't my CDialog::PreCreateWindow getting called?
  143.    *6.3.7.  How do I embed a common dialog in a property page?
  144.    *6.3.8.  Why can't I DDX/DDV to initialize my CDialog controls?
  145.   6.4.  Control bars, status bars, toolbars, dialog bars.  
  146.     6.4.1.  How do I add a combobox to my toolbar?
  147.     6.4.2.  How do I update the text of a pane in a status bar?
  148.     6.4.3.  How do I make my CToolBar customizable at run-time?
  149.     6.4.4.  How do I turn off the toolbar or status bar?
  150.     6.4.5.  How do I create a toolbar/statusbar in a dialog?
  151.   6.5.  Menus
  152.     6.5.1.  How do I get a pointer to the menu bar in a MDI app?
  153.    *6.5.2.  How do I implement a right-mouse popup-menu?
  154.    *6.5.3.  How do I dynamically change the mainframe menu?
  155.    *6.5.4.  How do I 'attach' a menu to a window's creation/destruction?
  156.  *6.6. Windows Common Controls (a.k.a. Windows 95 controls)
  157.     6.6.1.  Can I use these controls under NT or Win32s?
  158.     6.6.2.  Where's a demo of this wickedly cool controls?
  159.     6.6.3.  How do you handle NM_DBLCLK for a CListCtl?
  160.  
  161. 7.  Documents, Views and Frame Class Questions
  162.   7.1.  Views
  163.     7.1.1.  How do I size a view?
  164.     7.1.2.  How do I size a CFormView?
  165.     7.1.3.  How do I use new views with a doc template?
  166.     7.1.4.  How do I change the background color of a view?
  167.     7.1.5.  How do I get the current View?
  168.     7.1.6.  How do I create multiple views on one document?
  169.    *7.1.7.  How do I get all the views in an MDI app?
  170.   7.2.  Documents
  171.     7.2.1.  Do I have to use the Document/View architecture?
  172.     7.2.2.  How do I get the current Document?
  173.     7.2.3.  When are documents destroyed?
  174.     7.2.4.  How do I create multiple documents?
  175.     7.2.5.  How do I get a list of open documents?
  176.  
  177. 8.  OLE Class Questions
  178.   8.1.  Structured Storage
  179.     8.1.1.  When I upgraded, I could not read my files generated by
  180.             the old version of MFC.  What do I do?
  181.   8.2.  OLE Controls (previously called OCX's)
  182.     8.2.1.  What is an OLE control?
  183.     8.2.2.  How do I write OLE controls?
  184.     8.2.3.  What versions of MFC support OLE control containment?
  185.  
  186. 9.  WOSA Class Questions
  187.   9.1.  CRecordSet
  188.     9.1.1.  When I add a CRecordSet class, I get tons of linker errors..
  189.   9.2.  WinSock
  190.     9.2.1.  I'm having problems with CSocket blocking, what's up?
  191.  
  192. 10.  DLL and Build Questions
  193.    10.1.  Do I need a CWinApp object in a DLL?
  194.    10.2.  How should I define the WEP in an MFC DLL?
  195.    10.3.  How do I build an 'extension DLL'?
  196.  
  197. 11.  MFC Tips, Tricks, and Caveats (a.k.a Miscellaneous)
  198.    11.1.  What's the best way to convert my C Windows App to MFC?
  199.    11.2.  Why is my MFC application running really slow?
  200.    11.3.  How can I create an application that is initially maximized?
  201.    11.4.  How do I enable TRACE macros in my applications?
  202.    11.5.  How do I perform background processing in my application?
  203.    11.6.  How do I send a message to another thread?
  204.    11.7.  Does Microsoft use MFC in their products? Which ones?
  205.    11.8.  How do I limit my MFC application to one instance?
  206.    11.9.  How do I get my MFC app to use the Registry on Win32?
  207.    11.10.  How do I programmatically terminate my MFC application?
  208.   *11.11.  What's the difference between IMPLEMENT_DYNAMIC,
  209.            IMPLEMENT_DYNCREATE and IMPLEMENT_SERIAL?
  210.   *11.12.  How can I declare an abstract base class to be IMPLEMENT_SERIAL?
  211.   *11.13.  What is afx.inl and afxwin1.inl, etc..?
  212.   *11.14.  Is MFC available on the Macintosh?
  213.   *11.15.  Is MFC available on OS/2?
  214.   *11.16.  Is MFC available on UNIX/Motif?
  215.   *11.17.  How should I learn/start learning MFC?
  216.   *11.18.  What DLLs should I distribute with my MFC app?
  217.  
  218. 12.  Wizard Questions
  219.    12.1.  How can I change the AppWizard options I selected for my application?
  220.  
  221. 13.  Visual C++ Questions  
  222.    13.1.  Windows 95 questions
  223.       13.1.1.  I'm running MSVC 2.0 and I can't get Windows 95 look in
  224.                my dialogs, what's wrong?
  225.      %13.1.2.  When I compile under Windows 95, it flashes in and out of
  226.                DOS mode.
  227.       13.1.3.  Can MSVC 1.50 or 2.0 be used for Windows 95?
  228.    13.2.  Configuration questions
  229.      %13.2.1.  What are the memory requirements for MSVC?
  230.       13.2.2.  How can I get MSVC 2.1, I can't find it in stores?
  231.       13.2.3.  Should I run under Win 95 or NT?
  232.       13.2.4.  How do I set the include/lib/exe directories?
  233.       13.2.5.  I can't compile any programs!  Help!
  234.       13.2.6.  Can I setup a project to search different paths for source?
  235.      %13.2.7.  How do I build a browser file for all of MFC?
  236.    13.3.  Language feature questions
  237.      %13.3.1.  Does MSVC support templates and exception handling?
  238.       13.3.2.  Does MSVC support STL?
  239.       13.3.3.  Does MSVC support RTTI?
  240.    13.4.  Religious questions
  241.       13.4.1.  Which is better OWL or MFC, BC++ or MS MSVC?
  242.       13.4.2.  Should I use Visual C++ or Visual Basic?
  243.      %13.4.3.  MFC philosophy (from a microsoftie!)
  244.    13.5.  Advanced Visual C++ tips and tricks
  245.       13.5.1.  How do I see the MSVC 'Easter Eggs'?!
  246.      %13.5.2.  What are the command line options to MSVC?
  247.       13.5.3.  How to change the color of ClassWizard generated code!
  248.       13.5.4.  Ten cool things you can do in the VC++ editor.
  249.    13.6.  Miscellanous Visual C++ questions
  250.       13.6.1.  What are all these files that MSVC is creating?!
  251.     
  252. %14.  Third Party MFC Products/Reviews
  253.  
  254. %15.  MFC FAQ Revision History 
  255.  
  256. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  257.  
  258. 1.  MFC FAQ Info and Credits
  259. =============================
  260.    The MFC FAQ maintainer can be contacted via the following:
  261.    Internet: scot_wingo@msn.com
  262.    My URL is: http://www.unx.com/~scot
  263.    CompuServe: >INTERNET: scot_wingo@msn.com, or 75463,2146
  264.    Microsoft Network: scot_wingo
  265.    Snail Mail:
  266.             Scot Wingo
  267.             P.O. Box 638
  268.             Georgetown, CT 06829
  269.  
  270.    I welcome any comments, criticisms or suggested additions for the
  271.    FAQ.
  272.  
  273. ---------------------------------------------------------------------------
  274.  
  275. 1.1.  How do I get this FAQ?
  276. ============================
  277.    Hey, this is one of those chicken and egg questions, if you're reading 
  278.    this you already have the FAQ.  But seriously, the MFC FAQ is put
  279.    out just about monthly, so chances are you are reading an old and
  280.    stale version, instead of the fresh and fancy latest version.  If
  281.    you want to make sure you have the latest version:
  282.  
  283.    * "Instant-FAQ (TM)" - If you'd like to have a copy of any new MFC FAQ
  284.      releases emailed right to your front door, just send me an email via
  285.      scot_wingo@msn.com and I'll add you to the 'subscription'.  No cost
  286.      or anything, just another FAQ service.
  287.  
  288.      "Why wait for the announcements and then go get the FAQ yourself,
  289.      use "Instant-FAQ (TM)"
  290.  
  291.      "Instant-FAQ(TM) changed my life!!!  I no longer have to wait for
  292.      months for the latest FAQ.  It's just waiting in my email box the
  293.      second it's released, no fuss no muss! Thanks Instant-FAQ(TM)"
  294.      -Anonymous Instant-FAQ(TM) participant. 
  295.  
  296.      [All restrictions apply in states that do not allow Instant-FAQ
  297.       service, please see your local MFC FAQ dealer for details.]
  298.  
  299.    * The latest version can be downloaded from:
  300.      ftp://landru.unx.com/pub/mfc_faq/mfc_faqXX.txt
  301.      Where XX represents the latest version.
  302.  
  303.    * This FAQ is also available on the World Wide Web.
  304.      http://www.unx.com/~scot/mfc_faq.html
  305.      [Note: Still under construction]
  306.  
  307.    * The FAQ also is on CompuServe in the MSMFC forum, Developer
  308.      exchange download section, and the file name is MFC_FAQXX.TXT.
  309.      Where XX is the version number 
  310.  
  311.    * An announcement of a new FAQ release is posted to the usenet newsgroups:
  312.      comp.os.ms-windows.programmer.controls
  313.      comp.os.ms-windows.programmer.graphics
  314.      comp.os.ms-windows.programmer.mfc <coming soon!>
  315.      comp.os.ms-windows.programmer.misc
  316.      comp.os.ms-windows.programmer.ole
  317.      comp.os.ms-windows.programmer.tools
  318.      comp.os.ms-windows.programmer.win32
  319.      comp.answers
  320.      news.answers
  321.      comp.lang.c++
  322.  
  323.    * There's also an announcement on the mfc mailing list. (See Section 2.2.2.)
  324.  
  325.    * If all else fails, you can send me an email and I'll send the
  326.      latest copy to you.
  327.  
  328. ---------------------------------------------------------------------------
  329.  
  330. 1.2.  What's the goal of this FAQ?
  331. =================================
  332.    The goal of this FAQ is to be a clearing house for answers to MFC
  333.    questions commonly asked on primarily the usenet newsgroups but also
  334.    some stuff that gets asked on CompuServe may be included.  I'm hoping
  335.    not to duplicate the great documentation out there, the tech notes, 
  336.    MSDN, etc..  Hopefully you will look there first and then use this FAQ
  337.    as your last resort.  The FAQ will be much more interesting if you
  338.    check those resources first, then we won't have to cover 'the basics'.
  339.  
  340.    Right now the FAQ is in raw ASCII format (lowest common denominator),
  341.    but maybe some day, I'll turn it into a help file if there's enough
  342.    interest for it.
  343.  
  344.    I'm trying to load the FAQ up with good phone numbers,
  345.    CODE-CODE-CODE!,  URLs and email addresses of places to call.  I'm
  346.    putting 800 numbers first, and then the US number second.
  347.    International folks hate it when there are only 800 numbers, so if you
  348.    want a phone number in the FAQ, please send me both.
  349.  
  350. ---------------------------------------------------------------------------
  351.  
  352. 1.3.  Why are you doing this?
  353. =============================
  354.    I keep seeing the same posts and they're driving me insane!!! But
  355.    seriously, I started the MFC FAQ when I had gobs of free time and was
  356.    trying to get really totally submerged in MFC.  I figured, what better
  357.    way to get submerged, than to manage the FAQ.
  358.  
  359.    I'm also working on a top-secret MFC project and this is a good way
  360.    for me to learn more about MFC and what MFC folks are having a hard
  361.    time with.
  362.  
  363. ---------------------------------------------------------------------------
  364.  
  365. 1.4.  How can I contribute!?!
  366. =============================
  367.    Good question!  You can send me an email with your frequently asked
  368.    question and answer and I'll stick it right in the FAQ.  It's that
  369.    easy, I'll even make sure you get credit for that entry.  Please remember
  370.    to tell me what section of the FAQ you would like your FAQ added to.
  371.  
  372.    Also, if you search for the word 'TODO' that indicates there is
  373.    some information I need to fill in and would really like your help
  374.    with..
  375. ---------------------------------------------------------------------------
  376.  
  377. 1.5.  Credits
  378. ==============
  379.    I borrowed the format from Tom Haapanen's Windows Programmers FAQ, so
  380.    I'm eternally indebted to him for that.  Tom also knew the exact dates
  381.    of all MFC releases practically down to the second ;->
  382.  
  383.    I'd also like to use this space to thank some of the folks that always
  384.    try and help out people on the usenet groups:
  385.  
  386.    Chris Marriott - He has the highest bandwidth of darn good answers
  387.    I've ever seen. 
  388.  
  389.    Mike Blaszczak - A Microsoftie that reads netnews and gives great
  390.    answers! (See section 2.4.2 for info about his book!)  If anybody knows
  391.    how to pronounce his name, let me know..
  392.  
  393.    And of course thanks to everyone in the Microsoft MFC/MSVC group that
  394.    made MFC the phenomenon it is today:  Scott Randall, Jim McCarthy, Dean
  395.    McCrory, etc.., etc..
  396.  
  397.    These folks have given me lots of great feedback on the FAQ:
  398.    Jim B - jimb@turningpoint.com, 
  399.  
  400.    Individual FAQ contributions are usually near the FAQ.
  401.  
  402. ---------------------------------------------------------------------------
  403.  
  404. 1.6.  How is this different from the MSVC MFC FAQ?
  405. ==================================================
  406.    There is a MFC FAQ that comes with MSVC, this FAQ is different because:
  407.    A) It's not from Microsoft (so it has more dirt!)
  408.    B) The information here is gleaned from Usenet and CompuServe, where
  409.       their information is from technical support.  Hopefully the
  410.       Usenet/CompuServe folks ask better questions (they are
  411.       definitely cheaper ;-> )
  412.  
  413. ---------------------------------------------------------------------------
  414.  
  415. 1.7.  What other languages is this FAQ translated to?
  416. =====================================================
  417.  
  418. 1.7.1.  Japanese version of MFC FAQ
  419. -----------------------------------
  420.    I am coordinating efforts with Masahiko Funaki to have a Japanese
  421.    version of the FAQ.  He gets all changes so that he can maintain
  422.    the Japanese version.  He can be reached via email at: 'funa@hic.co.jp'.
  423.  
  424. ---------------------------------------------------------------------------
  425.  
  426.  
  427. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  428.  
  429. 2.  Where to go for Juicy MFC Information
  430. =========================================
  431.    Hopefully this FAQ is where you will look when all else fails.  This
  432.    section documents what else is out there and how to get your paws on it.
  433.  
  434. ---------------------------------------------------------------------------
  435.  
  436. 2.1 Microsoft
  437. =============
  438.    MFC comes with Microsoft's Visual C++, Watcom's C++, and Symantec's
  439.    C++ compilers.
  440.  
  441. 2.1.1 Visual C++ and Visual C++ subscription.
  442. -----------------------------------------
  443.    Microsoft sells Visual C++ in two flavors, a one-shot where you just 
  444.    get the most current release and a subscription where you receive a
  445.    years worth of updates for a little extra cash. See Section 3 for
  446.    the details of what MFC release is the latest and greatest.  Only
  447.    major versions are sold through outlets, so if you need a point
  448.    release, you need the subscription.
  449.  
  450.    NOTE:  There are TWO subscriptions out there.
  451.  
  452.    1. The Visual C++ subscription, which is the compiler/MFC, etc.. for a year.
  453.    2. The Microsoft Developer's Network subscription (See next section),
  454.       where you get some developer resources (no compiler/no MFC). It's
  455.       easy to get these confused.
  456.  
  457.    Prices fluctuate, so contact one of the compiler vendors for
  458.    information:
  459.  
  460.    * Microsoft
  461.      (800) 719-5577
  462.      (206) 936-8661
  463.      http://www.microsoft.com
  464.  
  465.    * Symantec:
  466.      (800) 628-4777
  467.      (408) 253-9600
  468.      http://www.symantec.com
  469.  
  470.    * Watcom
  471.      (800) 265-4555
  472.      (519) 886-3700
  473.      http://www.watcom.com
  474.  
  475.    There are also two programmer mail order houses that carry all of the
  476.    MFC supported compilers including the Visual C++ subscription:
  477.  
  478.    * Programmer's Paradise
  479.     (800) 445-7899
  480.     (908) 445-7899
  481.  
  482.   * The Programmer's Shop
  483.     (800) 421-8006
  484.     (617) 740-2510
  485.  
  486. ...........................................................................
  487.  
  488. 2.1.2 Microsoft Developers Network (MSDN)
  489. -----------------------------------------
  490.    Another great investment is the Microsoft Developers Network (MSDN),
  491.    which is a quarterly subscription set of CDROMs that contains all of the
  492.    information you can imagine about the Microsoft developer products,
  493.    including MFC.  There are two levels, level one gets you the CDs that
  494.    have all the developer tool information.
  495.  
  496.    Level 1: MSDN "Development Library" - This is a single disc which
  497.             contains an absolute wealth of useful developer 
  498.             information.  Such as:
  499.  
  500.             o Technical Articles (VC++ 1.0-2.0, C/C++, Windows, etc)
  501.             o Sample Code (Book & Magazine Samples, Product Samples
  502.               covering everything from MFC to SDK, etc.)
  503.             o Backgrounders and White Papers (including MFC 2.5 & 3.0)
  504.             o Specifications (Plug and Play, TAPI, Unicode, Winsock, etc)
  505.             o Knowledge Base and Bug Lists
  506.             o Books & Periodicals (MSJ, Dr. Dobb's, MS Press Books, etc)
  507.             o Product Docs (Word, Excel, VC++, MFC Migration Guide, etc)
  508.             o SDK's & DDK's (Win32 SDK, Telephony SDK, Speech API, etc)
  509.             o Product Tools and Utilities (Winsock, UI Guide, etc)
  510.             o Unsupported Tools and Utilities (Self Study Modules, etc)
  511.             o Conference and Seminar Papers (DevCast IV & V, Tech*Ed, etc)
  512.  
  513.  
  514.      Level 2: MSDN "Development Platform" - The full set is currently 
  515.               (July '95 Release), is 19 discs containing:
  516.  
  517.             o Discs 1-4 (U.S. "Core" Pack):  U.S. Windows NT Service
  518.               Packs, Windows Versions (3.11, WFW 3.11), and SDK's, 
  519.               Windows NT 3.51 Workstation Retail and Checked Builds, 
  520.               Win32 SDK (Final Windows NT Components), MS DOS 6.22
  521.  
  522.             o Discs 5-16 (International Pack):  Intl. SDKs and Drivers
  523.               Intl. Windows NT Service Packs, Intl. Additional Windows
  524.               NT Service Packs and Windows 3.11 Versions, Windows 95
  525.               International Beta Releases (May 1995), Intl. Win 3.1 &
  526.               Windows for Workgroups 3.11, 
  527.                  -also-
  528.               International versions of Windows NT 3.5 Workstation: 
  529.               Available in:  German, French, Italian, Spanish, 
  530.               Dutch, Swedish, Norwegian, Finish, Danish, 
  531.               Traditional Chinese, Portuguese, Korean, Japanese 
  532.               and the Japanese Win32 SDK.
  533.  
  534.             o Discs 17-19 (Device Driver Kit):  Windows NT 3.5 DDK 
  535.               (Japanese), Windows NT 3.51 DDK, General DDK's
  536.  
  537.    Level two subscribers have the option of receiving around 20 CD's
  538.    each quarter with all the latest operating systems.  It even has the
  539.    operating systems in every language you can imagine! (Swahili NT,
  540.    gotta have it!)  If you want to have the latest and greatest, get
  541.    level 2.  If you can live with going to Egghead for operating systems,
  542.    and don't need the Swahili NT, level one should be good.  You also get
  543.    a pretty good newsletter every quarter or so.
  544.  
  545.    
  546.    There's a MSDN FAQ at: ftp.microsoft.com:/developr/msdn/faq
  547.    There's a MSDN Web at: http://www.microsoft.com/msdn/
  548.    There's a gopher at:   topher://gopher.microsoft.com/1/msdn
  549.  
  550.    You can contact MSDN at:
  551.    (800) 759-5474
  552.    (303) 684-0914
  553.     msdn@microsoft.com
  554.  
  555.    Level 1: $195 ($275 CAN) per year
  556.    Level 2: $495 ($695 CAN) per year
  557.    Level 1 to Level 2 upgrades: $395 ($555 CAN) per year
  558.  
  559.    NOTE: This is NOT the Visual C++ subscription.  It is described in
  560.    section 2.1.1.  MSDN does not come with compilers or MFC, but does
  561.    come with SDKs (include files, libraries, etc..) and tons of other
  562.    developer related information.
  563.  
  564. ...........................................................................
  565.  
  566. 2.1.3 Knowledge Databases
  567. -------------------------
  568.    Microsoft support creates these knowledge databases that answer
  569.    frequently asked questions and sometimes have samples and stuff.  You
  570.    can get the knowledge databases from ftp.microsoft.com, CompuServe,
  571.    and they come on the MSDN (see section 2.1.2 above) CD-ROMs.
  572.  
  573.    There's a tool that lets you quickly search these.  Whenever I've tried
  574.    to find something here, I always end up with MFC 1.0 information
  575.    that's not very useful.  Your mileage may vary.
  576.  
  577.    http://www.microsoft.com/KB/indexes/visual_c.htm is the URL
  578.    for the MSVC knowledge databases.
  579.  
  580. ...........................................................................
  581.  
  582. 2.1.4.  Microsoft Software Library
  583. ----------------------------------
  584.    Microsoft maintains a giant library of samples, tools, and demos
  585.    called the Microsoft Software Library.  Here's how to find it on the
  586.    various electronic media->
  587.  
  588.    * CompuServe
  589.      GO MSL
  590.  
  591.    * Microsoft Download Service (MSDL)
  592.      Dial (206) 936-6735 to connect to MSDL
  593.  
  594.    * Internet (anonymous FTP)
  595.      ftp ftp.microsoft.com
  596.      Change to the SOFTLIB\MSLFILES directory
  597.  
  598.    - John Elsbree, elsbree@nwrain.com, programmer.misc, 6/24/95
  599.  
  600. ---------------------------------------------------------------------------
  601.  
  602. 2.2.  Internet
  603. ==============
  604.    Throw on some sunglasses, put the top down and take a cruise on that
  605.    big ole' information highway.  There's tons of great MFC information
  606.    at your finger tips (sorry billg), if you know where to look..
  607.  
  608. ...........................................................................
  609.  
  610. 2.2.1.  World Wide Web Pages
  611. ----------------------------
  612.  
  613.    Here are some URLs with MFC, or MFC related information:
  614.  
  615.    MFC/MSVC specific
  616.    -----------------
  617.    o http://www.microsoft.com -  Microsoft's WWW.
  618.    o http://www.microsoft.com/KB/indexes/visual_c.htm - MSVC KB
  619.  
  620.    Windows NT/95 specific
  621.    ----------------------
  622.    o http://www.bhs.com - Windows NT home page.
  623.    o http://biology.queensu.ca/~jonesp - Windows 95 home page.
  624.    o http://www.netex.net/w95/windows95 - More Windows 95 stuff
  625.  
  626.    C++ specific
  627.    ------------
  628.    o http://www.info.desy.de/user/projects/c++.html - Lots of C++ stuff.
  629.    o http://www.watcom.com/c/c.html - FAQ
  630.    o http://www.quadralay.com/www/CCForum/CCForum.html - C++ tutorials and
  631.      conversations.
  632.    o http://vinny.csd.mu.edu/learn.html - Whopping big list of books and
  633.      tutorials for C++.
  634.    o http://www.iftech.com/classes/vcpp/vcpp0.htm - Interface Technologies,
  635.      Inc. "Intro to MFC Programming with VC++ 1.5"
  636.    o http://www.solsem.com/Instructors.html - Info on Seminars for MFC 
  637.      and VC++, Windows 95, NT, etc.  
  638.    o http://execpc.com/~owl/cplus.html - On With Learning - Visual C++ 
  639.      Training Video Tapes
  640.    o http://www.yahoo.com/computers/languages/c_c__/ - Yahoo's Computer
  641.      Languages:  C/C++ Page with links to other resources
  642.  
  643.  
  644.    TODO ** Need more URLs!
  645.  
  646.    Lots of magazines are on the web, see section 2.4.1 for those URLs
  647.  
  648. ...........................................................................
  649.  
  650. 2.2.2.  Mailing lists
  651. ---------------------
  652.    As far as I can tell, there's only one mailing list, mfc-l. It's a
  653.    great mailing list, with many Microsofties that lurk and answer. To
  654.    subscribe send an email to listserv@netcom.com with the message:
  655.  
  656.    subscribe mfc-l
  657.  
  658.    David Elliott (dce@netcom.com), started and manages this list. Thanks
  659.    for setting it up David!!
  660.  
  661. ...........................................................................
  662.  
  663. 2.2.3.  Usenet Newsgroups
  664. ---------------------------
  665.    You can get to Usenet groups through the Internet, or through many of
  666.    the on-line services these days.  Unfortunately, there is not a MFC
  667.    specific newsgroup, but most of the Windows programming groups are
  668.    full of MFC questions.  Here's a quick rundown of where you can go for
  669.    MFC conversations, in order of MFC content:
  670.  
  671.    * comp.os.ms-windows.programmer.tools -
  672.      This is where most of the MFC stuff happens, it IS a tool after all. 
  673.  
  674.    * comp.os.ms-windows.programmer.misc -
  675.      Give it a shot, lots of noise here, but usually good noise.
  676.  
  677.    * comp.os.ms-windows.programmer.win32 -
  678.      I like this group, doesn't seem to crowded, people know what's going
  679.      on, I guess because they're already into win32.
  680.  
  681.    * comp.os.ms-windows.programmer.ole -
  682.      An occasional thread about some of the OLE classes pops up here.
  683.  
  684.    * comp.lang.c++ -
  685.      This is suppose to be for C++ language issues, but people are always
  686.      posting about MSVC and MFC here.  This group is really frustrating
  687.      to read, I recommend staying away.  There's about a 100000:1 noise
  688.      ratio on here.
  689.  
  690. ...........................................................................
  691.  
  692. 2.2.4.  Other FAQs of interest
  693. ------------------------------
  694.  
  695.    * Windows FAQ - Maintained by Tom Haapanen.
  696.      ftp.metrics.com:~/faq
  697.      Explains lots of great stuff about Windows that you won't find here.
  698.  
  699.    * Windows Programming FAQ - Maintained by Tom Haapanen.
  700.      ftp.metrics.com:~/faq
  701.      Awesome Windows Programming FAQ. 
  702.  
  703.    * C++ FAQ - Maintained by Marshall Cline.
  704.      ftp to  rtfm.mit.edu:/pub/usenet/comp.lang.c++, also on comp.lang.c++
  705.      This is an awesome FAQ, answers every C++ question you'd ever
  706.      conceive of.  It's not specific to MSVC so be careful, some behavior
  707.      could be different. 
  708.  
  709.    * WinHelp FAQ - Maintained by Pete Davis
  710.      Posted regularly to comp.os.ms-windows.programmer.winhelp
  711.      If you have a question about the Windows help system, this is for
  712.      you.
  713.  
  714.    * Windows NT FAQ - Maintained by Adam Hamilton
  715.      Posted to comp.os.ms-windows.nt.misc?
  716.      Pretty good, lots of networking stuff in there.
  717.  
  718.    * Portable GUI (PIGUI) FAQ - Maintained by Wade Guthrie
  719.      (wade@nb.rockwell.com).  Yes MFC is cross-platform, this FAQ describes
  720.      it better than we can ever hope to here.  Should be accessible via
  721.      rtfm.mit.edu it's the comp.windows.misc newsgroup FAQ.
  722.  
  723. ...........................................................................
  724.  
  725. 2.2.5.  FTP sites
  726. -----------------
  727.    There's not much MFC code out there.  You can check out these sites:
  728.  
  729.    * ftp.microsoft.com - Has all the knowledge databases and a couple of
  730.      MFC specific things.  Check out the software library too (softlib).
  731.  
  732.    * ftp.cica.indiana.edu - pub/pc/win3/progrmr
  733.  
  734.    * wuarchive.wustl.edu - Good site, don't know about MFC stuff.
  735.      pub/win3/progrmmr
  736.  
  737.    * ftp.uu.net - /vendors/microsoft has some developer support things
  738.      that are on both ftp.microsoft.com and CompuServe.  Microsoft seems to
  739.      be moving away from here.
  740.  
  741.    * oak.oakland.edu - (SimTel Mirror) SimTel/win3/pgmtools
  742.  
  743.    If you don't have Internet access, you can order CDROMs with these
  744.    entire archives from Walnut Creek.  Call (800) 786-9907 or (510)
  745.    947-5996 for more information.
  746.  
  747. ---------------------------------------------------------------------------
  748.  
  749. 2.3.  CompuServe
  750. ================
  751.    CompuServe, in my opinion, is by far the best resource for MFC
  752.    information.  The MSMFC forum is dedicated to MFC discussions and has
  753.    downloads that you can't even begin to find anywhere else.  Here's
  754.    some other CompuServe forums of interest:
  755.  
  756.     MFC                             GO MSMFC
  757.     Windows                         GO MSWIN
  758.     Win32                           GO MSWIN32
  759.     Windows NT                      GO WINNT
  760.     Software Library                GO MSL
  761.     Languages (C++)                 GO MSLANG
  762.     Microsoft Developer Network     GO MSDN
  763.     Microsoft Developer Services    GO MSDS
  764.     Microsoft Press                 GO MSP
  765.  
  766.    For more information about CompuServe call:
  767.    (800) 487-4838
  768.    (614) 457-8650
  769.  
  770. ---------------------------------------------------------------------------
  771.  
  772. 2.4.  Printed Matter
  773. =====================
  774.  
  775. 2.4.1.  Magazines and journals
  776. ----------------------------
  777.  
  778.    I've tried to list these in order of MFC content.  The ones first have
  779.    the most MFC content with the ones last having the least.  Even though
  780.    they don't directly cover MFC, most of the Windows programming
  781.    magazines are still pretty valuable. Any of these that I've read, I
  782.    put comments with.  If you'd like to comment, email me and I'll throw
  783.    it in here. 
  784.  
  785.    * Visual C++ Developer
  786.      Pinnacle Publishing ($149/yr)
  787.      (800) 788-1900
  788.      (206) 251-1900
  789.      My favorite, very meaty, lots of MFC coverage, diskette with each
  790.      issue.
  791.  
  792.    * Visual C++ Professional
  793.      Oakley Publishing   ($149/yr)
  794.      (800) 234-0386
  795.      (503) 747-0800
  796.      Similar to above, but just a smidge less MFC.
  797.  
  798.    * Inside Microsoft Visual C++
  799.      The COBB Group  ($69/yr)
  800.      (800) 223-8720
  801.      (502) 493-3300
  802.      Similar to above, but even less MFC.  Lot's of stuff about the
  803.      compiler, etc..
  804.  
  805.    * Microsoft Systems Journal (MSJ)
  806.      Miller Freeman Inc.
  807.      (800) 666-1084
  808.      (303) 678-0439
  809.      http://www.mfi.com/msj
  810.      About 1 MFC article every 2 months
  811.  
  812.    * Windows Tech Journal
  813.      Oakley Publishing
  814.      (800) 234-0386
  815.      (503) 747-0800
  816.      Same as above.
  817.  
  818.    * Windows/DOS Developers Journal
  819.      R+D Publications
  820.      (913) 841-1631
  821.      Same as above.
  822.  
  823.    * PC Techniques
  824.      Coriolis Group
  825.      (602) 483-0192
  826.      http://www.coriolis.com
  827.      Same as above.
  828.  
  829.    * Dr. Dobbs 
  830.      Miller Freeman Inc.
  831.      (800) 456-1215
  832.      (303) 678-0439
  833.      http://www.ddj.com
  834.      About one MFC article every 3-4 months, maybe.
  835.  
  836.    * C++ Report
  837.      SIGS Publications
  838.      (800) 361-1279
  839.      (212) 242-7447
  840.      These guys never talk about MFC, but they all hate it.  Purists!
  841.  
  842.    * C/C++ Users Journal
  843.      R+D Publications
  844.      (913) 841-1631
  845.      Same as above.
  846.  
  847. ...........................................................................
  848.  
  849. 2.4.2. Books on MFC
  850. -------------------
  851.    There's tons of books on Visual C++, but not many of them go into
  852.    the details about MFC.  Here's a list of books that are over 50%
  853.    oriented towards MFC (e.g. don't have pages of screenshots of compiler
  854.    options dialogs and the MSVC IDE)
  855.  
  856.    * Microsoft Visual C++ Documentation Set
  857.      Microsoft Press
  858.      (800) MSPRESS
  859.      (416) 293-8464
  860.      o Volume 2: Programming with MFC and Win32 ($27)
  861.        ISBN 1-55615-802-5
  862.      o Volume 3: MFC Library Reference ($45)
  863.        ISBN 1-55615-801-7
  864.      These come in the on-line docs, but nice to have printed versions of them.
  865.      If you are going to do MFC programming, volume 2 is a 'must have'
  866.  
  867.    * Inside Visual C++, Second Edition
  868.      Microsoft Press ($40)
  869.      David J. Kruglinski (Ex-Microsoftie)
  870.      ISBN: 1-55615-661-8
  871.  
  872.      # Sounds like it would be Visual C++ specific, but this is the 'Petzold
  873.        of MFC programming.  In other words, it's a 'must have' (along
  874.        with volume 2 of the printed docs.  If you can't afford both,
  875.        stick with volume 2 on-line and get this one)
  876.        **Note, this does not have Win32 coverage, yet.
  877.        -scot_wingo@msn.com
  878.  
  879.      # The best MFC book that I know of is "Inside Visual C++" by David
  880.        Kruglinski. Despite the name, this is primarily an MFC book.
  881.        -Chris Marriott, chris@chrism.demon.co.uk, programmer.graphics, 6/15/95
  882.  
  883.    * The Revolutionary Guide to Win32 Programming with MSVC
  884.      WROX Press ($45),  June 1995
  885.      Mike Blaszczak 
  886.      ISBN: 1-874416-47-8
  887.  
  888.      # I just finished reading this one.  As the title indicates, it's
  889.        Win32 specific.  I also think it's a little too advanced for
  890.        beginners.  If you're into Win32 (Win 95) programming, it has
  891.        really good chapters on those classes.  Also comes with a neato
  892.        poster!  Chapter 9 on DLLs is best coverage of that material, ever.
  893.        -scot_wingo@msn.com
  894.  
  895.      # If you understand C++ and _some_ windows programming this is a
  896.        great book to learn MFC. 
  897.        -Shelley Lambert, reach@ee.mcgill.ca, programmer.tools, 6/18/95
  898.  
  899.      # It is the best book on Win95 programming I have found.
  900.        -Gary Coombs, N40JW@News.Radio.Org, programmer.win32, 6/19/95
  901.  
  902.    * Writing Windows Applications with MFC
  903.      M+T Books ($40)
  904.      Bryan Waters
  905.      ISBN: 1-55851-379-5
  906.  
  907.      # At first I thought it was too beginner, but the last 5 chapters kick
  908.        butt. Lots of info on MFC internals, exception handling, and topics
  909.        not covered elsewhere.  Good for someone new to Windows and MFC
  910.        programming.
  911.  
  912.    * Visual C++ How To 
  913.      Waite Group ($40)
  914.  
  915.       # I can tell you that its a real good book for what its intended to be.
  916.        Which is, sort of like your FAQ.  It comes with a CD and has little
  917.        tidbits like: 
  918.  
  919.        1.) How to animate an icon.  I adapted this a bit to figure out how to
  920.        change icons (in an MDI on the fly).
  921.  
  922.        2.) How to detect multiple instances of a Windows app and pull the
  923.        other one to the top of the Z-order.  This is a perennial Usenet
  924.        question and I pulled the code and had it working first time.
  925.  
  926.        3.) How to put a bitmap on the main client window of a MDI app.
  927.        Again, a nasty little thing to figure out on your own, but given good
  928.        directions, quite easily done from the book.
  929.  
  930.        The CD is also broken out between those that are using VC 1.5 versus 2.0.
  931.    
  932.      # Like other Waite Group "How-To" programming books, this one is
  933.        in "Cookbook" or FAQ format.  You read the table of contents for
  934.        the functionality you are looking for, and the associated chapter
  935.        contains the code to implement it.
  936.  
  937.        Topics include:  Document and View, Status Bars and Toolbars, 
  938.                         Controls, Multimedia, Bitmaps and Icons, Dialogs
  939.                         OLE and DDE, System and a FAQ of short tips
  940.     
  941.        Many new classes are given here which all supplement the MFC in a
  942.        fairly logical manner.  Some of the chapters which were of interest
  943.        to me were:
  944.  
  945.            2.1 - Put the current time in the status bar
  946.            2.3 - Add a status bar to my Views
  947.            2.4 - Display Progress information in the status bar
  948.            4.1 - Preview an AVI file using the common file dialog
  949.            4.3 - Play AVI files in a CView
  950.            4.4 - Play large WAV files
  951.            4.6 - Create 3D animation using OpenGL and MFC
  952.            5.5 - Smoothly animate bitmaps
  953.            6.6 - Write customized DDX/DDV routines
  954.            8.3 - Localize MFC applications using resource DLLs
  955.            8.5 - Make multiple inheritance work in MFC
  956.            And many tidbits from the FAQ...
  957.  
  958.        I like the cookbook format which allows me to glue in specific
  959.        functionality on demand.  I found this book to be fairly helpful
  960.        in that regard.  I look forward to Volume II ;-)
  961.        -cntrline@winnet.com via email, 7/15/95
  962.  
  963.    * Visual C++ 2: Developing Professional Applications in Windows 95 and
  964.      Windows NT using MFC
  965.      Marshall Brain and Lance Lovette
  966.      Prentice Hall
  967.      ISBN: 0-13-305145-5
  968.      Should be out end of June 1995
  969.      TODO: Find comments on this book.
  970.  
  971.    * Animation Techniques in Win32
  972.      Nigel Thompson
  973.      Microsoft Press  (Early 1995)
  974.      ISBN: 1-55615-669-3
  975.         At first glance, I ignored this book on the shelves, however, when
  976.         I finally picked it up, it used MFC completely throughout.  A very
  977.         good book on doing graphics with MFC.
  978.         -jdc@biosym.com, John Clark, via email 6/6/95
  979.  
  980.    * Teach Yourself Microsoft Foundation Class Library Programming in 21 Days
  981.      Robert Shaw
  982.      SAMS ($30)
  983.      ISBN: 0-672-30462-7
  984.      -bossi@hp2.sm.dsi.unimi.it (Giuliano Bossi) no review.
  985.  
  986.        # I find "Teach Yourself Visual C++ in 21 Days" a good reference, since
  987.        it is set up to cover a small group of features each "day", so you can
  988.        quickly go to a subject area, and get a from-scratch description of it
  989.        and how to use it.  However, the author is not strong on using the VC
  990.        IDE, claiming that "you have to write this code yourself the first few
  991.        times, so you better appreciate what AppStudio and ClassWizard are
  992.        doing behind the scenes."  I'd prefer the approach where we use the
  993.        tools at hand, and then map out what those magic MESSAGE_MAP macros
  994.        are really doing.
  995.        -Paul.McGuire@SEMATECH.Org, email, 7/11/95
  996.  
  997.    * MS Foundation Class Primer: Prog Windows 3 & Windows NT w/MFC 
  998.      Jim Conger
  999.      The Waite Group Press ($32) Mar-93, 830 pages
  1000.      ISBN: 1-878739-31X 
  1001.      -jalvarez@uno.com
  1002.  
  1003.       # The best MFC book that I've seen that DOESN'T use VC++ Wizards is
  1004.         "Microsoft Foundation Class Primer" 
  1005.         -stasic@news.dorsai.org, ED, programmer.misc, 6/24/95
  1006.  
  1007.       # This book is a good intro for people new to MFC, but it's
  1008.         getting pretty dated.  This book was written during the time 
  1009.         of MS C++ 7.0, and some of the newest functionality just isn't 
  1010.         covered (for obvious reasons ;), which can confuse a newbie.  
  1011.         At any rate, it's still makes pretty good book for someone 
  1012.         looking for the basics.
  1013.         -cntrline@winnet.com, email, 7/15/95
  1014.  
  1015.    * Master Visual C++ 2,2/E w/CD-ROM  (covers MFC 3.0 library) 
  1016.      Howard W. Sams & Company ($ 50) Jan-95, 1183 pages
  1017.      Gurewich & Gurewich
  1018.      ISBN: 0-672305-321 
  1019.      -jalvarez@uno.com
  1020.  
  1021.        # I picked up a copy of "Master Visual C++" specifically for its
  1022.        coverage of creating custom VBX's.  This is not covered in Kuglinski's
  1023.        "Inside Visual C++" nor in "Teach Yourself Visual-C++ in 21 Days".
  1024.        "Master Visual C++" is just my speed, since I am a dabbler who does
  1025.        not read instructions or tutorials, just jumps in over my head, then
  1026.        starts looking for the routine calls I overlooked.  Similar to the
  1027.        Heavy Metal book, this book could have been squeezed down to about 1/3
  1028.        the size, but here that is not the point.  Each example starts with a
  1029.        demo of the finished product, then goes through the steps
  1030.        descriptively, then goes through the steps again with the code.  My
  1031.        little VBX was done in a day an a half, and I have a much better feel
  1032.        for the ins and outs of this process.
  1033.        -Paul.McGuire@SEMATECH.Org, email, 7/11/95
  1034.  
  1035.    * Heavy Metal Visual C++ Programming
  1036.      Steve Holzner
  1037.      Brady Publishing
  1038.      ISBN 1-56884-196-5
  1039.  
  1040.      # Hate to disagree, but I find this book disappointing. The reason is, I
  1041.        felt like being treated as a semi-idiot when reading the book. Don't get
  1042.        fooled by its number of pages -- it could have been easily reduced to
  1043.        half of its size, if the author knew how to list the code efficiently.
  1044.        Furthermore, there are too many misprints in the version I have.
  1045.        -Huayong (yang@math.umass.edu), programmer.tools, 6/18/95
  1046.  
  1047.      # The rule of thumb is never buy Holzner's book. His book only
  1048.        leads you the the door. You can't find practically useful
  1049.        examples. Almost every updated vesion is the same.
  1050.        -Runhong (chen@nice3.ne.rpi.edu), programmer.tools, 6/18/95
  1051.  
  1052.  
  1053.     * Programming the Windows 95 User Interface
  1054.       Microsoft Press
  1055.       ISBN 1-55615-884-X    
  1056.       Nancy Cluts (Due out August '95)
  1057.    
  1058.       NOTE: Microsoft Developer Network Developer Library contains the
  1059.             complete preliminary draft of this wonderful work, along with
  1060.             all the source code to the examples, with *BOTH* Win32 and MFC
  1061.             source!  Chapters cover all of the controls and features 
  1062.             necessary for Windows 95 development!  I've got mine on order,
  1063.             and I also printed it all out!  Anybody interested in looking
  1064.             at the first draft, it's on the July '95 MSDN Developer Library
  1065.             In:   
  1066.             \Books and Periodicals\Programming the Windows 95 User Interface
  1067.             -cntrline@winnet.com, email, 7/15/95
  1068.  
  1069.      * Visual C++ Power Toolkit
  1070.        Ventana Press ($50), 1995, 785 pages
  1071.        Info:  http://www.vmedia.com/vc++.html
  1072.        (919) 942-0220
  1073.        Richard Leinecker, Jamie Nye
  1074.        Includes a CD-ROM
  1075.        ISBN 1-56604-191-0
  1076.  
  1077.       # YACTB = Yet Another Cookbook Type Book.  Although this book tries to be
  1078.         a sourcebook for programmers by giving many new classes and clever
  1079.         code, it just isn't laid out as logically as other books I've seen
  1080.         recently (see: "Visual C++ How-To" listing).
  1081.  
  1082.         This book covers a lot of topics, such as: Customizing the 
  1083.         Interface, Animation, Screen Effects, Music & Sound, 
  1084.         Advanced Animation, Data Compression, OLE 2.0, Communications and
  1085.         Scanner Input (Using TWAIN).
  1086.  
  1087.         I haven't found this book to be as useful as other books for my
  1088.         purposes yet, but it does include a lot of new Classes which may
  1089.         prove useful for other programmers.
  1090.         -cntrline@winnet.com, email, 7/15/95
  1091.  
  1092.       # I just grabbed this one and at first glance it looked really
  1093.         useful, then I started reading it and BLECH!  The author's writing is,
  1094.         well, it's not so great.  Also, the classes are sloppy and show no OO
  1095.         design at all.  The author's comment is "I'm not hungarian, so
  1096.         why should I name variables like one".  Can't say I recommend
  1097.         this one.
  1098.         -scot_wingo@msn.com
  1099.  
  1100.    * The following are rumored to be coming out RSN (Real soon now)
  1101.      * MFC 3.0 Bible - The Waite Group ($45)
  1102.      * MFC Internals - AW George Shephard and Scot Wingo
  1103.      * Extending MFC - AW David Shmitt?
  1104.      * Visual Programming - Richard Hale Shaw
  1105.      * Programming Windows 95 with MFC, Microsoft Press, Jeff Prosise
  1106.      * Waite Group MFC book (title unkown!) Don Kiely, donkriely@crn.com
  1107.  
  1108. ...........................................................................
  1109.  
  1110. 2.4.3. Cool MFC Articles
  1111. ------------------------
  1112.    There's probably a million 'good' MFC articles out there, but this
  1113.    section is for the ulta-hip, totally-swinging, must-have,
  1114.    gotta-read MFC articles.  If you submit an article for this
  1115.    section, please include all the 'volume' information and a short
  1116.    paragraph about why it's so damn cool!  [Note if you have questions
  1117.    about the magazines or MSDN mentioned below, see sections: 2.4.1
  1118.    and 2.1.2]
  1119.  
  1120.    * "Fun with MFC: 33 Tips to Help You Get the Most Out of ..."
  1121.      -Paul DiLascia, MSJ, November 1993, Volume 8, Number 11
  1122.  
  1123.      # This is my A#1 MFC article of all time.  Even though this
  1124.        article is 2 years old, it has principals and ideas that are
  1125.        extremely valuable to today's MFC programmer.  Good news is
  1126.        that it's on MSDN in their MSJ archives!  You can also find
  1127.        this gem under books online: Extensions: articles/Technical
  1128.        Articles/Fun with MFC: 33 Tips.
  1129.        -scot_wingo@msn.com
  1130.  
  1131.    * Scott Randall has a great little article that you can find right
  1132.      on your Visual C++ 2.x in Books Online.  It's under Extensions:
  1133.      articles/Technical Articles/Tools for using MFC 2.0.  Describes
  1134.      the philosophy behind the VC++ Wizards. 
  1135.  
  1136.    * "Meandering Through the Maze of MFC Message and Command Routing"
  1137.      -Paul DiLascia, MSJ, July 1995, Volume 10, Number 7
  1138.  
  1139.      # Best explanation of messages ever, a MFC FAQ "must-read".
  1140.  
  1141.    * "Rewriting the MFC Scribble Program Using an OOD Approach"
  1142.       -Allen Holub, MSJ, August 1995, Volume 10, Number 8
  1143.  
  1144.       # Not my favorite article, but 'DID' stir up lots of talk on
  1145.         most MFC forums.  Any article that generates this much noise
  1146.         has to be good.
  1147.  
  1148.    * "Self Decorating Pages"
  1149.      -David A. Schmitt, Windows Tech Journal, July 1995
  1150.  
  1151.    * "Dad, Can I Drive the Printer Tonight?"
  1152.      -David A. Schmitt, Windows Tech Journal, August 1995
  1153.      # This series of articles is pretty good, especially if you are
  1154.        into printing.
  1155.  
  1156.    * "Plunge into MFC's User Interface"     
  1157.      -Scot Wingo, Windows Tech Journal, August 1994
  1158.      # WOW!  This guy is the best!
  1159.  
  1160.  * Coming in September:
  1161.      C++ Report, SIGS Publications,
  1162.      "A Brief History of MFC" - recaps section 3 of this FAQ and
  1163.      throws in some new information.
  1164.  
  1165.    TODO: Get more good article pointers.
  1166.  
  1167. ---------------------------------------------------------------------------
  1168.  
  1169. 2.5.  Trade shows
  1170. ================
  1171.  
  1172.    * MFC Professional Developers Conference
  1173.      Microsoft
  1174.      (800) 206-3000
  1175.      (612) 550-6340
  1176.      First one was in early June 1995.
  1177.   
  1178.    * Software Development (East and West)
  1179.      Miller Freeman
  1180.      (415) 905-2222
  1181.      http://www.mfi.com
  1182.      tloftus@mfi.com
  1183.  
  1184.      This is where Microsoft unveils the latest MSVC technology, they
  1185.      have a big booth and last year had a problem solving area.  Many
  1186.      Microsofties also give talks on MFC, some free, some part of the
  1187.      program.
  1188.  
  1189.      There are two Software Development shows a year.  The West show is
  1190.      held in San Francisco in Spring and the East show is held in
  1191.      Washington, D.C. in the Fall. The West show is bigger.
  1192.  
  1193.    * VBITS MFC Companion Conference
  1194.      (800) 848-5523
  1195.      Fawcette Publications puts on a Visual Basic show called VBITS, they
  1196.      are starting to put on MFC tracks too.
  1197.  
  1198.      TODO - Comments anyone?  I heard it was slow this year in NYC.
  1199.  
  1200.    * WinDev
  1201.      (508) 649-4200
  1202.      A Boston show, last held in June 12-16, 1995.  It's put on by Boston
  1203.      University and has a MFC/C++ track in addition to other MFC related
  1204.      talks.
  1205.      TODO - Anyone have comments on this?
  1206.  
  1207. ---------------------------------------------------------------------------
  1208.  
  1209. 2.6.  Users Groups
  1210. ===================
  1211.    I don't know of any MFC specific user's groups, but there are some
  1212.    really good C++ user's groups that have some MFC content in their
  1213.    programs.  The NW C++ User's group has a really nice email newsletter
  1214.    that anybody can subscribe to by emailing cpp@netcom.com.  Here's the
  1215.    contact information for the known C++ User's groups->
  1216.  
  1217.    |--------------------------------------------------------------|
  1218.    | Area              Contact Name       Contact Email           |
  1219.    |--------------------------------------------------------------|
  1220.    | New York, NY     | Saul Rosenberg  | Rosenberg@decus.org     |
  1221.    | Redmond, WA      | Steve Shimeall  | steves@amc.com          |
  1222.    | San Jose, CA     | Gene Paymar     | epaymar@hooked.net      |
  1223.    | Santa Clara, CA  | Marian Corcoran | mcorcora@ix.netcom.com  |
  1224.    | Tucson, AZ       | Martin Lapidus  | lascaux@primenet.com    |
  1225.    | North West       | Robin Rowe      | cpp@netcom.com          |
  1226.    |--------------------------------------------------------------|
  1227.  
  1228. ---------------------------------------------------------------------------
  1229.  
  1230. 2.7.  Technical Support
  1231. =======================
  1232.  
  1233.    * Microsoft MSVC Technical Support
  1234.     (206) 635-7007
  1235.  
  1236. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1237.  
  1238. 3.  A Brief History of MFC
  1239. ==========================
  1240.    I constantly see postings from folks confused about what version to
  1241.    use where, etc..  So this history kind of explains where MFC has been
  1242.    and where it's going.
  1243.    [This is the history as I remember it.  If you have any details that
  1244.    you can fill in, release dates, inside info, etc.. Let me know!]
  1245.  
  1246.    To understand the MFC releases, you need to realize that there are 16
  1247.    and 32-bit releases of MFC.  16-bit releases call Win16 and run on
  1248.    Windows 3.1 and 3.11 (Windows for Workgroups)
  1249.  
  1250.    The 32-bit releases call Win32 and run on Windows NT and Windows 95
  1251.    (and can run on Windows 3.1 with Win32s, but it still calls Win32)
  1252.  
  1253.    Skip to section 3.10 for a quick table of releases if you want to skip
  1254.    the long descriptions of each release.
  1255.  
  1256.    In each section, the new classes added to MFC are highlighted.  It's
  1257.    nearly impossible to do cool class diagrams in ASCII, so their
  1258.    hierarchy is just shown by indentation.  I've also left CObject out of
  1259.    most of the hierarchies for brevity.  You can pretty much assume that
  1260.    CObject is a parent of most of the classes except things like CString,
  1261.    etc. 
  1262.  
  1263. ---------------------------------------------------------------------------
  1264.  
  1265. 3.1.  How do I know what version of MFC I'm using?
  1266. ==================================================
  1267.    Check the top of the MFC header file afxver_.h (lives in
  1268.    mfc\include\afxver_.h). Older versions use afxver.h.  In there you
  1269.    will see a #define for _MFC_VER. 
  1270.  
  1271.    This is the hex version of the MFC release with this key:
  1272.  
  1273.    0x0250
  1274.       |||_____________ Point release ( very minor)
  1275.       ||______________ Minor number
  1276.       |_______________ Major number
  1277.  
  1278.  
  1279.   So in this example, the MFC release is 2.5.0.
  1280.  
  1281. ---------------------------------------------------------------------------
  1282.  
  1283. 3.2.  Pre-MFC 1.0
  1284. =================
  1285.    In the beginning, Microsoft created a group called the AFX group
  1286.    (stands for (A)pplication (F)ramework(X)).  This group probably was
  1287.    created to come out with an OWL competitor, since Borland C++ was
  1288.    doing pretty well.  They came up with a class library that presented a
  1289.    very high abstraction from the Windows API, kind of like OWL does.
  1290.    [Note: The group was actually formed before OWL 1.0 according to
  1291.    elsbree@nwrain.com ]
  1292.  
  1293.    Legend has it that they then went and tried writing applications with
  1294.    it for a couple of months and found that it was just too far removed
  1295.    from the Windows API.  They couldn't leverage any knowledge of
  1296.    Windows and most of these guys were die hard Windows API hackers.
  1297.  
  1298.    Legend also has it that at this point they scrapped the ENTIRE AFX
  1299.    class library, and then worked on what would become MFC 1.0...  You
  1300.    can still see remnants of the AFX days, many of the source files have
  1301.    afx prefixes and lots of macros in MFC today still have AFX in them.
  1302.  
  1303.    The AFX group was actually responsible for two things: the MFC library
  1304.    and the IDE's support for MFC (namely, the resource editor and the
  1305.    wizards). The AFX name was dropped in April 1994, and the group's
  1306.    members simply became part of smaller teams within the Visual C++
  1307.    group. One of those smaller teams is today's MFC team.
  1308.  
  1309.    I've also heard rumors that MFC was once called the MS Fulcrum Classes.
  1310.  
  1311. ---------------------------------------------------------------------------
  1312.  
  1313. 3.3.  MFC 1.0
  1314. =============
  1315.    This release was simultaneously released with Microsoft C/C++ 7.0 in
  1316.    early 1992.  It provided a very thin abstraction over the Windows API.
  1317.    This initial release did not have any of the document view
  1318.    architecture we know and love today, however it did lay the foundation
  1319.    by introducing CObject, MFC persistence via CArchive and many other
  1320.    features still heavily used in MFC today.  This was a 16-bit release
  1321.    released in 03/92.
  1322.  
  1323.    A 32-bit version of MFC 1.0 was released in July 1993, together with
  1324.    Windows NT 3.1 and the final Win32 SDK.  The files there are dated
  1325.    93-07-24.  The Win32 SDK did not include Visual C++ or the MFC 2.x.
  1326.  
  1327.   MFC 1.0 introduced these classes:
  1328.  
  1329. General:
  1330.   CObject
  1331.      CWinApp
  1332.      CMenu
  1333.   CArchive
  1334.   CDumpContext
  1335.   CRuntimeClass
  1336.   CMemoryState
  1337.   CFileStatus
  1338.   CString
  1339.   CTime
  1340.   CTimeSpan
  1341.   CPoint
  1342.   CRect
  1343.   CSize
  1344.  
  1345. Exceptions:
  1346.   CException
  1347.      CMemoryException
  1348.      CNotSupportedException
  1349.      CArchiveException
  1350.      CFileException
  1351.      CResourceException
  1352.  
  1353. File Services:
  1354.   CFile
  1355.      CStdioFile
  1356.      CMemFile
  1357.  
  1358. Collections:
  1359.   CByteArray
  1360.   CWordArray
  1361.   CDWordArray
  1362.   CPtrArray
  1363.   CObArray
  1364.   CStringArray
  1365.   CPtrList
  1366.   CObList
  1367.   CStringList
  1368.   CMapWordToPtr
  1369.   CMapWordToOb
  1370.   CMapPtrToWord
  1371.   CMapPtrToPtr
  1372.   CMapStringToPtr
  1373.   CMapStringToOb
  1374.   CMapStringToString
  1375.  
  1376. Graphics:
  1377.   CDC
  1378.      CClientDC
  1379.      CWindowDC
  1380.      CPaintDC
  1381.      CMetaFileDC
  1382.   CGdiObject
  1383.      CPen
  1384.      CBrush
  1385.      CFont
  1386.      CBitmap
  1387.      CPalette
  1388.      CRgn
  1389.  
  1390. Windows Support:
  1391.    CWnd
  1392.     CFrameWnd
  1393.        CMDIChildWnd
  1394.     CMDIFrameWnd
  1395.     CDialog
  1396.        CModalDialog
  1397.     CStatic
  1398.     CButton
  1399.     CEdit
  1400.     CListBox
  1401.     CComboBox
  1402.     CScrollBar
  1403.  
  1404. ---------------------------------------------------------------------------
  1405.  
  1406. 3.4.  MFC 2.0
  1407. =============
  1408.    MFC 2.0 was a 16-bit release that shipped with Visual C++ 1.0.  It
  1409.    added the Document/View framework on top of MFC 1.0 and also added OLE
  1410.    1.0 classes, message maps and common dialog classes.  This was a
  1411.    16-bit release released on 02/93
  1412.  
  1413.    MFC 2.0 introduced these classes:
  1414.  
  1415. General:
  1416.   CCreateContext
  1417.   CPrintInfo
  1418.   CDataExchange
  1419.   CCmdUI
  1420.  
  1421. Exceptions:
  1422.   CFileException
  1423.   COleException
  1424.  
  1425. Dialogs:
  1426.   [Note CModalDialog was nuked and functionality moved to CDialog, you
  1427.    can still see a #define CModalDialog CDialog in the header files]
  1428.   CDialog [not introduced here, but revamped to be a base for common dlgs]
  1429.      CFileDialog
  1430.      CColorDialog
  1431.      CFontDialog
  1432.      CPrintDialog
  1433.      CFindReplaceDialog
  1434.  
  1435. Windows Support:
  1436.    [Just new derivatives of CButton/CEdit and VBX class.]
  1437.    CButton
  1438.       CBitmapButton
  1439.    CEdit
  1440.       CHEdit
  1441.          CBEdit
  1442.    CVBControl
  1443.  
  1444. Document Architecture:
  1445.      CCmdTarget
  1446.       CWinApp [Moved in hierarchy, use to be derived from CObject]
  1447.       CDocTemplate
  1448.          CSingleDocTemplate
  1449.          CMultiDocTemplate
  1450.       CDocument
  1451.          COleDocument
  1452.             COleClientDoc
  1453.             COleServerDoc
  1454.  
  1455. Views:
  1456.    CView
  1457.       CScrollView
  1458.          CFormView
  1459.       CEditView
  1460.  
  1461. Control Bars:
  1462.    CControlBar
  1463.       CToolBar
  1464.       CStatusBar
  1465.       CDialogBar
  1466.    CSplitterWnd
  1467.  
  1468. OLE 1.0 Classes:
  1469.    COleServer
  1470.       COleTemplateServer
  1471.    CDocItem
  1472.       COleClientItem
  1473.       COleServerItem
  1474.  
  1475. ---------------------------------------------------------------------------
  1476.  
  1477. 3.5.  MFC 2.1
  1478. =============
  1479.    MFC 2.1 shipped with Visual C++ 1.1 for NT, it was basically a Win32
  1480.    port of MFC 2.0.  It was a 32-bit release that was released on
  1481.    08/93.
  1482.  
  1483.    MFC 2.1 did not introduce any new classes.
  1484.  
  1485. ---------------------------------------------------------------------------
  1486.  
  1487. 3.6.  MFC 2.5
  1488. =============
  1489.    MFC 2.5 shipped with Visual C++ 1.5.  It introduced the OLE 2 and ODBC
  1490.    classes.  It was the last 'official' 16-bit release.
  1491.  
  1492.    Released in 12/93
  1493.  
  1494.    MFC 2.5 introduced these classes:
  1495.  
  1496. General: [OLE and DB related]
  1497.    CFieldExchange
  1498.    COleDataObject
  1499.    COleDispatchDriver
  1500.    CRectTracker
  1501.  
  1502. Exceptions: [OLE and DB exceptions]
  1503.    COleException
  1504.       COleDispatchException
  1505.    CDBException
  1506.  
  1507. Files: [New OLE File support]
  1508.    CFile
  1509.       COleStreamfile
  1510.  
  1511. Dialogs: [New OLE Dialogs]
  1512.    CDialog
  1513.       COleDialog
  1514.          COleInsertdialog
  1515.          COleChangeIconDialog
  1516.          COlePasteSpecialDialog
  1517.          COleConvertDialog
  1518.          COleBusyDialog
  1519.          COleLinksDialog
  1520.             COleUpdateDialog
  1521.  
  1522. Windows Support: [Some OLE additions]   
  1523.    CFrameWnd
  1524.       COleIPFrameWnd
  1525.    CControlBar
  1526.       COleResizeBar
  1527.  
  1528. Document Architecture:  [Significant classes added for OLE here.]
  1529.    CCmdTarget
  1530.       COleObjectFactory
  1531.          COleTemplateServer
  1532.       COleDataSource
  1533.       COleDropSource
  1534.       COleDropTarget
  1535.       COleMessageFilter
  1536.       CDocument
  1537.          COleDocument
  1538.             COleLinkingDoc
  1539.                COleServerDoc
  1540.       CDocItem
  1541.          COleClientItem
  1542.          COleServerItem
  1543.  
  1544. Views: [New view for DB support]
  1545.    CView
  1546.       CScrollView
  1547.          CFormView
  1548.             CRecordView
  1549.  
  1550. ODBC/Database Classes:
  1551.    CDatabase
  1552.    CRecordSet
  1553.    CLongBinary
  1554.  
  1555. ...........................................................................
  1556.  
  1557. 3.6.1. MFC 2.51
  1558. ----------------
  1559.    A point release to 2.5 (16-bit) that was a bug fix release.  Shipped
  1560.    with MSVC 2.0 in 9/94 with MFC 3.0 (32-bit).
  1561.  
  1562. ...........................................................................
  1563.  
  1564. 3.6.2. MFC 2.52
  1565. ----------------
  1566.    A point release to 2.5 (16-bit) that added some of the MFC 3.0
  1567.    features such as property sheets, Winsock and MAPI support.
  1568.    Shipped with MSVC 2.1 in 1/95 with MFC 3.1 (32-bit).
  1569.  
  1570.    NOTE: This is only available via the MSVC Subscription.
  1571.  
  1572. Classes added in 2.52:
  1573.    CSocket
  1574.    CAsyncSocket
  1575.    CSocketFile
  1576.    CPropertyPage
  1577.    CPropertySheet
  1578.  
  1579. MAPI:
  1580. [Note that MAPI support was added to CDocument, no new classes]
  1581.    CDocument::OnFileSendMail
  1582.    CDocument::OnUpdateFileSendMail
  1583.    COleDocument::OnFileSendMail
  1584.  
  1585. ...........................................................................
  1586.  
  1587. 3.6.3.  MFC 2.52b
  1588. ----------------
  1589.    [Excerpt from the 2.52b rel notes]
  1590.    Visual C++ 1.52b includes the industry-standard Microsoft
  1591.    Foundation Class Library (MFC) version 2.52b. Besides classes for OLE
  1592.    and database, this version includes classes for OLE control
  1593.    development. 
  1594.  
  1595.    Bugs Fixed in Visual C++ 1.52b
  1596.  
  1597.    Visual C++ 1.52b fixes a number of bugs from Visual C++ 1.5. Of
  1598.    particular interest to most developers are the following bug fixes: 
  1599.  
  1600.    MFC 2.52b
  1601.  
  1602.    Error L2025 occurred on CWnd::DoDataExchange.
  1603.    This bug has been corrected. See Microsoft Knowledge Base article
  1604.    Q120152 for more information. 
  1605.  
  1606.    CArchive::ReadObject sometimes caused an assertion in a CPtrArray
  1607.    object because CPtrArray can hold a maximum object size of 16K in a
  1608.    large memory model application. CArchive did not take the memory model
  1609.    into account; since CArchive enforced a 32K limit, objects of 32K
  1610.    could be written but an assertion was generated if CArchive read in
  1611.    more than 16K. 
  1612.    This bug has been corrected.
  1613.  
  1614.    There was a memory leak in 16-bit AUX_DATA.
  1615.  
  1616.    The three pens used in the class CPropertySheet were leaking. See
  1617.    Microsoft Knowledge Base article Q128604 for more information. 
  1618.  
  1619.    The CArchive buffer pointer could wrap around the end of a segment unintentionally.
  1620.    This bug has been corrected.
  1621.  
  1622.    If AfxSockInit failed, applications sometimes produced a General
  1623.    Protection Fault. 
  1624.    This bug has been corrected. See Microsoft Knowledge Base article
  1625.    Q130653 for more information. 
  1626.  
  1627.    The MAPISendMail dialog did not stay modal.
  1628.    This bug has been corrected.
  1629.  
  1630.    Source file DLGPROP.CPP had non-near data. This could prevent
  1631.    applications from being able to run multi-instance. 
  1632.    This bug has been corrected.
  1633.  
  1634. ---------------------------------------------------------------------------
  1635.  
  1636. 3.7.  MFC 3.0
  1637. =============
  1638.    MFC 3.0 shipped with Visual C++ 2.0 in 9/94.  It introduced docking
  1639.    toolbars, property sheets and template based collection classes.  This
  1640.    was the first release in the MSVC subscription, it was a 32-bit release.
  1641.  
  1642.    Classes added in MFC 3.0:
  1643.  
  1644. Tabbed Dialog Support:
  1645. CWnd
  1646.   CPropertySheet
  1647.   CDialog
  1648.      CPropertyPage
  1649.  
  1650. ---------------------------------------------------------------------------
  1651.  
  1652. 3.8.  MFC 3.1
  1653. =============
  1654.    MFC 3.1 shipped with Visual C++ 2.1 in 1/95.  It introduced MAPI,
  1655.    WinSock and Windows Common Controls.  The MFC toolbar, status bar,
  1656.    etc.. still live in MFC. This is the latest release out.  It is a
  1657.    32-bit release. 
  1658.  
  1659.    NOTE: Only available via MSVC subscription.
  1660.  
  1661.    Classes added in MFC 3.1: 
  1662.  
  1663. MAPI:
  1664. [Note that MAPI support was added to CDocument, no new classes]
  1665.    CDocument::OnFileSendMail
  1666.    CDocument::OnUpdateFileSendMail
  1667.    COleDocument::OnFileSendMail
  1668.  
  1669. Windows Common Controls Classes: [All of these are CWnd derived]
  1670.    CAnimateCtrl
  1671.    CHeaderCtrl
  1672.    CHotkeyCtrl
  1673.    CImageList
  1674.    CListCtrl
  1675.    CProgressCtrl
  1676.    CSliderCtrl
  1677.    CSpinButtonCtrl
  1678.    CStatusBarCtrl
  1679.    CTabCtrl
  1680.    CToolBarCtrl
  1681.    CToolTipCtrl
  1682.    CTreeCtrl
  1683.  
  1684. WinSock Support:
  1685.    CAsyncSocket
  1686.       CSocket
  1687.  
  1688. ---------------------------------------------------------------------------
  1689. 3.9.  MFC 3.2
  1690. =============
  1691.    MFC 3.2 shipped with Visual C++ 2.2 via the subscription in
  1692.    mid/late July. It is a 32-bit release.  Includes a  2.52b 16-bit
  1693.    release update. 
  1694.  
  1695.    [here's an excerpt from the release notes]
  1696.  
  1697.    Support for Windows Common Controls in USRDLLs. In order to use the
  1698.    MFC Windows Common Control classes you must link in the appropriate
  1699.    static libraries, as shown in the following table: 
  1700.  
  1701.    Library      Target
  1702.    DAFXCC.LIB   Release version
  1703.    DAFXCCD.LIB  Debug version
  1704.    DAFXCCU.LIB  Release Unicode version
  1705.    DAFXCCUD.LIB Debug Unicode version
  1706.  
  1707.    Updated MFC Common Control classes that work with those controls
  1708.    that have been recently released in Windows NT 3.51 and those that
  1709.    will be available in Windows 95 and a future version of Win32s.
  1710.  
  1711.    Improved common control documentation that is more complete and
  1712.    reflects changes since the first implementation.  
  1713.  
  1714.    New MFC sample applications
  1715.    ---------------------------
  1716.     NOTEPAD +   Notepad+ is an enhanced version of Notepad.  The
  1717.                 enhancements are mainly from questions our customers
  1718.                 have been asking. 
  1719.   
  1720.     SAVER       Saver is a screen saver written using MFC.  It
  1721.                 "morphs" the text "MFC" to the text "C++".
  1722.  
  1723.     OLEVIEW     The OLEVIEW sample is very similar to the OLE2VIEW.EXE
  1724.                 applet provided in \MSVC20\BIN. The sample illustrates
  1725.                 how to implement OLE Object viewers through custom OLE
  1726.                 interfaces. These custom interfaces are implemented in
  1727.                 IVIEWERS.DLL
  1728.  
  1729.     BATCH       BATCH is an MDI application that lets you compress
  1730.                 different AVI (Audio Video Interleaved) files in
  1731.                 different ways. 
  1732.  
  1733.     WORDPAD     WORDPAD illustrates use of the CRichEditCtrl and
  1734.                 CRichEditView classes, which encapsulate the new Rich
  1735.                 Edit common control.
  1736.  
  1737.  
  1738.    These samples are located in the SAMPLES\MFC directory of your
  1739.    Visual C++ installation. 
  1740.  
  1741.    Updated Win32 SDK components
  1742.    ----------------------------
  1743.    With the release of Windows NT 3.51 and the upcoming release of
  1744.    Windows 95, the Win32 SDK has been updated to support both of these
  1745.    operating systems. Changes include new header files, new import
  1746.    libraries, and additional documentation. Visual C++ 2.2 includes the
  1747.    latest header files, import libraries and Win32 API documentation to
  1748.    support writing Windows NT- and Windows 95-compatible applications. 
  1749.  
  1750. ---------------------------------------------------------------------------
  1751.  
  1752. 3.10.  MFC 4.0
  1753. ==============
  1754.    Rumor has it that MFC 4.0 will be part of MSVC 4.0 (they are finally
  1755.    going to get the numbers in synch) to ship shortly after Windows 95
  1756.    ships (9/95).  The MFC status bar, toolbars, property dialog and
  1757.    other UI classes will be rewritten to use the Windows 95 common
  1758.    controls. There will be other Windows 95 enhancements as well and much
  1759.    better OLE control support too!  Just heard that there will be some
  1760.    new database classes based on the Jet Engine <Access DB engine> and
  1761.    something called message reflection, so you can stop messages from
  1762.    bouncing up to parents if you want to grab them all.
  1763.  
  1764.    Classes added in MFC 4.0: <Heard about these through the grapevine>
  1765.       CSynchronize
  1766.       CMutex
  1767.       CEvent
  1768.       CMultiLock
  1769.       CShellNew - Windows 95 
  1770.    
  1771.    **NOTE: This has not been released yet, MFC 3.2/MSVC 2.2 is the latest
  1772.      release with MFC 4.0/VC++ 4.0 due out in September.
  1773.  
  1774. ---------------------------------------------------------------------------
  1775.  
  1776. 3.11.  Table of MFC releases
  1777. ============================
  1778.    ** Hint, MFC releases are always MSVC release - 1. This is because MFC
  1779.       1.0 came out with MS C 7.
  1780.  
  1781.    MFC Rel     MSVC Release  16 or 32 bit Notes
  1782.    ---------------------------------------------------------------------------
  1783.    1.0         <C/C++ 7.0>    16          Just thin Windows coverage
  1784.    2.0         1.0            16          Document/Views added
  1785.    2.1         1.1 for NT     32          First 32-bit release for NT
  1786.    2.5         1.5            16          OLE/ODBC, last 16-bit release
  1787.    2.51        2.0            16          Bug fixes.
  1788.    2.52        2.1            16          Adds prop sheets to 2.5
  1789.    2.52b       2.2            16          Shipped in July '95, bug fixes
  1790.    3.0         2.0            32          Property sheets, dock toolbars
  1791.    3.1         2.1            32          Winsock/MAPI, Win commcntrls
  1792.    3.2         2.2            32          Shipped in July '95, more commcntrls
  1793.    4.0         4.0            32          Not out yet, Win 95, OLE Control container
  1794.  
  1795. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1796.  
  1797. 4. Generic Class Questions
  1798. =========================
  1799.  
  1800. 4.1. CException - Exceptions and exception handling.
  1801. ----------------------------------------------------
  1802.  
  1803. 4.1.1.  How do I throw a CUserException derived exception?
  1804. ----------------------------------------------------------   
  1805.    When I try to catch a derived exception I get the following error: 
  1806.    error C2039: 'classCMyException' : is not a member of
  1807.    'CMyException' 'classCMyException' : undeclared identifier
  1808.    'IsKindOf' : cannot convert parameter 1 from 'int*' to 'const
  1809.     struct CRuntimeClass*' 
  1810.  
  1811.    You need to make your CMyException class dynamically creatable 
  1812.    using the DECLARE_DYNAMIC() and IMPLEMENT_DYNAMIC() macros.  The
  1813.    CATCH macro expects to be able to access run-time information about
  1814.    the thrown class.
  1815.    -blaszczak@bix.com, Mike B, 6/5/95, comp.os.ms-windows.programmer.misc
  1816.  
  1817. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1818.  
  1819. 5. GDI Class Questions
  1820. ======================
  1821.  
  1822. 5.1. CDC
  1823. ========
  1824.  
  1825. 5.1.1. How do I create a CDC from a HDC?
  1826. ----------------------------------------
  1827.    Sometimes the Windows API will just give you a handle to a DC and
  1828.    you might want to create a CDC from that.  On example is
  1829.    owner-drawn lists, combos and buttons.  You will receive a draw
  1830.    item message with a hDC.  Here's some code to turn that hdc into
  1831.    the more familiar CDC.
  1832.  
  1833.    void MyODList::DrawItem(LPDRAWITEMSTRUCT lpDrawItem)
  1834.    {
  1835.  
  1836.        CDC myDC;
  1837.        myDC.Attach(lpDrawItem->hDC);
  1838.  
  1839.        //Do more stuff here
  1840.  
  1841.        //If you don't detach, it will get deleted and windows will
  1842.        //not be happy if you delete it's dc..
  1843.  
  1844.        myDC.Detach();
  1845.    }
  1846.    You can use this technique for any of the other MFC class/ Windows
  1847.    handle pairs too.
  1848.  
  1849.    Another approach is to call the CDC FromHandle method:
  1850.  
  1851.    CDC * pDC = CDC:FromHandle(lpDrawItem->hDC);
  1852.  
  1853.    It's not clear which is 'better', FromHandle is less error prone
  1854.    because you do not have to remember to 'detach'.
  1855.    -jmccabe@portage1.portup.com (Jim McCabe) 6/5/95
  1856.  
  1857. ---------------------------------------------------------------------------
  1858.  
  1859. 5.2. CBitmap
  1860. ============
  1861.  
  1862. 5.2.1. How do I read a 256 color bitmap file from disk?
  1863. ------------------------------------------------------
  1864.  
  1865.    Currently, MFC does not contain direct support for reading and
  1866.    displaying DIBs or BMPs. However, there are a number of sample
  1867.    applications that illustrate just how to do this. 
  1868.  
  1869.    The first sample is the MFC sample application DIBLOOK. The
  1870.    MULTDOCS sample uses the same source code provided by DIBLOOK to read
  1871.    and display DIBs and BMPs. 
  1872.  
  1873.    Two other examples provided with Visual C++ are the SDK samples
  1874.    DIBVIEW and SHOWDIB. 
  1875.   - Question posted on comp.lang.c++, 6/5/95, found this in MS FAQ, 6/25/95
  1876.  
  1877. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1878.  
  1879.  
  1880. 6. Window, Control, and Dialogs Class Questions
  1881. ===============================================
  1882.  
  1883. 6.1. Windows
  1884. ============
  1885.  
  1886. 6.1.1.  How can I use a custom icon for a window?
  1887. -------------------------------------------------
  1888.    The Microsoft Foundation Class Library stores icons for the main
  1889.    frame window and the MDI frame window as resources. The icon with
  1890.    resource ID AFX_IDI_STD_MDIFRAME is the icon for the MDI frame
  1891.    window, and the icon with resource ID AFX_IDI_STD_FRAME is the icon
  1892.    for the main frame window. To replace these icons in your
  1893.    application, add an icon to your resources file with the
  1894.    appropriate ID.
  1895.    
  1896.    The application specifies the icon for a view in an MDI child
  1897.    window when it creates the template. The application uses the icon
  1898.    with the specified resource ID when the user minimizes the MDI
  1899.    child window that contains the corresponding view.
  1900.    
  1901.    This technique allows you to specify one icon for the application
  1902.    to associate with these windows. Windows also supports dynamically
  1903.    painting a minimized window. To do this with MFC, use
  1904.    AfxRegisterWndClass() to register a window class with a NULL icon
  1905.    handle. Override the PreCreateWindow() function in the window class
  1906.    for the dynamically painted icon and copy the name returned by
  1907.    AfxRegisterWndClass() into the lpszClassName member of the
  1908.    CREATESTRUCT. This creates the window using the class that has a
  1909.    NULL icon. When the user minimizes this window, the icon receives
  1910.    WM_PAINT messages that it can process to display information
  1911.    appropriately. To do so, override the OnPaint() message handler and
  1912.    call the IsIconic() function to see if the window is minimized. If
  1913.    so, create a CPaintDC object and use it to draw on the icon. If the
  1914.    window is not minimized, call the base class version of OnPaint()
  1915.    to update the window normally.
  1916.    -MSVC Knowledge Base 6/4/94
  1917.  
  1918. ...........................................................................
  1919.  
  1920. 6.1.2. How do I change the styles for a window that's created by MFC?
  1921. ---------------------------------------------------------------------
  1922.    To change the default window attributes used by a framework
  1923.    application created in AppWizard, override the window's
  1924.    PreCreateWindow() virtual member function. PreCreateWindow()
  1925.    allows an application to access the creation process normally
  1926.    processed internally by the CDocTemplate class. The framework
  1927.    calls PreCreateWindow() just prior to creating the window. By
  1928.    modifying the CREATESTRUCT structure parameter to
  1929.    PreCreateWindow(), your application can change the attributes
  1930.    used to create the window.
  1931.  
  1932.    The CTRLBARS sample application, provided with the Microsoft
  1933.    Foundation Class Library version 2.0, demonstrates this
  1934.    technique to change window attributes. Note that depending on
  1935.    what your application changes in PreCreateWindow(), it may be
  1936.    necessary to call the base class implementation.
  1937.  
  1938.    For more information, see MSVC knowledge base article Q99847.
  1939.    -MSVC Knowledge Base 6/7/95
  1940.  
  1941. ............................................................................
  1942.  
  1943. 6.1.3.  How do I get the minimal size of a window using MFC?
  1944. ------------------------------------------------------------
  1945.    Write a handler for WM_GETMINMAXINFO.
  1946.    -blaszczak@BIX.com, Mike Blaszczak, 6/12/95 via programmer.misc
  1947.  
  1948. ............................................................................
  1949.  
  1950. 6.1.4.  How do I change a Window's title?
  1951. -----------------------------------------
  1952.   AfxGetApp()->m_pMainWnd->SetWindowText("My Window Title");
  1953.                       -or-
  1954.   AfxGetMainWnd()->SetWindowText ( "My Own Title" ) ;
  1955.    -aj536@freenet.toronto.on.ca, mfc-l, 7/9/95
  1956.  
  1957. ............................................................................
  1958.  
  1959. 6.1.5.  How do I get rid of 'Untitled' in my main window caption?
  1960. -----------------------------------------------------------------
  1961.    Override the PreCreateWindow function in your MainFrame class and
  1962.    do the following in it..
  1963.         cs.style &= ~FWS_ADDTOTITLE ;
  1964.  
  1965.    You can also set the initial window position (cs.x, cs.y, cs.cx,
  1966.    cs.cy) this way and change your class (cs.lpszClass) this way! 
  1967.  
  1968.    Remember to call CFrameWnd::PreCreateWindow at the end...
  1969.    -netninja@svpal.org, programmer.misc, 7/29/95
  1970.  
  1971. ----------------------------------------------------------------------------
  1972.    
  1973. 6.2. Controls
  1974. =============
  1975.  
  1976. 6.2.1.  How do I get a CControl from a Dialog Template?
  1977. -------------------------------------------------------
  1978.    You can get a pointer to a control from a already created dialog
  1979.    control by doing a simple typecast of the results from GetDlgItem.
  1980.    Here's an example that creates a CButton from a checkbox with ID
  1981.    IDC_CHECK1.
  1982.    
  1983.     void my_function(CDialog * pDialog)
  1984.     {
  1985.        
  1986.        CButton * pButton = (CButton *)pDialog->GetDlgItem(IDC_CHECK1);
  1987.     
  1988.        ASSERT(pButton != NULL);
  1989.        pButton->SetCheck(m_bShowState);
  1990.     }
  1991.  
  1992.     Note that it's always safer to check for the validity of the
  1993.     results from GetDlgItem.
  1994.    -scot_wingo@msn.com, 6/1/95
  1995.     
  1996. ............................................................................
  1997.  
  1998. 6.2.2.  How do I subclass a control using MFC?
  1999. ----------------------------------------------
  2000.    Read the documentation on SubClassDlgItem.  Here's an example of
  2001.    how to call it:
  2002.  
  2003.    BOOL CMyDialog::OnInitDialog()
  2004.    {
  2005.         //Do your subclassing first.        
  2006.         m_MyControl.SubClassDlgItem(ID_MYCONTROL, this);
  2007.  
  2008.         //Let the base class do its thing.
  2009.         CDialog::OnInitDialog();
  2010.  
  2011.         // Perhaps do some more stuff
  2012.         
  2013.         // Be sure to call Ctl3d last, or it will cause
  2014.         // assertions from multiple subclassing.
  2015.         
  2016.         Ctl3dSubclassDlg(m_hWnd, CTL3D_ALL);
  2017.    }
  2018.    -Mike Williams, mikew@marlin.ssnet.com, mfc-l 6/1/95
  2019.  
  2020. ...........................................................................
  2021.  
  2022. 6.2.3.  Why do I get an ASSERT when I subclass a control?
  2023. ---------------------------------------------------------
  2024.    Make sure that you subclass the control BEFORE you call
  2025.    Ctl3dSubclassDlg, if the 3-d control DLL is loaded first, it will
  2026.    already have subclassed your controls and you will get an assert.
  2027.    - Mike Williams, mikew@marlin.ssnet.com, mfc-l 6/1/95
  2028.  
  2029. ...........................................................................
  2030.  
  2031. 6.2.4.  How do I validate the contents of a control when it loses focus?
  2032. ------------------------------------------------------------------------
  2033.    NOTE: This is in the Microsoft Software Library.
  2034.  
  2035.    The FCSVAL sample application was created to show how an
  2036.    application can do control-by-control validation in a dialog box. 
  2037.  
  2038.    The application itself is just a modal dialog box displayed by the
  2039.    CWinApp::InitInstance(). After displaying the dialog box,
  2040.    InitInstance() simply quits the application.  
  2041.  
  2042.    The important part of the sample takes place in the dialog-box
  2043.    class implementation: There are two edit controls. The first takes
  2044.    input of an integer between 1 and 20. The second takes a character
  2045.    string as input with length less than or equal to 5. When you Tab or
  2046.    mouse-click from control to control within the displayed dialog box,
  2047.    the contents of the control that is losing focus are validated. 
  2048.  
  2049.    The CFocusDlg Class
  2050.  
  2051.    The application's functionality centers around the CFocusDlg class
  2052.    and its implementation of four message handlers (discussed below).
  2053.    Normal data exchange (DDX) and validation (DDV) using the routines
  2054.    provided by MFC take place in OnInitialUpdate(), when the dialog box
  2055.    is first displayed, and when the user chooses the OK button to accept
  2056.    the input. This is default behavior provided by ClassWizard when
  2057.    member variables are connected to dialog-box controls and can be
  2058.    examined in the dialog class DoDataExchange() function. 
  2059.  
  2060.    Validating control contents when switching focus from one control
  2061.    to the next is done by handling the EN_KILLFOCUS notification sent by
  2062.    the edit control that is losing focus. The idea here is to check the
  2063.    contents and, if they are not valid, to display the message box,
  2064.    inform the user, and then set the focus back to the control from which
  2065.    it came. Unfortunately, some difficulties arise when trying to set the
  2066.    focus (or display the message boxes) within a killfocus message
  2067.    handler. At this point, Windows is in an indeterminate state as it is
  2068.    moving focus from one control to the other. This is a bad place to do
  2069.    the validation and SetFocus() call. 
  2070.  
  2071.    The solution here is to post a user-defined message to the dialog
  2072.    box (parent) and do the validation and SetFocus() there, thus waiting
  2073.    for a safer time to do the work. (See "CFocusDlg::OnEditLostFocus()"
  2074.    in the file FOCUSDLG.CPP and "WM_EDITLOSTFOCUS user-defined message"
  2075.    in the file FOCUSDLG.H.) 
  2076.  
  2077.    Another thing you will notice about this function is that it uses
  2078.    TRY/CATCH to do the validation. The provided DDX/DDV routines throw
  2079.    CUserExceptions when failing to validate or load a control's data. You
  2080.    should catch these and do the SetFocus() in the CATCH block. 
  2081.  
  2082.    Note: This sample has other cool stuff, but this is the major one
  2083.    I've seen asked about on the net.
  2084.    -MS FAQ, 6/25/95
  2085.  
  2086. ...........................................................................
  2087.  
  2088. 6.2.5.  How do I enable/disable a bank of checkboxes?
  2089. -----------------------------------------------------
  2090.    I don't know about a magic way to do this using a single HWND, but there
  2091.    is a simple and self-documenting technique that I've been using for a
  2092.    long time.  You can make a routine that accepts an array of UINTs (your
  2093.    control IDs) and a visibility flag.
  2094.  
  2095.    This function can be a stand-alone function, or you can put it inside a
  2096.    class.  I have been collecting little utility functions like this and keep
  2097.    them in a CDialogBase class -- when I create a new dialog box in ClassWizard,
  2098.    I fix up the code to derive from CDialogBase instead of CDialog.
  2099.   
  2100.    For example, the function might look like this:
  2101.  
  2102.    void CDialogBase::ShowControls(UINT* pControls, UINT cControls, BOOL fVisible)
  2103.    {
  2104.        for (UINT uIndex = 0; uIndex < cControls; uIndex++)
  2105.        {
  2106.            CWnd* pwnd = GetDlgItem(pControls[uIndex]);
  2107.            if (pwnd)
  2108.            {
  2109.                pwnd->ShowWindow(fVisible ? SW_SHOW : SW_HIDE);
  2110.                pwnd->EnableWindow(fVisible);
  2111.            }
  2112.        }
  2113.    }
  2114.  
  2115.    Then later, often in your OnInitDialog handler, you can call this
  2116.    function with your control group:
  2117.  
  2118.    #define SIZEOF_ARRAY(a) (sizeof(a) / sizeof(a[0]))
  2119.    {
  2120.        static UINT aGroup1[] = { DLG_CHBOX1, DLG_CHBOX2, DLG_STATIC1 };
  2121.        static UINT aGroup2[] = { DLG_LABEL2, DLG_LABEL7 };
  2122.  
  2123.        ShowControls(aGroup1, SIZEOF_ARRAY(aGroup1), TRUE);
  2124.        ShowControls(aGroup2, SIZEOF_ARRAY(aGroup2), FALSE);
  2125.    }
  2126.  
  2127.    You can find many uses for these control arrays later too...
  2128.    (Changing fonts in a series of controls, etc...)  Good luck,
  2129.    -jmccabe@portage1.portup.com, mfc-l, 7/18/95
  2130.  
  2131. ...........................................................................
  2132.  
  2133. 6.2.6.  How do I change the background color of a control?
  2134. ----------------------------------------------------------
  2135.    Your dialog can trap the WM_CTLCOLOR message, look up the MFC help
  2136.    file notes for CWnd::OnCtlColor().  Before a control is about to paint
  2137.    itself, the parent window receives a chance to set its own default
  2138.    text color and background brush. 
  2139.    -jmccabe@portage1.portup.com, mfc-l, 7/18/95
  2140.  
  2141.    Also check out the MS KB article  ID: Q117778
  2142.    TITLE: Changing the Background Color of an MFC Edit Control
  2143.    -Ramesh, MSMFC, 7/19/95
  2144.  
  2145. ---------------------------------------------------------------------------
  2146.  
  2147. 6.3.  Dialogs
  2148. ============
  2149.  
  2150. 6.3.1. How do I center my dialog?
  2151. ---------------------------------
  2152.    Use the CWnd::CenterWindow method accomplish this.  I usually put
  2153.    it in my OnInitDialog overloaded function.  Since CDialog is an
  2154.    ancestor of CWnd, you can call the method directly->
  2155.  
  2156.    BOOL CMyDialog::OnInitDialog()
  2157.    {
  2158.       //Perform any other dialog initialization up here.
  2159.  
  2160.       CenterWindow();
  2161.  
  2162.       return TRUE;
  2163.    }
  2164.    - scot_wingo@msn.com, 6/1/95.
  2165.  
  2166. ...........................................................................
  2167.  
  2168. 6.3.2.  How do I get the 'old style' common dialogs on win95?
  2169. -------------------------------------------------------------
  2170.    MFC detects if it is running on Win95, and if so, replaces the 
  2171.    standard FileOpen Dialog with an explorer version of the FileOpen
  2172.    Dialog.   You can prevent MFC  from using this "explorer" version by
  2173.    adding the following line to your CFileDialog derived  class
  2174.    constructor:   m_ofn.Flags &= ~OFN_EXPLORER;
  2175.    -andyd@andyne.on.ca (Andy DeWolfe), via programmer.win32, 5/10/95
  2176.  
  2177. ...........................................................................
  2178.  
  2179. 6.3.3.  How do I subclass a win95 common dialog?
  2180. ------------------------------------------------
  2181.    You can do it but Microsoft has made it much more difficult in
  2182.    Win95.  You need to create a "child dialog template" (with the
  2183.    WS_CHILD style) and set it to m_ofn.lpTemplateName (making sure
  2184.    m_ofn.hInstance is set to your app instance). This template must
  2185.    *only* contain the controls that you are adding to the dialog (ie. NOT
  2186.    the whole dialog with the standard controls  duplicated as in Win3.x).
  2187.  
  2188.    When the dialog is invoked, your template will appear (by default)
  2189.    below the regular file dialog controls.  If you put a static control
  2190.    with id stc32 (defined in include\dlgs.h), the common dialog code will
  2191.    rearrange things so that the original controls will appear wherever
  2192.    your put the stc32 control (you don't have to size it to match - the
  2193.    common dlg code will do that for you). 
  2194.  
  2195.    You will need to supply m_ofn.lpfnHook and handle your additional
  2196.    controls through the hook proc.  Note that since the system puts your
  2197.    dialog template ON TOP of the normal dialog, MFC message routing won't
  2198.    get to your controls so you can't code them through a message map in
  2199.    your CFileDialog derivative.  If anybody has found a way around this,
  2200.    I'd love to hear it!! 
  2201.  
  2202.    This is very messy and Microsoft knows it.  They promise a fix in
  2203.    MFC 4.0.  
  2204.    -joej@golddisk.com, Joe Janakovic, via programmer.win32, 6/10/95
  2205.  
  2206. ...........................................................................
  2207.  
  2208. 6.3.4.  CDialog::Create fails, what could be wrong?
  2209. ---------------------------------------------------
  2210.    - Invalid HWND passed as a parent
  2211.    - Invalid dialog resource ID passed (be careful about numeric IDs
  2212.      vs. string IDs -- be careful with #define ID_MYDIALOG 0x1234 -- it is
  2213.      a "string" ID to the resource compiler). 
  2214.    - one or more controls on your dialog could not be created, usually
  2215.      because of the use of a custom control that was not registered. 
  2216.    - calling EndDialog during the OnInitDialog message (or some other
  2217.      handler called early in the game)! 
  2218.    - NULL HWND passed as parent when dialog has WS_CHILD style
  2219.  
  2220.    That's about all I can think of right now,
  2221.    -Dean McCrory, MSMFC, 6/16/95
  2222.  
  2223. ...........................................................................
  2224.  
  2225. 6.3.5.  How do I create a toolbar/statusbar in a dialog?
  2226. --------------------------------------------------------
  2227.    There's a sample in the Microsoft Software Library, DLGCBR, that
  2228.    demonstrates how to do this.
  2229.  
  2230.    Basically there's four steps, outlined and then coded below->
  2231.  
  2232.    To add a control bar to a dialog, you must create the control bar
  2233.    as usual, and then make room for the control bar within the client
  2234.    area of the dialog. For the control bar to function properly, the
  2235.    dialog must duplicate some of the functionality of frame windows. If
  2236.    you want ON_UPDATE_COMMAND_UI handlers to work for the control bars,
  2237.    you also need to derive new control bar classes, and handle the
  2238.    WM_IDLEUPDATECMDUI message. If your dialog is not the main window of
  2239.    your application, you will also need to modify its parent frame window
  2240.    to pass the WM_IDLEUPDATECMDUI message on to the dialog's control
  2241.    bars. 
  2242.  
  2243.  
  2244.    To make room for a control bar within the client area of the dialog,
  2245.    follow these steps in your dialog's OnInitDialog() function: 
  2246.    1. Create the control bars.
  2247.    2. Figure out how much room the control bars will take by using the
  2248.       reposQuery option of RepositionBars(): 
  2249.  
  2250.       CRect rcClientStart;
  2251.       CRect rcClientNow;
  2252.       GetClientRect(rcClientStart);
  2253.       RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,
  2254.                      0, reposQuery, rcClientNow);
  2255.  
  2256.    3. Move all the controls in your dialog to account for space used
  2257.       by control bars at the top or left of the client area. If your dialog
  2258.       contains a menu, you also need to account for the space used by the
  2259.       menu: 
  2260.  
  2261.       CPoint ptOffset(rcClientStart.left - rcClientNow.left,
  2262.       rcClientStart.top - rcClientNow.top);
  2263.       ptOffset.y += ::GetSystemMetrics(SM_CYMENU);
  2264.  
  2265.       CRect rcChild;
  2266.       CWnd* pwndChild = GetWindow(GW_CHILD);
  2267.       while (pwndChild) {
  2268.         pwndChild->GetWindowRect(rcChild);
  2269.         rcChild.OffsetRect(ptOffset);
  2270.         pwndChild->MoveWindow(rcChild, FALSE);
  2271.         pwndChild = pwndChild->GetNextWindow();
  2272.       }
  2273.  
  2274.    4. Increase the dialog window dimensions by the amount of space used
  2275.       by the control bars: 
  2276.  
  2277.       CRect rcWindow;
  2278.       GetWindowRect(rcWindow);
  2279.       rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
  2280.       rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();
  2281.       MoveWindow(rcWindow, FALSE);
  2282.  
  2283.    5. Position the control bars using RepositionBars().
  2284.  
  2285.  
  2286.    To update the first pane of a status bar with menu item text, you
  2287.    must handle WM_MENUSELECT, WM_ENTERIDLE, and WM_SETMESSAGESTRING in
  2288.    your dialog class. You need to duplicate the functionality of the
  2289.    CFrameWnd handlers for these messages. See the CModelessMain class in
  2290.    the sample program for examples of these message handlers. 
  2291.  
  2292.    To allow ON_UPDATE_COMMAND_UI handlers to work for other status bar
  2293.    panes and for toolbar buttons, you must derive new control bar classes
  2294.    and implement a message handler for WM_IDLEUPDATECMDUI. This is
  2295.    necessary because the default control bar implementations of
  2296.    OnUpdateCmdUI() assume the parent window is a frame window. However,
  2297.    it doesn't do anything but pass the parent window pointer on to a
  2298.    function which only requires a CCmdTarget pointer. Therefore, you can
  2299.    temporarily tell OnUpdateCmdUI() that the parent window pointer you
  2300.    are giving it is a CFrameWnd pointer to meet the compiler
  2301.    requirements. Here's an example: 
  2302.  
  2303.      LRESULT CDlgToolBar::OnIdleUpdateCmdUI(WPARAM wParam,LPARAM lParam)
  2304.      {
  2305.       if (IsWindowVisible()) {
  2306.         CFrameWnd* pParent = (CFrameWnd*)GetParent();
  2307.         if (pParent)
  2308.            OnUpdateCmdUI(pParent, (BOOL)wParam);
  2309.       }
  2310.       return 0L;
  2311.      }
  2312.  
  2313.  
  2314.    To pass WM_IDLEUPDATECMDUI messages on to dialogs other than the
  2315.    main window, save dialog pointers in your frame window class and
  2316.    create a WM_IDLEUPDATECMDUI handler in that class. The handler should
  2317.    send the WM_IDLEUPDATECMDUI message on to the dialog child windows by
  2318.    using CWnd::SendMessageToDescendants(). Then perform default
  2319.    processing for the message within the frame window. 
  2320.    -MS FAQ 6/25/95
  2321.  
  2322. ...........................................................................
  2323.  
  2324. 6.3.6.  Why isn't my CDialog::PreCreateWindow getting called?
  2325. -------------------------------------------------------------
  2326.    PreCreateWindow does not get called when you create a dialog box.
  2327.    If you would like to init some data/controls for a dialog box you have
  2328.    to trap the OnInitDialog message and do you stuff there.
  2329.    PreCreateWindow is use to modify params for a window that you are
  2330.    creating.  
  2331.    -ewalker@tezcat.com, mfc-l, 7/12/95
  2332.  
  2333. ...........................................................................
  2334.  
  2335. 6.3.7.  How do I embed a common dialog in a property page?
  2336. -----------------------------------------------------------
  2337.    This question comes up frequently on the "MFC" forum of CompuServe
  2338.    and the simple answer - unfortunately - is that there is no way to do
  2339.    it :-( 
  2340.    -chris@chrism.demon.co.uk, programmer.win32, 7/12/95
  2341.  
  2342. ...........................................................................
  2343.  
  2344. 6.3.8.  Why can't I DDX/DDV to initialize my CDialog controls?
  2345. --------------------------------------------------------------
  2346.    You can't do anything with the dialog controls until your dialog is
  2347.    created - which doesn't happen until DoModal(). The standard way of
  2348.    overcoming the problems is to create member variables for the data,
  2349.    initialise them before calling DoModal and then transfer the values
  2350.    in OnInitDialog. Or perhaps in UpdateData(). Much like the
  2351.    ClassWizard member variables does it. 
  2352.  
  2353.    So have your dialog include a CStringList or CStringArray, put the
  2354.    values  for the listbox in that and transfer them to the listbox in
  2355.    OnInitDialog. [etc...] 
  2356.    -null@diku.dk, programmer.controls, 7/11/95
  2357.  
  2358.    Init your dialog in OnInitDialog. If neccessary pass a pointer to
  2359.    your document to the constructor of your dialog (and save it in a
  2360.    private/protected m_pDoc member). 
  2361.    -jhasling@gascad.co.at, programmer.controls, 7/11/95
  2362.  
  2363. ---------------------------------------------------------------------------
  2364.  
  2365. 6.4. Control bars, status bars, toolbars, dialog bars.
  2366. =======================================================
  2367.  
  2368. 6.4.1.  How do I add a combobox to my toolbar?
  2369. ----------------------------------------------
  2370.    You can do this using the CToolBar::SetButtonInfo method.
  2371.    The MFC sample ctrlbars shows how to do this.  Basically you call
  2372.    SetButtonInfo with the resource ID of your combobox.  You might
  2373.    want to throw some separators in there too.
  2374.    -scot_wingo@msn.com, 6/1/95
  2375.  
  2376. ...........................................................................
  2377.  
  2378. 6.4.2.  How do I update the text of a pane in a status bar?
  2379. -----------------------------------------------------------
  2380.    By default, a CStatusBar pane is not enabled when the pane is
  2381.    created. To activate a pane, you must call the
  2382.    ON_UPDATE_COMMAND_UI() macro for each pane on the status bar and
  2383.    update the panes. Because panes do not send WM_COMMAND messages,
  2384.    you cannot use ClassWizard to activate panes; you must type the
  2385.    code manually. For example, suppose one pane has ID_INDICATOR_PAGE
  2386.    as its identifier and that it contains the current page number in a
  2387.    document. To make the ID_INDICATOR_PAGE pane display text, add the
  2388.    following to a header file (probably the MAINFRM.H file):
  2389.    
  2390.           afx_msg void OnUpdatePage(CCmdUI *pCmdUI);
  2391.           
  2392.    Add the following to the application message map:
  2393.  
  2394.           ON_UPDATE_COMMAND_UI(ID_INDICATOR_PAGE, OnUpdatePage)
  2395.  
  2396.    Add the following to a source code file (probably MAINFRM.CPP):
  2397.  
  2398.           void CMainFrame::OnUpdatePage(CCmdUI *pCmdUI)
  2399.           {
  2400.              pCmdUI->Enable();
  2401.  
  2402.           }
  2403.           
  2404.    To display text in the panes, either call SetPaneText() or call
  2405.    CCmdUI::SetText() in the OnUpdate() function. For example, you
  2406.    might want to set up an integer variable m_nPage that contains the
  2407.    current page number. Then, the OnUpdatePage() function might read
  2408.    as follows: 
  2409.  
  2410.           void CMainFrame::OnUpdatePage(CCmdUI *pCmdUI)
  2411.           {
  2412.              pCmdUI->Enable();
  2413.              char szPage[16];
  2414.              wsprintf((LPSTR)szPage, "Page %d", m_nPage);
  2415.              pCmdUI->SetText((LPSTR)szPage);
  2416.  
  2417.           }
  2418.           
  2419.    This technique causes the page number to appear in the pane during
  2420.    idle processing in the same manner that the application updates
  2421.    other indicators. 
  2422.    - MSVC Knowledge Base 6/4/94
  2423.  
  2424. ...........................................................................
  2425.  
  2426. 6.4.3.  How do I make my CToolBar customizable at run-time?
  2427. -----------------------------------------------------------
  2428.    You might consider reading article "CToolBarCtrl :Handling
  2429.    Customization Notifications" in the Product Documentation of VC++
  2430.    2.1. 
  2431.  
  2432.    Here is the relevant extract :
  2433.    "A Windows toolbar common control has built-in customization
  2434.    features, including a system-defined customization dialog box, which
  2435.    allow the user to insert, delete, or rearrange toolbar buttons. The
  2436.    application determines whether the customization features are
  2437.    available and controls the extent to which the user can customize the
  2438.    toolbar. These customization features are available in the
  2439.    CToolBarCtrl class but not in the current CToolBar class.
  2440.  
  2441.    You can make these customization features available to the user by
  2442.    giving the toolbar the CCS_ADJUSTABLE style. The customization
  2443.    features allow the user to drag a button to a new position or to
  2444.    remove a button by dragging it off the toolbar. In addition, the user
  2445.    can double-click the toolbar to display the Customize Toolbar dialog
  2446.    box, which allows the user to add, delete, and rearrange toolbar
  2447.    buttons. The application can display the dialog box by using the
  2448.    Customize member function."
  2449.  
  2450.    - R.Rajendran (NetQuest), 76041.2245@compuserve.com,
  2451.      MSMFC Forum, May-9-95 
  2452.  
  2453. ...........................................................................
  2454.  
  2455. 6.4.4.  How do I turn off the toolbar or status bar?
  2456. ----------------------------------------------------
  2457.    You can turn the status bar off in any of your views (i.e. in the 
  2458.    OnViewStatusBar() method you describe above) with the following code:
  2459.  
  2460.    if( ((CMainFrame*)GetParent())->m_wndToolBar.IsWindowVisible() )
  2461.     GetParent()->SendMessage(WM_COMMAND, ID_VIEW_TOOLBAR, 0L);
  2462.    if( ((CMainFrame*)GetParent())->m_wndStatusBar.IsWindowVisible() )
  2463.     GetParent()->SendMessage(WM_COMMAND, ID_VIEW_STATUS_BAR, 0L);
  2464.  
  2465.    Use 1L instead of 0L for the SendMessage's lParam to turn the bars on.
  2466.    -JKBenjamin@aol.com via mfc-l, 5/16/95
  2467.  
  2468. ...........................................................................
  2469.  
  2470. 6.4.5.  How do I create a toolbar/statusbar in a dialog?
  2471. --------------------------------------------------------
  2472.   See section 6.3.5. of this FAQ
  2473.  
  2474. ---------------------------------------------------------------------------
  2475.  
  2476. 6.5. Menus
  2477. =======================================================
  2478.  
  2479. ---------------------------------------------------------------------------
  2480.  
  2481. 6.5.1.  How do I get a pointer to the menu bar in a MDI app?
  2482. ------------------------------------------------------------
  2483.    Q>I'm writing a MDI application and I have problems to get a pointer to the
  2484.      actual menu bar. The normal construction doesn't seem to work in MDI:
  2485.  
  2486.      CMenu *menu;
  2487.      menu = GetMenu()->GetSubMenu(0);
  2488.  
  2489.      How can I get a pointer to the menu bar to update the menu?
  2490.  
  2491.     A> AfxGetApp()->m_pMainWnd->GetMenu()->GetSubMenu(n)
  2492.     -mlinar@pollux.usc.edu, Mitch Mlinar, 6/8/95
  2493.  
  2494. ...........................................................................
  2495.  
  2496. 6.5.2.  How do I implement a right-mouse popup-menu?
  2497. ----------------------------------------------------
  2498.    //////////////////////////////////////////////////////////////////////
  2499.    // WM_RBUTTONDOWN handler.
  2500.    //
  2501.    // Trap this message and display the button properties popup menu.
  2502.    // The main frame receives the popup menu messages. This allows the
  2503.    // status bar to be updated with the help text.
  2504.    //
  2505.    /////////////////////////////////////////////////////////////////////// 
  2506.    void CAppButton::OnRButtonDown(UINT flags, CPoint point)
  2507.    {
  2508.     
  2509.       CMenu menu;
  2510.       CMenu *submenu;
  2511.          
  2512.       // load the menu
  2513.       menu.LoadMenu(IDR_LAUNCH); 
  2514.          
  2515.       // get the popup menu
  2516.       submenu = menu.GetSubMenu(0);
  2517.          
  2518.       // convert to screen coordinates
  2519.       ClientToScreen(&point);
  2520.                   
  2521.       // post the menu
  2522.       submenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,                  
  2523.                               point.x,
  2524.                               point.y,
  2525.                               AfxGetApp()->m_pMainWnd,NULL);
  2526.                   
  2527.    }
  2528.    -johnm@unipalm.co.uk, programmer.win32, 7/12/95
  2529.  
  2530. ...........................................................................
  2531.  
  2532. 6.5.3.  How do I dynamically change the mainframe menu?
  2533. -------------------------------------------------------
  2534.     CMenu newMenu;
  2535.     newMenu.LoadMenu (IDR_MENU1);
  2536.     AfxGetMainWnd()->SetMenu( &newMenu );
  2537.     AfxGetMainWnd()->DrawMenuBar();
  2538.     newMenu.Detach ();
  2539.     -Arun Rao, MSMFC, 6/27/95
  2540.  
  2541. ...........................................................................
  2542.  
  2543. 6.5.4.  How do I 'attach' a menu to a window's creation/destruction?
  2544. --------------------------------------------------------------------
  2545. {Note the original question talked about dialogs, but you can
  2546. interpolate this code to any kind of window that you want to have
  2547. change the menu.}
  2548.  
  2549.     One of the ways to do this is as follows -
  2550.  
  2551.     1. Declare a variable CMenu pNewMenu in one of the dialog class.
  2552.     2. Handle the WM_INITDIALOG and WM_CLOSE messages in the
  2553.        dialog class as follows.
  2554.     3. BOOL CMydlg::OnInitDialog()
  2555.        {
  2556.            CDialog::OnInitDialog();
  2557.  
  2558.            // Load the IDR_MYFRAME menu
  2559.            pNewMenu = new CMenu;
  2560.            pNewMenu->LoadMenu(IDR_MYFRAME);
  2561.            // Set the mainframe menu to mainframe.
  2562.            ((CMainFrame *)AfxGetMainWnd())->SetMenu(pNewMenu);
  2563.  
  2564.            return TRUE;
  2565.        }
  2566.      And
  2567.        void CMydlg::OnClose()
  2568.        {
  2569.            // Detach the previous HMenu handle from the object.
  2570.            pNewMenu->Detach();
  2571.            pNewMenu->LoadMenu(IDR_MAINFRAME);
  2572.            // Restore the mainframe menu.
  2573.            ((CMainFrame *)AfxGetMainWnd())->SetMenu(pNewMenu);
  2574.            CDialog::OnClose();
  2575.        }
  2576.      4. If there are other methods of closing the dialog (example-
  2577.         By clicking a button in the Dialog), then The code given
  2578.         above in OnClose handler, must be put in the button click
  2579.         handler.
  2580.      -Sanjeev Kumar, MSMFC, 6/23/95
  2581.  
  2582. ---------------------------------------------------------------------------
  2583.  
  2584. 6.6.  Windows Common Controls (a.k.a. Windows 95 controls)
  2585. =======================================================
  2586.  
  2587. ---------------------------------------------------------------------------
  2588.  
  2589. 6.6.1.  Can I use these controls under NT or Win32s?
  2590. ------------------------------------------------------------
  2591.    The version of Win32s now in beta supports the common controls.
  2592.  
  2593.    Windows NT 3.50 does not support the common controls, and will not
  2594.    in the future.  You must use Windows NT version 3.51 to gain the
  2595.    common controls.
  2596.    -blaszczak@BIX.com, mfc-l, 7/6/95
  2597.  
  2598.    TODO: Get Win32s version number!
  2599.  
  2600.  
  2601. 6.6.2.  Where's a demo of this wickedly cool controls?
  2602. ------------------------------------------------------
  2603.    Check out the MFC sample, fire, it features most of the controls in
  2604.    action:  MSVC20\samples\mfc\fire.
  2605.    -scot_wingo@msn.com, 7/27/95
  2606. ...........................................................................
  2607.  
  2608. 6.6.3.  How do you handle NM_DBLCLK for a CListCtl?
  2609. ---------------------------------------------------
  2610.    BEGIN_MESSAGE_MAP(CListView, CView)
  2611.    ON_NOTIFY( NM_DBLCLK,ID_LISTCTRL,OnDblClick )
  2612.    END_MESSAGE_MAP()
  2613.  
  2614.    void CListView::OnDblClick(NMHDR* /*k*/, LRESULT* /*j*/) 
  2615.    {
  2616.       int nItem, nFlags;
  2617.       char szTest[80];
  2618.  
  2619.       nFlags = LVNI_SELECTED;
  2620.       nItem = m_ListCtrl->GetNextItem(-1, nFlags );
  2621.       if ( nItem != -1 )
  2622.       {
  2623.            sprintf( szTest, "Selected Item %d", nItem);
  2624.            AfxMessageBox(szTest);
  2625.       }
  2626.     }
  2627.     -spolyak@interaccess.com, mfc-l, 7/21/95
  2628.  
  2629. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2630.  
  2631. 7. Documents, Views and Frame Class Questions
  2632. =============================================
  2633.  
  2634. ---------------------------------------------------------------------------
  2635.  
  2636. 7.1.  Views
  2637. ===========
  2638.  
  2639. 7.1.1. How do I size a view?
  2640. ----------------------------
  2641.    Normally, you can change the size of a window by calling
  2642.    MoveWindow(). In an application developed with the Microsoft
  2643.    Foundation Class (MFC) Library, the view window is a child window of
  2644.    the frame window that surrounds the view. To change the size of the
  2645.    view window, retrieve a pointer to the frame window of the view by
  2646.    calling GetParentFrame(), then call MoveWindow() to change the size of
  2647.    the parent. When the parent frame window changes size, it
  2648.    automatically changes the size of the view window to fit in the parent
  2649.    frame.
  2650.    -MSVC Knowledge Base. 6/4/94
  2651.  
  2652. ...........................................................................
  2653.  
  2654. 7.1.2. How do I size a CFormView?
  2655. ---------------------------------
  2656.    See MS Knowledge Base article Q98598 for a very long answer.
  2657.    Basically, you need to override OnInitialUpdate() in a CFormView
  2658.    derived class.  There's other details to deriving from CFormView
  2659.    that the article goes into.
  2660.    -MSVC Knowledge Base. 6/7/95
  2661.  
  2662. ...........................................................................
  2663.  
  2664. 7.1.3. How do I use new views with a doc template?
  2665. --------------------------------------------------
  2666.    In an application created with AppWizard, you have two options:
  2667.    change the derivation of the current view, or create a new view
  2668.    and use the new view in your MDI application along with the
  2669.    original view.
  2670.  
  2671.    To create a new view, use ClassWizard to create a new class
  2672.    derived from CView. After the class has been created, the steps
  2673.    to use the new view or to modify the view provided by App
  2674.    Wizard are the same.
  2675.  
  2676.    1. Modify the header file for the view class to change all
  2677.       references to CView to the name of the desired view class.
  2678.       In this example, the class is derived from CScrollView.
  2679.       Usually, this step involves changing the class the view
  2680.       class is derived from as follows:
  2681.  
  2682.       class CMyView : public CScrollView
  2683.  
  2684.    2. Modify the implementation file for the view class to change
  2685.       all references to CView to the name of the desired view
  2686.       class. This involves changing the IMPLEMENT_DYNCREATE line
  2687.       as follows:
  2688.  
  2689.       IMPLEMENT_DYNCREATE(CMyView, CScrollView)
  2690.  
  2691.       changing the BEGIN_MESSAGE_MAP as follows:
  2692.  
  2693.       BEGIN_MESSAGE_MAP(CMyView, CScrollView)
  2694.  
  2695.       and changing any other references to CView to CScrollView.
  2696.  
  2697.    3. No further modifications are required if you are modifying a
  2698.       view created by App Wizard. If you create a new view, find
  2699.       the AddDocTemplate() call in the CWinApp::InitInstance()
  2700.       function. The third parameter to AddDocTemplate() is
  2701.       RUNTIME_CLASS(CSomeView). To replace the current view with
  2702.       the new view class, change CSomeView to CMyView. In an MDI
  2703.       application, you can use multiple view types by adding a
  2704.       second AddDocTemplate() call that changes
  2705.       RUNTIME_CLASS(CSomeView) to RUNTIME_CLASS(CMyView).
  2706.  
  2707.       For more information, please see Knowledge Base article Q99562.
  2708.       -MSVC Knowledge Base 6/7/95
  2709.  
  2710. ...........................................................................
  2711.  
  2712. 7.1.4. How do I change the background color of a view?
  2713. ------------------------------------------------------
  2714.    To change the background color for a CView, CFrameWnd, or CWnd
  2715.    object, process the WM_ERASEBKGND message. The following code shows how:
  2716.  
  2717.    BOOL CSampleView::OnEraseBkgnd(CDC* pDC)
  2718.    {
  2719.      // Set brush to desired background color
  2720.      CBrush backBrush(RGB(255, 128, 128));
  2721.  
  2722.      // Save old brush
  2723.      CBrush* pOldBrush = pDC->SelectObject(&backBrush);
  2724.  
  2725.      CRect rect;
  2726.      pDC->GetClipBox(&rect);     // Erase the area needed
  2727.  
  2728.      pDC->PatBlt(rect.left, rect.top, rect.Width(),
  2729.                  rect.Height(), PATCOPY);
  2730.      pDC->SelectObject(pOldBrush);
  2731.      return TRUE;
  2732.    }
  2733.  
  2734. ...........................................................................
  2735.  
  2736. 7.1.5. How do I get the current View?
  2737. -------------------------------------
  2738.    The best thing to do is to pass the view along as a parameter.
  2739.    If this is impractical, you can get the view if you KNOW, that it is
  2740.    the currently active document and the currently active view. For
  2741.    details, see Microsoft KB, article Q108587, "Get Current CDocument or
  2742.    CView from Anywhere". In brief, use 
  2743.  
  2744.    (CFrameWnd*)(AfxGetApp()->m_pMainWnd)->GetActiveDocument()
  2745.    and 
  2746.    (CFrameWnd*)(AfxGetApp()->m_pMainWnd)->GetActiveView()
  2747.  
  2748.    to get the document and the view. It might be a good idea to wrap them
  2749.    in static functions in your CMyDoc and CMyView and check that they are
  2750.    of the correct RUNTIME_CLASS.
  2751.  
  2752.    If the view isn't the currently active view or if you can run OLE
  2753.    in-place, this won't work however.
  2754.    -null@diku.dk, Niels Ull Jacobsen, programmer.misc, 6/8/95
  2755.  
  2756. ...........................................................................
  2757.  
  2758. 7.1.6.  How do I create multiple views on one document?
  2759. -------------------------------------------------------
  2760.    The CDocTemplate::CreateNewFrame() function creates additional
  2761.    views of a document in an MDI application written with MFC.
  2762.  
  2763.    To call this function, specify a pointer to a CDocument object (the
  2764.    document for which the function will create a view) and a pointer to a
  2765.    frame window that has the properties to duplicate. Typically, the
  2766.    second parameter of this function is NULL. 
  2767.  
  2768.    When an application calls CreateNewFrame(), the function creates a
  2769.    new frame window and a view in the frame window. The frame window type
  2770.    and view type depend on the document template (CDocTemplate)
  2771.    associated with the document specified in the CreateNewFrame() call. 
  2772.  
  2773.    The CHKBOOK MFC sample application that ships with Visual C++ also
  2774.    demonstrates creating additional frames and views for documents.
  2775.    Check out CHKBOOK.CPP, the CChkBookApp::OpenDocumentfile() function.
  2776.  
  2777.    Another example of using CreateNewFrame() is the MULTVIEW sample
  2778.    application. Also, Dale Rogerson's article, "Multiple Views for a
  2779.    Single Document" located on the Microsoft Developer Network
  2780.    Development Library CD-ROM, which explains in detail how to add
  2781.    additional views to an existing document, is an excellent source of
  2782.    information. 
  2783.  
  2784.    CreateNewFrame() creates both a frame and a view; not only a view.
  2785.    If, for some reason, CreateNewFrame() does not quite address your
  2786.    situation, the source code for CreateNewFrame() is quite useful to
  2787.    demonstrate the steps required to create frames and views. 
  2788.    -MS FAQ with mods, 6/25/95
  2789.  
  2790. ...........................................................................
  2791.  
  2792. 7.1.7.  How do I get all the views in an MDI app?
  2793. -------------------------------------------------
  2794.    You need to use some functions which are undocumented:
  2795.  
  2796.       CDocument::GetFirstViewPosition(); // DOCCORE.CPP
  2797.       CDocument::GetNextView(); // DOCCORE.CPP
  2798.       CMultiDocTemplate::GetFirstDocPosition(); // DOCMULTI.CPP
  2799.       CMultiDocTemplate::GetNextDoc(); // DOCMULTI.CPP
  2800.  
  2801.    You'll also need to mess with the m_templateList member of CWinApp. 
  2802.    -blaszczak@Bix.com, mfc-l, 7/11/95
  2803.  
  2804. ----------------------------------------------------------------------
  2805.  
  2806. 7.2.  Documents
  2807. ---------------
  2808.  
  2809. 7.2.1.  Do I have to use the Document/View architecture?
  2810. ----------------------------------------------------
  2811.    MFC does not force you to use document/views.  Check out hello,
  2812.    mdi, and helloapp samples, they don't use it at all.  Most MFC
  2813.    features can be used in non-document/view applications.  You do
  2814.    lose features like print preview and of many OLE features when you
  2815.    don't go document/view.
  2816.    -scot_wingo@msn.com 6/7/95
  2817.  
  2818. ...........................................................................
  2819.  
  2820. 7.2.2. How do I get the current Document?
  2821. -----------------------------------------
  2822.    See section 7.1.5. for the details.
  2823.  
  2824. ...........................................................................
  2825.  
  2826. 7.2.3.  When are documents destroyed?
  2827. -------------------------------------
  2828.    In SDI applications, the document is deleted when the application
  2829.    exits.  In MDI applications, the document is deleted when the last
  2830.    view on the document is closed.  To help keep your document SDI/MDI
  2831.    compatible, you should delete the document's data in the virtual
  2832.    DeleteContents() function, not in the destructor.
  2833.    -Richard Hazenberg, drmcode@euronet.nl, programmer.misc, 6/24/95
  2834.  
  2835. ...........................................................................
  2836.  
  2837. 7.2.4.  How do I create multiple documents?
  2838. -------------------------------------------
  2839.    To add support for additional document types, you can create and
  2840.    register additional CMultiDocTemplate objects with your CWinApp
  2841.    derived object. This technique is illustrated in the MULTDOCS sample
  2842.    application. The general steps needed to add an additional document
  2843.    type to an MFC application are listed below: 
  2844.  
  2845.    1. Use AppWizard to create a new document class and a new view class.
  2846.    2. Use the Resource Editor to add a new resource string to support
  2847.       the new document class. For more information on the format of the
  2848.       document template string resource, see the topic How to Interpret a
  2849.       Document Template String. 
  2850.    3. Use the Resource Editor to add an additional icon and menu
  2851.       resource to the application. Note, the ID for each of these resources
  2852.       needs to be the same ID as the resource ID used for the document
  2853.       template string created in step 2. This ID is used by the
  2854.       CMultiDocTemplate class to identify the resources associated with the
  2855.       additional document type. 
  2856.    4. In the applications InitInstance() function, create another
  2857.       CMultiDocTemplate object and register it with the
  2858.       CWinApp::AddDocTemplate() function. For example: 
  2859.  
  2860.       CMultiDocTemplate* pDocTemplate2 = new CMultiDocTemplate(
  2861.        IDR_DOC2TYPE, RUNTIME_CLASS(CDoc2),
  2862.        RUNTIME_CLASS(CMDIChildWnd), RUNTIME_CLASS(CView2));
  2863.       AddDocTemplate(pDocTemplate2);
  2864.  
  2865.    5. And finally, add the custom serialization and painting code to
  2866.       your new document and view classes. 
  2867.      -MS FAQ, 6/25/95
  2868.  
  2869. ...........................................................................
  2870.  
  2871. 7.2.5.  How do I get a list of open documents?
  2872. ----------------------------------------------
  2873.    The code below demonstrates how to retrieve a list of pointers to
  2874.    all CDocuments that were created using a CDocTemplate object. 
  2875.  
  2876.    In the code below, CMyApp is derived from CWinApp. The variable
  2877.    m_templateList is a CPtrList object that is a member of CWinApp, and
  2878.    it contains a list of pointers to all of the document templates
  2879.    (CDocTemplates). The CDocTemplate functions GetFirstDocPosition() and
  2880.    GetNextDoc() are used to iterate through the list of documents for
  2881.    each document template. 
  2882.  
  2883.    Sample Code
  2884.  
  2885.    void CMyApp::GetDocumentList(CObList * pDocList)
  2886.    {
  2887.       ASSERT(pDocList->IsEmpty());
  2888.  
  2889.       POSITION pos = m_templateList.GetHeadPosition();
  2890.  
  2891.       while (pos){
  2892.          CDocTemplate* pTemplate = 
  2893.             (CDocTemplate*)m_templateList.GetNext(pos);
  2894.          POSITION pos2 = pTemplate->GetFirstDocPosition();
  2895.          while (pos2) {
  2896.             CDocument * pDocument;
  2897.             if ((pDocument=pTemplate->GetNextDoc(pos2)) != NULL)
  2898.                pDocList->AddHead(pDocument);
  2899.          }
  2900.      }
  2901.    }
  2902.  
  2903.    There are two public member functions of the CDocTemplate class that
  2904.    are not documented in the reference manual or the online help.
  2905.    However, these are public member functions defined in the CDocTemplate
  2906.    class and provide simple functionality for traversing the list of open
  2907.    documents. These functions operate as follows: 
  2908.  
  2909.    Function: virtual POSITION GetFirstDocPosition() const;
  2910.  
  2911.    Remarks:   Call this function to get the position of the first
  2912.               document in the list of open documents associated with
  2913.               the template.  
  2914.    Return Value:  A POSITION value that can be used for iteration with
  2915.                   the GetNextDoc member function. 
  2916.  
  2917.    Function: virtual CDocument* GetNextDoc(POSITION& rPosition) const;
  2918.      rPosition:  A reference to a POSITION value returned by a previous
  2919.                  call to the GetNextDoc or GetFirstDocPosition member
  2920.                  function. This value must not be NULL. 
  2921.  
  2922.    Remarks:   Call this function to iterate through all of the
  2923.               document template's open documents. The function
  2924.               returns the document identified by rPosition and then
  2925.               sets rPosition to the POSITION value of the next
  2926.               document in the list. If the retrieved document is the
  2927.               last in the list, then rPosition is set to NULL.  
  2928.  
  2929.    Return Value:  A pointer to the view identified by rPosition.
  2930.    -MS FAQ, 6/25/95
  2931.  
  2932. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2933.  
  2934. 8. OLE Class Questions
  2935. ======================
  2936.  
  2937. 8.1. Structured Storage/Compound Files
  2938. ======================================
  2939.  
  2940. 8.1.1.  When I upgraded, I could not read my files generated by
  2941.         the old version of MFC.  What do I do?
  2942. ---------------------------------------------------------------
  2943.    There may be an easier way, but here is how I did it:
  2944.  
  2945.    Use VERSIONABLE_SCHEMA and GetObjectSchema to identify the version.
  2946.    If old version, then it is stored in OLE 1.0 format.  To read this 
  2947.    format, first read a WORD and a CString (type and name info).  Next is 
  2948.    the OLE data itself (the hard part). Use the following steps:
  2949.  
  2950.    1) use StgCreateDocfile to create a temporary Compound File.
  2951.  
  2952.    2) use OleConvertOLESTREAMToIStorage to copy the data to the Compound 
  2953.       file, converting to OLE 2 format.
  2954.  
  2955.    3) call OleLoad using the IStorage to get an IUnknown pointer, then call 
  2956.       QueryInterface to set the COleClientItem::m_lpObject member, and set 
  2957.       m_nDrawAspect to DVASPECT_CONTENT.
  2958.  
  2959.     4) release the IUnknown pointer and the IStorage pointer
  2960.  
  2961.     5) The OleConvertOLESTREAMToIStorage code requires an OLESTREAM 
  2962.        implementation.  Copy the code from MSVC 1.0 MFC code.
  2963.  
  2964.     This actually works.  Theres some issues with messing with the schema 
  2965.     parameter, and I have not implemented writing OLE 1/MFC files.
  2966.  
  2967.     Code available on request.
  2968.     -ronjones@xnet.com, Ron Jones, via programmer.tools, 5/9/95
  2969.  
  2970. --------------------------------------------------------------------------
  2971. 8.2.  OLE Controls (previously called OCX's)
  2972. ============================================
  2973.  
  2974. 8.2.1.  What is an OLE control?
  2975. -------------------------------
  2976.     OLE controls are the 32-bit successor to 16-bit VBX controls.
  2977.     Instead of being stored in a plain DLL and having functional
  2978.     interfaces, OLE controls rely on OLE automation.  Hopefully this
  2979.     will make the interface more flexible and easier to use than VBXs.
  2980.     -scot_wingo@msn.com, 6/25/95
  2981.  
  2982. ...........................................................................
  2983.  
  2984. 8.2.2.  How do I write OLE controls?
  2985. ------------------------------------
  2986.     In VC++ 2.x, Microsoft released the CDK (OLE control developer
  2987.     kit), you use that kit and it's tools to write OLE controls.
  2988.     -scot_wingo@msn.com, 6/25/95
  2989.  
  2990. ...........................................................................
  2991.  
  2992. 8.2.3.  What versions of MFC support OLE control containment?
  2993. -------------------------------------------------------------
  2994.    To clarify the situation:
  2995.  
  2996.    VC++ 2.x can create OCX controls.
  2997.    VC++ 2.x does NOT yet have built-in "OCX container" support. That will
  2998.    be added in VC++ 4, due out this autumn. The only popular application
  2999.    I'm aware of which currently supports OCXs (albeit in only a limited
  3000.    way) is Access 2.
  3001.  
  3002.    The problem is that obviously the place you want OCX container support in
  3003.    MFC is in classes like "CDialog" and (possibly) "CWnd" or "CView". As I'm
  3004.    sure you know, OCX controls have to implement a LARGE number of OLE2
  3005.    interfaces, which makes the support code large.
  3006.  
  3007.    At present, OLE2 support in MFC happens in the "CCmdTarget" class, which
  3008.    is the base class from which ALL "application architecture" classes are
  3009.    derived. I guess the choice is to extend the OLE2 support in this class
  3010.    to include OCX support (which would make ALL apps using OLE2 a LOT larger),
  3011.    or to add OCX-specific support to certain specific classes such as
  3012.    CDialog. Either way, it's a major undertaking!
  3013.  
  3014.    -Chris Marriott, chris@chrism.demon.co.uk, programmer.tools, 6/24/95
  3015.  
  3016. TODO: Find out more about OLE control limitations/support in 4.0
  3017.  
  3018. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3019.  
  3020. 9. WOSA Class Questions
  3021. =======================
  3022.  
  3023. 9.1. CRecordSet
  3024. ---------------
  3025.  
  3026. 9.1.1.  When I add a CRecordSet class, I get tons of linker errors..
  3027. --------------------------------------------------------------------
  3028.   
  3029.    If you haven't told the AppWizard to use Database Support when you
  3030.    created your project, the AppWizard doesn't include the database
  3031.    headers.  If you add "#include <afxdb.h>" in your stdafx.h,
  3032.    CRecordSet will be "legalized".
  3033.    Then open the Linker Options window and add the library: "odbc".
  3034.    This avoids tons of linker errors.
  3035.    -bessler@highland.swb.de (Wolfgang Bessler) 06/05/95, comp.lang.c++
  3036.  
  3037. --------------------------------------------------------------------------
  3038.  
  3039. 9.2.  WinSock
  3040. =============
  3041.  
  3042. 9.2.1.  I'm having problems with CSocket blocking, what's up?
  3043. -------------------------------------------------------------
  3044.    I've worked around this by creating a dialog box that I pop up after
  3045.    calling Connect()... ie:
  3046.  
  3047.          CMySocket MySocket;
  3048.          MySocket.Create();
  3049.          MySocket.Connect("mysmtphost",25);
  3050.          CDummyDlg DummyDialog;
  3051.          MySocket.m_pDialog=&DummyDialog;
  3052.          DummyDialog.DoModal();
  3053.  
  3054.     This suspends the thread until MySocket sends a WM_CLOSE message to
  3055.     DummyDialog.
  3056.  
  3057.     I'd rather it look like:
  3058.  
  3059.          MySocket.m_hEvent=CreateEvent(...);
  3060.          WaitForSingleObject(MySocket.m_hEvent,INFINITE);
  3061.  
  3062.     But that stops all processing of MySocket.
  3063.  
  3064.     -Cynthia Jennings (idlewild@is.net), programmer.win32, 6/19/95
  3065.  
  3066.     TODO: Find better answer.
  3067.  
  3068. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3069.  
  3070. 10. DLL and Build Questions
  3071. ===========================
  3072.  
  3073.    If you have questions about extension and user DLLs, be sure to read
  3074.    technical notes 11 and 33.  Volume 2 of the documentation has more
  3075.    info too.  Finally, try searching on the sample names dllhusk
  3076.    (extension DLL) and dlltrace (user DLL) in books on-line.
  3077.  
  3078. --------------------------------------------------------------------------
  3079.  
  3080. 10.1. Do I need a CWinApp object in a DLL?
  3081. ------------------------------------------
  3082.    The Microsoft Foundation Class Library supports two types of DLLs:
  3083.    _USRDLL and _AFXDLL. The _USRDLL model requires one CWinApp object
  3084.    to perform the initialization and cleanup of the Microsoft
  3085.    Foundation Class Library Windows classes that the DLL uses. This
  3086.    requirement is described in MFC Tech Note 11; the DLLTRACE sample
  3087.    demonstrates a _USRDLL that contains a CWinApp object.
  3088.    
  3089.    An _AFXDLL does not require a CWinApp object. Because it shares the
  3090.    Microsoft Foundation Class Library classes with the application, it
  3091.    does not require a CWinApp to provide initialization and cleanup.
  3092.    Instead, an _AFXDLL requires a special version of LibMain() and a
  3093.    DLL initialization function. 
  3094.    -MSVC Knowledge Base 6/4/95
  3095.  
  3096. ---------------------------------------------------------------------------
  3097.  
  3098. 10.2. How should I define the WEP in a MFC DLL?
  3099. ------------------------------------------------
  3100.    In a dynamic-link library (DLL) built with Microsoft Foundation
  3101.    Class Library version 2.0, the _USRDLL model uses the WEP()
  3102.    (Windows exit procedure) function provided in the C run-time
  3103.    library. Because the code uses the C library WEP() function,
  3104.    the destructors for static and global objects in the DLL are
  3105.    called and the CWinApp::ExitInstance() function for the DLL
  3106.    application object is called.
  3107.  
  3108.    See MSVC Knowledge Base article Q98374 and Tech notes 11 and 33.
  3109.    -MSVC Knowledge Base 6/7/95
  3110.  
  3111. ---------------------------------------------------------------------------
  3112.  
  3113. 10.3.  How do I build an 'extension DLL'?
  3114. ------------------------------------------------
  3115.  
  3116.    1.  When you're building a 32-bit extension DLL, define _AFXEXT on the
  3117.    compiler command line.  If you look in AFXVER_.H, you'll see that this forces
  3118.    _AFXDLL to also be defined.  So an "AFXEXT" DLL is an AFXDLL.
  3119.  
  3120.    2. When _AFXDLL is defined, AfxGetResourceHandle returns a value stored in
  3121.    MFC's global data, which is shared by the EXE, the extension DLL and the MFC
  3122.    DLL.  The handle returned identifies the module which will be searched first
  3123.    when looking for a resource.
  3124.    (See the source code for AfxFindResourceHandle() if you're curious about the
  3125.    order of the search.)
  3126.  
  3127.    3. Strictly speaking, what we need to load a resource is a module handle
  3128.    rather than an instance handle.  (Instances share modules --- e.g., code and
  3129.    resources --- but have different data.)  A DLL has a module handle which is
  3130.    distinct from the handle of the EXE.
  3131.  
  3132.    4. You can use ::GetModuleHandle to get the handle for your DLL, then pass it
  3133.    to AfxSetResourceHandle so that your DLL is the first place searched for
  3134.    resources.  But note that this removes the EXE module from of modules
  3135.    searched.  You'll probably want to save a copy of the handle returned by
  3136.    AfxGetResourceHandle before calling AfxSetResourceHandle, then restore it
  3137.    once you're done loading the DLL resource.
  3138.    -Charlie Kester, Microsoft Developer Support, MSMFC, 7/19/95
  3139.  
  3140. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3141.  
  3142. 11. MFC Tips Tricks and Caveats
  3143. ===============================
  3144.  
  3145. 11.1. What's the best way to convert my C Windows App to MFC?
  3146. =============================================================
  3147.    Microsoft and Symantec have jointly developed a tool that helps you
  3148.    make the move from a C Windows application to MFC.  It's called the
  3149.    MFC migration kit.  You can find it on the MSVC 2.x CDROM in the MFCKIT
  3150.    directory.  The kit is also available from the Microsoft Software
  3151.    Library (See section 2.1.4) and from Symantec.
  3152.  
  3153. ---------------------------------------------------------------------------
  3154.  
  3155. 11.2. Why is my MFC application running slow?
  3156. =============================================
  3157.    MFC Apps should be nice and snappy.  Make sure you are not building
  3158.    the debug version and that you have the trace options off
  3159.    (MFCTRACE.EXE).  If your application continues to be slow, try
  3160.    doing some quick profiling to see if you are making any redundant
  3161.    calls.
  3162.    -scot_wingo@msn.com, 5/31/95
  3163.  
  3164. ---------------------------------------------------------------------------
  3165.  
  3166. 11.3. How can I create an application that is initially maximized?
  3167. ===================================================================
  3168.    For new applications, this can be done with AppWizard during Step
  3169.    4. During Step 4, choose Advanced..., and then select the Main
  3170.    Frame tab. Check the Maximized option. 
  3171.  
  3172.    For an MDI application, in the CWinApp::InitInstance() function,
  3173.    set CWinApp::m_nCmdShow to SW_SHOWMAXIMIZED before calling
  3174.    pMainFrame->ShowWindow(m_nCmdShow). In an application generated by
  3175.    AppWizard, the code is as follows:
  3176.    
  3177.           // create main MDI Frame window
  3178.           CMainFrame* pMainFrame = new CMainFrame;
  3179.           if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  3180.               return FALSE;
  3181.           m_nCmdShow = SW_SHOWMAXIMIZED;  // ADD THIS LINE!
  3182.           pMainFrame->ShowWindow(m_nCmdShow);
  3183.           pMainFrame->UpdateWindow();
  3184.  
  3185.           m_pMainWnd = pMainFrame;
  3186.           
  3187.    In an SDI application, in the CWinApp::InitInstance() function, set
  3188.    CWinApp::m_nCmdShow to SW_SHOWMAXIMIZED before calling OnFileNew().
  3189.    For example, in an application generated by AppWizard,  the code is
  3190.    as follows:
  3191.    
  3192.          m_nCmdShow = SW_SHOWMAXIMIZED;
  3193.          // create a new (empty) document
  3194.          OnFileNew();
  3195.    - MSVC Knowledge Base, 6/4/95
  3196.  
  3197. --------------------------------------------------------------------------
  3198.  
  3199. 11.4. How do I enable TRACE macros in my app?
  3200. =============================================
  3201.    If you use Visual C++ 1.0, run the TRACER application from your
  3202.    Microsoft Visual C++ program group (its icon has the title "MFC
  3203.    Trace Options"). Select "Enable Tracing," then choose OK.
  3204.  
  3205.    If you use Microsoft C/C++ 7.0, you must copy the AFX.INI file
  3206.    from the Microsoft Foundation Class Library source directory
  3207.    (by default, C:\C700\MFC\SRC) to your Windows directory (by
  3208.    default, C:\WINDOWS). This file should contain a section such
  3209.    as the following:
  3210.  
  3211.    [Diagnostics]
  3212.    TraceEnabled = 1
  3213.    TraceFlags = 0
  3214.  
  3215.    As long as TraceEnabled is set to 1, tracing is enabled.
  3216.  
  3217.    This AFX.INI file is the same for both C/C++ 7.0 and Visual C++ 1.0.
  3218.    In MSVC 2.x, the TRACE output automatically goes to the 'Debug'
  3219.    window when you run in the debugger.
  3220.    -VC+ Knowledge Base, 6/7/95
  3221.  
  3222. --------------------------------------------------------------------------
  3223.  
  3224. 11.5. How do I perform background processing in my application?
  3225. ===============================================================
  3226.    Many applications perform lengthy processing "in the
  3227.    background" during intervals that the user is not otherwise
  3228.    interacting with the application. In an application developed
  3229.    for the Microsoft Windows operating system, an application can
  3230.    perform background processing by splitting a lengthy process
  3231.    into many small fragments. After processing each fragment, the
  3232.    application yields execution control to Windows using a
  3233.    PeekMessage() loop.
  3234.  
  3235.    An application developed with the Microsoft Foundation Class
  3236.    Library can perform background processing either by using the
  3237.    PeekMessage() loop in the library code's main message loop or
  3238.    by embedding another PeekMessage() loop in the application.
  3239.  
  3240.    See MSVC Knowledge Base Q99999 for more info.
  3241.    -MSVC Knowledge Base 6/7/95.
  3242.  
  3243. --------------------------------------------------------------------------
  3244.  
  3245. 11.6. How do I send a message to another thread?
  3246. ================================================
  3247.    Try using SendNotifyMessage() to send messages to another thread.
  3248.    null@diku.dk, Neils Ull Jacobsen via programmer.misc, 6/18/95
  3249.  
  3250. --------------------------------------------------------------------------
  3251.  
  3252. 11.7.  Does Microsoft use MFC in their products? Which ones?
  3253. ============================================================
  3254.    There are many Microsoft apps written in MFC.  Sometimes its just
  3255.    not obvious... (to name a few: Bookshelf, Bob!, WordArt OLE server,
  3256.    Visual C++ (of course), Win95 paint, Win95 WordPad, some portions of
  3257.    Win95 FAX software, some Win95 games I know of...). 
  3258.  
  3259.    In the future, there are more apps coming out using MFC.  I don't
  3260.    have a way to track all of these uses, so there is certainly more that
  3261.    I'm not aware of or can't remember. 
  3262.  
  3263.    I don't expect Word or Excel to ever use MFC -- they have way too
  3264.    much legacy code and they don't see any customer benefit to rewriting
  3265.    to MFC. 
  3266.  
  3267.    But my point is -- definitely for new code, Microsoft is using MFC.
  3268.    Even some "old" code is taking advantage of MFC in future versions.
  3269.    -Dean McCrory, MSMFC, 6/8/95
  3270.  
  3271. --------------------------------------------------------------------------
  3272.  
  3273. 11.8.  How do I limit my MFC application to one instance?
  3274. =====================================================
  3275.    Look at the Microsoft sample ONETIME.ZIP, (MSDN CD or
  3276.    ftp.microsoft.com). In brief:
  3277.  
  3278.    const char* MyMainWndClassName = "MyMainWndXQW"
  3279.  
  3280.    BOOL CMyApp::InitApplication()
  3281.    {
  3282.      //Call base class.  Default version does nothing.
  3283.      CWinApp::InitApplication();  
  3284.  
  3285.      WNDCLASS wndcls;
  3286.      memset(&wndcls, 0, sizeof(WNDCLASS));   // start with NULL defaults
  3287.  
  3288.      // Get class information for default window class.
  3289.      ::GetClassInfo(AfxGetInstanceHandle(),"AfxFrameOrView",&wndcls);
  3290.  
  3291.      // Substitute unique class name for new class
  3292.      wndcls.lpszClassName = MyMainWndClassName;
  3293.   
  3294.      //Register new class and return the result code
  3295.  
  3296.      return ::RegisterClass(&wndcls);
  3297.   }
  3298.  
  3299.   BOOL CMyApp::FirstInstance()
  3300.    {
  3301.      CWnd *PrevCWnd, *ChildCWnd;
  3302.   
  3303.      // Determine if another window with our class name exists...
  3304.      PrevCWnd = CWnd::FindWindow(MyMainWndClassName, NULL);
  3305.      if (PrevCWnd != NULL)
  3306.      {
  3307.        // if so, does it have any popups?
  3308.        ChildCWnd=PrevCWnd->GetLastActivePopup(); 
  3309.        // Bring the main window to the top
  3310.        PrevCWnd->BringWindowToTop();
  3311.     
  3312.        // If iconic, restore the main window
  3313.        if (PrevCWnd->IsIconic()) 
  3314.           PrevCWnd->ShowWindow(SW_RESTORE);
  3315.        // If there are popups, bring them along too!
  3316.        if (PrevCWnd != ChildCWnd) 
  3317.           ChildCWnd->BringWindowToTop();
  3318.        // Return FALSE.  This isn't the first instance
  3319.        // and we are done activating the previous one.
  3320.        return FALSE;
  3321.      }
  3322.      else
  3323.        // First instance. Proceed as normal.
  3324.        return TRUE;
  3325.    }
  3326.  
  3327.    CMyApp::InitInstance()
  3328.    {
  3329.        if (!FirstInstance()) return FALSE;
  3330.        ...
  3331.    }
  3332.    -Niels Ull Jacobsen (null@diku.dk), programmer.tools, 6/19/95
  3333.  
  3334. --------------------------------------------------------------------------
  3335.  
  3336. 11.9.  How do I get my MFC app to use the Registry on Win32 platforms?
  3337. ======================================================================
  3338.    Just make a call to SetRegistryKey("MyCompany") in your CWinApp
  3339.    class and pass it a string (typically your company name). This string
  3340.    will define where in the registry the data goes:
  3341.    HKEY_CURRENT_USER\Software\MyCompany\<application name>\<section
  3342.    name>\<value name> 
  3343.  
  3344.    After making this call just use the normal WriteProfilexxx()
  3345.    routines and the data will go to the registry instead of to an INI
  3346.    file.  It works well and is simple!
  3347.    -Brett Robichaud, brett_robichaud@tallysys.com, 6/23/95, programmer.win32
  3348.  
  3349. --------------------------------------------------------------------------
  3350.  
  3351. 11.10.  How do I programmatically terminate my MFC application?
  3352. ===============================================================
  3353.    MFC does not provide a public function to gracefully exit an application.
  3354.  
  3355.    A method for dealing with this is to create a function in your application like the following:
  3356.  
  3357.  
  3358.    void ExitApp()
  3359.    {
  3360.       // same as double-clicking on main window close box
  3361.       ASSERT(AfxGetApp()->m_pMainWnd != NULL);
  3362.       AfxGetApp()->m_pMainWnd->SendMessage(WM_CLOSE);
  3363.    }
  3364.  
  3365.  
  3366.    As you can see, this is implemented as a global function, which can
  3367.    be called from anywhere in your application. It simply sends a
  3368.    WM_CLOSE message to your application's mainframe window. This
  3369.    initiates an orderly shutdown of the application. 
  3370.  
  3371.    If you are using MFC, version 2.5 or later, you can take advantage
  3372.    of a new global MFC function, "AfxGetMainWnd", to simplify the code: 
  3373.  
  3374.    void ExitMFCApp()
  3375.    {
  3376.       // same as double-clicking on main window close box
  3377.       ASSERT(AfxGetMainWnd() != NULL);
  3378.       AfxGetMainWnd()->SendMessage(WM_CLOSE);
  3379.    }
  3380.  
  3381.  
  3382.    NOTE: Always call CDocument::SetModifiedFlag() after changing your
  3383.    document data. This will ensure that the framework prompts the user to
  3384.    save before shutdown. If you need more extensive control over the
  3385.    shutdown procedure, you can override CDocument::SaveModified(). 
  3386.    -MS FAQ, 6/25/95
  3387.  
  3388. --------------------------------------------------------------------------
  3389.  
  3390. 11.11.  What's the difference between IMPLEMENT_DYNAMIC,
  3391. IMPLEMENT_DYNCREATE and IMPLEMENT_SERIAL?
  3392. ===============================================================
  3393.    IMPLEMENT_DYNAMIC provides run time type information to support
  3394.    macros such as IsKindOf and GetRuntimeClass.
  3395.  
  3396.    IMPLEMENT_DYNCREATE adds the ability to allow MFC to create
  3397.    the type on the fly.  This is required for any concrete data
  3398.    type that will be serialized to a file.
  3399.  
  3400.    IMPLEMENT_SERIAL also provides a version number for the class
  3401.    and adds the ability to use the >> operator to read the
  3402.    type from a file.
  3403.  
  3404.    As an example, if a derived class Dog uses IMPLEMENT_DYNCREATE and a
  3405.    base class Animal uses IMPLEMENT_SERIAL, then a Dog can be written
  3406.    with a pointer to either but can only be read by a pointer to Animal. 
  3407.  
  3408.    MFC 3.x provides a constant called VERSIONABLE_SCHEMA to
  3409.    be used with IMPLEMENT_SERIAL to support multiple versions
  3410.    at the same time.  The implementation in MFC is broken and
  3411.    fails at runtime.
  3412.    -jimb@turningpoint.com, email, 7/11/95
  3413.  
  3414. --------------------------------------------------------------------------
  3415.  
  3416. 11.12.  How can I declare an abstract base class to be
  3417.         IMPLEMENT_SERIAL?
  3418. =======================================================
  3419.    You need a special form of IMPLEMENT_SERIAL that looks like this:
  3420.    Use the regular DECLARE_SERIAL but use IMPLEMENT_SERIAL_ABC shown
  3421.    below instead of IMPLEMENT_SERIAL.
  3422.  
  3423.    #define IMPLEMENT_SERIAL_ABC(class_name, base_class_name, wSchema) \
  3424.            _IMPLEMENT_RUNTIMECLASS(class_name, base_class_name, wSchema, \
  3425.            NULL) \
  3426.            CArchive& AFXAPI operator>>(CArchive& ar, class_name* &pOb) \
  3427.            { pOb = (class_name*) ar.ReadObject(RUNTIME_CLASS(class_name)); \
  3428.            return ar; }
  3429.    -anonymous
  3430.  
  3431.  
  3432. --------------------------------------------------------------------------
  3433.  
  3434. 11.13.  What is afx.inl and afxwin1.inl, etc..?
  3435. =======================================================
  3436.    These files live in the msvcXX\mfc\include directory and include
  3437.    inline functions.  These functions are only 'inline' during non-debug
  3438.    (_DEBUG is not defined) builts of MFC.  They are prefaced with a
  3439.    special _AFX_INLINE derective which gets turned into 'inline' for
  3440.    non-debug builds and '' for debug builds.
  3441.  
  3442.    MFC does this so you can debug into the functions in debug mode, but
  3443.    get the benefits of inlining during release builds.  That's one of the
  3444.    reasons the library shrinks so much in release build mode.
  3445.    -scot_wingo@msn.com, 7/20/95
  3446.  
  3447. --------------------------------------------------------------------------
  3448.  
  3449. 11.14.  Is MFC available on the Macintosh?
  3450. =======================================================
  3451.    Yes!  Microsoft has something called the Visual C++ cross-platform
  3452.    edition.  This product lets you cross-compile for the 68000 based Macs
  3453.    and I think they have a PowerPC version coming out soon.  Contact
  3454.    Microsoft directly for more info.
  3455.    -scot_wingo@msn.com, 7/27/95
  3456.  
  3457.    TODO: Comments on this anyone?
  3458.  
  3459. --------------------------------------------------------------------------
  3460.  
  3461. 11.15.  Is MFC available on OS/2? 
  3462. =======================================================
  3463.    No!
  3464.  
  3465. --------------------------------------------------------------------------
  3466.  
  3467. 11.16.  Is MFC available on UNIX/Motif?
  3468. =======================================================
  3469.    Yes, contact one of the following (or all):
  3470.  
  3471.    Bristol Technology Inc.
  3472.    (203) 438-6969
  3473.    Wind/U - Windows to UNIX toolkit
  3474.    info@bristol.com
  3475.    http://www.bristol.com
  3476.  
  3477.    Software Uno
  3478.    WM_MOTIF - Windows to UNIX (and DOS) toolkit
  3479.    jalvarez@uno.com
  3480.  
  3481. --------------------------------------------------------------------------
  3482.  
  3483. 11.17.  How should I learn/start learning MFC?
  3484. ==============================================
  3485.    I see this posted lots.  To start with, check out section 2.4.2 of
  3486.    this FAQ, books always help.  Another good point is that you can't
  3487.    really get down and dirty in MFC without knowing and understanding the
  3488.    underlying Windows API, so you might want to start with an overview
  3489.    of that. (The 'Petzold' book is the classic here)  At the very
  3490.    least get a feel of what windows does and what it's capable of.
  3491.  
  3492.    Another hint I have is don't rely too much on the Wizards, these
  3493.    are great, but they sometimes shield the newbie too much.  Take a
  3494.    look at what AppWizard/ClassWizard has done from you, run the debugger
  3495.    through a mainfrm.cpp, etc..  You won't understand what the heck is
  3496.    going on until you understand what your magically generated code is
  3497.    doing.
  3498.  
  3499.    I thought the 'writing windows apps with MFC' book was a good merge
  3500.    between Petzold and intro MFC stuff.  'Inside Visual C++' may move
  3501.    too fast for someone that doesn't know Windows already..
  3502.    -scot_wingo@msn.com, 7/27/95
  3503.  
  3504.    * There's no substitute for paying your dues.
  3505.    * Unfortunately MFC is set up so that you're never done paying your dues.
  3506.    (HAHAHAHA!!!)
  3507.    -raymond@btw.com, mfc-l, 7/23/95
  3508.  
  3509.    Start with the VC++ User's Guide and work your way through the
  3510.    Scribble Tutorial.  You get an intro to VC++ and MFC and see how they
  3511.    work together.  Then there are numerous articles on the MSDN CD to
  3512.    help with basic concepts.  Try searching on MFC and Architecture.
  3513.    Don't shy away from reading the MFC Encyclopedia articles (they take
  3514.    more of a 'how-to' approach) and by all means become familiar with the
  3515.    MFC Technical Notes.  Also (hint), stay focused on the 32-bit stuff if
  3516.    you're just starting out.  There are also a number of excellent
  3517.    journals out there to help.
  3518.    -billb@microsoft.com, mfc-l, 7/23/95
  3519.  
  3520.  
  3521.    The important points (of the top of my head) are:
  3522.  
  3523.    If you're a windows programmer don't worry about graphics the CDC
  3524.    member functions are an almost direct encapsulation of the Windows
  3525.    functions. Also CWnd encapsulates much of the window manipulation functions.
  3526.  
  3527.    Learn the Document-View architecture: document templates, the
  3528.    interaction between the application, the documents and views
  3529.    (AfxGetApp, GetDocument, UpdateAllViews etc).
  3530.  
  3531.    Learn serialisation (scribble makes a good intro to it).
  3532.  
  3533.    DDX and DDV for dialog boxes: there is a good tech note on this.
  3534.  
  3535.    WM_COMMAND handlers, COMMAND_UI handlers (which allow you to
  3536.    enable/disable menu items as well as applying check mark and radio
  3537.    button marks on menu items, it also gives you one way to use status bars).
  3538.  
  3539.    During all this you'll also learn how to use ClassWizard and see
  3540.    how it is integrated with the editor and resource editor.
  3541.  
  3542.    Perhaps as part of the MFC FAQ we could create a list of topics
  3543.    (ordered in terms of importance) to learn?
  3544.    {Sure, this is a good start, no? -Scot}
  3545.    -grimes@parallax.co.uk, mfc-l, 7/24/95
  3546.  
  3547. --------------------------------------------------------------------------
  3548.  
  3549.  
  3550. 11.18.  What DLLs should I distribute with my MFC app?
  3551. ======================================================
  3552.    You should review the file REDISTRB.WRI on your Visual C++ CD.
  3553.    This file explains what files are necessary for different kinds of
  3554.    applications; it explains what to do about both Windows files and MFC files.
  3555.    -blaszczak@BIX.com, programmer.tools, 7/9/95
  3556.  
  3557.    dumpbin /imports myapp.exe dll_one.dll dll_two.dll | grep -i dll
  3558.    And recurse through the dll's you find.   Won't find dll's loaded
  3559.    by LoadLibrary() however. 
  3560.    -null@diku.dk, programmer.tools, 7/10/95
  3561.  
  3562. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3563.  
  3564. 12. Wizard Questions
  3565. ====================
  3566.  
  3567. 12.1.  How can I change the AppWizard options I selected for my application?
  3568. ----------------------------------------------------------------------------
  3569.    Unfortunately, AppWizard will not modify already created and
  3570.    modified applications.  You need to generate a new skeleton
  3571.    application using AppWizard and either merge your code into that or
  3572.    compare that skeleton with your original to see what's different.
  3573.    The good news is that it's mostly just a minor tweak to add/remove
  3574.    OLE support or MDI or something like that.  It usually is just
  3575.    changing your CWinApp derivate, your frame window, or something
  3576.    like that.
  3577.    - scot_wingo@msn.com, 5/31/95
  3578.  
  3579. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3580.  
  3581. 13. Visual C++ Questions
  3582. ========================
  3583. I'm trying to keep these as generic as possible, but these types of
  3584. questions tend to be very release-specific, so where possible, I've
  3585. included the version that's being questioned.
  3586.  
  3587. 13.1.  Windows 95 questions
  3588. ===========================
  3589.  
  3590. 13.1.1.  I'm running MSVC 2.0 and I can't get Windows 95 look and feel in
  3591.          my dialogs, what's wrong?
  3592. -------------------------------------------------------------------------
  3593.    In MSVC 2.0, go to the Project/Options dialog, select "Linker" and
  3594.    change the linker command line to include:  /subsystem:windows,4.0
  3595.    This is the default in MSVC 2.1.
  3596.    -Chris Marriott, chris@chrism.demon.co.uk, 5/25/95, via programmer.misc
  3597.  
  3598. ...........................................................................
  3599.   
  3600. 13.1.2.  When I compile under Windows 95, it flashes in and out of
  3601.          DOS mode.
  3602. ----------------------------------------------------------------   
  3603.    Remove or rename any dosprmpt.pif files in your win95 and windows
  3604.    directories.  If this doesn't work, do the same with all pif files.
  3605.    -scot_wingo@msn.com, 5/25/95
  3606.  
  3607.    In the Win95\system directory there is a pif for Conagent.  It is
  3608.    this pif file that a person has to change to Window screen mode
  3609.    instead of Full Screen mode.  Worked like a charm on mine after
  3610.    running about a month with the screen blanking...
  3611.    -RockyMoore@aol.com, email, 7/16/95
  3612.   
  3613. ...........................................................................
  3614.  
  3615. 13.1.3.  Can MSVC 1.5 or 2.0 be used for Windows 95?
  3616. ----------------------------------------------------------------   
  3617.    You can run both versions under Windows 95.  Visual C++ 1.5x can
  3618.    ONLY generate 16-bit applications.  You 'can' run these on Windows
  3619.    95, but it's more desirable to have true 32-bit applications,
  3620.    which MSVC 2.0 generates.  These same rules apply to NT.
  3621.    -scot_wingo@msn.com 6/5/95
  3622.  
  3623. ----------------------------------------------------------------------------
  3624.  
  3625. 13.2.  Configuration Questions
  3626. ==============================
  3627.  
  3628. 13.2.1.  What are the memory requirements of MSVC?
  3629. ------------------------------------------------
  3630.    MSVC 1.5.x will work on a 486 class machine with a minimum of 4MB
  3631.    of RAM. 8MB will make your life much better.
  3632.  
  3633.    MSVC 2.x needs at least 16MB.  Microsoft recommends 20MB on the box.
  3634.  
  3635.    Note: VC 1.5 takes a big (3x) performance hit under all operating
  3636.    systems if you have less than 16 Meg.  I published an article about
  3637.    this (and other performance enhancements) in Windows/DOS Developers
  3638.    Journal in May, 95. 
  3639.    -jimb@turningpoint.com, email, 7/11/95
  3640.  
  3641. ...........................................................................
  3642.  
  3643. 13.2.2.  How can I get MSVC 2.1, I can't find it in stores?
  3644. ---------------------------------------------------------
  3645.    The point releases are part of the MSVC subscription (See section
  3646.    2.1.1.).  Only major releases are sold through retail, so you'll
  3647.    need to buy a subscription to get the point releases.
  3648.    Subscriptions are available from Microsoft, Programmer's Paradise
  3649.    and Programmer's shop. (See section 2.1 for info)
  3650.  
  3651. ...........................................................................
  3652.  
  3653. 13.2.3.  Should I run under Win 95 or NT?
  3654. ----------------------------------------
  3655.    Life is a bunch of trade offs.  The trade offs here are if you run
  3656.    under 95, you won't need as much memory, but the OS is not as
  3657.    robust as NT, so you will probably crash more.  On the flip side,
  3658.    if you run under NT (a full 32-bit OS), you won't crash as much,
  3659.    but alas, you will need more memory.  Personally, I prefer the NT
  3660.    route.  NT catches all memory problems and handles them nicely for
  3661.    you without destabilizing the system.
  3662.    -scot_wingo@msn.com, 6/18/95
  3663.  
  3664. ...........................................................................
  3665.  
  3666. 13.2.4.  How do I set the include/lib/exe directories?
  3667. -----------------------------------------------------
  3668.    MSVC versions < 2.0 used environment variables INCLUDE/LIBDIR/EXEDIR.
  3669.    MSVC versions > 2.0 uses settings in the Visual C++ Tools menu.
  3670.  
  3671.    Select "Tools" and then "Options" menu item.
  3672.    A dialog opens, and select "Directories" tab button.
  3673.    There you can set Include directories, Library directories, Executable 
  3674.    directories...
  3675.    -lee@sam1.info.samsung.co.kr (Lee, Jin Woo), via programmer.win32, 6/10/95
  3676.  
  3677. ...........................................................................
  3678.  
  3679. 13.2.5.  I can't compile any programs!  Help!
  3680. ---------------------------------------------
  3681.    Q> I just installed VC1.51 on my system.  Installation proceeded smoothly
  3682.    without any errors. 
  3683.    However, I can't compile any programs!  Even when I try to compile the
  3684.    simplest and shortest programs, I get this error message:
  3685.    
  3686.     Can't open the compilation response file
  3687.  
  3688.    A> A common cause of this type of error is having a TMP or TEMP environment
  3689.       variable which isn't pointing at a valid directory. Eg your AUTOEXEC.BAT
  3690.       file says:
  3691.  
  3692.       set TMP=C:\TMP
  3693.  
  3694.       and you don't have a "C:\TMP" directory.
  3695.       -Chris Marriott, chris@chrism.demon.co.uk, programmer.misc, 6/18/95
  3696.  
  3697. ...........................................................................
  3698.  
  3699. 13.2.6.  Can I setup a project to search different paths for source?
  3700. --------------------------------------------------------------------
  3701.    I would like to have my projects first search for the source in a
  3702.    local directory, and if it can't find it there, search a network
  3703.    drive.
  3704.  
  3705.    TODO: Find answer to this one, seems good.  Asked on tools 6/21 by
  3706.    Joe Kinsella, jkinsella@procd.com
  3707.  
  3708. ...........................................................................
  3709.  
  3710. 13.2.7.  How do I build a browser file for all of MFC?
  3711. ------------------------------------------------------
  3712.    It's nice to be able to browse the MFC classes and source code, the
  3713.    best way to do this is via some Microsoft supplied .BAT files for
  3714.    the Microsoft Software Library:  
  3715.  
  3716.    BLDBSC15.BAT - for VC++ 1.5
  3717.    BLDBSC20.BAT - for VC++ 2.0
  3718.    BLDBSC21.BAT - for VC++ 2.1
  3719.  
  3720.    Basically, you want invoke the compiler on every file with /Zs as
  3721.    the option, which means generate the .sbr file and no .obj.
  3722.    Next, you want to run bscmake.exe on the generated .sbr files to
  3723.    create your .bsc file.  The MFC makefile will complain about the
  3724.    .obj's being missing, but you can ignore that warning.  It will
  3725.    take significantly longer and more time to create both .sbrs and
  3726.    .objs.
  3727.    -scot_wingo@msn.com, 6/25/95
  3728.  
  3729.    It is worth noting that VC 2.1 has a prebuilt browser file that is
  3730.    on the CD-ROM  but is not installed.  It can be loaded at any time
  3731.    into the IDE with the File/Open command.
  3732.    -jimb@turningpoint.com, email, 7/11/95
  3733.  
  3734.    If you are using the 32-bit versions, you can get more information in
  3735.    the README.TXT file in the \msvc20\mfc\src directory.  What is tells
  3736.    you is to move to that directory and from the dos prompt run:
  3737.  
  3738.          nmake DEBUG=1 BROWSEONLY=1
  3739.  
  3740.    -billb@microsoft.com, mfc-l, 7/17/95
  3741.  
  3742. ---------------------------------------------------------------------------
  3743.  
  3744. 13.3.  Language feature questions
  3745. =================================
  3746.  
  3747. 13.3.1.  Does MSVC support templates and exception handling?
  3748. ---------------------------------------------------------
  3749.    The 32-bit Visual C++ 2.0 release introduced templates and
  3750.    exception handling.  There is no support for these C++ features in
  3751.    16-bit versions of the product. 
  3752.  
  3753.    It is worth noting that the 16 bit implementation of THROW and
  3754.    CATCH are brain-damaged.  They do not clean up the stack as it
  3755.    unwinds.  
  3756.    -jimb@turningpoint.com, email, 7/11/95
  3757.  
  3758. ...........................................................................
  3759.  
  3760. 13.3.2.  Does MSVC support the Standard Template Library?
  3761. --------------------------------------------------------
  3762.    You can not compile the HP freeware version of STL with MSVC 2.x.
  3763.    There are some problems with templates that keep this from working.
  3764.    However, several commercial versions of STL are available that work
  3765.    with Visual C++ 2.x.  
  3766.   -scot_wingo@msn.com, 6/7/95
  3767.  
  3768. ...........................................................................
  3769.  
  3770. 13.3.3.  Does MSVC support RTTI?
  3771. ------------------------------
  3772.    Currently none of the MSVC releases support RTTI (C++ Run Time Type
  3773.    Information).  However, all classes derived from CObject support
  3774.    CRuntime which does basically the same thing using some clever macros.
  3775.    -scot_wingo@msn.com, 6/7/95
  3776.  
  3777. ---------------------------------------------------------------------------
  3778.  
  3779. 13.4.  Religious questions
  3780. ==========================
  3781.  
  3782. 13.4.1.  Which is better OWL or MFC, BC++ or MS MSVC?
  3783. ---------------------------------------------------
  3784.    This is constantly getting asked on Usenet.  The answer really
  3785.    depends on what you are doing.  If you demand the latest C++
  3786.    features such as templates, RTTI, etc.. BC++ usually has these
  3787.    first. But be careful, when Borland went from OWL 2 to 3 (or was it
  3788.    1 to 2?) they made everybody completely rewrite their applications.
  3789.    Applications that were written with MFC 1.0 still work with the
  3790.    newer versions of MFC today!
  3791.    The best advice is to get the features from each vendor and see
  3792.    what's best for your situation.
  3793.    -scot_wingo@msn.com 6/8/95, comp.lang.c++ 
  3794.  
  3795. ...........................................................................
  3796.  
  3797. 13.4.2.  Should I use Visual C++ or Visual Basic?
  3798. -------------------------------------------------
  3799.    (Here's a funny analogy I saw posted->)
  3800.    Well, the principle is the same (create interface, add code to respond
  3801.    to events, add code to do something useful).
  3802.    But programming in VB is like riding a kiddy bike, while programming
  3803.    in C++ is like driving a Formula 1 racing car - be prepared for accidents.
  3804.  
  3805.    But seriously, VB is interpreted, MSVC is compiled, therefore MSVC
  3806.    programs should be much faster (if written well).  It's generally
  3807.    believed that VB is the best way to 'prototype' a user-interface,
  3808.    but when it comes to code reuse and solving larger problems, VB
  3809.    breaks down.  Visual C++ on the other hand is not as easy to use as
  3810.    VB, but once you learn it, you can write much more complex programs
  3811.    than with VB.
  3812.  
  3813.    The readers digest version of all this is:  It depends on the application
  3814.    you are writing.
  3815.    -scot_wingo@msn.com, 6/18/95
  3816.  
  3817. ...........................................................................
  3818.  
  3819. 13.4.3.  MFC philosophy (from a microsoftie!)
  3820. ---------------------------------------------
  3821.    Just a note about the classes provided in MFC... keep in mind that
  3822.    these classes are designed as "general-purpose" classes, not
  3823.    "all-purpose" classes. No one implementation can have performance
  3824.    characteristics that are ideal for *all* possible applications. It
  3825.    is up to you, the programmer, to evaluate a provided implementation
  3826.    and decide whether it is appropriate for the task at hand. If it is
  3827.    not, you have several alternatives: modify or subclass the provided
  3828.    implementation; find a more appropriate class from another source;
  3829.    or write one from scratch. 
  3830.    -elsbree@nwrain.com, mfc-l, 7/15/95
  3831.  
  3832. ---------------------------------------------------------------------------
  3833.  
  3834. 13.5. Advanced Visual C++ tips and tricks
  3835. =========================================
  3836.  
  3837. 13.5.1. How do I see the MSVC 'Easter Eggs'?!
  3838. --------------------------------------------
  3839.     FYI: Easter eggs are hidden screens that usually have
  3840.          secret initials, development team names, etc..
  3841.  
  3842.     1.  To see the spinning PLUS with the MSVC team members:
  3843.         In MSVC 2.0 or 2.1->
  3844.         A.  Bring up the about box: help/about
  3845.         B.  Press control-tab and double click in the middle of
  3846.             the box at the same time.
  3847.         NOTE: You must have the MSVC CD loaded for this to work, I think.
  3848.  
  3849.     2. If above does not work, try this->
  3850.        copy the MSVCCRD.DLL from the CD to msvc\bin
  3851.        CTRL+Double-click the picture in the dialog
  3852.        note: release the CTRL key at the same time as the second click.
  3853.        -ohallorj@pwc-tpc.ca, Jeff O'Halloran
  3854.  
  3855. ...........................................................................
  3856.  
  3857. 13.5.2. What are the command line options to MSVC?
  3858. --------------------------------------------------
  3859.    * MSVC /V - Runs the compiler in a dos box (version 1.5 only?)
  3860.      -mark@techop.demon.co.uk
  3861.  
  3862.    * MSVC /NOLOGO - Runs MSVC without the about box, saves second
  3863.      or 2.
  3864.  
  3865.    * MSVC /bppassc:yes - Enables a cool breakpoint counter in the
  3866.      'breakpoints' dialog (under the Debug menu).
  3867.      -jimb@turningpoint.com, email 7/11/95
  3868.  
  3869.    * MSVC -p <pid> - attatches VC++ to a process.
  3870. ...........................................................................
  3871.  
  3872. 13.5.3.  How to change the color of ClassWizard generated code!
  3873. ---------------------------------------------------------------
  3874.    The default color for text modified by the ClassWizard is black
  3875.    print on a white background. Visual C++ is aware of the code that the
  3876.    ClassWizard modifies and can highlight these changes for you using a
  3877.    different color. 
  3878.  
  3879.    Highlighting the text ClassWizard modifies makes the new
  3880.    modifications very obvious and easy to find. To do this, from the
  3881.    Tools menu, choose Options. Then select the Colors tab in the Options
  3882.    dialog box. From the Set Colors For listbox, select Wizard-Modified
  3883.    Code. Then define the colors for text and the background. 
  3884.  
  3885.    NOTE: Only applies to VC++ 2.x, but it's waaaay cool!
  3886.    -MS FAQ, 6/25/95
  3887.  
  3888. ...........................................................................
  3889.  
  3890. 13.5.4.  Ten cool things you can do in the VC++ editor!
  3891. -------------------------------------------------------
  3892.    10. CTRL+ALT+T shows your tab characters
  3893.    9.  SHIFT+ESC closes the active dockable window
  3894.    8.  CTRL+F3 finds the next occurrence of the current word
  3895.    7.  CTRL+M finds the matching bracket
  3896.    6.  CTRL+> and CTRL+< find the next/prev matching #ifdef/#else/#endif
  3897.    5.  CTRL+SHIFT+R starts/stops macro recording
  3898.    4.  CTRL+SHIFT+P plays recorded macro
  3899.    3.  Right-click #includes to open the header file
  3900.    2.  TAB/SHIFT+TAB indent or unindent selected lines
  3901.    1.  Hold ALT key down to select columns
  3902.    -Jeff Henshaw, borrowed of MFC PDC slide, 6/25/95
  3903.  
  3904. ---------------------------------------------------------------------------
  3905.  
  3906. 13.6.  Miscellaneous Visual C++ questions
  3907. =========================================
  3908.  
  3909. 13.6.1.  What are all these files that MSVC is creating?!
  3910. --------------------------------------------------------
  3911.    Here's a table that explains the common extensions and what MSVC
  3912.    uses them for:
  3913.  
  3914.    Extension           Use                        Notes
  3915.    ------------------------------------------------------------------
  3916.    APS                 App Studio file
  3917.    BSC                 Browser file               SBR's combined into 1 BSC.
  3918.    CLW                 Class Wizard file          
  3919.    ILK                 Incremental linker file
  3920.    PCH                 Pre-compiled header file
  3921.    PDB                 Debugging info             /Z7 affects this
  3922.    RES                 RC 'object' file           Linked into EXE
  3923.    SBR                 Browser info for 1 file    Combined into BSC
  3924.    VCP                 Visual C++ state file
  3925.    
  3926.    TODO: Fill this table in more completely.
  3927.  
  3928. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3929.  
  3930. 14. Third Party MFC Products
  3931. ============================
  3932.    This section lists products that make the MFC developer's life easy.
  3933.    No OCX/VBX type products are listed here, go check some catalog.
  3934.    Where possible, I've put a review by someone!
  3935.  
  3936.    * Premia CodeWright Fusion
  3937.      (800) 547-9902
  3938.      (503) 641-6000
  3939.      Great add-in editor for MSVC, they have both 16 and 32-bit versions.
  3940.      TODO: Get a review, anyone?
  3941.  
  3942.    * Nu-Mega Bounds-Checker
  3943.      (800) 468-6342
  3944.      (603) 889-2386
  3945.      Lets you know if you've clobbered memory, has a special MFC feature
  3946.      so you can see class names and paths through message maps.
  3947.      TODO: Review?
  3948.  
  3949.    * Rogue Wave Tools.h++
  3950.      TODO: Contact info.
  3951.  
  3952.      * There's been a looong thread on the mfc-l about how hard this
  3953.        is to use with MFC, people are trying everything and it doesn't
  3954.        seem to help.  Evidently they use a totally different memory model,
  3955.        internationalization and persistance.
  3956.        -various, mfc-l 7/18/95 - 7/27/95
  3957.  
  3958. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3959.  
  3960. 15. MFC FAQ Revision History
  3961. ============================
  3962.  
  3963. * 1.0 Beta  5/25/95
  3964.   -Did heavy work on TOC, more info, history.  Not many FAQs yet.
  3965.   
  3966. * 1.0 Final Beta  6/2/95
  3967.   -Put in some FAQs I keep seeing. Integrated feedback from mfc-l posting.
  3968.   -Posted one last time to mfc-l for final feedback before FCS...
  3969.  
  3970. * 1.0 FCS! 6/8/95
  3971.   -Put in some FAQs from MSVC KB
  3972.   -Got lots of good feedback from mfc-l
  3973.   -Got some new FAQs from Usenet
  3974.   -Integrated news from MFC Conference, MSVC 4/2.2, etc..
  3975.   -Posted to Usenet and CompuServe for first time.
  3976.  
  3977. * 1.1 6/25/95
  3978.   - Lot's of new stuff from MFC PDC
  3979.   - Lot's of cserve and usenet FAQs too
  3980.   - redid VC++ section
  3981.   - Lots of good book reviews coming out.
  3982.   - Grabbed some stuff from new MS FAQ too.
  3983.  
  3984. * 1.2 7/30/95
  3985.   - Updated from 1.1
  3986.     * Lots of book reviews got emailed and added.
  3987.     * Windows common controls section added.
  3988.     * 11.x - probably needs new hierarchy soon.
  3989.   - Introducing "Instant-FAQ (TM)"
  3990.   - Added article section to complement book section
  3991.   - Updated VC++ 2.2 information.
  3992.  
  3993. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3994.  
  3995.                       =-=-=-=-THE END-=-=-=-=-=
  3996.