home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Doc / MFCFAQ.5_5 / MFC_FAQ.TXT < prev    next >
Encoding:
Text File  |  1997-10-30  |  229.8 KB  |  6,507 lines

  1.           Microsoft Visual C++/Microsoft Foundation Classes (MFC)
  2.  
  3.                 Frequently Asked Questions (aka the MFC FAQ)
  4.  
  5.                Scot Wingo/Justin Rudd(mfc_faq@stingsoft.com)
  6.  
  7.                                 Version 5.0
  8.  
  9.                            Last updated: 5/15/97
  10.  
  11.  
  12.  
  13.                                   [Image]
  14.  
  15.  
  16.  
  17.                              Stingray Software
  18.                    [Stingray home page - click me now!!!]
  19.  
  20. The MFC FAQ is graciously sponsored by Stingray Software. Stingray Software
  21. was founded to create and market MFC extensions. It is our belief that
  22. MFC/VC++ developers would rather use object-oriented class libraries,
  23. instead of binary, black box, OLE controls (a.k.a. ActiveX controls). We
  24. are now almost two years old and have several thousand customers who agree
  25. that MFC extensions are a great solution to many Windows development
  26. problems.
  27.  
  28. Here is a quick list of our products:
  29.  
  30.    * Objective Chart - 100% MFC charting package.
  31.    * Objective Diagram - MFC GDI abstraction and Visio-like embeddable
  32.      graphics.
  33.    * Objective Grid - 100% MFC grid control - very powerful for database
  34.      apps too.
  35.    * Objective Plug-in - Web-enable your MFC apps with OPI!
  36.    * Objective Toolkit - Over 60 MFC extensions including docking windows,
  37.      tree control, customizable toolbar, etc..
  38.  
  39.  
  40.  
  41. Click here to go to the Stingray WEB! - Free demos, white papers, etc..
  42.  
  43.                                   [Image]
  44.  
  45.  
  46.  
  47.                               Shameless Plugà
  48.  
  49. Don't be one of the few MFC/VC developers on the planet without a copy of
  50. MFC Internals! This is the ONLY book that covers the "other" side of MFC -
  51. how it is implemented. Every hit an ASSERT in MFC? A bug? Ever have to work
  52. around some limitation in MFC? MFC Internals is for you! The book covers
  53. MFC 4.0, but NOTHING has changed since then in the areas covered, so it is
  54. still a very valid reference for those of you that don't want to stop at
  55. the written documentation. http://www.amazon.com has the best price and we
  56. have some details on the book at http://www.stingsoft.com/mfc_internals or
  57. at http://www.aw.com .
  58.  
  59.                      Buy a copy (or 2 or three) today!!
  60.  
  61.                                   [Image]
  62.  
  63.  
  64.  
  65.                          Version 5.0 Release Note
  66.  
  67. Well, it's been over a year since I have been able to update the MFC FAQ.
  68. I've been putting 110% of my energies into Stingray where we are pushing
  69. the MFC envelope and creating cool extensions that help MFC developers like
  70. you work with MFC more effectively. In fact, for fun recently we counted
  71. how many lines of code are in our various MFC extension products and were
  72. startled to see that we have written almost five times as much code
  73. EXTENDING MFC as is IN MFC!!
  74.  
  75. I finally have been able to piece together enough free time to put out this
  76. release of the MFC FAQ, version 5.0. This release brings the FAQ up to
  77. speed with version 5.0 of Visual C++ (4.21 of MFC if you're counting) and
  78. sadly will be the last MFC FAQ release for me.
  79.  
  80. But don't despair - one of the new hotshot MFC programmers at Stingray,
  81. Justin Rudd, has volunteered to carry the MFC FAQ torch and hopefully he
  82. will be able to update the FAQ more frequently than I have. I hope that you
  83. all give Justin as many helpful comments and feedback as I've received over
  84. the years. (I think I'm going to cry!!!! Ok, I'm over it nowà) FYI, George
  85. Shepherd and myself are regular columnists for the Dr. Dobbs Journal (The
  86. Undocumented Corner Column)- http://www.ddj.com and the Microsoft Systems
  87. Journal (The Visual Developer Column) - http://www.msj.com and also (phew!)
  88. Visual C++ Developer's Journal - http://www.vcdj.com so check out the new
  89. Shepherd/Wingo material monthly in these different mags. (The Stingray
  90. scoop and monthly Scot's Soapbox at http://www.stingsoft.com are also
  91. updated pretty frequently.)
  92.  
  93. Many of you may not realize it, but we receive almost a hundred emails a
  94. day at MFC FAQ headquarters. Most of the emails are Instant-FAQ™
  95. submissions, but many of them are questions about MFC. Unfortunately, we
  96. are not able to answer your questions, this would take far too long and it
  97. would only benefit one person - you. Instead, we urge you to post your
  98. question to a public forum, namely the MFC news groups or the MFC mailing
  99. list and we have even created a MFC FAQ newsgroup that we invite you to
  100. post questions to. By sharing your question and answer with the MFC
  101. community, many more people benefit from the experience. The MFC FAQ
  102. newsgroup and a variety of others are discussed in topic 2.2 of the MFC
  103. FAQ.
  104.  
  105. Since this is my last time on the MFC FAQ soap box, I thought this would be
  106. a great time to address a VERY WRONG rumor/opinion that MFC is dead that
  107. I've been seeing on the newsgroups for the last several months. There have
  108. been so many rumors that I thought it would be fun to take a look at the
  109. top ten rumors behind MFC's ill reported demise:
  110.  
  111. They are:
  112.  
  113. 10. Microsoft will replace MFC with ATL.
  114.  
  115. 9. I read that MFC is in "maintenance mode" in a magazine (it's true that
  116. Windows Tech Journal did incorrectly report this. The irony is that Oakley
  117. actually "died" and MFC is really alive.)
  118.  
  119. 8. VC++ 5.0 didn't have a major release of MFC, so it is dead.
  120.  
  121. 7. There are just no more features that could be added to MFC.
  122.  
  123. 6. Java will kill C++, thus killing MFC.
  124.  
  125. 5. There is nobody on the MFC team anymore - they have all moved to
  126. different areas of Microsoft.
  127.  
  128. 4. Microsoft stopped the Visual C++ subscription program, so MFC is dead.
  129.  
  130. 3. I read a posting on a newsgroup from this guy in Portugal that heard
  131. from a friend at Microsoft that MFC is dead.
  132.  
  133. 2. Stingray has done such a great job filling the holes in MFC that
  134. Microsoft decided they couldn't keep up.
  135.  
  136. And finally, the number one reason that people think MFC is deadà.
  137.  
  138. 1. Aliens have abducted the MFC team and they are now hiding behind a Comet
  139. touring the Universe, instead of working on MFC.
  140.  
  141.  
  142.  
  143. The truth of the matter is that MFC is NOT DEAD! Don't believe me? Well
  144. maybe you will believe it from the horses mouth, here is an MFC FAQ
  145. submission from Mike Blaszczak, who is the current MFC Team Lead, on the
  146. subject of MFC's incorrectly rumored demise:
  147.  
  148. Q: Is MFC dead?
  149.  
  150. A: No. MFC continues to grow and change as the operating system grows and
  151. changes, and as the needs of our users continue to grow and mature. During
  152. the summer of 1997, some MFC team members will provide presentations under
  153. strict non-disclosure agreements that explain some of the planning that's
  154. happening for the next version of the product. But the caveat in the above
  155. question still strongly applies: the development of the product might
  156. change directions to fill an unforseen pressing need, but the product is by
  157. no means dead.
  158.  
  159. Q: Does ATL replace MFC?
  160.  
  161. A: No. ATL and MFC are designed to solve two very different problems.
  162.  
  163. -Mike Blaszczak (mikeblas@microsoft.com)
  164.  
  165. So there you have it folks, those of you that were genuinely concerned
  166. (like me!) that MFC was in maintenance mode, or never going to see another
  167. major revision, you can sleep again. For those of you that continue to
  168. spread the incorrect rumor that MFC is dead - stop it! If you see anyone
  169. posting to newsgroups that MFC is dead, please help set the record straight
  170. and feel free to copy this portion of the MFC FAQ and paste it right into a
  171. reply.
  172.  
  173. I think that this was a big conspiracy by the old Borland OWL team (or
  174. maybe JavaSoft) to scare people away from MFC.
  175.  
  176. Together we can stop the madness! LONG LIVE MFC!!! (Wow - I'm glad I
  177. finally was able to get that off my chest <g>)
  178.  
  179. Another piece of exciting news is that one of the old-time MFC team members
  180. is back on the MFC Team! After a tour through one of Microsoft's Java
  181. teams, Dean has rejoined the ranks of the MFC Team. FYI, Dean wrote large
  182. chunks of the OLE support in MFC, etc.. Rumor also has it that Dean has a
  183. girlfriend now, so he probably won't be pulling too many all-nighters, at
  184. least on MFC <g>
  185.  
  186.                                   [Image]
  187.  
  188.  
  189.  
  190. Want to learn more about MFC/VC?
  191.  
  192.  
  193.  
  194. There are three resources I am compelled to plug before we get started with
  195. the FAQ that every MFC/VC++ developer should be aware of. These are covered
  196. in detail in section TODO, but I want to bring them to your attention here
  197. too.
  198.  
  199.   1. The MFC mailing list - this was sponsored by the world famous David
  200.      Elliott, but he burned out on maintaining and moderating the list and
  201.      now it is sponsored by Microsoft and moderated by a team of
  202.      moderators. This is an EXCELLENT way to learn about the MFC FAQ.
  203.      Details on joining are in section 2.
  204.   2. Visual C++ Developer's Conference - This is a conference 100% about
  205.      Visual C++. If you are like me and are getting burned out on every
  206.      conference suddenly covering the Internet, but you want to learn more
  207.      about OLE/MFC/ATL/VC/COM/ActiveX as far as applications/Windows
  208.      programming is concerned, then VCDC is for you. Section 2 has details
  209.      or surf to http://www.vcdj.com .
  210.   3. Visual C++ Developer's Journal - An online monthly magazine about
  211.      VC++/MFC - http://www.vcdj.com - excellent stuff. I wish it was a
  212.      printed magazine, but online works I guess - better than nothing!
  213.  
  214.    *
  215.                                      o [Image]
  216.  
  217.           What's New in MFC FAQ 5.0??
  218.  
  219.           Ok - enough rambling it's time for the moment you have all been
  220.           waiting for - new MFC FAQ material! This version of MFC FAQ is
  221.           only being distributed as an HTML file right here at this
  222.           location. If you are not reading this at
  223.           http://www.stingsoft.com/mfc_faq, then it is probably an old
  224.           version so you should click on that link and go the site to see
  225.           if it has been updated. If you don't like the fact that the FAQ
  226.           is 100% HTML - tough, it takes too much work converting it to
  227.           word/html/rtf and back again - we're focusing on content here not
  228.           format.
  229.  
  230.           One of the cool things about this release is that many of the
  231.           FAQs have been answered by members of the MFC team or someone
  232.           here at Stingray so you can be pretty sure they are going to be
  233.           helpful.
  234.  
  235.           Disclaimer: One of the things we do at Stingray for product
  236.           ideas, especially our Objective Toolkit product, is monitor the
  237.           newsgroups and implement the most commonly asked for features
  238.           that are not in MFC. For example, docking windows such as those
  239.           found in Visual Studio. So the answer to this FAQ is that
  240.           Stingray's Objective Toolkit does this, but it is not trivial to
  241.           do with raw MFC. It is not the intention that the MFC FAQ be a
  242.           total product plug, but to be honest if that's the answer, that's
  243.           what is going to end up in here. If this bothers you, press
  244.           "back" now.
  245.  
  246.           To find out what is new in this release of the MFC FAQ, bounce
  247.           down to the table of contents and follow this legend:
  248.  
  249.           % - An entirely new, fresh FAQ!
  250.  
  251.           & - An updated FAQ
  252.  
  253.           If there is no mark, the FAQ hasn't really changed so it wasn't
  254.           touched in this release. If you have ideas for new sections of
  255.           the MFC FAQ (the ActiveX/OLE section is admittedly not that great
  256.           right now), please email mfc_faq@stingsoft.com.
  257.  
  258. ------------------------------------------------------------------------
  259.  
  260. Instant-FAQ
  261.  
  262. To automatically be notified of new MFC FAQ releases, we invite you to join
  263. the Instant-FAQ program. To join, complete the online form below or send
  264. your email address to MFC FAQ headquarters via mailto:mfc_faq@stingsoft.com
  265. and we'll add you for free. We at MFC FAQ headquarters aim to please!! (In
  266. other words, it's like a free MFC FAQ subscription, this is NOT a mailing
  267. list or listserver.)
  268.  
  269. ------------------------------------------------------------------------
  270. ------------------------------------------------------------------------
  271.  
  272. Copyright
  273.  
  274. This document is compilation Copyright (c) 1997 by Scot Wingo. It may be
  275. freely copied and/or distributed in its entirety as long as this copyright
  276. notice is not removed. It may not be sold for profit or incorporated into
  277. commercial products without the author's written permission. [Compilation
  278. copyright means that you can freely use individual sections of this
  279. document, but any significant collection of sections is subject to the
  280. copyright. Hey, I may want to turn this into a book or a movie some day!]
  281.  
  282. This FAQ is in no way connected with Microsoft. It contains some answers to
  283. frequently asked questions about their products. The author in no way
  284. guarantees that any of these answers are correct. This is just a collection
  285. of information posted to public on-line forums to help the average MFC
  286. programmer. [In other words, please don't sue me. ]
  287.  
  288. ------------------------------------------------------------------------
  289.  
  290.    *
  291.                             o MFC FAQ TABLE OF CONTENTS
  292.  
  293.           &1.  MFC FAQ INFO AND CREDITS
  294.  
  295.                  &1.1.  HOW DO I GET THIS FAQ?
  296.  
  297.                   1.2.  WHAT'S THE GOAL OF THIS FAQ?
  298.  
  299.                   1.3.  WHY ARE YOU DOING THIS?
  300.  
  301.                   1.4.  HOW CAN I CONTRIBUTE!?!
  302.  
  303.                  &1.5.  CREDITS
  304.  
  305.                  &1.6.  HOW IS THIS DIFFERENT FROM THE MSVC MFC FAQ?
  306.  
  307.                   1.7.  WHAT OTHER LANGUAGES IS THIS FAQ TRANSLATED TO?
  308.  
  309.                           1.7.1.  Japanese version of MFC FAQ
  310.  
  311.           2.  WHERE TO GO FOR JUICY MFC INFORMATION
  312.  
  313.                   2.1. MICROSOFT
  314.  
  315.                           &2.1.1.  Visual C++ and Visual C++ subscription.
  316.  
  317.                           &2.1.2.  Microsoft Developers Network (MSDN)
  318.  
  319.                           &2.1.3.  Knowledge Databases
  320.  
  321.                           &2.1.4.  Microsoft Software Library
  322.  
  323.                   2.2.  INTERNET
  324.  
  325.                           &2.2.1.  World Wide Web Pages
  326.  
  327.                           &2.2.2.  Mailing lists
  328.  
  329.                           &2.2.3.  Usenet Newsgroups
  330.  
  331.                           2.2.4.  Other FAQs of interest
  332.  
  333.                           2.2.5.  FTP sites
  334.  
  335.                          &2.2.6.  The MFC FAQ FTP Archive!
  336.  
  337.                   &2.3.  COMPUSERVE
  338.  
  339.                   &2.4.  PRINTED MATTER
  340.  
  341.                           &2.4.1. Magazines and journals
  342.  
  343.                           &2.4.2. Books on MFC
  344.  
  345.                           &2.4.3. Cool MFC Articles
  346.  
  347.                  &2.5.  TRADE SHOWS
  348.  
  349.                  &2.6.  USERS GROUPS
  350.  
  351.                   2.7.  TECHNICAL SUPPORT
  352.  
  353.           3.  A BRIEF HISTORY OF MFC
  354.  
  355.                   3.1.  HOW DO I KNOW WHAT VERSION OF MFC I'M USING?
  356.  
  357.                   3.2.  PRE-MFC 1.0
  358.  
  359.                   3.3.  MFC 1.0
  360.  
  361.                   3.4.  MFC 2.0
  362.  
  363.                   3.5.  MFC 2.1
  364.  
  365.                   3.6.  MFC 2.5
  366.  
  367.                           3.6.1.  MFC 2.51
  368.  
  369.                           3.6.2.  MFC 2.52
  370.  
  371.                           3.6.3.  MFC 2.52b
  372.  
  373.                           3.6.4.  MFC 2.52c
  374.  
  375.                   3.7.  MFC 3.0
  376.  
  377.                   3.8.  MFC 3.1
  378.  
  379.                   3.9.  MFC 3.2
  380.  
  381.                   3.10. MFC 4.0
  382.  
  383.                  %3.11. MFC 4.1
  384.  
  385.                  %3.12. MFC 4.2
  386.  
  387.                  %3.13. MFC 4.2b
  388.  
  389.                  %3.14. MFC 4.21
  390.  
  391.                  &3.15. TABLE OF MFC RELEASES
  392.  
  393.           4. GENERIC CLASS QUESTIONS
  394.  
  395.                   4.1.  CEXCEPTION - EXCEPTIONS AND EXCEPTION HANDLING.
  396.  
  397.                           4.1.1.  How do I throw a CUserException derived exception?
  398.  
  399.                           4.1.2.  Do my exceptions have to be derived from CUserException?
  400.  
  401.           5.  GDI CLASS QUESTIONS
  402.  
  403.                   5.1.  CDC
  404.  
  405.                           5.1.1.  How do I create a CDC from a HDC?
  406.  
  407.                   5.2.  CBITMAP
  408.  
  409.                           5.2.1.  How do I read a 256 color bitmap file from disk?
  410.  
  411.           6.  WINDOW, CONTROL, AND DIALOGS CLASS QUESTIONS
  412.  
  413.                   6.1.  WINDOWS
  414.  
  415.                           6.1.1.  How can I use a custom icon for a window?
  416.  
  417.                           6.1.2.  How do I change the styles for a window that's created by MFC?   5
  418.  
  419.                           6.1.3.  How do I get the minimal size of a window using MFC?
  420.  
  421.                           6.1.4.  How do I change a Window's title?
  422.  
  423.                           6.1.5.  How do I get rid of 'Untitled' in my main window caption?
  424.  
  425.                           6.1.6.  How do I maximize my MDI child?
  426.  
  427.                           6.1.7.  Why does focus go nutso with a CSplitterWnd?
  428.  
  429.                          %6.1.8. How do I make my first MDI child window start out maximized?
  430.  
  431.                   6.2. CONTROLS
  432.  
  433.                           6.2.1.  How do I get a CControl from a Dialog Template?
  434.  
  435.                           6.2.2.  How do I subclass a control using MFC?
  436.  
  437.                           6.2.3.  Why do I get an ASSERT when I subclass a control?
  438.  
  439.                           6.2.4.  How do I validate the contents of a control when it loses focus?
  440.  
  441.                           6.2.5.  How do I enable/disable a bank of checkboxes?
  442.  
  443.                           6.2.6.  How do I change the background color of a control?
  444.  
  445.                           6.2.7.  How do I trap the key for my control?
  446.  
  447.                           6.2.8.  How can I DDX with a multiple selection listbox?
  448.  
  449.                           6.2.9.  How do I change the background color of a BUTTON???
  450.  
  451.                           6.2.10.  Why isn't CEdit putting things on separate lines?
  452.  
  453.                           6.2.11.  How do I get to the CEdit in a combobox?
  454.  
  455.                           6.2.12.  How do I load more than 64K into an edit control?
  456.  
  457.                           6.2.13.  How do I subclass the listbox portion of a combobox?
  458.  
  459.                           6.2.14.  How do I inherit a from a MFC standard control class?
  460.  
  461.                   6.3.  DIALOGS
  462.  
  463.                           6.3.1.  How do I center my dialog?
  464.  
  465.                           6.3.2.  How do I get the 'old style' common dialogs on win95?
  466.  
  467.                           6.3.3.  How do I subclass a win95 common dialog?
  468.  
  469.                           6.3.4.  CDialog::Create() fails, what could be wrong?
  470.  
  471.                           6.3.5.  How do I create a toolbar/statusbar in a dialog?
  472.  
  473.                           6.3.6.  Why isn't my CDialog::PreCreateWindow() getting called?
  474.  
  475.                           6.3.7.  How do I embed a common dialog in a property page?
  476.  
  477.                           6.3.8.  Why can't I DDX/DDV to initialize my CDialog controls?
  478.  
  479.                           6.3.9.  How do I change the captions of a CPropertyPage?
  480.  
  481.                           6.3.10.  How do I trap F1 in my dialog?
  482.  
  483.                           6.3.11.  How do I change the icon for a dialog-only MFC application?
  484.  
  485.                   6.4. CONTROL BARS, STATUS BARS, TOOLBARS, DIALOG BARS.
  486.  
  487.                           6.4.1.  How do I add a combobox to my toolbar?
  488.  
  489.                           6.4.2.  How do I update the text of a pane in a status bar?
  490.  
  491.                          %6.4.3.  How do I make my CToolBar customizable at run-time?
  492.  
  493.                           6.4.4.  How do I turn off the toolbar or status bar?
  494.  
  495.                           6.4.5.  How do I create a toolbar/statusbar in a dialog?
  496.  
  497.                          %6.4.6. Why doesn't MFC support the new controls provided by IE?
  498.  
  499.                          %6.4.7. Why doesn't MFC have toolbars like the Office 97 application?
  500.  
  501.                          %6.4.8. Why doesn't MFC support command bar menus like the Visual C++ IDE?
  502.  
  503.                   6.5. MENUS
  504.  
  505.                           6.5.1.  How do I get a pointer to the menu bar in a MDI app?
  506.  
  507.                           6.5.2.  How do I implement a right-mouse popup-menu?
  508.  
  509.                           6.5.3.  How do I dynamically change the mainframe menu?
  510.  
  511.                           6.5.4.  How do I 'attach' a menu to a window's creation/destruction?
  512.  
  513.                   6.6.  WINDOWS COMMON CONTROLS (A.K.A. WINDOWS 95 CONTROLS)
  514.  
  515.                           6.6.1.  Can I use these controls under NT or Win32s?
  516.  
  517.                           6.6.2.  Where's a demo of these wickedly cool controls?
  518.  
  519.                           6.6.3.  How do you handle NM_DBLCLK for a CListCtl?
  520.  
  521.                           6.6.4.  Does CTreeCtrl support multiple selection?
  522.  
  523.                           6.6.5. When I expand a node in my CTreeCtrl, there's no visual feedback, what to do?
  524.  
  525.                          %6.6.6. How do I get multiple selection, tooltips, editable nodes, multiple columns in my trees?
  526.  
  527.                  %6.7. CSPLITTERWND
  528.  
  529.           7.  DOCUMENTS, VIEWS AND FRAME CLASS QUESTIONS
  530.  
  531.                   7.1.  VIEWS
  532.  
  533.                           7.1.1.  How do I size a view?
  534.  
  535.                           7.1.2.  How do I size a CFormView?
  536.  
  537.                           7.1.3.  How do I use new views with a doc template?
  538.  
  539.                           7.1.4.  How do I change the background color of a view?
  540.  
  541.                           7.1.5.  How do I get the current View?
  542.  
  543.                           7.1.6.  How do I create multiple views on one document?
  544.  
  545.                           7.1.7.  How do I get all the views in an MDI app?
  546.  
  547.                           7.1.8.  How do I make a CScrollView "mouse scrollable"?
  548.  
  549.                   7.2.  DOCUMENTS
  550.  
  551.                           7.2.1.  Do I have to use the Document/View architecture?
  552.  
  553.                           7.2.2.  How do I get the current Document?
  554.  
  555.                           7.2.3.  When are documents destroyed?
  556.  
  557.                           7.2.4.  How do I create multiple documents?
  558.  
  559.                           7.2.5.  How do I get a list of open documents?
  560.  
  561.                           7.2.6.  How do I keep my application from creating a new document at startup?
  562.  
  563.           8.  OLE CLASS QUESTIONS
  564.  
  565.                   8.1.  STRUCTURED STORAGE/COMPOUND FILES
  566.  
  567.                           8.1.1.  When I upgraded, I could not read my files generated by the old version of MFC?
  568.  
  569.                   8.2.  OLE CONTROLS (PREVIOUSLY CALLED OCX'S)
  570.  
  571.                           8.2.1.  What is an OLE control?
  572.  
  573.                           8.2.2.  How do I write OLE controls?
  574.  
  575.                           8.2.3.  What versions of MFC support OLE control containment?
  576.  
  577.                           8.2.4.  How do I get application specific control bars to disappear when in-placed editing.
  578.  
  579.           9. WOSA CLASS QUESTIONS
  580.  
  581.                   9.1. CRECORDSET
  582.  
  583.                           9.1.1.  When I add a CRecordSet class, I get tons of linker errors..
  584.  
  585.                           9.1.2.  I need a CRecordSet::Find(), what should I do?
  586.  
  587.                   9.2.  WINSOCK
  588.  
  589.                           9.2.1.  I'm having problems with CSocket blocking, what's up?
  590.  
  591.           10.  DLL AND BUILD QUESTIONS
  592.  
  593.                   10.1.  DO I NEED A CWINAPP OBJECT IN A DLL?
  594.  
  595.                   10.2.  HOW SHOULD I DEFINE THE WEP IN A MFC DLL?
  596.  
  597.                   10.3.  HOW DO I BUILD AN 'EXTENSION DLL'?
  598.  
  599.                   10.4.  HOW CAN I MANAGE RESOURCES IN A RESOURCE ONLY DLL AND STILL BENEFIT FROM CLASSWIZARD?
  600.  
  601.                  %10.5.  I am having [some problem] with exports/imports and extension DLLs.
  602.  
  603.           11. MFC TIPS TRICKS AND CAVEATS
  604.  
  605.                   11.1.  WHAT'S THE BEST WAY TO CONVERT MY C WINDOWS APP TO MFC?
  606.  
  607.                   11.2.  WHY IS MY MFC APPLICATION RUNNING SLOW?
  608.  
  609.                   11.3.  HOW CAN I CREATE AN APPLICATION THAT IS INITIALLY MAXIMIZED?
  610.  
  611.                   11.4.  HOW DO I ENABLE TRACE MACROS IN MY APP?
  612.  
  613.                   11.5.  HOW DO I PERFORM BACKGROUND PROCESSING IN MY APPLICATION?
  614.  
  615.                   11.6.  HOW DO I SEND A MESSAGE TO ANOTHER THREAD?
  616.  
  617.                   11.7.  DOES MICROSOFT USE MFC IN THEIR PRODUCTS? WHICH ONES?
  618.  
  619.                   11.8.  HOW DO I LIMIT MY MFC APPLICATION TO ONE INSTANCE?
  620.  
  621.                   11.9.  HOW DO I GET MY MFC APP TO USE THE REGISTRY ON WIN32 PLATFORMS?
  622.  
  623.                   11.10.  HOW DO I PROGRAMMATICALLY TERMINATE MY MFC APPLICATION?
  624.  
  625.                   11.11.  WHAT'S THE DIFFERENCE BETWEEN IMPLEMENT_DYNAMIC, IMPLEMENT_DYNCREATE AND IMPLEMENT_SERIAL?
  626.  
  627.                           11.11.1. MFC 4.0 4.0 NOTE
  628.  
  629.                   11.12.  HOW CAN I DECLARE AN ABSTRACT BASE CLASS TO BE IMPLEMENT_SERIAL?
  630.  
  631.                   11.13.  WHAT IS AFX.INL AND AFXWIN1.INL, ETC..?
  632.  
  633.                   11.14.  IS MFC AVAILABLE ON THE MACINTOSH?
  634.  
  635.                   11.15.  IS MFC AVAILABLE ON OS/2?
  636.  
  637.                   11.16.  HOW SHOULD I LEARN/START LEARNING MFC?
  638.  
  639.                   11.17.  WHAT DLLS SHOULD I DISTRIBUTE WITH MY MFC APP?
  640.  
  641.                   11.18.  HOW DO I INTERCEPT WM_SETTEXT MESSAGES
  642.  
  643.                   11.19.  I CAN'T CREATE AN INSTANCE BECAUSE OF DECLARE_DYNCREATE!
  644.  
  645.                   11.20.  WHAT THE HECK IS THIS _T() THING I KEEP SEEING?
  646.  
  647.                   11.21.  HOW DO I USE CMEMORYSTATE?
  648.  
  649.                   11.22.  HOW DO I HANDLE MY OWN REGISTERED MESSAGES?
  650.  
  651.                   11.23.  HOW DO I CUSTOMIZE THE MFC IDLE TIME PROCESSING?
  652.  
  653.                   11.24.  HOW DO I CREATE NON-RESIZABLE (STATIC AND FIXED) SPLITTER BARS?
  654.  
  655.                   11.25.  HOW DO I ADD WHAT'S THIS MENUS TO MY APPLICATION - LIKE WIN95 HIP APPS HAVE?
  656.  
  657.                   11.26.  HOW DO I DISPLAY A CHOOSE DIRECTORY DIALOG, INSTEAD OF A CHOOSE FILE DIALOG?     109
  658.  
  659.                   11.27.  I'M HAVING PROBLEMS USING MFC 4.0 AND THE STL, WHAT COULD BE WRONG?
  660.  
  661.                   11.28.  HOW DO I MAKE A WINDOW STAY ON TOP OF THE OTHERS?
  662.  
  663.                   11.29.  HOW DO I MAKE A WINDOW MOVE IN FRONT OF ANOTHER?
  664.  
  665.                  %11.30. Is MFC DEAD?
  666.  
  667.                  %11.31. DOES ATL REPLACE MFC?
  668.  
  669.                  %11.32. HOW DO I IMPLEMENT DOCKING WINDOWS LIKE DEVSTUDIO HAS?
  670.  
  671.                  %11.33. WILL THE NEXT VERSION OF MFC SUPPORT [SOME PARTICULAR FEATURE]?
  672.  
  673.           12.  WIZARD QUESTIONS
  674.  
  675.                   12.1.  HOW CAN I CHANGE THE APPWIZARD OPTIONS I SELECTED FOR MY APPLICATION?
  676.  
  677.           13. VISUAL C++ QUESTIONS
  678.  
  679.                   13.1.  WINDOWS 95 QUESTIONS
  680.  
  681.                           13.1.1.  I'm running MSVC 2.0 and I can't get Windows 95 look and feel in my dialogs, what's wrong?
  682.  
  683.                           13.1.2.  When I compile under Windows 95, it flashes in and out of DOS mode.
  684.  
  685.                           13.1.3.  Can MSVC 1.5 or 2.0 be used for Windows 95?
  686.  
  687.                   13.2.  CONFIGURATION QUESTIONS
  688.  
  689.                           13.2.1.  What are the memory requirements of MSVC?
  690.  
  691.                           13.2.2.  How can I get MSVC 2.1, I can't find it in stores?
  692.  
  693.                           13.2.3.  Should I run under Win 95 or NT?
  694.  
  695.                           13.2.4.  How do I set the include/lib/exe directories?
  696.  
  697.                           13.2.5.  I can't compile any programs!  Help!
  698.  
  699.                           13.2.6.  Can I setup a project to search different paths for source?
  700.  
  701.                           13.2.7.  How do I build a browser file for all of MFC?
  702.  
  703.                          %13.2.8. What does the "unexpected end of file while looking for Precompiled header" message mean?
  704.  
  705.                   13.3.  LANGUAGE FEATURE QUESTIONS
  706.  
  707.                           13.3.1.  Does MSVC support templates and exception handling?
  708.  
  709.                           13.3.2.  Does MSVC support the Standard Template Library?
  710.  
  711.                           13.3.3.  Does VC++ support RTTI?
  712.  
  713.                   13.4.  RELIGIOUS QUESTIONS
  714.  
  715.                           13.4.1.  Which is better OWL or MFC, BC++ or MS MSVC?
  716.  
  717.                           13.4.2.  Should I use Visual C++ or Visual Basic?
  718.  
  719.                           13.4.3.  MFC philosophy (from a microsoftie!)
  720.  
  721.                           13.4.4.  Should I use the MFC collections or the STL collections?
  722.  
  723.                   13.5.  ADVANCED VISUAL C++ TIPS AND TRICKS
  724.  
  725.                          &13.5.1.  How do I see the MSVC 'Easter Eggs'?!
  726.  
  727.                           13.5.2.  What are the command line options to MSVC?
  728.  
  729.                           13.5.3.  How to change the color of ClassWizard generated code!
  730.  
  731.                           13.5.4.  Ten cool things you can do in the VC++ editor!
  732.  
  733.                           13.5.5.  How do I speed up VC++ compiles?
  734.  
  735.                           13.5.6.  Make all MFC keywords a different color!
  736.  
  737.                           13.5.7.  Easy way to launch 4.x projects without mdp files.
  738.  
  739.                   13.6.  MISCELLANEOUS VISUAL C++ QUESTIONS
  740.  
  741.                           13.6.1.  What are all these files that MSVC is creating?!
  742.  
  743.                           13.6.2.  How do I change from using MFCXX.DLL to using a statically linked library?
  744.  
  745.                           13.6.3.  How do I report a bug to Microsoft?
  746.  
  747.                   %13.7.  VISUAL C++/MFC Version SPECIFIC HINTS, PROBLEMS, ETC..
  748.  
  749.                           13.7.1  Why aren't my windows being created in MFC 4.0?
  750.  
  751.                           13.7.2.  How do I convert a VC++ 2.x makefile over to 4.x?
  752.  
  753.                           13.7.3.  ClassWizard has problems wiring controls to members in international 4.0 versions, what the heck do I do?
  754.  
  755.                           13.7.4.  VC++ 4.0 crashes all the time on me!!!  HELP!?!?!?!?!
  756.  
  757.                           13.7.5.  How do I add components (not just classes) to the Component Gallery?
  758.  
  759.                          %13.7.6. What is up with the Visual C++ 5.0 help system!?
  760.  
  761.           14. THIRD PARTY MFC PRODUCTS
  762.  
  763.           15. MFC FAQ REVISION HISTORY
  764.  
  765. ------------------------------------------------------------------------
  766.  
  767.                        MFC FAQ WWW-version Hot-jumps
  768.  
  769. Click below to hop right to a chapter of the FAQ.
  770.  
  771. 1. MFC FAQ INFO AND CREDITS
  772.  
  773. 2. WHERE TO GO FOR JUICY MFC INFORMATION
  774.  
  775. 3. A BRIEF HISTORY OF MFC
  776.  
  777. 4. GENERIC CLASS QUESTIONS
  778.  
  779. 5. GDI CLASS QUESTIONS
  780.  
  781. 6. WINDOW, CONTROL, AND DIALOGS CLASS QUESTIONS
  782.  
  783. 7. DOCUMENTS, VIEWS AND FRAME CLASS QUESTIONS
  784.  
  785. 8. OLE CLASS QUESTIONS
  786.  
  787. 9. WOSA CLASS QUESTIONS
  788.  
  789. 10. DLL AND BUILD QUESTIONS
  790.  
  791. 11. MFC TIPS TRICKS AND CAVEATS
  792.  
  793. 12. WIZARD QUESTIONS
  794.  
  795. 13. VISUAL C++ QUESTIONS
  796.  
  797. 14. THIRD PARTY MFC PRODUCTS
  798.  
  799. 15. MFC FAQ REVISION HISTORY
  800.  
  801. ------------------------------------------------------------------------
  802.  
  803. 1. MFC FAQ Info and Credits
  804.  
  805. The MFC FAQ maintainers can be contacted via the following:
  806.  
  807. Internet: mfc_faq@stingsoft.com
  808.  
  809. Our URL is: http://www.stingsoft.com/scot - this hasn't been updated in
  810. ages - sorry.
  811.  
  812. We welcome any comments, criticisms or suggested additions for the FAQ.
  813.  
  814. 1.1. How do I get this FAQ?
  815.  
  816. Hey, this is one of those chicken and egg questions, if you're reading this
  817. you already have the FAQ. But seriously, the MFC FAQ is put out just about
  818. monthly, so chances are you are reading an old and stale version, instead
  819. of the fresh and fancy latest version. If you want to make sure you have
  820. the latest version:
  821.  
  822. * "Instant-FAQ" - If you'd like to have a copy of any new MFC FAQ releases
  823. emailed right to your front door, just send me an email via
  824. mfc_faq@stingsoft.com and I'll add you to the 'subscription'. No cost or
  825. anything, just another FAQ service.
  826.  
  827. "Why wait for the announcements and then go get the FAQ yourself, use
  828. "Instant-FAQ"
  829.  
  830. "Instant-FAQ changed my life!!! I no longer have to wait for months for the
  831. latest FAQ. It's just waiting in my email box the second it's released, no
  832. fuss no muss! Thanks Instant-FAQ"
  833.  
  834. -Anonymous Instant-FAQ participant.
  835.  
  836. [All restrictions apply in states that do not allow Instant-FAQ service,
  837. please see your local MFC FAQ dealer for details.]
  838.  
  839. This FAQ is only available on the World Wide Web at
  840. http://www.stingsoft.com/mfc_faq - if you are reading it somewhere else
  841. (e.g. MSDN) it is probably stale.
  842.  
  843. Sadly, I can not email the FAQ to you because of my current workload.
  844.  
  845. If you send me an email asking for the FAQ, I'll just put you on
  846. Instant-FAQand you'll get the next version announcement instead.
  847.  
  848. An announcement of a new FAQ release is posted to the usenet newsgroups:
  849.  
  850. comp.os.ms-windows.programmer.controls
  851.  
  852. comp.os.ms-windows.programmer.graphics
  853.  
  854. comp.os.ms-windows.programmer.tools.mfc
  855.  
  856. comp.os.ms-windows.programmer.misc
  857.  
  858. comp.os.ms-windows.programmer.ole
  859.  
  860. comp.os.ms-windows.programmer.tools
  861.  
  862. comp.os.ms-windows.programmer.win32
  863.  
  864. comp.lang.c++
  865.  
  866. The Microsoft MFC newsgroups which I can never remember.
  867. (news://news.microsoft.com/microsoft.public/visualc.mfc or something like
  868. that)
  869.  
  870.   1. There's also an announcement on the mfc mailing list. (See Section
  871.      2.2.2.)
  872.  
  873. 1.2. What's the goal of this FAQ?
  874.  
  875. The goal of this FAQ is to be a clearing house for answers to MFC questions
  876. commonly asked on primarily the usenet newsgroups and the MFC List. We try
  877. not to duplicate the great documentation out there, the tech notes, MSDN,
  878. etc.. Hopefully you will look there first and then use this FAQ as your
  879. last resort. The FAQ will be much more interesting if you check those
  880. resources first, then we won't have to cover 'the basics'.
  881.  
  882. I'm trying to load the FAQ up with good phone numbers, CODE-CODE-CODE!,
  883. URLs and email addresses of places to call. I'll puting 800 numbers first,
  884. and then the US number second. International folks hate it when there are
  885. only 800 numbers, so if you want a phone number in the FAQ, please send
  886. both.
  887.  
  888. 1.3. Why are you doing this?
  889.  
  890. I keep seeing the same posts and they're driving me insane!!! But
  891. seriously, I started the MFC FAQ when I had gobs of free time and was
  892. trying to get really totally submerged in MFC. I figured, what better way
  893. to get submerged, than to manage the FAQ.
  894.  
  895. 1.4. How can I contribute!?!
  896.  
  897. Good question! You can send me an email with your frequently asked question
  898. and answer and I'll stick it right in the FAQ. It's that easy, We'll even
  899. make sure you get credit for that entry. Please remember to tell me what
  900. section of the FAQ you would like your FAQ added to.
  901.  
  902. Also, if you search for the string '%%TODO' that indicates there is some
  903. information I need to fill in and would really like your help with..
  904.  
  905. 1.5. Credits
  906.  
  907. I borrowed the format from Tom Haapanen's Windows Programmers FAQ, so I'm
  908. eternally indebted to him for that. Tom also knew the exact dates of all
  909. MFC releases practically down to the second.
  910.  
  911. I'd also like to use this space to thank some of the folks that always try
  912. and help out people on the usenet groups:
  913.  
  914. Chris Marriott - He has the highest bandwidth of darn good answers I've
  915. ever seen.
  916.  
  917. Mike Blaszczak - A Microsoftie that reads netnews and gives great answers!
  918. (See section 2.4.2 for info about his book!) If anybody knows how to
  919. pronounce his name, let me know.. Mike is now the lead of the MFC Team. If
  920. you see a guy post and he signs:
  921.  
  922. .B ekiM - that is Mike. He's a little backwards, but gives good answers.
  923. Ask him about his RX7.
  924.  
  925. And of course thanks to everyone in the Microsoft MFC/MSVC group that made
  926. MFC the phenomenon it is today: Scott Randall, Jim McCarthy, Dean McCrory,
  927. John Elsbree, etc.., etc..
  928.  
  929. These folks have given me lots of great feedback on the FAQ and get a big
  930. round of applause!
  931.  
  932.    * Jim B - jimb@turningpoint.com
  933.    * Niels Ull Jacobsen - null@diku.dk
  934.    * Vinny Mayfield converted the FAQ over to Word for me.
  935.  
  936. Individual FAQ contributions are usually near the FAQ.
  937.  
  938. 1.6. How is this different from the MSVC MFC FAQ?
  939.  
  940. There is a MFC FAQ that comes with MSVC, this FAQ is different because:
  941.  
  942. A) It's not from Microsoft (so it has more dirt and less evangelism!)
  943.  
  944. B) The information here is gleaned from Usenet and CompuServe, where their
  945. information is from technical support. Hopefully the Usenet/CompuServe
  946. folks ask better questions (they are definitely cheaper ;-> )
  947.  
  948. 1.7. What other languages is this FAQ translated to?
  949.  
  950. 1.7.1. Japanese version of MFC FAQ
  951.  
  952. I am coordinating efforts with Masahiko Funaki to have a Japanese version
  953. of the FAQ. He gets all changes so that he can maintain the Japanese
  954. version. He can be reached via email at: 'funa@hic.co.jp'.
  955.  
  956. The MFC FAQ-J is now available: http://www.st.rim.or.jp/~funa/mfc_faq.html
  957.  
  958. ------------------------------------------------------------------------
  959.  
  960. 2. Where to go for Juicy MFC Information
  961.  
  962. Hopefully this FAQ is where you will look when all else fails. This section
  963. documents what else is out there and how to get your paws on it.
  964.  
  965. 2.1. Microsoft
  966.  
  967. MFC comes with Microsoft's Visual C++, Watcom's C++, and Symantec's C++
  968. compilers.
  969.  
  970. 2.1.1. Visual C++ and Visual C++ subscription.
  971.  
  972. Microsoft no longer sells subscriptions to Visual C++. However, you can get
  973. updates to it through the MSDN Universal subscription. See Section 3 for
  974. the details of what MFC release is the latest and greatest. Only major
  975. versions are sold through outlets, so if you need a point release, you need
  976. the Universal Subscription that is now done with MSDN.
  977.  
  978. Prices fluctuate, so contact one of the compiler vendors for information:
  979.  
  980.    * Microsoft(800) 719-5577(206) 936-8661http://www.microsoft.com
  981.    * Watcom and Symantec carry MFC compatible VC++'s but I think you would
  982.      be nearly insane to choose one of these over VC++. They tend to be
  983.      behind VC++ in functionality and never seem to have the latest MFC.
  984.  
  985. There are also two programmer mail order houses that carry all of the MFC
  986. supported compilers including the Visual C++ subscription:
  987.  
  988.    * Programmer's Paradise - My personal favorite.(800) 445-7899/(908)
  989.      445-7899
  990.    * The Programmer's Shop(800) 421-8006/(617) 740-2510
  991.  
  992. 2.1.2. Microsoft Developers Network (MSDN)
  993.  
  994. Another great investment is the Microsoft Developers Network (MSDN), which
  995. is a quarterly subscription set of CDROMs that contains all of the
  996. information you can imagine about the Microsoft developer products,
  997. including MFC. There are two levels, level one gets you the CDs that have
  998. all the developer tool information. Hey - the MFC FAQ is even on there now.
  999. The MSDN options change almost monthly so instead of detailing them here,
  1000. why don't you just surf on over to http://www.microsoft.com/msdn and check
  1001. out what they have to say. The Universal subscription gives you the biggest
  1002. bang for the buck because it sends out everything you could ever want in
  1003. one affordable package.
  1004.  
  1005. If you are Internet challenged, you can contact MSDN at:
  1006.  
  1007. (800) 759-5474
  1008.  
  1009. (303) 684-0914
  1010.  
  1011. msdn@microsoft.com
  1012.  
  1013. 2.1.3. Knowledge Databases
  1014.  
  1015. Microsoft support creates these knowledge databases that answer frequently
  1016. asked questions and sometimes have samples and stuff. You can get the
  1017. knowledge databases from ftp.microsoft.com, CompuServe, and they come on
  1018. the MSDN (see section 2.1.2 above) CD-ROMs.
  1019.  
  1020. There's a tool that lets you quickly search these. Whenever I've tried to
  1021. find something here, I always end up with MFC 1.0 information that's not
  1022. very useful. Your mileage may vary.
  1023.  
  1024. http://www.microsoft.com/KB
  1025.  
  1026. Is the URL that I use, change the product to Visual C++ and party on!
  1027.  
  1028. 2.1.4. Microsoft Software Library
  1029.  
  1030. Microsoft maintains a giant library of samples, tools, and demos called the
  1031. Microsoft Software Library. Here's how to find it on the various electronic
  1032. media :
  1033.  
  1034.    * CompuServe - GO MSL
  1035.    * Microsoft Download Service (MSDL) Dial (206) 936-6735 to connect to
  1036.      MSDL
  1037.    * Internet (anonymous FTP) ftp://ftp.microsoft.comChange to the
  1038.      SOFTLIB\MSLFILES directory
  1039.  
  1040. John Elsbree, elsbree@msn.com, programmer.misc, 6/24/95
  1041.  
  1042. 2.2. Internet
  1043.  
  1044. Throw on some sunglasses, put the top down and take a cruise on that big
  1045. ole' information highway. There's tons of great MFC information at your
  1046. finger tips (sorry billg), if you know where to lookà..
  1047.  
  1048. 2.2.1. World Wide Web Pages
  1049.  
  1050. Instead of having to manage a bunch of fluctuating URLs in the FAQ this is
  1051. just a start-off point. Check out the Stingray "For Developer's Only" and
  1052. the Foundation Software pages for really good pages that are always
  1053. up-to-date.
  1054.  
  1055. Here are some URLs with MFC, or MFC related information:
  1056.  
  1057.                                   MFC/MSVC
  1058. Specific_____________________________________________________________________
  1059.  
  1060.    * http://www.microsoft.com - Microsoft's WWW.
  1061.    * http://www.microsoft.com/visualc - Visual C++ MotherShip for
  1062.      information - check this weekly if you want to be really hip (or a BIG
  1063.      VC++ NERD depending on your perspective <g>).
  1064.    * http://www.stingsoft.com/dev/dev.htm - For MFC Developer's ONLY!!
  1065.    * http://www.webcom.com/~sleslie/resources.html - Great page by Scott
  1066.      Leslie of VC++/MFC resources on the web.
  1067.    * http://www.stingsoft.com - MFC extensions company, Stingray Software
  1068.    * http://www.visionx.com/mfcpro - The MFC Professional - a site that has
  1069.      some useful MFC information, not updated very frequently though.
  1070.    * http://www.vcdj.com - Visual C++ Developer's Journal.
  1071.  
  1072. Lots of magazines are on the web, see section 2.4.1 for those URLs
  1073.  
  1074. 2.2.2. Mailing lists
  1075.  
  1076. The MFC mailing list was originally started by David Elliott and now it has
  1077. been picked up by none other than Microsoft (Big Brother is listening!).
  1078. But seriously, it is really great that Microsoft decided to keep this
  1079. source of peer-level support alive. Oh MFC mailing list, why do I love you?
  1080. Let me count the ways:
  1081.  
  1082.   1. Very low noise.
  1083.   2. Sometimes Mike yells at people and it makes me laugh uncontrollably.
  1084.   3. It's moderated so someone else has to deal with all of the bounces,
  1085.      weirdos, flames, spams, etc..
  1086.   4. It's an advanced group - there are no: "What is CObject!?" kind of
  1087.      questions - or at least they are few and far between.
  1088.   5. Want to learn MFC? Spend two weeks reading this and see if you can
  1089.      answer every question. Don't stop until you can. You now know MFC
  1090.      better than the top 2% of programmers.
  1091.  
  1092. Interested? Instructions on joining are at:
  1093.  
  1094. http://www.microsoft.com/sitebuilder/resource/mailfaq.asp (you may have to
  1095. have IE to view this, don't know).
  1096.  
  1097. There is a nice archive at
  1098. http://microsoft.ease.lsoft.com/archives/index.html
  1099.  
  1100. If you want to have some fun, ask if you should call TerminateThread()!
  1101.  
  1102. 2.2.3. Usenet Newsgroups
  1103.  
  1104. You can get to Usenet groups through the Internet, or through many of the
  1105. on-line services these days. Here's a quick rundown of newsgroups that have
  1106. MFC-specific content or similar things of interest:
  1107.  
  1108.    * comp.os.ms-windows.programmer.tools.mfc - A MFC-only newsgroup - and
  1109.      it's a good one. This is relatively new in the netnews Universe, so
  1110.      you may have to get an administrator to add it at your news site. It's
  1111.      available on MSN, AOL and CIS.
  1112.    * comp.os.ms-windows.programmer.tools - This is where most of the MFC
  1113.      stuff USED to happen, nothing but noise now. You want to check out the
  1114.      .mfc group first.
  1115.    * comp.os.ms-windows.programmer.misc - Give it a shot, lots of noise
  1116.      here, but usually good noise.
  1117.    * comp.os.ms-windows.programmer.win32 - I like this group, doesn't seem
  1118.      too crowded, people know what's going on, I guess because they're
  1119.      really into win32.
  1120.    * comp.os.ms-windows.programmer.ole - An occasional thread about some of
  1121.      the OLE classes pops up here.
  1122.    * comp.lang.c++ - This is suppose to be for C++ language issues, but
  1123.      people are always posting about MSVC and MFC here. This group is
  1124.      really frustrating to read, I recommend staying away. There's about a
  1125.      100000:1 noise ratio in here.
  1126.  
  1127. Microsoft has ditched their Compu$erve forums (Yeah!) and now they sponsor
  1128. "peer support" via a news server at news://msnews.microsoft.com . Point
  1129. your news reader there and then navigate to the microsoft.public.vc.mfc.
  1130. There is a whole hierarchy under VC you may want to explore, but this one
  1131. is the most active and interesting in my opinion. If you are having
  1132. problems getting onto this, try this URL:
  1133.  
  1134. news://msnews.microsoft.com/microsoft.public.vc.mfc if that doesn't work,
  1135. try a different email reader, but please don't email us, we are not in the
  1136. business of helping people read newsgroups -sorry.
  1137.  
  1138. 2.2.4. Other FAQs of interest
  1139.  
  1140.    * Windows FAQ - Maintained by Tom Haapanen.
  1141.  
  1142. ftp.metrics.com:~/faq
  1143.  
  1144. Explains lots of great stuff about Windows that you won't find here.
  1145.  
  1146.    * Windows Programming FAQ - Maintained by Tom Haapanen.
  1147.  
  1148. ftp.metrics.com:~/faq
  1149.  
  1150. Awesome Windows Programming FAQ. I think it's been resurrected by a new
  1151. fellow under Tom's watchful eye. Keep an ear to the newsgroups for the
  1152. details.
  1153.  
  1154.    * C++ FAQ - Maintained by Marshall Cline.
  1155.  
  1156. ftp to rtfm.mit.edu:/pub/usenet/comp.lang.c++, also on comp.lang.c++
  1157.  
  1158. This is an awesome FAQ, answers every C++ question you'd ever conceive of.
  1159. It's not specific to MSVC so be careful, some behavior could be
  1160. different.These guys have a book out on it.
  1161.  
  1162.    * WinHelp FAQ - Maintained by Pete Davis
  1163.  
  1164. Posted regularly to comp.os.ms-windows.programmer.winhelp If you have a
  1165. question about the Windows help system, this is for you.
  1166.  
  1167.    * Windows NT FAQ - Maintained by Adam Hamilton
  1168.  
  1169. Posted to comp.os.ms-windows.nt.misc? Pretty good, lots of networking stuff
  1170. in there.
  1171.  
  1172. 2.2.5. FTP sites
  1173.  
  1174. There's not much MFC code out there. You can check out these sites:
  1175.  
  1176.    * ftp.microsoft.com - Has all the knowledge databases and a couple of
  1177.      MFC specific things. Check out the software library too (softlib).
  1178.    * ftp.cica.indiana.edu - pub/pc/win3/progrmr
  1179.    * wuarchive.wustl.edu - Good site, don't know about MFC
  1180.      stuff.pub/win3/progrmmr
  1181.    * ftp.uu.net - /vendors/microsoft has some developer support things that
  1182.      are on both ftp.microsoft.com and CompuServe. Microsoft seems to be
  1183.      moving away from here.
  1184.    * oak.oakland.edu - (SimTel Mirror) SimTel/win3/pgmtools
  1185.  
  1186. If you don't have Internet access, you can order CDROMs with these entire
  1187. archives from Walnut Creek. Call (800) 786-9907 or (510)947-5996 for more
  1188. information.
  1189.  
  1190. 2.2.6. The MFC FAQ FTP Archive!
  1191.  
  1192. We've started a MFC FAQ FTP archive. This archive contains MFC samples that
  1193. illustrate FAQs.
  1194.  
  1195. ftp://ftp.stingsoft.com/pub/stingray/mfc_faq
  1196.  
  1197. To submit a sample, upload it into the mfc_faq/incoming directory and send
  1198. and email to scot@stingsoft.com explaining the submission.
  1199.  
  1200. Currently the MFC FAQ FTP Archive contains:
  1201.  
  1202.    * multdocs.zip - Shows how to have multiple CDocuments.
  1203.    * multview.zip - Shows how to have multiple views.
  1204.    * onetime.zip - How to restrict your application to one instance.
  1205.    * dlgcbr.zip - How to put controlbars in your dialogs.
  1206.  
  1207. %%TODO - Update these samples for 5.0 -someone? anyone? Bueller? Bueller?
  1208. Bueller? These were lost when the landru.unx.com account disappeared,
  1209. anyone have them?
  1210.  
  1211. 2.3. CompuServe
  1212.  
  1213. CompuServe, well how can I say this politely- sucks! Don't waste your time.
  1214.  
  1215. 2.4. Printed Matter
  1216.  
  1217. 2.4.1. Magazines and journals
  1218.  
  1219. Ok, ok, ok, I admit it! I'm a MAGAZINE JUNKIE! There's just no better place
  1220. to pick up a good little nugget of MFC info than a well written rag. I
  1221. think I get every magazine on this list and more. Here's a list of all mags
  1222. I know of with my review. Please feel free to submit any reviews you have
  1223. of magazines - it's always a subjective kind of thing.
  1224.  
  1225. I've tried to list these in order of MFC content. The ones first have the
  1226. most MFC content with the ones last having the least. Even though they
  1227. don't directly cover MFC, most of the Windows programming magazines are
  1228. still pretty valuable. Any of these that I've read, I put comments with. If
  1229. you'd like to comment, email me and I'll throw it in here. Please don't
  1230. tell me about more magazines - I'll go broke <g>.
  1231.  
  1232.    * Visual C++ Developer
  1233.    *
  1234.         o Pinnacle Publishing ($149/yr)
  1235.         o (800) 788-1900 voice
  1236.         o (206) 251-1900 voice
  1237.         o (206) 251-5057 fax
  1238.         o visualcdev@pinpub.com
  1239.         o http://www.pinnacle.com
  1240.         o My favorite, very meaty, lots of MFC coverage. They have had a
  1241.           rocky year, but appear to be back on track now.
  1242.    * Visual C++ Professional
  1243.         o Oakley Publishing ($149/yr)
  1244.    * (800) 234-0386
  1245.    * (503) 747-0800
  1246.    * Similar to above, but just a smidge less MFC.
  1247.  
  1248.    * Microsoft Systems Journal (MSJ)
  1249.         o Miller Freeman Inc.
  1250.         o (800) 666-1084
  1251.         o (303) 678-0439
  1252.         o http://www.mfi.com/msj
  1253.         o Visual Programmer column is EXCELLENT!!!!
  1254.  
  1255.    * Dr. Dobbs
  1256.         o Miller Freeman Inc.
  1257.         o (800) 456-1215
  1258.         o (303) 678-0439
  1259.         o http://www.ddj.com
  1260.         o Check out the "Undocumented Corner" for the continuing adventures
  1261.           of George and Scot's wild MFC Internals explorations. Ok, it's
  1262.           not that exciting, but it is a living.
  1263.    * Windows/DOS Developers Journal
  1264.         o Miller Freeman
  1265.         o (913) 841-1631
  1266.         o Continuing to add strong MFC material - getting better!
  1267.    * C/C++ Users Journal
  1268.    * Miller Freeman
  1269.    *
  1270.         o (913) 841-1631
  1271.         o Not much MFC specific stuff at all, language-y articles.
  1272.    * C++ Report
  1273.    * SIGS Publications
  1274.    * (800) 361-1279
  1275.    * (212) 242-7447
  1276.    * Great if you want to learn about the dynamics of instantiated,
  1277.      real-time templates as applied to generic programming and patterns in
  1278.      modern-day CASE/UNIX based GNU compilers. <yawn> Don't these guys have
  1279.      day jobs?
  1280.  
  1281. 2.4.2. Books on MFC
  1282.  
  1283. There's tons of books on Visual C++, but not many of them go into the
  1284. details about MFC. Here's a list of books that are over 50% oriented
  1285. towards MFC (e.g. don't have pages of screenshots of compiler options
  1286. dialogs and the MSVC IDE)
  1287.  
  1288.    * Microsoft Visual C++ Documentation Set
  1289.    *
  1290.         o Microsoft Press
  1291.         o MSPRESS
  1292.         o (416) 293-8464
  1293.         o
  1294.              + Volume 2: Programming with MFC and Win32 ($27)ISBN
  1295.                1-55615-802-5
  1296.              + Volume 3: MFC Library Reference ($45)ISBN 1-55615-801-7
  1297.  
  1298. These come in the on-line docs, but nice to have printed versions of them.
  1299. If you are going to do MFC programming, volume 2 is a 'must have'
  1300.  
  1301.    * Inside Visual C++, Fourth edition
  1302.    *
  1303.         o Microsoft Press ($45)
  1304.         o David J. Kruglinski (Ex-Microsoftie)
  1305.         o ISBN: 1-55615-661-8
  1306.         o http://www.mspress.com
  1307.         o ISBN is 1-55615-891-2
  1308.  
  1309. Sounds like it would be Visual C++ specific, but this is the 'Petzold of
  1310. MFC programming. In other words, it's a 'must have' (along with volume 2 of
  1311. the printed docs. If you can't afford both, stick with volume 2 on-line and
  1312. get this one)
  1313.  
  1314. **Note, the MFC/VC++ 5.0 version (fourth edition) just hit the streets - it
  1315. looks pretty good. -see last comment for the scoop on the latest version.
  1316. Do not buy the third or second edition, it is bird-cage liner at this
  1317. point. Rumor has it that David passed away recently in a freak hangliding
  1318. accident. Does anyone know if this is true or not?!
  1319.  
  1320. The best MFC book that I know of is "Inside Visual C++" by David
  1321. Kruglinski. Despite the name, this is primarily an MFC book.
  1322.  
  1323. Chris Marriott, chris@chrism.demon.co.uk, programmer.graphics, 6/15/95
  1324.  
  1325. I owned the previous version of Inside VC++ and learned a lot about MFC [ed
  1326. note - he now has the third NEW version]. This was the book that got me
  1327. started in MFC programming and I have recommended it to everyone who asked.
  1328. I recently bought the latest edition and my impressions are as follows:
  1329.  
  1330. It still is THE book for SDK programmers who want to learn MFC.
  1331.  
  1332. Its strong suit is the coverage of the Document/View architechure, printing
  1333. and print preview and on-line help.
  1334.  
  1335. It is weak in it's coverage of Windows controls (CListCtrl, CTreeCtrl, etc,
  1336. etc)
  1337.  
  1338. I did not feel that the new material it contained justified the almost
  1339. $50.00 price tag, however. I recommend that anyone who owns an earlier
  1340. edition of the book spend a little time in the bookstore with this 3rd
  1341. edition before taking it home.
  1342.  
  1343. - Blaine Anderson Blaine.Anderson@msfc.nasa.gov, mfc-l, 1/14/96
  1344.  
  1345.    * The Revolutionary Guide to MFC Programming.
  1346.    *
  1347.         o WROX Press ($45), June 1996
  1348.         o Mike Blaszczak
  1349.         o ISBN: 1-874416-47-8
  1350.         o http://www.wrox.com NOTE: A second edition of this book is out,
  1351.           it has MFC in the title, the old one has Win32 in the title.
  1352.         o This is my personal favorite MFC book (well next to MFC Internals
  1353.           of courseà).
  1354.  
  1355.    *
  1356.         o
  1357.              + - scot@stingsoft.com
  1358.  
  1359. If you understand C++ and _some_ windows programming this is a great book
  1360. to learn MFC.
  1361.  
  1362. Shelley Lambert, reach@ee.mcgill.ca, programmer.tools, 6/18/95
  1363.  
  1364. It is the best book on Win95 programming I have found.
  1365.  
  1366. Gary Coombs, N40JW@News.Radio.Org, programmer.win32, 6/19/95
  1367.  
  1368.    * MFC Internals - AW George Shephard and Scot Wingo
  1369.    *
  1370.         o Addison Wesley $39.95
  1371.         o George Shepherd and Scot Wingo
  1372.         o ISBN: 0201407213
  1373.         o http://www.aw.com
  1374.  
  1375. This book is best described as the 'other side' of the Mike B book. Where
  1376. Mike shows you how to use MFC at an advanced pace, we show you how MFC
  1377. works under the hood (also at an advanced pace). If you've ever gotten lost
  1378. in the MFC source, you'll know why this is *extremely* helpful information.
  1379. Plus, it's MFC 4.0 so it's pretty darn current information. Check out the
  1380. March "Undocumented MFC" column in Dr. Dobbs for a sneak peek at the book.
  1381.  
  1382. -scot@stingsoft.com - co-author.
  1383.  
  1384. "Quite simply, this book is a must-have for any serious MFC developer."
  1385.  
  1386. ""This book is definitely not a rehash of existing documents. It is not a
  1387. "how-to" book-it is a "how does it work" book."
  1388.  
  1389. -Dean McCrory - technical editor, lead of the MFC team.
  1390.  
  1391.    * Writing Windows Applications with MFC
  1392.    *
  1393.         o M+T Books ($40)
  1394.         o Bryan Waters
  1395.         o ISBN: 1-55851-379-5
  1396.  
  1397. At first I thought it was too beginner, but the last 5 chapters kick butt.
  1398. Lots of info on MFC internals, exception handling, and topics not covered
  1399. elsewhere. Good for someone new to Windows and MFC programming. - not
  1400. updated to cover 4.0.
  1401.  
  1402.    * Visual C++ How-To: The Definitive MFC Problem Solver
  1403.    *
  1404.         o Waite Group Press ($40) Apr-95, 570 pages
  1405.         o Info: http://www.dnai.com/waite/
  1406.         o (800) 788-3123
  1407.         o (510) 658-3453
  1408.         o Scott Stanfield, Ralph Arveson, Alan Light & Mickey Williams
  1409.         o Includes a CD-ROM
  1410.         o ISBN 1-878739-82-4
  1411.  
  1412. Note: Not updated for VC++ 4.0.
  1413.  
  1414. I can tell you that its a real good book for what its intended to be. Which
  1415. is, sort of like your FAQ. It comes with a CD and has little tidbits like:
  1416.  
  1417. 1.) How to animate an icon. I adapted this a bit to figure out how to
  1418. change icons (in an MDI on the fly).
  1419.  
  1420. 2.) How to detect multiple instances of a Windows app and pull theother one
  1421. to the top of the Z-order. This is a perennial Usenet question and I pulled
  1422. the code and had it working first time.
  1423.  
  1424. 3.) How to put a bitmap on the main client window of a MDI app. Again, a
  1425. nasty little thing to figure out on your own, but given good directions,
  1426. quite easily done from the book.
  1427.  
  1428. The CD is also broken out between those that are using VC 1.5 versus 2.0.
  1429.  
  1430. Like other Waite Group "How-To" programming books, this one is in
  1431. "Cookbook" or FAQ format. You read the table of contents for the
  1432. functionality you are looking for, and the associated chapter contains the
  1433. code to implement it.
  1434.  
  1435. Topics include: Document and View, Status Bars and Toolbars, Controls,
  1436. Multimedia, Bitmaps and Icons, Dialogs OLE and DDE, System and a FAQ of
  1437. short tips. Many new classes are given here which all supplement the MFC in
  1438. a fairly logical manner. Some of the chapters which were of interest to me
  1439. were:
  1440.  
  1441. 2.1 - Put the current time in the status bar
  1442.  
  1443. 2.3 - Add a status bar to my Views
  1444.  
  1445. 2.4 - Display Progress information in the status bar
  1446.  
  1447. 4.1 - Preview an AVI file using the common file dialog
  1448.  
  1449. 4.3 - Play AVI files in a CView
  1450.  
  1451. 4.4 - Play large WAV files
  1452.  
  1453. 4.6 - Create 3D animation using OpenGL and MFC
  1454.  
  1455. 5.5 - Smoothly animate bitmaps
  1456.  
  1457. 6.6 - Write customized DDX/DDV routines
  1458.  
  1459. 8.3 - Localize MFC applications using resource DLLs
  1460.  
  1461. 8.5 - Make multiple inheritance work in MFC
  1462.  
  1463. And many tidbits from the FAQ...
  1464.  
  1465. I like the cookbook format which allows me to glue in specific
  1466. functionality on demand. I found this book to be fairly helpful in that
  1467. regard. I look forward to Volume II
  1468.  
  1469. cntrline@winnet.com via email, 7/15/95
  1470.  
  1471.    * Visual C++ 2: Developing Professional Applications in Windows 95 and
  1472.    *
  1473.         o Windows NT using MFC
  1474.         o Marshall Brain and Lance Lovette
  1475.         o Prentice Hall
  1476.         o ISBN: 0-13-305145-5
  1477.  
  1478. Note: Not updated for VC++ 4.0.
  1479.  
  1480. This was the third MFC book I picked up, and by far the best one. Like
  1481. Brain's other books (Heart of NT...) this one sets out to answer some
  1482. frequently asked questions, as enumerated in the introduction. It's
  1483. definitely a comprehensive book, divided into five sections covering the
  1484. basics of Visual C++ and MFC, Controls, Using the App Wizard with MFC,
  1485. Professional Features, and Advanced MFC classes. It has an interesting
  1486. appendix that is designed to get C programmers up to speed with the C++
  1487. concepts that they will need to use MFC right away. It does cover things
  1488. like OLE, ODBC and Threads as well as some 'example chapters' covering
  1489. things like splash screens, and multiple document templates per
  1490. application. It's pretty cool because it goes through MFC without the
  1491. Class/App Wizards before introducint them to you. It's very clear, and most
  1492. everything is done by example, which I really like ;). What it doesn't do
  1493. is cover any of the new common controls despite its title implying Windows
  1494. 95 development. This seems to be ok, because Nancy Cluts' book looks like
  1495. it should handle
  1496.  
  1497. that part well enough ;) I highly recommend this one, especially if you
  1498. have previous windows programming experience and are looking to migrate to
  1499. MFC 3.x for 95/NT.
  1500.  
  1501. Topics of interest:
  1502.  
  1503. Understanding Message Maps, Debugging and Robustness, Dynamic Data Exchange
  1504. and Validation, How MFC Works with Windows, Creating a Self Drawing
  1505. Control, Property Sheets, OLE, MFC Threads, Combining Two Documents and
  1506. Views in a Single Application, Subclassing and Windows Procedures, as well
  1507. as the standard treatment of every control from edit to combo boxes.
  1508.  
  1509. jgordon@hyperimage.com
  1510.  
  1511.    * Animation Techniques in Win32
  1512.    *
  1513.         o Nigel Thompson
  1514.         o Microsoft Press (Early 1995)
  1515.         o ISBN: 1-55615-669-3
  1516.  
  1517. At first glance, I ignored this book on the shelves, however, when I
  1518. finally picked it up, it used MFC completely throughout. A very good book
  1519. on doing graphics with MFC.
  1520.  
  1521. jdc@biosym.com, John Clark, via email 6/6/95
  1522.  
  1523.    * Teach Yourself Microsoft Foundation Class Library Programming in 21
  1524.      Days
  1525.    *
  1526.         o Robert Shaw
  1527.         o SAMS ($30)
  1528.         o ISBN: 0-672-30462-7
  1529.         o Note: Not updated for VC++ 4.0.
  1530.  
  1531. I find "Teach Yourself Visual C++ in 21 Days" a good reference, since it is
  1532. set up to cover a small group of features each "day", so you can quickly go
  1533. to a subject area, and get a from-scratch description of it and how to use
  1534. it. However, the author is not strong on using the VC IDE, claiming that
  1535. "you have to write this code yourself the first few times, so you better
  1536. appreciate what AppStudio and ClassWizard are doing behind the scenes." I'd
  1537. prefer the approach where we use the tools at hand, and then map out what
  1538. those magic MESSAGE_MAP macros are really doing.
  1539.  
  1540. Paul.McGuire@SEMATECH.Org, email, 7/11/95
  1541.  
  1542. Robert Shaws` book is terrific for the beginner learning MSVC and MFC.
  1543. Before trying out the examples found within, download the updated files via
  1544. ftp from the address specified in the book. This will save you alot of
  1545. frustration. The examples are well thought out. This book is better that
  1546. Steve Holzner`s series of books on OLE or MFC (what isn't?). Once a
  1547. beginner has finished with this book he is ready for more serious books
  1548. such as "Inside Visual C++" by David Kruglinski.
  1549.  
  1550. mario@mksinfo.qc.ca
  1551.  
  1552.    * MS Foundation Class Primer: Prog Windows 3 & Windows NT w/MFC
  1553.    *
  1554.         o Jim Conger
  1555.         o The Waite Group Press ($32) Mar-93, 830 pages
  1556.         o ISBN: 1-878739-31X
  1557.         o Note: Not updated for VC++ 4.0.
  1558.  
  1559. The best MFC book that I've seen that DOESN'T use VC++ Wizards is Microsoft
  1560. Foundation Class Primer.
  1561.  
  1562. stasic@news.dorsai.org, ED, programmer.misc, 6/24/95
  1563.  
  1564. This book is a good intro for people new to MFC, but it's getting pretty
  1565. dated. This book was written during the time of MS C++ 7.0, and some of the
  1566. newest functionality just isn't covered (for obvious reasons ;), which can
  1567. confuse a newbie. At any rate, it's still makes pretty good book for
  1568. someone looking for the basics.
  1569.  
  1570. cntrline@winnet.com, email, 7/15/95
  1571.  
  1572.    * Master Visual C++ 2,2/E w/CD-ROM (covers MFC 3.0 library)
  1573.    *
  1574.         o Howard W. Sams & Company ($ 50) Jan-95, 1183 pages
  1575.         o Gurewich & Gurewich
  1576.         o ISBN: 0-672305-321
  1577.  
  1578. Note: Not updated for VC++ 4.0.I picked up a copy of "Master Visual C++"
  1579. specifically for its coverage of creating custom VBX's. This is not covered
  1580. in Kuglinski's "Inside Visual C++" nor in "Teach Yourself Visual-C++ in 21
  1581. Days". "Master Visual C++" is just my speed, since I am a dabbler who does
  1582. not read instructions or tutorials, just jumps in over my head, then starts
  1583. looking for the routine calls I overlooked. Similar to the Heavy Metal
  1584. book, this book could have been squeezed down to about 1/3 the size, but
  1585. here that is not the point. Each example starts with a demo of the finished
  1586. product, then goes through the steps descriptively, then goes through the
  1587. steps again with the code. My little VBX was done in a day an a half, and I
  1588. have a much better feel for the ins and outs of this process.
  1589.  
  1590. Paul.McGuire@SEMATECH.Org, email, 7/11/95
  1591.  
  1592.    * Heavy Metal Visual C++ Programming
  1593.    *
  1594.         o Steve Holzner
  1595.         o Brady Publishing
  1596.         o ISBN 1-56884-196-5
  1597.         o Note: Not updated for VC++ 4.0.
  1598.  
  1599. Hate to disagree, but I find this book disappointing. The reason is, I felt
  1600. like being treated as a semi-idiot when reading the book. Don't get fooled
  1601. by its number of pages, it could have been easily reduced to half of its
  1602. size, if the author knew how to list the code efficiently. Furthermore,
  1603. there are too many misprints in the version I have.
  1604.  
  1605. Huayong (yang@math.umass.edu), programmer.tools, 6/18/95
  1606.  
  1607. The rule of thumb is never buy Holzner's book. His book only leads you the
  1608. the door. You can't find practically useful examples. Almost every updated
  1609. vesion is the same.
  1610.  
  1611. Runhong (chen@nice3.ne.rpi.edu), programmer.tools, 6/18/95
  1612.  
  1613.    * Programming the Windows 95 User Interface
  1614.    *
  1615.         o Microsoft Press ($34.95)
  1616.         o ISBN 1-55615-884-X
  1617.         o Nancy Cluts
  1618.  
  1619. NOTE: Microsoft Developer Network Developer Library contains the complete
  1620. text of this book. Might want to check it out there first before buying it?
  1621.  
  1622. %%TODO - get a review!
  1623.  
  1624.    * Visual C++ Power Toolkit
  1625.    *
  1626.         o Ventana Press ($50), 1995, 785 pages
  1627.         o Info: http://www.vmedia.com/vc++.html
  1628.         o (919) 942-0220
  1629.         o Richard Leinecker, Jamie Nye
  1630.         o Includes a CD-ROM
  1631.         o ISBN 1-56604-191-0
  1632.         o Note: Not updated for VC++ 4.0.
  1633.  
  1634. YACTB = Yet Another Cookbook Type Book. Although this book tries to be a
  1635. sourcebook for programmers by giving many new classes and clever code, it
  1636. just isn't laid out as logically as other books I've seen recently (see:
  1637. "Visual C++ How-To" listing). This book covers a lot of topics, such as:
  1638. Customizing the Interface, Animation, Screen Effects, Music & Sound,
  1639. Advanced Animation, Data Compression, OLE 2.0, Communications and Scanner
  1640. Input (Using TWAIN). I haven't found this book to be as useful as other
  1641. books for my purposes yet, but it does include a lot of new Classes which
  1642. may prove useful for other programmers.
  1643.  
  1644. cntrline@winnet.com, email, 7/15/95
  1645.  
  1646. I just grabbed this one and at first glance it looked really useful, then I
  1647. started reading it and BLECH! The author's writing is, well, it's not so
  1648. great. Also, the classes are sloppy and show no OO design at all. The
  1649. author's comment is "I'm not hungarian, so why should I name variables like
  1650. one". Can't say I recommend this one.
  1651.  
  1652. scot@stingsoft.com
  1653.  
  1654. The following are rumored to be coming out RSN (Real soon now)
  1655.  
  1656.    * MFC 4.0 Bible - The Waite Group ($45)
  1657.    * Extending MFC - AW David Shmitt
  1658.    * Programming Windows 95 with MFC, Microsoft Press, Jeff Prosise
  1659.  
  1660. %%TODO - get review, I think this is out.
  1661.  
  1662. 2.4.3. Cool MFC Articles
  1663.  
  1664. There's probably a million 'good' MFC articles out there, but this section
  1665. is for the ultra-hip, totally-swinging, must-have, gotta-read MFC articles.
  1666. If you submit an article for this section, please include all the 'volume'
  1667. information and a short paragraph about why it's so damn cool! [Note if you
  1668. have questions about the magazines or MSDN mentioned below, see sections:
  1669. 2.4.1 and 2.1.2]
  1670.  
  1671.    * "Fun with MFC: 33 Tips to Help You Get the Most Out of ..." Paul
  1672.      DiLascia, MSJ, November 1993, Volume 8, Number 11
  1673.  
  1674. This is my A#1 MFC article of all time. Even though this article is 2 years
  1675. old, it has principals and ideas that are extremely valuable to today's MFC
  1676. programmer. Good news is that it's on MSDN in their MSJ archives! You can
  1677. also find this gem under books online: Extensions: articles/Technical
  1678. Articles/Fun with MFC: 33 Tips.
  1679.  
  1680. scot@stingsoft.com
  1681.  
  1682.    * "Meandering Through the Maze of MFC Message and Command Routing" Paul
  1683.      DiLascia, MSJ, July 1995, Volume 10, Number 7
  1684.  
  1685. Best explanation of messages ever, a MFC FAQ "must-read".
  1686.  
  1687.    * "Rewriting the MFC Scribble Program Using an OOD Approach" Allen
  1688.      Holub, MSJ, August 1995, Volume 10, Number 8.
  1689.  
  1690. Not my favorite article, but 'DID' stir up lots of talk on most MFC forums.
  1691. Any article that generates this much noise has to be good.
  1692.  
  1693.    * "Self Decorating Pages" David A. Schmitt, Windows Tech Journal, July
  1694.      1995
  1695.    * "Dad, Can I Drive the Printer Tonight?" -David A. Schmitt, Windows
  1696.      Tech Journal, August 1995
  1697.  
  1698. This series of articles is pretty good, especially if you are into
  1699. printing.
  1700.  
  1701.    * "Plunge into MFC's User Interface" Scot Wingo, Windows Tech Journal,
  1702.      August 1994
  1703.  
  1704. Stuff by MFC FAQ maintainer:
  1705.  
  1706.    * C++ Report, SIGS Publications, "A Brief History of MFC" - recaps
  1707.      section 3 of this FAQ and throws in some new information.
  1708.    * Dr. Dobbs, January 1996, "Extending MFC" - describes an MFC grid
  1709.      extension.
  1710.  
  1711. %%TODO - Come on MFC FAQ readers - let's get some new submissions in this
  1712. section, getting boring!
  1713.  
  1714. 2.5. Trade shows
  1715.  
  1716.    * Visual C++ Developer's Conference
  1717.    *
  1718.         o There have been two US conferences put on by these guys and they
  1719.           keep getting better. These are kind of modeled after VBITs, where
  1720.           you have very focused talks on VC++/MFC/ATL. Check out
  1721.           http://www.vcdj.com. We really highly recommend this show since
  1722.           it is slowly becoming the only place for raw, uncensored MFC/VC
  1723.           informaiton!
  1724.    * Software Development (East and West)
  1725.    *
  1726.         o Miller Freeman
  1727.         o (415) 905-2222
  1728.         o http://www.mfi.com/sdconfs
  1729.         o tloftus@mfi.com
  1730.  
  1731. This show has gone down hill somewhat as far as MFC/VC is concerned.
  1732. Internet internet internet - sigh!
  1733.  
  1734. 2.6. Users Groups
  1735.  
  1736. I don't know of any MFC specific user's groups, but there are some really
  1737. good C++ user's groups that have some MFC content in their programs. The NW
  1738. C++ User's group has a really nice email newsletter that anybody can
  1739. subscribe to by emailing cpp@netcom.com. Here's the contact information for
  1740. the known C++ User's groups
  1741.  
  1742. %%TODO - add information on DC VC++ group.
  1743.  
  1744. ------------------------------------------------------------------------
  1745.  
  1746. Area                Contact Name            Contact Email
  1747.  
  1748. New York, NY        Saul Rosenberg          Rosenberg@decus.org
  1749.  
  1750. Redmond, WA         Steve Shimeall          steves@amc.com
  1751.  
  1752. San Jose, CA        Gene Paymar             epaymar@hooked.net
  1753.  
  1754. Santa Clara, CA     Marian Corcoran         mcorcora@ix.netcom.com
  1755.  
  1756. Tucson, AZ          Martin Lapidus          lascaux@primenet.com
  1757.  
  1758. North West          Robin Rowe              cpp@netcom.com
  1759.  
  1760. Boston, MA          John Barrie             70373.2241@compuserve.com
  1761.  
  1762. ------------------------------------------------------------------------
  1763.  
  1764. 2.7. Technical Support
  1765.  
  1766.    * Microsoft MSVC Technical Support
  1767.    *
  1768.         o (206) 635-7007
  1769.  
  1770. ------------------------------------------------------------------------
  1771.  
  1772. 3. A Brief History of MFC
  1773.  
  1774. I constantly see postings from folks confused about what version to use
  1775. where, etc.. So this history kind of explains where MFC has been and where
  1776. it's going. [This is the history as I remember it. If you have any details
  1777. that you can fill in, release dates, inside info, etc.. Let me know!]
  1778.  
  1779. To understand the MFC releases, you need to realize that there are 16 and
  1780. 32-bit releases of MFC. 16-bit releases call Win16 and run on Windows 3.1
  1781. and 3.11 (Windows for Workgroups)
  1782.  
  1783. The 32-bit releases call Win32 and run on Windows NT and Windows 95 (and
  1784. can run on Windows 3.1 with Win32s, but it still calls Win32)
  1785.  
  1786. Skip to section 3.10 for a quick table of releases if you want to skip the
  1787. long descriptions of each release.
  1788.  
  1789. In each section, the new classes added to MFC are highlighted. It's nearly
  1790. impossible to do cool class diagrams in ASCII, so their hierarchy is just
  1791. shown by indentation. I've also left CObject out of most of the hierarchies
  1792. for brevity. You can pretty much assume that CObject is a parent of most of
  1793. the classes except things like CString, etc.
  1794.  
  1795. 3.1. How do I know what version of MFC I'm using?
  1796.  
  1797. Check the top of the MFC header file afxver_.h (lives in
  1798. mfc\include\afxver_.h). Older versions use afxver.h. In there you will see
  1799. a #define for _MFC_VER.
  1800.  
  1801. This is the hex version of the MFC release with this key:
  1802.  
  1803. 0x0250
  1804.  
  1805. |_____________ Point release ( very minor)
  1806.  
  1807. |______________ Minor number
  1808.  
  1809. |______________ Major number
  1810.  
  1811. So in this example, the MFC release is 2.5.0.
  1812.  
  1813. 3.2. Pre-MFC 1.0
  1814.  
  1815. In the beginning, Microsoft created a group called the AFX group (stands
  1816. for (A)pplication (F)ramework(X)). This group probably was created to come
  1817. out with an OWL competitor, since Borland C++ was doing pretty well. They
  1818. came up with a class library that presented a very high abstraction from
  1819. the Windows API, kind of like OWL does.
  1820.  
  1821. [Note: The group was actually formed before OWL 1.0 according to
  1822. elsbree@msn.com ]
  1823.  
  1824. Legend has it that they then went and tried writing applications with it
  1825. for a couple of months and found that it was just too far removed from the
  1826. Windows API. They couldn't leverage any knowledge of Windows and most of
  1827. these guys were die hard Windows API hackers.
  1828.  
  1829. Legend also has it that at this point they scrapped the ENTIRE AFX class
  1830. library, and then worked on what would become MFC 1.0... You can still see
  1831. remnants of the AFX days, many of the source files have afx prefixes and
  1832. lots of macros in MFC today still have AFX in them.
  1833.  
  1834. The AFX group was actually responsible for two things: the MFC library and
  1835. the IDE's support for MFC (namely, the resource editor and the wizards).
  1836. The AFX name was dropped in April 1994, and the group's members simply
  1837. became part of smaller teams within the Visual C++ group. One of those
  1838. smaller teams is today's MFC team.
  1839.  
  1840. I've also heard rumors that MFC was once called the MS Fulcrum Classes.
  1841.  
  1842. 3.3. MFC 1.0
  1843.  
  1844. This release was simultaneously released with Microsoft C/C++ 7.0 in early
  1845. 1992. It provided a very thin abstraction over the Windows API. This
  1846. initial release did not have any of the document view architecture we know
  1847. and love today, however it did lay the foundation by introducing CObject,
  1848. MFC persistence via CArchive and many other features still heavily used in
  1849. MFC today. This was a 16-bit release released in 03/92.
  1850.  
  1851. A 32-bit version of MFC 1.0 was released in July 1993, together with
  1852. Windows NT 3.1 and the final Win32 SDK. The files there are dated 93-07-24.
  1853. The Win32 SDK did not include Visual C++ or the MFC 2.x.
  1854.  
  1855.                      MFC 1.0 Introduced These Classes:
  1856.  
  1857.    * General:
  1858.    *
  1859.         o Cobject
  1860.         o CWinApp
  1861.         o Cmenu
  1862.         o Carchive
  1863.         o CDumpContext
  1864.         o CRuntimeClass
  1865.         o CMemoryState
  1866.         o CFileStatus
  1867.         o Cstring
  1868.         o Ctime
  1869.         o CTimeSpan
  1870.         o Cpoint
  1871.         o Crect
  1872.         o CSize
  1873.    * Exceptions:
  1874.    * Cexception
  1875.    * CMemoryException
  1876.    * CNotSupportedException
  1877.    * CArchiveException
  1878.    * CFileException
  1879.    * CResourceException
  1880.    * File Services:
  1881.    * CFile
  1882.    * CStdioFile
  1883.    * CMemFile
  1884.    * Collections:
  1885.    * CByteArray
  1886.    * CWordArray
  1887.    * CDWordArray
  1888.    * CPtrArray
  1889.    * CObArray
  1890.    * CStringArray
  1891.    * CPtrList
  1892.    * CObList
  1893.    * CStringList
  1894.    * CMapWordToPtr
  1895.    * CMapWordToOb
  1896.    * CMapPtrToWord
  1897.    * CMapPtrToPtr
  1898.    * CMapStringToPtr
  1899.    * CMapStringToOb
  1900.    * CMapStringToString
  1901.    * Graphics:
  1902.    *
  1903.         o CDC
  1904.         o CClientDC
  1905.         o CWindowDC
  1906.         o CPaintDC
  1907.         o CMetaFileDC
  1908.         o CGdiObject
  1909.         o CPen
  1910.         o CBrush
  1911.         o CFont
  1912.         o CBitmap
  1913.         o CPalette
  1914.         o CRgn
  1915.    * Windows Support:
  1916.    * CWnd
  1917.    * CFrameWnd
  1918.    * CMDIChildWnd
  1919.    * CMDIFrameWnd
  1920.    * CDialog
  1921.    * CModalDialog
  1922.    * CStatic
  1923.    * CButton
  1924.    * CEdit
  1925.    * CListBox
  1926.    * CComboBox
  1927.    * CScrollBar
  1928.  
  1929. 3.4. MFC 2.0
  1930.  
  1931. MFC 2.0 was a 16-bit release that shipped with Visual C++ 1.0. It added the
  1932. Document/View framework on top of MFC 1.0 and also added OLE 1.0 classes,
  1933. message maps and common dialog classes. This was a 16-bit release released
  1934. on 02/93.
  1935.  
  1936.                      MFC 2.0 Introduced These Classes:
  1937.  
  1938.    * General:
  1939.    *
  1940.         o CCreateContext
  1941.         o CPrintInfo
  1942.         o CDataExchange
  1943.         o CCmdUI
  1944.    * Exceptions:
  1945.    * CFileException
  1946.    * COleException
  1947.    * Dialogs:
  1948.  
  1949. [Note CModalDialog was nuked and functionality moved to CDialog, you can
  1950. still see a #define CModalDialog CDialog in the header files]
  1951.  
  1952.    * CDialog [not introduced here, but revamped to be a base for common
  1953.      dlgs]
  1954.    * CFileDialog
  1955.    * CColorDialog
  1956.    * CFontDialog
  1957.    * CPrintDialog
  1958.    * CFindReplaceDialog
  1959.    * Windows Support:
  1960.  
  1961. [Just new derivatives of CButton/CEdit and VBX class.]
  1962.  
  1963.    * CButton
  1964.    * CBitmapButton
  1965.    * CEdit
  1966.    * CHEdit
  1967.    * CBEdit
  1968.    * CVBControl
  1969.    * Document Architecture:
  1970.    * CCmdTarget
  1971.    * CWinApp [Moved in hierarchy, use to be derived from CObject]
  1972.    * CDocTemplate
  1973.    * CSingleDocTemplate
  1974.    * CMultiDocTemplate
  1975.    * CDocument
  1976.    * COleDocument
  1977.    * COleClientDoc
  1978.    * COleServerDoc
  1979.    * Views:
  1980.    *
  1981.         o CView
  1982.         o CScrollView
  1983.         o CFormView
  1984.         o CEditView
  1985.    * Control Bars:
  1986.    * CControlBar
  1987.    * CToolBar
  1988.    * CStatusBar
  1989.    * CDialogBar
  1990.    * CSplitterWnd
  1991.    * OLE 1.0 Classes:
  1992.    * COleServer
  1993.    * COleTemplateServer
  1994.    * CDocItem
  1995.    * COleClientItem
  1996.    * COleServerItem
  1997.  
  1998. 3.5. MFC 2.1
  1999.  
  2000. MFC 2.1 shipped with Visual C++ 1.1 for NT, it was basically a Win32 port
  2001. of MFC 2.0. It was a 32-bit release that was released on 08/93.
  2002.  
  2003.                 MFC 2.1 Did NOT Introduce Any New Classes.
  2004.  
  2005. 3.6. MFC 2.5
  2006.  
  2007. MFC 2.5 shipped with Visual C++ 1.5. It introduced the OLE 2 and ODBC
  2008. classes. It was the last 'official' 16-bit release. Released in 12/93
  2009.  
  2010.                      MFC 2.5 introduced these classes:
  2011.  
  2012.    * General: [OLE and DB related]
  2013.    *
  2014.         o CFieldExchange
  2015.         o COleDataObject
  2016.         o COleDispatchDriver
  2017.         o CRectTracker
  2018.    * Exceptions: [OLE and DB exceptions]
  2019.    * COleException
  2020.    * COleDispatchException
  2021.    * CDBException
  2022.    * Files: [New OLE File support]
  2023.    * CFile
  2024.    * COleStreamfile
  2025.    * Dialogs: [New OLE Dialogs]
  2026.    *
  2027.         o CDialog
  2028.         o COleDialog
  2029.         o COleInsertdialog
  2030.         o COleChangeIconDialog
  2031.         o COlePasteSpecialDialog
  2032.         o COleConvertDialog
  2033.         o COleBusyDialog
  2034.         o COleLinksDialog
  2035.         o COleUpdateDialog
  2036.    * Windows Support: [Some OLE additions]
  2037.    * CFrameWnd
  2038.    * COleIPFrameWnd
  2039.    * CControlBar
  2040.    * COleResizeBar
  2041.    * Document Architecture: [Significant classes added for OLE here.]
  2042.    * CCmdTarget
  2043.    * COleObjectFactory
  2044.    * COleTemplateServer
  2045.    * COleDataSource
  2046.    * COleDropSource
  2047.    * COleDropTarget
  2048.    * COleMessageFilter
  2049.    * CDocument
  2050.    * COleDocument
  2051.    * COleLinkingDoc
  2052.    * COleServerDoc
  2053.    * CDocItem
  2054.    * COleClientItem
  2055.    * COleServerItem
  2056.    * Views: [New view for DB support]
  2057.    * CView
  2058.    * CScrollView
  2059.    * CFormView
  2060.    * CRecordView
  2061.    * ODBC/Database Classes:
  2062.    * CDatabase
  2063.    * CRecordSet
  2064.    * CLongBinary
  2065.  
  2066. 3.6.1. MFC 2.51
  2067.  
  2068. A point release to 2.5 (16-bit) that was a bug fix release. Shipped with
  2069. MSVC 2.0 in 9/94 with MFC 3.0 (32-bit).
  2070.  
  2071. 3.6.2. MFC 2.52
  2072.  
  2073. A point release to 2.5 (16-bit) that added some of the MFC 3.0 features
  2074. such as property sheets, Winsock and MAPI support. Shipped with MSVC 2.1 in
  2075. 1/95 with MFC 3.1 (32-bit).
  2076.  
  2077. NOTE: This is only available via the MSVC Subscription.
  2078.  
  2079.                           Classes added in 2.52:
  2080.  
  2081.    * CSocket
  2082.    * CAsyncSocket
  2083.    * CSocketFile
  2084.    * CPropertyPage
  2085.    * CPropertySheet
  2086.    * MAPI:
  2087.  
  2088. [Note that MAPI support was added to CDocument, no new classes]
  2089.  
  2090.    * CDocument::OnFileSendMail
  2091.    * CDocument::OnUpdateFileSendMail
  2092.    * COleDocument::OnFileSendMail
  2093.  
  2094. 3.6.3. MFC 2.52b
  2095.  
  2096. [Excerpt from the 2.52b rel notes]
  2097.  
  2098. Visual C++ 1.52b includes the industry-standard Microsoft Foundation Class
  2099. Library (MFC) version 2.52b. Besides classes for OLE and database, this
  2100. version includes classes for OLE control development.
  2101.  
  2102.                       Bugs Fixed in Visual C++ 1.52b
  2103.  
  2104. Visual C++ 1.52b fixes a number of bugs from Visual C++ 1.5. Of particular
  2105. interest to most developers are the following bug fixes:
  2106.  
  2107.                                  MFC 2.52b
  2108.  
  2109. Error L2025 occurred on CWnd::DoDataExchange. This bug has been corrected.
  2110. See Microsoft Knowledge Base article Q120152 for more information.
  2111.  
  2112. CArchive::ReadObject sometimes caused an assertion in a CPtrArray object
  2113. because CPtrArray can hold a maximum object size of 16K in a large memory
  2114. model application. CArchive did not take the memory model into account;
  2115. since CArchive enforced a 32K limit, objects of 32K could be written but an
  2116. assertion was generated if CArchive read in more than 16K. This bug has
  2117. been corrected.
  2118.  
  2119. There was a memory leak in 16-bit AUX_DATA.
  2120.  
  2121. The three pens used in the class CPropertySheet were leaking. See Microsoft
  2122. Knowledge Base article Q128604 for more information.
  2123.  
  2124. The CArchive buffer pointer could wrap around the end of a segment
  2125. unintentionally. This bug has been corrected.
  2126.  
  2127. If AfxSockInit failed, applications sometimes produced a General Protection
  2128. Fault. This bug has been corrected. See Microsoft Knowledge Base article
  2129. Q130653 for more information.
  2130.  
  2131. The MAPISendMail dialog did not stay modal. This bug has been corrected.
  2132.  
  2133. Source file DLGPROP.CPP had non-near data. This could prevent applications
  2134. from being able to run multi-instance. This bug has been corrected.
  2135.  
  2136. 3.6.4. MFC 2.52c
  2137.  
  2138. This bug-fix release shipped with Visual C++ 4.0 on a separate CDROM.
  2139.  
  2140. %%TODO check relnotes for details - is anyone still using this stuff?
  2141.  
  2142. 3.7. MFC 3.0
  2143.  
  2144. MFC 3.0 shipped with Visual C++ 2.0 in 9/94. It introduced docking
  2145. toolbars, property sheets and template based collection classes. This was
  2146. the first release in the MSVC subscription, it was a 32-bit release.
  2147.  
  2148.                          Classes added in MFC 3.0:
  2149.  
  2150.    * Tabbed Dialog Support:
  2151.    *
  2152.         o CWnd
  2153.         o CPropertySheet
  2154.         o CDialog
  2155.         o CPropertyPage
  2156.  
  2157. 3.8. MFC 3.1
  2158.  
  2159. MFC 3.1 shipped with Visual C++ 2.1 in 1/95. It introduced MAPI, WinSock
  2160. and Windows Common Controls. The MFC toolbar, status bar, etc.. still live
  2161. in MFC. This is the latest release out. It is a 32-bit release.
  2162.  
  2163. NOTE: Only available via MSVC subscription.
  2164.  
  2165.                          Classes Added in MFC 3.1:
  2166.  
  2167.    * MAPI: [Note that MAPI support was added to CDocument, no new classes]
  2168.    *
  2169.         o CDocument::OnFileSendMail
  2170.         o CDocument::OnUpdateFileSendMail
  2171.         o COleDocument::OnFileSendMail
  2172.    * Windows Common Controls Classes: [All of these are CWnd derived]
  2173.    * CAnimateCtrl
  2174.    * CHeaderCtrl
  2175.    * CHotkeyCtrl
  2176.    * CImageList
  2177.    * CListCtrl
  2178.    * CProgressCtrl
  2179.    * CSliderCtrl
  2180.    * CSpinButtonCtrl
  2181.    * CStatusBarCtrl
  2182.    * CTabCtrl
  2183.    * CToolBarCtrl
  2184.    * CToolTipCtrl
  2185.    * CTreeCtrl
  2186.    * WinSock Support:
  2187.    * CAsyncSocket
  2188.    * CSocket
  2189.  
  2190. 3.9. MFC 3.2
  2191.  
  2192. MFC 3.2 shipped with Visual C++ 2.2 via the subscription in mid/late July.
  2193. It is a 32-bit release. Includes a 2.52b 16-bit release update.
  2194.  
  2195. [here's an excerpt from the release notes]
  2196.  
  2197. Support for Windows Common Controls in USRDLLs. In order to use the MFC
  2198. Windows Common Control classes you must link in the appropriate static
  2199. libraries, as shown in the following table:
  2200.  
  2201. ------------------------------------------------------------------------
  2202.  
  2203. Library              Target
  2204.  
  2205. DAFXCC.LIB           Release Version
  2206.  
  2207. DAFXCCD.LIB          Debug Version
  2208.  
  2209. DAFXCCU.LIB          Release Unicode Version
  2210.  
  2211. DAFXCCUD.LIB         Debug Unicode Version
  2212.  
  2213. ------------------------------------------------------------------------
  2214.  
  2215. Updated MFC Common Control classes that work with those controls that have
  2216. been recently released in Windows NT 3.51 and those that will be available
  2217. in Windows 95 and a future version of Win32s.
  2218.  
  2219. Improved common control documentation that is more complete and reflects
  2220. changes since the first implementation.
  2221.  
  2222.                         New MFC sample applications
  2223.  
  2224.    * NOTEPAD + Notepad+ is an enhanced version of Notepad. Theenhancements
  2225.      are mainly from questions our customershave been asking.
  2226.    * SAVER Saver is a screen saver written using MFC. It "morphs" the text
  2227.      "MFC" to the text "C++".
  2228.    * OLEVIEW The OLEVIEW sample is very similar to the OLE2VIEW.EXE applet
  2229.      provided in \MSVC20\BIN. The sample illustrates how to implement OLE
  2230.      Object viewers through custom OLE interfaces. These custom interfaces
  2231.      are implemented in IVIEWERS.DLL
  2232.    * BATCH BATCH is an MDI application that lets you compress different AVI
  2233.      (Audio Video Interleaved) files in different ways.
  2234.    * WORDPAD WORDPAD illustrates use of the CRichEditCtrl and CRichEditView
  2235.      classes, which encapsulate the new Rich Edit common control.
  2236.  
  2237. These samples are located in the SAMPLES\MFC directory of your Visual C++
  2238. installation.
  2239.  
  2240.                        Updated Win32 SDK Components
  2241.  
  2242. With the release of Windows NT 3.51 and the upcoming release of Windows 95,
  2243. the Win32 SDK has been updated to support both of these operating systems.
  2244. Changes include new header files, new import libraries, and additional
  2245. documentation. Visual C++ 2.2 includes the latest header files, import
  2246. libraries and Win32 API documentation to support writing Windows NT- and
  2247. Windows 95-compatible applications.
  2248.  
  2249. 3.10. MFC 4.0
  2250.  
  2251. MFC 4.0 was released with Visual C++ 4.0 in November of 1995. Microsoft
  2252. skipped from Visual C++ 2.2 to 4.0 to synchronize numbers, which they later
  2253. broke in VC++ 5.0, but that's life I guess.
  2254.  
  2255.                          Classes added in MFC 4.0:
  2256.  
  2257.    * CSynchronize
  2258.    * CMutex
  2259.    * CEvent
  2260.    * CMultiLock
  2261.    * CShellNew - Windows 95
  2262.  
  2263. Visual C++ 4.0 also includes the component gallery, STL support and tons of
  2264. new features. Check out the Microsoft WWW for the details.
  2265.  
  2266. See FAQ section 11.24 and 13.7 for MFC/VC++ 4.0-specific questions.
  2267.  
  2268. 3.11. MFC 4.1
  2269.  
  2270. The most important thing about this release is that it is the last release
  2271. that supports Win32s. There are tons of MFC developers stuck on this
  2272. release, so if you see someone posting that they are using MFC 4.1, that is
  2273. probably why. This fixed many of the 4.0 bugs and added some new Internet
  2274. features.
  2275.  
  2276. %%TODO - get the date and a more comprehensive list of what was new. Can't
  2277. remember if ISAPI was in here yet, but I'm pretty sure it had the "sweeper"
  2278. stuff - HTTP, gopher and ftp classes.
  2279.  
  2280. 3.12. MFC 4.2
  2281.  
  2282. ISAPI classes added and actually usable OCX container support (still up for
  2283. debate IMO).
  2284.  
  2285. %%TODO - get the date and more features.
  2286.  
  2287. 3.13. MFC 4.2b
  2288.  
  2289. MFC 4.2 had numerous bugs in the areas of the Internet classes, OLE
  2290. controls, etc.
  2291.  
  2292. %%TODO - again, more specifics.
  2293.  
  2294. 3.14. MFC 4.21
  2295.  
  2296. Released on March 19, 1997 as part of Visual C++ 5.0, this is the latest
  2297. and greatest MFC release. The only new feature added to this release is
  2298. IntelliMouse ™ support which evidently took the better part of an
  2299. afternoon for .B ekiM to bang out. This release also includes another round
  2300. of bug fixes and I would say is by far the most stable MFC since 3.2 (this
  2301. is due to all of the new features added, which is understandable).
  2302.  
  2303. Unfortunately, we now have a situation where the MFC release doesn't match
  2304. VC++ - everybody on the newgroups thinks they are using MFC 5.0, which
  2305. doesn't exist. Help me set them straight!!
  2306.  
  2307. 3.11. Table of MFC releases
  2308.  
  2309. Hint, MFC releases are always MSVC release - 1. This is because MFC 1.0
  2310. came out with MS C 7. This was all changed with 4.0 of course, now the
  2311. formula is much easier: MSVC release = MFC release, well until VC++ 5.0
  2312. came out <sigh>.
  2313.  
  2314. ------------------------------------------------------------------------
  2315.  
  2316. MFC Release      MSVC Release       16 or 32 Bit   Notes
  2317.  
  2318. 1.0                                 16             Just thin Windows coverage
  2319.  
  2320. 2.0              1.0                16             Document/Views added
  2321.  
  2322. 2.1              1.1 for NT         32             First 32-bit release for NT
  2323.  
  2324. 2.5              1.5                16             OLE/ODBC, last 16-bit release
  2325.  
  2326. 2.51             2.0                16             Bug fixes
  2327.  
  2328. 2.52             2.1                16             Adds prop sheets to 2.5
  2329.  
  2330. 2.52b            2.2                16             Shipped in July '95, bug fixes
  2331.  
  2332. 2.5c             4.0                16             Shipped in Nov '95, bug fixes
  2333.  
  2334. 3.0              2.0                32             Property sheets, dock toolbars
  2335.  
  2336. 3.1              2.1                32             Winsock/MAPI, Win comctrls
  2337.  
  2338. 3.2              2.2                32             Shipped in July '95,more comctrls
  2339.  
  2340. 4.0              4.0                32             Win 95, thread classes, OCX containers
  2341.  
  2342. 4.1              4.1                32             Tons of bug fixes, sweeper (WinInet) classes
  2343.  
  2344. **Above was last release to support Win32s.
  2345.  
  2346. 4.2              4.2                32             More bug fixes, ISAPI classes
  2347.  
  2348. 4.2b             internet dl        32             Lots-o-bug-fixes!
  2349.  
  2350. 4.21             5.0                32             IntelliMouse™ support.
  2351.  
  2352. ------------------------------------------------------------------------
  2353. ------------------------------------------------------------------------
  2354.  
  2355. 4. Generic Class Questions
  2356.  
  2357. 4.1. CException - Exceptions and exception handling.
  2358.  
  2359. 4.1.1. How do I throw a CUserException derived exception?
  2360.  
  2361. When I try to catch a derived exception I get the following error: error
  2362. C2039: 'classCMyException' : is not a member of 'CMyException'
  2363. 'classCMyException' : undeclared identifier 'IsKindOf' : cannot convert
  2364. parameter 1 from 'int*' to 'const struct CRuntimeClass*'
  2365.  
  2366. You need to make your CMyException class dynamically creatable using the
  2367. DECLARE_DYNAMIC() and IMPLEMENT_DYNAMIC() macros. The CATCH macro expects
  2368. to be able to access run-time information about the thrown class.
  2369.  
  2370. - blaszczak@bix.com, Mike B, 6/5/95, comp.os.ms-windows.programmer.misc
  2371.  
  2372. 4.1.2. Do my exceptions have to be derived from CUserException?
  2373.  
  2374. No: The "User" in CUserException simply means that the exception is caused
  2375. by
  2376.  
  2377. user actions. It is a common misperception that this is the only exception
  2378. you can derive from.
  2379.  
  2380. -nuj@kruger.dk via email 11/23/95
  2381.  
  2382. ------------------------------------------------------------------------
  2383. ------------------------------------------------------------------------
  2384.  
  2385. 5. GDI Class Questions
  2386.  
  2387. 5.1. CDC
  2388.  
  2389. 5.1.1. How do I create a CDC from a HDC?
  2390.  
  2391. Sometimes the Windows API will just give you a handle to a DC and you might
  2392. want to create a CDC from that. On example is owner-drawn lists, combos and
  2393. buttons. You will receive a draw item message with a hDC. Here's some code
  2394. to turn that hdc into the more familiar CDC.
  2395.  
  2396. You can use this technique for any of the other MFC class/ Windows handle
  2397. pairs too.
  2398.  
  2399. void MyODList::DrawItem(LPDRAWITEMSTRUCT lpDrawItem){       CDC myDC;
  2400.  
  2401.        myDC.Attach(lpDrawItem->hDC);
  2402.  
  2403.        //Do more stuff here
  2404.  
  2405.        //If you don't detach, it will get deleted and windows will
  2406.  
  2407.        //not be happy if you delete it's dc..
  2408.  
  2409.        myDC.Detach();
  2410.  
  2411. }
  2412.  
  2413. Another approach is to call the CDC FromHandle method:
  2414.  
  2415.           CDC * pDC = CDC:FromHandle(lpDrawItem->hDC);
  2416.  
  2417. It's not clear which is 'better', FromHandle() is less error prone because
  2418. you do not have to remember to 'detach'.
  2419.  
  2420. jmccabe@portage1.portup.com (Jim McCabe) 6/5/95
  2421.  
  2422. 5.2. CBitmap
  2423.  
  2424. 5.2.1. How do I read a 256 color bitmap file from disk?
  2425.  
  2426. Currently, MFC does not contain direct support for reading and displaying
  2427. DIBs or BMPs. However, there are a number of sample applications that
  2428. illustrate just how to do this.
  2429.  
  2430. The first sample is the MFC sample application DIBLOOK. The MULTDOCS sample
  2431. uses the same source code provided by DIBLOOK to read and display DIBs and
  2432. BMPs.
  2433.  
  2434. Two other examples provided with Visual C++ are the SDK samples DIBVIEW and
  2435. SHOWDIB.
  2436.  
  2437. Question posted on comp.lang.c++, 6/5/95, found this in MS FAQ, 6/25/95
  2438.  
  2439. ------------------------------------------------------------------------
  2440.  
  2441. 6. Window, Control, and Dialogs Class Questions
  2442.  
  2443. 6.1. Windows
  2444.  
  2445. 6.1.1. How can I use a custom icon for a window?
  2446.  
  2447. The Microsoft Foundation Class Library stores icons for the main frame
  2448. window and the MDI frame window as resources. The icon with resource ID
  2449. AFX_IDI_STD_MDIFRAME is the icon for the MDI frame window, and the icon
  2450. with resource ID AFX_IDI_STD_FRAME is the icon for the main frame window.
  2451. To replace these icons in your application, add an icon to your resources
  2452. file with theappropriate ID.
  2453.  
  2454. The application specifies the icon for a view in an MDI child window when
  2455. it creates the template. The application uses the icon with the specified
  2456. resource ID when the user minimizes the MDI child window that contains the
  2457. corresponding view.
  2458.  
  2459. This technique allows you to specify one icon for the application to
  2460. associate with these windows. Windows also supports dynamically painting a
  2461. minimized window. To do this with MFC, use AfxRegisterWndClass() to
  2462. register a window class with a NULL icon handle. Override the
  2463. PreCreateWindow() function in the window class for the dynamically painted
  2464. icon and copy the name returned by AfxRegisterWndClass() into the
  2465. lpszClassName member of the CREATESTRUCT. This creates the window using the
  2466. class that has a NULL icon. When the user minimizes this window, the icon
  2467. receives WM_PAINT messages that it can process to display information
  2468. appropriately. To do so, override the OnPaint() message handler and call
  2469. the IsIconic() function to see if the window is minimized. If so, create a
  2470. CPaintDC object and use it to draw on the icon. If the window is not
  2471. minimized, call the base class version of OnPaint() to update the window
  2472. normally.
  2473.  
  2474. MSVC Knowledge Base 6/4/94
  2475.  
  2476. 6.1.2. How do I change the styles for a window that's created by MFC?
  2477.  
  2478. To change the default window attributes used by a framework application
  2479. created in AppWizard, override the window's PreCreateWindow() virtual
  2480. member function. PreCreateWindow() allows an application to access the
  2481. creation process normally processed internally by the CDocTemplate class.
  2482. The framework calls PreCreateWindow() just prior to creating the window. By
  2483. modifying the CREATESTRUCT structure parameter to PreCreateWindow(), your
  2484. application can change the attributes used to create the window.
  2485.  
  2486. The CTRLBARS sample application, provided with the Microsoft Foundation
  2487. Class Library version 2.0, demonstrates this technique to change window
  2488. attributes. Note that depending on what your application changes in
  2489. PreCreateWindow(), it may be necessary to call the base class
  2490. implementation. For more information, see MSVC knowledge base article
  2491. Q99847.
  2492.  
  2493. MSVC Knowledge Base 6/7/95
  2494.  
  2495. 6.1.3. How do I get the minimal size of a window using MFC?
  2496.  
  2497. Write a handler for WM_GETMINMAXINFO.
  2498.  
  2499. blaszczak@BIX.com, Mike Blaszczak, 6/12/95 via programmer.misc
  2500.  
  2501. 6.1.4. How do I change a Window's title?
  2502.  
  2503.  AfxGetApp()->m_pMainWnd->SetWindowText("My Window Title");
  2504.  
  2505.                             -or-
  2506.  
  2507. AfxGetMainWnd()->SetWindowText ( "My Own Title" ) ;
  2508.  
  2509. aj536@freenet.toronto.on.ca, mfc-l, 7/9/95
  2510.  
  2511. 6.1.5. How do I get rid of 'Untitled' in my main window caption?
  2512.  
  2513. Override the PreCreateWindow() function in your MainFrame class and do the
  2514. following in it..
  2515.  
  2516. cs.style &= ~FWS_ADDTOTITLE ;
  2517.  
  2518. You can also set the initial window position (cs.x, cs.y, cs.cx, cs.cy)
  2519. this way and change your class (cs.lpszClass) this way! Remember to call
  2520. CFrameWnd::PreCreateWindow at the end...
  2521.  
  2522. netninja@svpal.org, programmer.misc, 7/29/95
  2523.  
  2524. 6.1.6. How do I maximize my MDI child?
  2525.  
  2526. void CMainFrame::ActivateFrame(int nCmdShow){       if (!m_bActivated)
  2527.  
  2528.        {           m_bActivated = TRUE;            nCmdShow = SW_SHOWMAXIMIZED;       }
  2529.  
  2530.        CFrameWnd::ActivateFrame(nCmdShow);}
  2531.  
  2532. where m_bActivated is a member variable of your frame object.
  2533.  
  2534. duane@anasazi.com, programmer.win32, 8/3/95
  2535.  
  2536. 6.1.7. Why does focus go nutso with a CSplitterWnd?
  2537.  
  2538. Whenever I move the splitter bar, the I-beam cursor in my edit control goes
  2539. away. I have to click again in the edit control to get back the cursor.
  2540.  
  2541. The following Knowledge Base Article (GO MSKB on CIS) explains the focus
  2542. problem associated with splitter windows and a couple of work-arounds to
  2543. the problem. This may be of help to you.
  2544.  
  2545. ID: Q108434
  2546.  
  2547. FIX: CSplitterWnd Class Does Not Handle All Focus Cases
  2548.  
  2549. Ramesh, NetQuest., MSMFC, 8/3/95
  2550.  
  2551.  
  2552.  
  2553. 6.1.8. How do I make my first MDI child window start out maximized?
  2554.  
  2555. Here is a solution which works for me:
  2556.  
  2557. class CChildFrame : public CMDIChildWnd
  2558.  
  2559. {
  2560.  
  2561.         // .. stuff deleted ...
  2562.  
  2563.         // This makes the MDI child maximized.
  2564.  
  2565.           virtual void ActivateFrame(int nCmdShow) {
  2566.  
  2567.             // if another window is open, use default
  2568.  
  2569.             if(GetMDIFrame()->MDIGetActive())
  2570.  
  2571.                 CMDIChildWnd::ActivateFrame(nCmdShow);
  2572.  
  2573.             else
  2574.  
  2575.                 CMDIChildWnd::ActivateFrame(SW_SHOWMAXIMIZED); // else open maximized.
  2576.  
  2577.   }
  2578.  
  2579. // ... stuff deleted ...
  2580.  
  2581. };
  2582.  
  2583. - Stephen Bade, bade@convergent-design.com
  2584.  
  2585. 6.2. Controls
  2586.  
  2587. 6.2.1. How do I get a CControl from a Dialog Template?
  2588.  
  2589. You can get a pointer to a control from a already created dialog control by
  2590. doing a simple typecast of the results from GetDlgItem. Here's an example
  2591. that creates a CButton from a checkbox with ID : IDC_CHECK1.
  2592.  
  2593. void my_function(CDialog * pDialog){       CButton * pButton = (CButton *)pDialog->GetDlgItem(IDC_CHECK1);
  2594.  
  2595.        ASSERT(pButton != NULL);
  2596.  
  2597.        pButton->SetCheck(m_bShowState);
  2598.  
  2599. }
  2600.  
  2601. Note that it's always safer to check for the validity of the results from
  2602. GetDlgItem.
  2603.  
  2604. scot@stingsoft.com, 6/1/95
  2605.  
  2606. 6.2.2. How do I subclass a control using MFC?
  2607.  
  2608. Read the documentation on SubClassDlgItem. Here's an example of how to call
  2609. it:
  2610.  
  2611. BOOL CMyDialog::OnInitDialog(){        //Do your subclassing first.
  2612.  
  2613.         m_MyControl.SubClassDlgItem(ID_MYCONTROL, this);
  2614.  
  2615.         //Let the base class do its thing.        CDialog::OnInitDialog();
  2616.  
  2617.         // Perhaps do some more stuff        // Be sure to call Ctl3d last, or it will cause        // assertions from multiple subclassing.
  2618.  
  2619.         Ctl3dSubclassDlg(m_hWnd, CTL3D_ALL);}
  2620.  
  2621. Mike Williams, mikew@marlin.ssnet.com, mfc-l 6/1/95
  2622.  
  2623. 6.2.3. Why do I get an ASSERT when I subclass a control?
  2624.  
  2625. Make sure that you subclass the control BEFORE you call Ctl3dSubclassDlg,
  2626. if the 3-d control DLL is loaded first, it will already have subclassed
  2627. your controls and you will get an assert.
  2628.  
  2629. Mike Williams, mikew@marlin.ssnet.com, mfc-l 6/1/95
  2630.  
  2631. 6.2.4. How do I validate the contents of a control when it loses focus?
  2632.  
  2633. NOTE: This is in the Microsoft Software Library.
  2634.  
  2635. The FCSVAL sample application was created to show how an application can do
  2636. control-by-control validation in a dialog box.
  2637.  
  2638. The application itself is just a modal dialog box displayed by the
  2639. CWinApp::InitInstance(). After displaying the dialog box, InitInstance()
  2640. simply quits the application.
  2641.  
  2642. The important part of the sample takes place in the dialog-box class
  2643. implementation: There are two edit controls. The first takes input of an
  2644. integer between 1 and 20. The second takes a character string as input with
  2645. length less than or equal to 5. When you Tab or mouse-click from control to
  2646. control within the displayed dialog box, the contents of the control that
  2647. is losing focus are validated.
  2648.  
  2649.                             The CFocusDlg Class
  2650.  
  2651. The application's functionality centers around the CFocusDlg class and its
  2652. implementation of four message handlers (discussed below). Normal data
  2653. exchange (DDX) and validation (DDV) using the routines provided by MFC take
  2654. place in OnInitialUpdate(), when the dialog box is first displayed, and
  2655. when the user chooses the OK button to accept the input. This is default
  2656. behavior provided by ClassWizard when member variables are connected to
  2657. dialog-box controls and can be examined in the dialog class
  2658. DoDataExchange() function.
  2659.  
  2660. Validating control contents when switching focus from one control to the
  2661. next is done by handling the EN_KILLFOCUS notification sent by the edit
  2662. control that is losing focus. The idea here is to check the contents and,
  2663. if they are not valid, to display the message box, inform the user, and
  2664. then set the focus back to the control from which it came. Unfortunately,
  2665. some difficulties arise when trying to set the focus (or display the
  2666. message boxes) within a killfocus message handler. At this point, Windows
  2667. is in an indeterminate state as it is moving focus from one control to the
  2668. other. This is a bad place to do the validation and SetFocus() call.
  2669.  
  2670. The solution here is to post a user-defined message to the dialog box
  2671. (parent) and do the validation and SetFocus() there, thus waiting for a
  2672. safer time to do the work. (See "CFocusDlg::OnEditLostFocus()" in the file
  2673. FOCUSDLG.CPP and "WM_EDITLOSTFOCUS user-defined message" in the file
  2674. FOCUSDLG.H.)Another thing you will notice about this function is that it
  2675. uses TRY/CATCH to do the validation. The provided DDX/DDV routines throw
  2676. CUserExceptions when failing to validate or load a control's data. You
  2677. should catch these and do the SetFocus() in the CATCH block.
  2678.  
  2679. Note: This sample has other cool stuff, but this is the major one I've seen
  2680. asked about on the Net.
  2681.  
  2682. MS FAQ, 6/25/95
  2683.  
  2684. 6.2.5. How do I enable/disable a bank of checkboxes?
  2685.  
  2686. I don't know about a magic way to do this using a single HWND, but there is
  2687. a simple and self-documenting technique that I've been using for a long
  2688. time. You can make a routine that accepts an array of UINTs (your control
  2689. IDs) and a visibility flag.This function can be a stand-alone function, or
  2690. you can put it inside a class. I have been collecting little utility
  2691. functions like this and keep them in a CDialogBase class -- when I create a
  2692. new dialog box in ClassWizard, I fix up the code to derive from CDialogBase
  2693. instead of CDialog.
  2694.  
  2695. For example, the function might look like this:
  2696.  
  2697. void CDialogBase::ShowControls(UINT* pControls, UINT cControls, BOOL fVisible)
  2698.  
  2699. {
  2700.  
  2701.         for (UINT uIndex = 0; uIndex < cControls; uIndex++)
  2702.  
  2703.         {              CWnd* pwnd = GetDlgItem(pControls[uIndex]);
  2704.  
  2705.                 if (pwnd)
  2706.  
  2707.                 {
  2708.  
  2709.                         pwnd->ShowWindow(fVisible ? SW_SHOW : SW_HIDE);
  2710.  
  2711.                         pwnd->EnableWindow(fVisible);
  2712.  
  2713.                 }
  2714.  
  2715.         }
  2716.  
  2717. }
  2718.  
  2719. Then later, often in your OnInitDialog handler, you can call this function
  2720. with your control group:
  2721.  
  2722. #define SIZEOF_ARRAY(a) (sizeof(a) / sizeof(a[0]))
  2723.  
  2724. {
  2725.  
  2726.         static UINT aGroup1[] = { DLG_CHBOX1, DLG_CHBOX2,
  2727.  
  2728.                         DLG_STATIC1 };
  2729.  
  2730.         static UINT aGroup2[] = { DLG_LABEL2, DLG_LABEL7 };
  2731.  
  2732.         ShowControls(aGroup1, SIZEOF_ARRAY(aGroup1), TRUE);
  2733.  
  2734.         ShowControls(aGroup2, SIZEOF_ARRAY(aGroup2), FALSE);
  2735.  
  2736. }
  2737.  
  2738. You can find many uses for these control arrays later too... (Changing
  2739. fonts in a series of controls, etc...) Good luck,
  2740.  
  2741. jmccabe@portage1.portup.com, mfc-l, 7/18/95
  2742.  
  2743. 6.2.6. How do I change the background color of a control?
  2744.  
  2745. Your dialog can trap the WM_CTLCOLOR message, look up the MFC help file
  2746. notes for CWnd::OnCtlColor(). Before a control is about to paint itself,
  2747. the parent window receives a chance to set its own default text color and
  2748. background brush.
  2749.  
  2750. jmccabe@portage1.portup.com, mfc-l, 7/18/95
  2751.  
  2752. Also check out the MS KB article ID: Q117778 TITLE: Changing the Background
  2753. Color of an MFC Edit Control.
  2754.  
  2755. Ramesh, MSMFC, 7/19/95
  2756.  
  2757. 6.2.7. How do I trap the key for my control?
  2758.  
  2759. Handle WM_GETDLGCODE and return the appropriate value. Remember that the
  2760. listbox (or any other control) can only handle keyboard input when it has
  2761. the focus.
  2762.  
  2763. joej@golddisk.com, programmer.misc, 8/21/95, programmer.misc
  2764.  
  2765. 6.2.8. How can I DDX with a multiple selection listbox?
  2766.  
  2767. Download MLBDDX.ZIP from the MSMFC library on CIS. You'll get all the
  2768. necessary code. When the dialog closes, a provided CStringList will be
  2769. filled with the selected items. Freeware.
  2770.  
  2771. -Patrick Philippot, CIS email, 8/3/95
  2772.  
  2773. 6.2.9. How do I change the background color of a BUTTON???
  2774.  
  2775. NOTE: THE METHOD IN 6.2.6 WILL NOT WORK FOR BUTTONS!
  2776.  
  2777. If you want to change the color of a dialog button, you have to use
  2778. owner-draw button. (you can use bitmap buttons) Changing the color through
  2779. OnCtlColor() will not work for buttons. The following Knowledge Base
  2780. articles (GO MSKB on CIS) may be of help to you.
  2781.  
  2782. ID: Q32685 TITLE: Using the WM_CTLCOLOR Message
  2783.  
  2784. ID: Q64328 SAMPLE: Owner-Draw: 3-D Push Button Made from Bitmaps with Text
  2785.  
  2786. This article explains sample code for a owner-draw button.
  2787.  
  2788. Ramesh, NetQuest., MSMFC, 8/3/95
  2789.  
  2790. 6.2.10. Why isn't CEdit putting things on separate lines?
  2791.  
  2792. Make sure that the lines are separated with \r\n, not just \n.
  2793.  
  2794. sutor@watson.ibm.com, mfc-l, 8/7/95
  2795.  
  2796. 6.2.11. How do I get to the CEdit in a combobox?
  2797.  
  2798.         CComboCox combo;
  2799.  
  2800.         CEdit edit;
  2801.  
  2802.         // combobox creation ...
  2803.  
  2804.         // ...
  2805.  
  2806.         POINT tmpPoint = {1,1};
  2807.  
  2808.         edit.SubclassWindow( combo.ChildWindowFromPoint(tmpPoint)
  2809.  
  2810.         ->GetSafeHwnd());
  2811.  
  2812. jahans@slb.com, mfc-l, 8/25/95
  2813.  
  2814. Or:
  2815.  
  2816. Look into the mfc sample - npp - npview.cpp! Turns out all combo's create
  2817. their edits
  2818.  
  2819. with an ID of 1001 (decimal) so - if pComboBox is the pWnd object pointing
  2820. to the combo - all you need is:
  2821.  
  2822.          pComboBox->GetDlgItem(1001);
  2823.  
  2824. 6.2.12. How do I load more than 64K into an edit control?
  2825.  
  2826. The Rich Edit Control available in VC++ 2.1+ supports much more than 64k.
  2827. The Wordpad sample is a great way to learn more about this subject. If
  2828. you're stuck with 16-bit programming, I think that magma systems has a
  2829. 16-bit DLL that does this. Contact Marc Adler at: 75300.2062@compuserve.com
  2830. for details.
  2831.  
  2832. scot@stingsoft.com
  2833.  
  2834. 6.2.13. How do I subclass the listbox portion of a combobox?
  2835.  
  2836. The listbox portion of a combobox is of type COMBOLBOX ( notice the 'L').
  2837.  
  2838. Because the ComboLBox window is not a child of the ComboBox window, it is
  2839.  
  2840. not obvious how to subclass the COMBOLBOX control. Luckily, under the Win32
  2841.  
  2842. API, Windows sends a message to the COMBOBOX ( notice no 'L') called
  2843.  
  2844. WM_CTLCOLORLISTBOX before the listbox is drawn. The lParam passed with this
  2845.  
  2846. message contains the handle of the listbox. For example:
  2847.  
  2848. LRESULT CFileUpdateCombo::OnCtlColorListBox(WPARAM wParam,
  2849.  
  2850. LPARAM lParam)
  2851.  
  2852. {
  2853.  
  2854.         if ( ! m_bSubclassedListBox )
  2855.  
  2856. {
  2857.  
  2858.                         HWND hWnd = (HWND)lParam;
  2859.  
  2860.                         CWnd* pWnd = FromHandle(hWnd);
  2861.  
  2862.                         if ( pWnd && pWnd != this )
  2863.  
  2864.                         {
  2865.  
  2866.                                 // m_ListBox is derived from CListBox
  2867.  
  2868.                                 m_ListBox.SubclassWindow(hWnd );
  2869.  
  2870.                                 m_ListBox.SetOwner(this);
  2871.  
  2872.                                 m_bSubclassedListBox = TRUE;
  2873.  
  2874.                         }
  2875.  
  2876.         }
  2877.  
  2878.         return (LRESULT)GetStockObject(WHITE_BRUSH);
  2879.  
  2880. }
  2881.  
  2882. mikem@abelcomputers.com, email, 9/7/95
  2883.  
  2884. 6.2.14. How do I inherit a from a MFC standard control class and provide
  2885. initialization code that works on both subclassed and non-subclassed
  2886. controls?
  2887.  
  2888. [ed note: Ok, this probably isn't a FAQ, but I thought it sounded pretty
  2889. cool.]
  2890.  
  2891. I have a fix, but you may not like it; however, it takes care of both
  2892. subclassing methods.
  2893.  
  2894. If SubclassWindow() was virtual, all problems would be solved, as
  2895. SubclassDlgItem calls SubclassWindow(), and common initialization could be
  2896. called from this point, and from OnCreate(). Even better would be a virtual
  2897. SetupWindow() function called from all initialization points by Microsoft's
  2898. code.
  2899.  
  2900. C'est la vie. My fix might slow the message loop for the control in
  2901. question, but so far I haven't seen any performance hits. Over-ride the
  2902. virtual function WindowProc() for your control something like the following
  2903. (call SetupWindow() in OnCreate() also):
  2904.  
  2905. LRESULT CExtendControl::WindowProc( UINT message, WPARAM wParam,
  2906.  
  2907.  LPARAM lParam)
  2908.  
  2909. {
  2910.  
  2911.         if (!m_bSetup)
  2912.  
  2913.                 SetupWindow();
  2914.  
  2915.         return CEdit::WindowProc(message, wParam, lParam );
  2916.  
  2917. }
  2918.  
  2919. //This is a virtual function. Use it for Hwnd setup in all inherited
  2920.  
  2921. //classes. It will work for a subclassed window.
  2922.  
  2923. void CExtendControl::SetupWindow()
  2924.  
  2925. {
  2926.  
  2927.         ASSERT( m_hWnd );
  2928.  
  2929.         m_bSetup = TRUE;
  2930.  
  2931.         *** Insert Initialization Code here!***
  2932.  
  2933. }
  2934.  
  2935. Jody Power (jodyp@andyne.on.ca)
  2936.  
  2937. 6.3. Dialogs
  2938.  
  2939. 6.3.1. How do I center my dialog?
  2940.  
  2941. Use the CWnd::CenterWindow method accomplish this. I usually put it in my
  2942. OnInitDialog overloaded function. Since CDialog is an ancestor of CWnd, you
  2943. can call the method directly:
  2944.  
  2945.  BOOL CMyDialog::OnInitDialog()
  2946.  
  2947. {      //Perform any other dialog initialization up here.
  2948.  
  2949.         CenterWindow();
  2950.  
  2951.         return TRUE;
  2952.  
  2953. }
  2954.  
  2955. scot@stingsoft.com, 6/1/95.
  2956.  
  2957. 6.3.2. How do I get the 'old style' common dialogs on win95?
  2958.  
  2959. MFC detects if it is running on Win95, and if so, replaces the standard
  2960. FileOpen Dialog with an explorer version of the FileOpen Dialog. You can
  2961. prevent MFC from using this "explorer" version by adding the following line
  2962. to your CFileDialog derived class constructor:
  2963.  
  2964.         m_ofn.Flags &= ~OFN_EXPLORER;
  2965.  
  2966. andyd@andyne.on.ca (Andy DeWolfe), via programmer.win32, 5/10/95
  2967.  
  2968. 6.3.3. How do I subclass a win95 common dialog?
  2969.  
  2970. You can do it but Microsoft has made it much more difficult in Win95. You
  2971. need to create a "child dialog template" (with the WS_CHILD style) and set
  2972. it to m_ofn.lpTemplateName (making sure m_ofn.hInstance is set to your app
  2973. instance). This template must *only* contain the controls that you are
  2974. adding to the dialog (ie. NOT the whole dialog with the standard controls
  2975. duplicated as in Win3.x).
  2976.  
  2977. When the dialog is invoked, your template will appear (by default) below
  2978. the regular file dialog controls. If you put a static control with id stc32
  2979. (defined in include\dlgs.h), the common dialog code will rearrange things
  2980. so that the original controls will appear wherever your put the stc32
  2981. control (you don't have to size it to match the common dlg code will do
  2982. that for you).
  2983.  
  2984. You will need to supply m_ofn.lpfnHook and handle your additional controls
  2985. through the hook proc. Note that since the system puts your dialog template
  2986. ON TOP of the normal dialog, MFC message routing won't get to your controls
  2987. so you can't code them through a message map in your CFileDialog
  2988. derivative. If anybody has found a way around this, I'd love to hear it!!
  2989.  
  2990. This is very messy and Microsoft knows it. They promise a fix in MFC
  2991. 4.0.[ed. note: This is much nicer in 4.0. There are virtuals to override
  2992. for getting callbacks, plus it even handles the old and new style templates
  2993. - pretty clever stuff!]
  2994.  
  2995. joej@golddisk.com, Joe Janakovic, via programmer.win32, 6/10/95
  2996.  
  2997. 6.3.4. CDialog::Create() fails, what could be wrong?
  2998.  
  2999.    * Invalid HWND passed as a parent
  3000.    * Invalid dialog resource ID passed (be careful about numeric IDsvs.
  3001.      string IDs -- be careful with #define ID_MYDIALOG 0x1234 -- it isa
  3002.      "string" ID to the resource compiler).
  3003.    * One or more controls on your dialog could not be created, usually
  3004.    * Because of the use of a custom control that was not registered.
  3005.    * Calling EndDialog during the OnInitDialog message (or some
  3006.      otherhandler called early in the game)!
  3007.    * NULL HWND passed as parent when dialog has WS_CHILD style
  3008.  
  3009. That's about all I can think of right now,
  3010.  
  3011. Dean McCrory, MSMFC, 6/16/95
  3012.  
  3013. 6.3.5. How do I create a toolbar/statusbar in a dialog?
  3014.  
  3015. There's a sample in the Microsoft Software Library, DLGCBR, that
  3016. demonstrates how to do this. Basically there's four steps, outlined and
  3017. then coded belowàà
  3018.  
  3019. To add a control bar to a dialog, you must create the control bar as usual,
  3020. and then make room for the control bar within the client area of the
  3021. dialog. For the control bar to function properly, the dialog must duplicate
  3022. some of the functionality of frame windows. If you want
  3023. ON_UPDATE_COMMAND_UI handlers to work for the control bars, you also need
  3024. to derive new control bar classes, and handle the WM_IDLEUPDATECMDUI
  3025. message. If your dialog is not the main window of your application, you
  3026. will also need to modify its parent frame window to pass the
  3027. WM_IDLEUPDATECMDUI message on to the dialog's control bars.
  3028.  
  3029. To make room for a control bar within the client area of the dialog, follow
  3030. these steps in your dialog's OnInitDialog() function:
  3031.  
  3032. 1. Create the control bars.
  3033.  
  3034.                 CRect rcClientStart;
  3035.  
  3036.                 CRect rcClientNow;
  3037.  
  3038.                 GetClientRect(rcClientStart);
  3039.  
  3040.                 RepositionBars(AFX_IDW_CONTROLBAR_FIRST,
  3041.  
  3042.                                         AFX_IDW_CONTROLBAR_LAST,
  3043.  
  3044.                                         0,reposQuery,
  3045.  
  3046.                                         rcClientNow);
  3047.  
  3048. 2. Figure out how much room the control bars will take by using the
  3049. reposQuery option of RepositionBars():
  3050.  
  3051.                 CPoint ptOffset(rcClientStart.left - rcClientNow.left,
  3052.  
  3053.                                         rcClientStart.top - rcClientNow.top);
  3054.  
  3055.                 ptOffset.y += ::GetSystemMetrics(SM_CYMENU);
  3056.  
  3057.                 CRect rcChild;
  3058.  
  3059.                 CWnd* pwndChild = GetWindow(GW_CHILD);
  3060.  
  3061.                 while (pwndChild)
  3062.  
  3063.                 {
  3064.  
  3065.                         pwndChild->GetWindowRect(rcChild);
  3066.  
  3067.                         rcChild.OffsetRect(ptOffset);
  3068.  
  3069.                         pwndChild->MoveWindow(rcChild, FALSE);
  3070.  
  3071.                         pwndChild = pwndChild->GetNextWindow();
  3072.  
  3073.                 }
  3074.  
  3075. 3. Move all the controls in your dialog to account for space used by
  3076. control bars at the top or left of the client area. If your dialog contains
  3077. a menu, you also need to account for the space used by the menu:4. Increase
  3078. the dialog window dimensions by the amount of space used by the control
  3079. bars:
  3080.  
  3081.                 CRect rcWindow;
  3082.  
  3083.                 GetWindowRect(rcWindow);
  3084.  
  3085.                 rcWindow.right += rcClientStart.Width()
  3086.  
  3087.                          - rcClientNow.Width();
  3088.  
  3089.                 rcWindow.bottom += rcClientStart.Height() -
  3090.  
  3091.                         rcClientNow.Height();
  3092.  
  3093.                 MoveWindow(rcWindow, FALSE);
  3094.  
  3095. 5. Position the control bars using RepositionBars().
  3096.  
  3097. To update the first pane of a status bar with menu item text, you must
  3098. handle WM_MENUSELECT, WM_ENTERIDLE, and WM_SETMESSAGESTRING in your dialog
  3099. class. You need to duplicate the functionality of the CFrameWnd handlers
  3100. for these messages. See the CModelessMain class in the sample program for
  3101. examples of these message handlers.
  3102.  
  3103. To allow ON_UPDATE_COMMAND_UI handlers to work for other status bar panes
  3104. and for toolbar buttons, you must derive new control bar classes and
  3105. implement a message handler for WM_IDLEUPDATECMDUI. This is necessary
  3106. because the default control bar implementations of OnUpdateCmdUI() assume
  3107. the parent window is a frame window. However, it doesn't do anything but
  3108. pass the parent window pointer on to a function which only requires a
  3109. CCmdTarget pointer. Therefore, you can temporarily tell OnUpdateCmdUI()
  3110. that the parent window pointer you are giving it is a CFrameWnd pointer to
  3111. meet the compiler requirements. Here's an example:
  3112.  
  3113. LRESULT CDlgToolBar::OnIdleUpdateCmdUI(WPARAM wParam,LPARAM lParam)
  3114.  
  3115. {
  3116.  
  3117.         if (IsWindowVisible())
  3118.  
  3119.         {
  3120.  
  3121.                 CFrameWnd* pParent = (CFrameWnd*)GetParent();
  3122.  
  3123.                 if (pParent)
  3124.  
  3125.                         OnUpdateCmdUI(pParent, (BOOL)wParam);
  3126.  
  3127.         }
  3128.  
  3129.         return 0L;
  3130.  
  3131. }
  3132.  
  3133. To pass WM_IDLEUPDATECMDUI messages on to dialogs other than the main
  3134. window, save dialog pointers in your frame window class and create a
  3135. WM_IDLEUPDATECMDUI handler in that class. The handler should send the
  3136. WM_IDLEUPDATECMDUI message on to the dialog child windows by using
  3137. CWnd::SendMessageToDescendants(). Then perform default processing for the
  3138. message within the frame window.
  3139.  
  3140. MS FAQ 6/25/95
  3141.  
  3142. 6.3.6. Why isn't my CDialog::PreCreateWindow() getting called?
  3143.  
  3144. PreCreateWindow does not get called when you create a dialog box. If you
  3145. would like to init some data/controls for a dialog box you have to trap the
  3146. OnInitDialog message and do you stuff there. PreCreateWindow is use to
  3147. modify params for a window that you are creating.
  3148.  
  3149. ewalker@tezcat.com, mfc-l, 7/12/95
  3150.  
  3151. 6.3.7. How do I embed a common dialog in a property page?
  3152.  
  3153. This question comes up frequently on the "MFC" forum of CompuServe and the
  3154. simple answer - unfortunately - is that there is no way to do it :-(
  3155.  
  3156. chris@chrism.demon.co.uk, programmer.win32, 7/12/95
  3157.  
  3158. 6.3.8. Why can't I DDX/DDV to initialize my CDialog controls?
  3159.  
  3160. You can't do anything with the dialog controls until your dialog is created
  3161. - which doesn't happen until DoModal(). The standard way of overcoming the
  3162. problems is to create member variables for the data, initialise them before
  3163. calling DoModal and then transfer the values in OnInitDialog. Or perhaps in
  3164. UpdateData(). Much like the ClassWizard member variables does it.
  3165.  
  3166. So have your dialog include a CStringList or CStringArray, put the values
  3167. for the listbox in that and transfer them to the listbox in OnInitDialog.
  3168. [etc...]
  3169.  
  3170. null@diku.dk, programmer.controls, 7/11/95
  3171.  
  3172. Init your dialog in OnInitDialog. If neccessary pass a pointer to your
  3173. document to the constructor of your dialog (and save it in a
  3174. private/protected m_pDoc member).
  3175.  
  3176. jhasling@gascad.co.at, programmer.controls, 7/11/95
  3177.  
  3178. 6.3.9. How do I change the captions of a CPropertyPage?
  3179.  
  3180. You can change the label before adding the page to the property sheet in
  3181. the following way. You have to derive a class from CPropertyPage and add a
  3182. public function SetCaption which sets the caption.
  3183.  
  3184. void CPage1::SetCaption(char *str)
  3185.  
  3186. {
  3187.  
  3188.         m_strCaption = str; // m_strCaption is protected member of
  3189.  
  3190.         //CPropertyPage
  3191.  
  3192. }
  3193.  
  3194. Now you can us the SetCaption() function in the following way.
  3195.  
  3196. CMySheet my("My PropSheet");
  3197.  
  3198. CPage1 p1;
  3199.  
  3200. p1.SetCaption(str); // Setting the caption
  3201.  
  3202. my.AddPage(&p1);
  3203.  
  3204. CAnotherSheet newps("New Sheet");
  3205.  
  3206. CPage1 p2;
  3207.  
  3208. p2.SetCaption(newstr);
  3209.  
  3210. newps.AddPage(&p2);
  3211.  
  3212. my.DoModal();
  3213.  
  3214. Ramesh, NetQuest., MSMFC 8/3/95
  3215.  
  3216. 6.3.10. How do I trap F1 in my dialog?
  3217.  
  3218. The following Knowledge Base Article explains a way to trap the WM_KEYDOWN
  3219. messages in the dialog box.
  3220.  
  3221. ID: Q117563, TITLE: How to Trap WM_KEYDOWN Messages in a CDialog
  3222.  
  3223. The next article explains how to provide context sensitive help in a
  3224. dialog. It also points to sample code.
  3225.  
  3226. ID: Q110506, SAMPLE: Context Sensitive Help in a CDialog
  3227.  
  3228. Ramesh, NetQuest., MSMFC, 8/31/95
  3229.  
  3230. 6.3.11. How do I change the icon for a dialog-only MFC application?
  3231.  
  3232. Add the following code to the InitInstance() for the CWinApp derived class:
  3233.  
  3234. BOOL CDialogTestApp::InitInstance()
  3235.  
  3236. {
  3237.  
  3238.         //à
  3239.  
  3240. #if(_MFC_VER >= 0x0300)
  3241.  
  3242.         SetClassLong(m_pMainWnd->m_hWnd,GCL_HICON,
  3243.  
  3244.                 (LONG)LoadIcon(IDC_ICONDIALOGAPP));
  3245.  
  3246. #else
  3247.  
  3248.         SetClassWord(m_pMainWnd->m_hWnd,GCW_HICON,
  3249.  
  3250.                 (WORD)LoadIcon(IDC_ICONDIALOGAPP));
  3251.  
  3252. #endif
  3253.  
  3254.         //à
  3255.  
  3256.         m_pMainWnd->ShowWindow(m_nCmdShow);
  3257.  
  3258.         return TRUE;
  3259.  
  3260. }
  3261.  
  3262. 6.4. Control bars, status bars, toolbars, dialog bars.
  3263.  
  3264. 6.4.1. How do I add a combobox to my toolbar?
  3265.  
  3266. You can do this using the CToolBar::SetButtonInfo() method. The MFC sample
  3267. ctrlbars shows how to do this in file mainfrm.cpp. Basically you call
  3268. SetButtonInfo to create a blank space (TBBS_SEPARATOR)for the combo box,
  3269. with the resource ID of the help and tool tip for the
  3270.  
  3271. combobox. You then use GetItemRect to get the bounding rectangle of the
  3272. combobox, and create a combobox window of your own in that space.
  3273.  
  3274. scot@stingsoft.com, 6/1/95 martynl@cix.compulink.co.uk - updated.
  3275.  
  3276. 6.4.2. How do I update the text of a pane in a status bar?
  3277.  
  3278. By default, a CStatusBar pane is not enabled when the pane is created. To
  3279. activate a pane, you must call the ON_UPDATE_COMMAND_UI() macro for each
  3280. pane on the status bar and update the panes. Because panes do not send
  3281. WM_COMMAND messages, you cannot use ClassWizard to activate panes; you must
  3282. type the code manually. For example, suppose one pane has ID_INDICATOR_PAGE
  3283. as its identifier and that it contains the current page number in a
  3284. document. To make the ID_INDICATOR_PAGE pane display text, add the
  3285. following to a header file (probably the MAINFRM.H file):
  3286.  
  3287.  afx_msg void OnUpdatePage(CCmdUI *pCmdUI);
  3288.  
  3289. Add the following to the application message map:
  3290.  
  3291.  ON_UPDATE_COMMAND_UI(ID_INDICATOR_PAGE, OnUpdatePage)
  3292.  
  3293. Add the following to a source code file (probably MAINFRM.CPP):
  3294.  
  3295.  void CMainFrame::OnUpdatePage(CCmdUI *pCmdUI)
  3296.  
  3297. {
  3298.  
  3299.         pCmdUI->Enable();
  3300.  
  3301. }
  3302.  
  3303. To display text in the panes, either call SetPaneText() or call
  3304. CCmdUI::SetText() in the OnUpdate() function. For example, you might want
  3305. to set up an integer variable m_nPage that contains the current page
  3306. number. Then, the OnUpdatePage() function might read as follows:
  3307.  
  3308. void CMainFrame::OnUpdatePage(CCmdUI *pCmdUI)
  3309.  
  3310. {
  3311.  
  3312.         pCmdUI->Enable();
  3313.  
  3314.         char szPage[16];
  3315.  
  3316.         wsprintf((LPSTR)szPage, "Page %d", m_nPage);
  3317.  
  3318.         pCmdUI->SetText((LPSTR)szPage);
  3319.  
  3320. }
  3321.  
  3322. This technique causes the page number to appear in the pane during idle
  3323. processing in he same manner that the application updates other indicators.
  3324.  
  3325. MSVC Knowledge Base 6/4/94
  3326.  
  3327. 6.4.3. How do I make my CToolBar customizable at run-time?
  3328.  
  3329. You might consider reading article "CToolBarCtrl :Handling Customization
  3330. Notifications" in the Product Documentation of VC++ 2.1.
  3331.  
  3332. Here is the relevant extract :
  3333.  
  3334. "A Windows toolbar common control has built-in customization features,
  3335. including a system-defined customization dialog box, which allow the user
  3336. to insert, delete, or rearrange toolbar buttons. The application determines
  3337. whether the customization features are available and controls the extent to
  3338. which the user can customize the tolbar. These customization features are
  3339. available in the CToolBarCtrl class but not in the current CToolBar class.
  3340.  
  3341. You can make these customization features available to the user by giving
  3342. the toolbar the CCS_ADJUSTABLE style. The customization features allow the
  3343. user to drag a button to a new position or to remove a button by dragging
  3344. it off the toolbar. In addition, the user can double-click the toolbar to
  3345. display the Customize Toolbar dialog box, which allows the user to add,
  3346. delete, and rearrange toolbar buttons. The application can display the
  3347. dialog box by using the Customize member function."
  3348.  
  3349. R.Rajendran (NetQuest), 76041.2245@compuserve.com,
  3350.  
  3351. MSMFC Forum, May-9-95
  3352.  
  3353. If you want to make a standard MFC CToolbar customizable, you can download
  3354. CUSBAR.ZIP from the MSMFC library on Compuserve. This package implements
  3355. CCustomTolbar, the run-time customizable toolbar and also provides the
  3356. necessary user tools (customization dialog box including the code for a
  3357. bitmapped listbox). Freeware.
  3358.  
  3359. Patrick Philippot, 8/3/95 via email on CSERVE
  3360.  
  3361. 6.4.4. How do I turn off the toolbar or status bar?
  3362.  
  3363. You can turn the status bar off in any of your views (i.e. in the
  3364. OnViewStatusBar() method you describe above) with the following code:
  3365.  
  3366. if( ((CMainFrame*)GetParent())->m_wndToolBar.IsWindowVisible() )
  3367.  
  3368. {
  3369.  
  3370.         GetParent()->SendMessage(WM_COMMAND, ID_VIEW_TOOLBAR, 0L);
  3371.  
  3372. }
  3373.  
  3374. if( ((CMainFrame*)GetParent())->m_wndStatusBar.IsWindowVisible() )
  3375.  
  3376. {
  3377.  
  3378.         GetParent()->SendMessage(WM_COMMAND, ID_VIEW_STATUS_BAR, 0L);
  3379.  
  3380. }
  3381.  
  3382. Use 1L instead of 0L for the SendMessage's lParam to turn the bars on.
  3383.  
  3384. JKBenjamin@aol.com via mfc-l, 5/16/95
  3385.  
  3386. 6.4.5. How do I create a toolbar/statusbar in a dialog?
  3387.  
  3388. See section 6.3.5. of this FAQ
  3389.  
  3390.  
  3391.  
  3392. 6.4.6. Why doesn't MFC support the new controls provided by IE?
  3393.  
  3394. 6.4.7. Why doesn't MFC have toolbars like the Office 97 applications?
  3395.  
  3396. 6.4.8. Why doesn't MFC support command bar menus like the Visual C++ IDE?
  3397.  
  3398.  
  3399.  
  3400. A: The new user interface style provided by IE is implemented by a version
  3401. of COMCTL32.DLL that's still in beta. The beta import library, DLL, and
  3402. documentation is available in the ActiveX 3.01 SDK and is available for
  3403. download from Microsoft's web site. Since the controls are still in beta,
  3404. MFC doesn't support them. When they're available in their final version,
  3405. you can assume that a version of MFC that supports them will be
  3406. forthcoming.
  3407.  
  3408. The IDE and the Office applications do not use the COMCTL32.DLL
  3409. implementations of those controls, and therefore aren't concerned
  3410.  
  3411. with the release state of the system implementation library.
  3412.  
  3413. -.B ekiM - mikeblas@microsoft.com.
  3414.  
  3415. Note: the IE control is called Rebar and there was a very good MSJ article
  3416. about it. It is useful ONLY if you want to implement IE3/4 style toolbars.
  3417. The toolbars in VC++ 5.x and Office 97 are different - they are called
  3418. Command bars. THEY ARE NOT REBARS - the differences?
  3419.  
  3420.    * Rebars "slide" around.
  3421.    * Rebars aren't customizable (to my knowledge)
  3422.    * Command bars have cool floating menus too (rebar may do this
  3423.      eventually)
  3424.    * Command bars are less clunky.
  3425.    * Command bars don't have a transparent background.
  3426.    * Command bars are implemented inside of Office97/DevStudio - they are
  3427.      not available for developers to use, Rebar will be as part of a common
  3428.      control DLL.
  3429.    * Both have a "cool" or "flat" look and feel where the button reacts to
  3430.      the mouse movement by displaying a border.
  3431.    * I don't think Rebars are vertically dockable.
  3432.  
  3433. If you want to play with rebar you need the files COMMCTRL.H and
  3434. COMCTL32.LIB that comes with the ActiveX SDK available at
  3435. http://www.microsoft.com/intedev/sdk/.
  3436.  
  3437. Also, for more information take a look at the REBAR-Sample available at
  3438.  
  3439. http://www.microsoft.com/win32dev/ui/rebar.htm
  3440.  
  3441. FYI, Stingray Software has implemented Office97/DevStudio style command
  3442. bars in Objective Toolkit - check out the demo at http://www.stingsoft.com
  3443. . Right now we only have the toolbar working, but a future release will
  3444. have complete menus too!
  3445.  
  3446.  
  3447.  
  3448. 6.5. Menus
  3449.  
  3450. 6.5.1. How do I get a pointer to the menu bar in a MDI app?
  3451.  
  3452. QUESTION:
  3453.  
  3454. I'm writing a MDI application and I have problems to get a pointer to the
  3455. actual menu bar. The normal construction doesn't seem to work in MDI:
  3456.  
  3457.                 CMenu *menu;
  3458.  
  3459.                 menu = GetMenu()->GetSubMenu(0);
  3460.  
  3461. How can I get a pointer to the menu bar to update the menu?ANSWER:
  3462.  
  3463.                 AfxGetApp()->m_pMainWnd->GetMenu()->GetSubMenu(n);
  3464.  
  3465. mlinar@pollux.usc.edu, Mitch Mlinar, 6/8/95
  3466.  
  3467. 6.5.2. How do I implement a right-mouse popup-menu?
  3468.  
  3469. ///////////////////////////////////////////////////////////////////
  3470.  
  3471. // WM_RBUTTONDOWN handler.
  3472.  
  3473. //
  3474.  
  3475. // Trap this message and display the button properties popup menu.
  3476.  
  3477. // The main frame receives the popup menu messages. This allows the
  3478.  
  3479. // status bar to be updated with the help text.
  3480.  
  3481. // ///////////////////////////////////////////////////////////////////
  3482.  
  3483. void CAppButton::OnRButtonDown(UINT flags, CPoint point)
  3484.  
  3485. {
  3486.  
  3487.         CMenu menu;
  3488.  
  3489.         CMenu *submenu;
  3490.  
  3491.         // load the menu
  3492.  
  3493.         menu.LoadMenu(IDR_LAUNCH);
  3494.  
  3495.         // get the popup menu
  3496.  
  3497.         submenu = menu.GetSubMenu(0);
  3498.  
  3499.         // convert to screen coordinates
  3500.  
  3501.         ClientToScreen(&point);
  3502.  
  3503.         // post the menu
  3504.  
  3505.         submenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,
  3506.  
  3507.                                                 point.x,        point.y,
  3508.  
  3509.                                                 AfxGetApp()->m_pMainWnd,NULL);
  3510.  
  3511. }
  3512.  
  3513. johnm@unipalm.co.uk, programmer.win32, 7/12/95
  3514.  
  3515. It's better to use RBUTTONUP instead, however right-clicking on dialog
  3516. controls doesn't generate RBUTTONUP and RBUTTONDOWN messages.
  3517.  
  3518. If it's necessary to treat this situation too, a program have to catch
  3519. WM_PARENTNOTIFY message in Win3.x and WinNT and WM_CONTEXTMENU in Windows
  3520. 95. Here's a code:
  3521.  
  3522. // May be dialog too:
  3523.  
  3524. BEGIN_MESSAGE_MAP(CMyPropertyPage, CPropertyPage)
  3525.  
  3526.         //{{AFX_MSG_MAP(CMyPropertyPage)
  3527.  
  3528.         ON_WM_RBUTTONUP()
  3529.  
  3530.         ON_WM_PARENTNOTIFY()
  3531.  
  3532.         ON_MESSAGE(WM_CONTEXTMENU, OnContextMenu)
  3533.  
  3534.         //}}AFX_MSG_MAP
  3535.  
  3536. END_MESSAGE_MAP()
  3537.  
  3538. void CMyPropertyPage::OnRButtonUp(UINT nFlags, CPoint point)=20
  3539.  
  3540. {
  3541.  
  3542.         PopupMenu (&point);
  3543.  
  3544. }
  3545.  
  3546. void CMyPropertyPage::OnParentNotify(UINT message, LPARAM lParam)
  3547.  
  3548. {
  3549.  
  3550.         if (message !=3D WM_RBUTTONDOWN)
  3551.  
  3552.                 CPropertyPage::OnParentNotify(message, lParam);
  3553.  
  3554.         else
  3555.  
  3556.         {
  3557.  
  3558.                 CPoint pt(LOWORD(lParam),HIWORD(lParam));
  3559.  
  3560.                 PopupMenu (&pt);
  3561.  
  3562.         }
  3563.  
  3564. }
  3565.  
  3566. LONG CMyPropertyPage::OnContextMenu (UINT wParam, LONG lParam)
  3567.  
  3568. {
  3569.  
  3570.         CPoint pt(LOWORD(lParam),HIWORD(lParam));
  3571.  
  3572.         ScreenToClient (&pt);
  3573.  
  3574.         PopupMenu (&pt);
  3575.  
  3576.         return 0;
  3577.  
  3578. }
  3579.  
  3580. //*****************************************************************
  3581.  
  3582. void CMyPropertyPage::PopupMenu(CPoint* pt)
  3583.  
  3584. {
  3585.  
  3586.         ASSERT(m_idContextMenu !=3D 0);
  3587.  
  3588.         ASSERT(nSubMenu >=3D 0);
  3589.  
  3590.         ClientToScreen (pt);
  3591.  
  3592.         CMenu FloatingMenu;
  3593.  
  3594.         VERIFY(FloatingMenu.LoadMenu(ID_POPUP_MENU));
  3595.  
  3596.         CMenu* pPopupMenu =3D FloatingMenu.GetSubMenu (0);
  3597.  
  3598.         ASSERT(pPopupMenu !=3D NULL);
  3599.  
  3600.         pPopupMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON,=20
  3601.  
  3602.                 pt->x, pt->y, this);
  3603.  
  3604. }
  3605.  
  3606. PaulACost@msn.com - via email, 10/15/95
  3607.  
  3608. 6.5.3. How do I dynamically change the mainframe menu?
  3609.  
  3610.         CMenu newMenu;
  3611.  
  3612.         newMenu.LoadMenu (IDR_MENU1);
  3613.  
  3614.         AfxGetMainWnd()->SetMenu( &newMenu );
  3615.  
  3616.         AfxGetMainWnd()->DrawMenuBar();
  3617.  
  3618.         newMenu.Detach ();
  3619.  
  3620. Arun Rao, MSMFC, 6/27/95
  3621.  
  3622. 6.5.4. How do I 'attach' a menu to a window's creation/destruction?
  3623.  
  3624. {Note the original question talked about dialogs, but you can interpolate
  3625. this code to any kind of window that you want to have change the menu.}
  3626.  
  3627. One of the ways to do this is as followsàà
  3628.  
  3629.   1.
  3630.        1.
  3631.             1.
  3632.                  1. Declare a variable CMenu pNewMenu in one of the dialog
  3633.                     class.
  3634.                  2. Handle the WM_INITDIALOG and WM_CLOSE messages in
  3635.                     thedialog class as follows.
  3636.  
  3637. BOOL CMydlg::OnInitDialog()
  3638.  
  3639. {
  3640.  
  3641.         CDialog::OnInitDialog();
  3642.  
  3643.         // Load the IDR_MYFRAME menu
  3644.  
  3645.         pNewMenu = new CMenu;
  3646.  
  3647.         pNewMenu->LoadMenu(IDR_MYFRAME);
  3648.  
  3649.         // Set the mainframe menu to mainframe.
  3650.  
  3651.         ((CMainFrame *)AfxGetMainWnd())->SetMenu(pNewMenu);
  3652.  
  3653.         return TRUE;
  3654.  
  3655. }
  3656.  
  3657. And
  3658.  
  3659. void CMydlg::OnClose()
  3660.  
  3661. {
  3662.  
  3663.         // Detach the previous HMenu handle from the object.
  3664.  
  3665.         pNewMenu->Detach();
  3666.  
  3667.         pNewMenu->LoadMenu(IDR_MAINFRAME);
  3668.  
  3669.         // Restore the mainframe menu.
  3670.  
  3671.         ((CMainFrame *)AfxGetMainWnd())->SetMenu(pNewMenu);
  3672.  
  3673.         CDialog::OnClose();
  3674.  
  3675. }
  3676.  
  3677. 4. If there are other methods of closing the dialog (example- By clicking a
  3678. button in the Dialog), then The code given above in OnClose handler, must
  3679. be put in the button click handler.
  3680.  
  3681. Sanjeev Kumar, MSMFC, 6/23/95
  3682.  
  3683. 6.6. Windows Common Controls (a.k.a. Windows 95 controls)
  3684.  
  3685. 6.6.1. Can I use these controls under NT or Win32s?
  3686.  
  3687. Windows NT 3.50 does not support the common controls, and will not in the
  3688. future. You must use Windows NT version 3.51 to gain the common controls.
  3689.  
  3690. blaszczak@BIX.com, mfc-l, 7/6/95
  3691.  
  3692. Version 1.30 of Win32s supports the Common controls.
  3693.  
  3694. 6.6.2. Where's a demo of these wickedly cool controls?
  3695.  
  3696. Check out the MFC sample, fire, it features most of the controls in action:
  3697. MSVC20\samples\mfc\fire. Under 4.0, there's another one called cmnctrls.
  3698.  
  3699. scot@stingsoft.com, 7/27/95
  3700.  
  3701. 6.6.3. How do you handle NM_DBLCLK for a CListCtl?
  3702.  
  3703. BEGIN_MESSAGE_MAP(CListView, CView)
  3704.  
  3705.         ON_NOTIFY( NM_DBLCLK,ID_LISTCTRL,OnDblClick )
  3706.  
  3707. END_MESSAGE_MAP()
  3708.  
  3709. void CListView::OnDblClick(NMHDR* /*k*/, LRESULT* /*j*/)
  3710.  
  3711. {
  3712.  
  3713.         int nItem, nFlags;
  3714.  
  3715.         char szTest[80];
  3716.  
  3717.         nFlags = LVNI_SELECTED;
  3718.  
  3719.         nItem = m_ListCtrl->GetNextItem(-1, nFlags );
  3720.  
  3721.         if ( nItem != -1 )
  3722.  
  3723.         {
  3724.  
  3725.                 sprintf( szTest, "Selected Item %d", nItem);
  3726.  
  3727.                 AfxMessageBox(szTest);
  3728.  
  3729.         }
  3730.  
  3731. }
  3732.  
  3733. spolyak@interaccess.com, mfc-l, 7/21/95
  3734.  
  3735. 6.6.4. Does CTreeCtrl support multiple selection?
  3736.  
  3737. No. Sorry! (I see this one all the time!)
  3738.  
  3739. scot@stingsoft.com
  3740.  
  3741. If it's accessible to you, Microsoft Systems Journal, July 1994, has an
  3742. extensive look at TreeViews, including a sample program that includes drag
  3743. & drop. If you're developing for Windows 95, you don't need a shareware
  3744. implementation, MFC has a class for it.
  3745.  
  3746. steven@primenet.com
  3747.  
  3748. 6.6.5. When I expand a node in my CTreeCtrl, there's no visual feedback,
  3749. what to do?
  3750.  
  3751. Create the control with TVS_SHOWSELALWAYS style.
  3752.  
  3753. kfreeman@viewlogic.com
  3754.  
  3755. 6.6.6. (The FAQ of the devil!) How do I implement multiple selection,
  3756. tooltips, editable nodes and multiple columns in my tree control?
  3757.  
  3758. Unfortunately, since the tree control lives in a binary DLL, it is not very
  3759. extensible and you are stuck without these features. There have been
  3760. articles on how to try and "hack" these features, but they do not work
  3761. reliably.
  3762.  
  3763. We have a drop-in tree control replacement that implements all of these
  3764. features and more in Objective Toolkit. Demos are at
  3765. http://www.stingsoft.com.
  3766.  
  3767. 6.7. CSplitterWnd FAQs
  3768.  
  3769. %%TODO - add lots of these, email us your toughest ones.
  3770.  
  3771. FYI - MFC Internals has a whole chapter devoted to this - it's my personal
  3772. favorite MFC class because it has lots of interesting internals,
  3773. shortcomings, odd behaviors, etc..
  3774.  
  3775. We wrote a DDJ article where we show how to swap the splitter from
  3776. horizontal to vertical. I think the code is at http://www.ddj.com if you
  3777. are interested.
  3778.  
  3779. ------------------------------------------------------------------------
  3780.  
  3781. -scot@stingsoft.com - Scot Wingo
  3782.  
  3783. 7. Documents, Views and Frame Class Questions
  3784.  
  3785. 7.1. Views
  3786.  
  3787. 7.1.1. How do I size a view?
  3788.  
  3789. Normally, you can change the size of a window by calling MoveWindow(). In
  3790. an application developed with the Microsoft Foundation Class (MFC) Library,
  3791. the view window is a child window of the frame window that surrounds the
  3792. view. To change the size of the view window, retrieve a pointer to the
  3793. frame window of the view by calling GetParentFrame(), then call
  3794. MoveWindow() to change the size of the parent. When the parent frame window
  3795. changes size, it automatically changes the size of the view window to fit
  3796. in the parent frame.
  3797.  
  3798. MSVC Knowledge Base. 6/4/94
  3799.  
  3800. 7.1.2. How do I size a CFormView?
  3801.  
  3802. See MS Knowledge Base article Q98598 for a very long answer. Basically, you
  3803. need to override OnInitialUpdate() in a CFormView derived class. There's
  3804. other details to deriving from CFormView that the article goes into.
  3805.  
  3806. MSVC Knowledge Base. 6/7/95
  3807.  
  3808. In the view ClikethisView declaration:
  3809.  
  3810.         virtual void OnInitialUpdate();
  3811.  
  3812. In the ClikethisView code:
  3813.  
  3814. void ClikethisView::OnInitialUpdate(){
  3815.  
  3816.         // make the window the size of the main dialog
  3817.  
  3818.         CFormView::OnInitialUpdate();
  3819.  
  3820.         GetParentFrame()->RecalcLayout();
  3821.  
  3822.         ResizeParentToFit( /*FALSE*/ );
  3823.  
  3824. }
  3825.  
  3826. andyr@gate.net, programmer.misc, 8/11/95
  3827.  
  3828. 7.1.3. How do I use new views with a doc template?
  3829.  
  3830. In an application created with AppWizard, you have two options: change the
  3831. derivation of the current view, or create a new view and use the new view
  3832. in your MDI application along with the original view.
  3833.  
  3834. To create a new view, use ClassWizard to create a new class derived from
  3835. CView. After the class has been created, the steps to use the new view or
  3836. to modify the view provided by App Wizard are the same.
  3837.  
  3838. 1. Modify the header file for the view class to change all references to
  3839. CView to the name of the desired view class. In this example, the class is
  3840. derived from CScrollView.Usually, this step involves changing the class the
  3841. view class is derived from as follows:
  3842.  
  3843.  class CMyView : public CScrollView
  3844.  
  3845. 2. Modify the implementation file for the view class to change all
  3846. references to CView to the name of the desired view class. This involves
  3847. changing the IMPLEMENT_DYNCREATE line as follows:
  3848.  
  3849. IMPLEMENT_DYNCREATE(CMyView, CScrollView)
  3850.  
  3851. changing the BEGIN_MESSAGE_MAP as follows:
  3852.  
  3853. BEGIN_MESSAGE_MAP(CMyView, CScrollView)
  3854.  
  3855. and changing any other references to CView to CScrollView.
  3856.  
  3857. 3. No further modifications are required if you are modifying a view
  3858. created by App Wizard. If you create a new view, find the AddDocTemplate()
  3859. call in the CWinApp::InitInstance() function. The third parameter to
  3860. AddDocTemplate() is RUNTIME_CLASS(CSomeView). To replace the current view
  3861. with the new view class, change CSomeView to CMyView. In an MDI
  3862. application, you can use multiple view types by adding a second
  3863. AddDocTemplate() call that changes RUNTIME_CLASS(CSomeView) to
  3864. RUNTIME_CLASS(CMyView).
  3865.  
  3866. For more information, please see Knowledge Base article Q99562.
  3867.  
  3868. MSVC Knowledge Base 6/7/95
  3869.  
  3870. 7.1.4. How do I change the background color of a view?
  3871.  
  3872. To change the background color for a CView, CFrameWnd, or CWnd object,
  3873. process the WM_ERASEBKGND message. The following code shows how:
  3874.  
  3875. BOOL CSampleView::OnEraseBkgnd(CDC* pDC)
  3876.  
  3877. {
  3878.  
  3879.         // Set brush to desired background color
  3880.  
  3881.         CBrush backBrush(RGB(255, 128, 128));
  3882.  
  3883.         // Save old brush
  3884.  
  3885.         CBrush* pOldBrush = pDC->SelectObject(&backBrush);
  3886.  
  3887.         CRect rect;
  3888.  
  3889.         pDC->GetClipBox(&rect);     // Erase the area needed
  3890.  
  3891.         pDC->PatBlt(rect.left, rect.top, rect.Width(),
  3892.  
  3893.         rect.Height(), PATCOPY);
  3894.  
  3895.         pDC->SelectObject(pOldBrush);
  3896.  
  3897.         return TRUE;
  3898.  
  3899. }
  3900.  
  3901. I solved the problem like this->
  3902.  
  3903. HBRUSH dlgtest::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  3904.  
  3905. {
  3906.  
  3907.         switch (nCtlColor)
  3908.  
  3909.         {
  3910.  
  3911.                 case CTLCOLOR_BTN:
  3912.  
  3913.                 case CTLCOLOR_STATIC:
  3914.  
  3915.                 {
  3916.  
  3917.                         pDC->SetBkMode(TRANSPARENT);
  3918.  
  3919.                 }
  3920.  
  3921.                 case CTLCOLOR_DLG:
  3922.  
  3923.                 {
  3924.  
  3925.                         CBrush*         back_brush;
  3926.  
  3927.                         COLORREF        color;
  3928.  
  3929.                         color = (COLORREF) GetSysColor(COLOR_BTNFACE);
  3930.  
  3931.                         back_brush = new CBrush(color);
  3932.  
  3933.                         return (HBRUSH) (back_brush->m_hObject);
  3934.  
  3935.                 }
  3936.  
  3937.         }
  3938.  
  3939.         return(CFormView::OnCtlColor(pDC, pWnd, nCtlColor));
  3940.  
  3941. }
  3942.  
  3943. Tim, tfiner@vrli.com, email, 9/10/95
  3944.  
  3945. 7.1.5. How do I get the current View?
  3946.  
  3947. The best thing to do is to pass the view along as a parameter. If this is
  3948. impractical, you can get the view if you KNOW, that it is the currently
  3949. active document and the currently active view. For details, see :
  3950.  
  3951. Microsoft KB, article Q108587, "Get Current CDocument or CView from
  3952. Anywhere".
  3953.  
  3954. In brief, use
  3955.  
  3956.         ((CFrameWnd*) AfxGetApp()->m_pMainWnd))->GetActiveDocument()
  3957.  
  3958. and
  3959.  
  3960.         ((CFrameWnd*)(AfxGetApp()->m_pMainWnd))->GetActiveView()
  3961.  
  3962. to get the document and the view. It might be a good idea to wrap them in
  3963. static functions in your CMyDoc and CMyView and check that they are of the
  3964. correct RUNTIME_CLASS.
  3965.  
  3966. If the view isn't the currently active view or if you can run OLE in-place,
  3967. this won't work however.
  3968.  
  3969. null@diku.dk, Niels Ull Jacobsen, programmer.misc, 6/8/95
  3970.  
  3971. 7.1.6. How do I create multiple views on one document?
  3972.  
  3973. The CDocTemplate::CreateNewFrame() function creates additional views of a
  3974. document in an MDI application written with MFC. To call this function,
  3975. specify a pointer to a CDocument object (the document for which the
  3976. function will create a view) and a pointer to a frame window that has the
  3977. properties to duplicate. Typically, the second parameter of this function
  3978. is NULL.
  3979.  
  3980. When an application calls CreateNewFrame(), the function creates a new
  3981. frame window and a view in the frame window. The frame window type and view
  3982. type depend on the document template (CDocTemplate) associated with the
  3983. document specified in the CreateNewFrame() call.
  3984.  
  3985. The CHKBOOK MFC sample application that ships with Visual C++ also
  3986. demonstrates creating additional frames and views for documents. Check out
  3987. CHKBOOK.CPP, the CChkBookApp::OpenDocumentfile() function.
  3988.  
  3989. Another example of using CreateNewFrame() is the MULTVIEW sample
  3990. application. Also, Dale Rogerson's article, "Multiple Views for a Single
  3991. Document" located on the Microsoft Developer Network Development Library
  3992. CD-ROM, which explains in detail how to addadditional views to an existing
  3993. document, is an excellent source of information.
  3994.  
  3995. CreateNewFrame() creates both a frame and a view; not only a view. If, for
  3996. some reason, CreateNewFrame() does not quite address your situation, the
  3997. source code for CreateNewFrame() is quite useful to demonstrate the steps
  3998. required to create frames and views.
  3999.  
  4000. MS FAQ with mods, 6/25/95
  4001.  
  4002. 7.1.7. How do I get all the views in an MDI app?
  4003.  
  4004. You need to use some functions which are undocumented:
  4005.  
  4006.    * CDocument::GetFirstViewPosition(); // DOCCORE.CPP
  4007.    * CDocument::GetNextView(); // DOCCORE.CPP
  4008.    * CMultiDocTemplate::GetFirstDocPosition(); // DOCMULTI.CPP
  4009.    * CMultiDocTemplate::GetNextDoc(); // DOCMULTI.CPP
  4010.  
  4011. You'll also need to mess with the m_templateList member of CWinApp.
  4012.  
  4013. blaszczak@Bix.com, mfc-l, 7/11/95
  4014.  
  4015. Note: This has changed with MFC 4.0. There's now a class called CDocManager
  4016. which can get to all of the views/docs for you. Check out MFC Internals for
  4017. details.
  4018.  
  4019. scot@stingsoft.com
  4020.  
  4021. 7.1.8. How do I make a CScrollView "mouse scrollable"?
  4022.  
  4023. Download AUTOSV.LZH from the MSMFC library on CIS. This code shows you how
  4024. to implement a secondary message loop taking care of the mouse activity.
  4025. Hooks are provided to customize the code. Freeware.
  4026.  
  4027. Patrick Philippot, CIS email, 8/3/95
  4028.  
  4029. 7.2. Documents
  4030.  
  4031. 7.2.1. Do I have to use the Document/View architecture?
  4032.  
  4033. MFC does not force you to use document/views. Check out hello, mdi, and
  4034. helloapp samples, they don't use it at all. Most MFC features can be used
  4035. in non-document/view applications. You do lose features like print preview
  4036. and of many OLE features when you don't go document/view.
  4037.  
  4038. scot@stingsoft.com 6/7/95
  4039.  
  4040. 7.2.2. How do I get the current Document?
  4041.  
  4042. See section 7.1.5. for the details.
  4043.  
  4044. 7.2.3. When are documents destroyed?
  4045.  
  4046. In SDI applications, the document is deleted when the application exits. In
  4047. MDI applications, the document is deleted when the last view on the
  4048. document is closed. To help keep your document SDI/MDI compatible, you
  4049. should delete the document's data in the virtualDeleteContents() function,
  4050. not in the destructor.
  4051.  
  4052. Richard Hazenberg, drmcode@euronet.nl, programmer.misc, 6/24/95
  4053.  
  4054. 7.2.4. How do I create multiple documents?
  4055.  
  4056. To add support for additional document types, you can create and register
  4057. additional CMultiDocTemplate objects with your CWinApp derived object. This
  4058. technique is illustrated in the MULTDOCS sample application. The general
  4059. steps needed to add an additional documenttype to an MFC application are
  4060. listed below:
  4061.  
  4062. 1. Use AppWizard to create a new document class and a new view class.
  4063.  
  4064. 2. Use the Resource Editor to add a new resource string to support the new
  4065. document class. For more information on the format of the document template
  4066. string resource, see the topic How to Interpret a Document Template String.
  4067.  
  4068. 3. Use the Resource Editor to add an additional icon and menu resource to
  4069. the application. Note, the ID for each of these resources needs to be the
  4070. same ID as the resource ID used for the document template string created in
  4071. step 2. This ID is used by the CMultiDocTemplate class to identify the
  4072. resources associated with the additional document type.
  4073.  
  4074. 4. In the applications InitInstance() function, create another
  4075. CMultiDocTemplate object and register it with the CWinApp::AddDocTemplate()
  4076. function. For example:
  4077.  
  4078.         CMultiDocTemplate* pDocTemplate2 = new CMultiDocTemplate(
  4079.  
  4080.         IDR_DOC2TYPE, RUNTIME_CLASS(CDoc2),
  4081.  
  4082.         RUNTIME_CLASS(CMDIChildWnd), RUNTIME_CLASS(CView2));
  4083.  
  4084.         AddDocTemplate(pDocTemplate2);
  4085.  
  4086.   1.
  4087.        1.
  4088.             1.
  4089.                  1. And finally, add the custom serialization and painting
  4090.                     code to your new document and view classes.
  4091.                  2. MS FAQ, 6/25/95
  4092.  
  4093.                     7.2.5. How do I get a list of open documents?
  4094.  
  4095.                     The code below demonstrates how to retrieve a list of
  4096.                     pointers to all CDocuments that were created using a
  4097.                     CDocTemplate object.
  4098.  
  4099.                     In the code below, CMyApp is derived from CWinApp. The
  4100.                     variable m_templateList is a CPtrList object that is a
  4101.                     member of CWinApp, and it contains a list of pointers
  4102.                     to all of the document templates (CDocTemplates). The
  4103.                     CDocTemplate functions GetFirstDocPosition() and
  4104.                     GetNextDoc() are used to iterate through the list of
  4105.                     documents for each document template.
  4106.  
  4107.                     void CMyApp::GetDocumentList(CObList * pDocList)
  4108.  
  4109.                     {
  4110.  
  4111.                             ASSERT(pDocList->IsEmpty());
  4112.  
  4113.                             POSITION pos = m_templateList.GetHeadPosition();
  4114.  
  4115.                             while (pos)
  4116.  
  4117.                             {
  4118.  
  4119.                                     CDocTemplate* pTemplate =
  4120.  
  4121.                                             (CDocTemplate*)m_templateList.GetNext(pos);
  4122.  
  4123.                                     POSITION pos2 = pTemplate->GetFirstDocPosition();
  4124.  
  4125.                                     while (pos2)
  4126.  
  4127.                                     {
  4128.  
  4129.                                             CDocument * pDocument;
  4130.  
  4131.                                             if ((pDocument=pTemplate->GetNextDoc(pos2)) != NULL)
  4132.  
  4133.                                                     pDocList->AddHead(pDocument);
  4134.  
  4135.                                     }
  4136.  
  4137.                             }
  4138.  
  4139.                     }
  4140.  
  4141.                     There are two public member functions of the
  4142.                     CDocTemplate class that are not documented in the
  4143.                     reference manual or the online help. However, these are
  4144.                     public member functions defined in the CDocTemplate
  4145.                     class and provide simple functionality for traversing
  4146.                     the list of open documents. These functions operate as
  4147.                     follows:
  4148.  
  4149.                     Function: virtual POSITION GetFirstDocPosition() const;
  4150.  
  4151.                     Remarks: Call this function to get the position of the
  4152.                     first document in the list of open documents associated
  4153.                     with the template.
  4154.  
  4155.                     Return Value: A POSITION value that can be used for
  4156.                     iteration with the GetNextDoc member function.
  4157.  
  4158.                     Function: virtual CDocument* GetNextDoc(POSITION&
  4159.                     rPosition) const;
  4160.  
  4161.                     rPosition: A reference to a POSITION value returned by
  4162.                     a previous call to the GetNextDoc or
  4163.                     GetFirstDocPosition member function. This value must
  4164.                     not be NULL.
  4165.  
  4166.                     Remarks: Call this function to iterate through all of
  4167.                     the document template's open documents. The function
  4168.                     returns the document identified by rPosition and then
  4169.                     sets rPosition to the POSITION value of the next
  4170.                     document in the list. If the retrieved document is the
  4171.                     last in the list, then rPosition is set to NULL.
  4172.  
  4173.                     Return Value: A pointer to the view identified by
  4174.                     rPosition.
  4175.  
  4176.                     MS FAQ, 6/25/95
  4177.  
  4178.                     NOTE: This is only valid for MFC 3.2 and lower, MFC 4.0
  4179.                     version follows->
  4180.  
  4181.                     void CMyApp::DoSomethingToAllDocs()
  4182.  
  4183.                     {
  4184.  
  4185.                              CObList  pDocList;
  4186.  
  4187.                              POSITION pos = GetFirstDocTemplatePosition();
  4188.  
  4189.                             while(pos)
  4190.  
  4191.                             {
  4192.  
  4193.                                     CDocTemplate* pTemplate = GetNextDocTemplate(pos);
  4194.  
  4195.                                     POSITION pos2 = pTemplate->GetFirstDocPosition();
  4196.  
  4197.                                     while(pos2)
  4198.  
  4199.                                     {
  4200.  
  4201.                                             CDocument* pDocument;
  4202.  
  4203.                                             if(pDocument = pTemplate->GetNextDoc(pos2))
  4204.  
  4205.                                                     pDocList.AddHead(pDocument);
  4206.  
  4207.                                     }
  4208.  
  4209.                             }
  4210.  
  4211.                             if(!pDocList.IsEmpty()){
  4212.  
  4213.                                     pos = pDocList.GetHeadPosition();
  4214.  
  4215.                             while(pos)
  4216.  
  4217.                             {
  4218.  
  4219.                                     // Call some CDocument function for each document
  4220.  
  4221.                                     ( (CDocument*)pDocList.GetNext(pos) )
  4222.  
  4223.                                             ->UpdateAllViews(NULL);
  4224.  
  4225.                             }
  4226.  
  4227.                     }
  4228.  
  4229.                     mcontest@universal.com, email, 9/22/95
  4230.  
  4231.                     7.2.6. How do I keep my application from creating a new
  4232.                     document at startup?
  4233.  
  4234.                     Add this call:
  4235.  
  4236.                             cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing
  4237.  
  4238.                     just before the call to ProcessShellCommand in the
  4239.                     app's InitInstance.
  4240.  
  4241.                     lechner-cos1@kaman.com, email, 1/6/96
  4242.  
  4243.                     -------------------------------------------------------
  4244.  
  4245.                     8. OLE Class Questions
  4246.  
  4247.                     8.1. Structured Storage/Compound Files
  4248.  
  4249.                     8.1.1. When I upgraded, I could not read my files
  4250.                     generated by the old version of MFC. What do I do?
  4251.  
  4252.                     There may be an easier way, but here is how I did it:
  4253.  
  4254.                     Use VERSIONABLE_SCHEMA and GetObjectSchema to identify
  4255.                     the version. If old version, then it is stored in OLE
  4256.                     1.0 format. To read this format, first read a WORD and
  4257.                     a CString (type and name info). Next is the OLE data
  4258.                     itself (the hard part). Use the following steps:
  4259.  
  4260.                     1) use StgCreateDocfile to create a temporary Compound
  4261.                     File.
  4262.  
  4263.                     2) use OleConvertOLESTREAMToIStorage to copy the data
  4264.                     to the Compoundfile, converting to OLE 2 format.
  4265.  
  4266.                     3) call OleLoad using the IStorage to get an IUnknown
  4267.                     pointer, then call QueryInterface to set the
  4268.                     COleClientItem::m_lpObject member, and set
  4269.                     m_nDrawAspect to DVASPECT_CONTENT.
  4270.  
  4271.                     4) release the IUnknown pointer and the IStorage
  4272.                     pointer
  4273.  
  4274.                     5) The OleConvertOLESTREAMToIStorage code requires an
  4275.                     OLESTREAM implementation. Copy the code from MSVC 1.0
  4276.                     MFC code.
  4277.  
  4278.                     This actually works. Theres some issues with messing
  4279.                     with the schema parameter, and I have not implemented
  4280.                     writing OLE 1/MFC files. Code available on request.
  4281.  
  4282.                     ronjones@xnet.com, Ron Jones, via programmer.tools,
  4283.                     5/9/95
  4284.  
  4285.                     8.2. OLE Controls (previously called OCX's)
  4286.  
  4287.                     8.2.1. What is an OLE control?
  4288.  
  4289.                     OLE controls are the 32-bit successor to 16-bit VBX
  4290.                     controls. Instead of being stored in a plain DLL and
  4291.                     having functional interfaces, OLE controls rely on OLE
  4292.                     automation. Hopefully this will make the interface more
  4293.                     flexible and easier to use than VBXs.
  4294.  
  4295.                     Although OLE controls use OLE, they are not object
  4296.                     oriented. There is a flat set of properties you have
  4297.                     access to and you can not apply OO techniques such as
  4298.                     inheritance, polymorphism, etc.. to them. In my
  4299.                     opinion, this can be pretty frustrating to the MFC
  4300.                     programmer who is
  4301.  
  4302.                     used to the OO techniques.
  4303.  
  4304.                     scot@stingsoft.com, 6/25/95
  4305.  
  4306.                     8.2.2. How do I write OLE controls?
  4307.  
  4308.                     In VC++ 2.x, Microsoft released the CDK (OLE control
  4309.                     developer kit), you use that kit and it's tools to
  4310.                     write OLE controls. In VC++ 4.0, this is no longer
  4311.                     separate and you now just run the Control Wizard. Check
  4312.                     your VC++ documentation for more info.
  4313.  
  4314.                     scot@stingsoft.com, 6/25/95
  4315.  
  4316.                     8.2.3. What versions of MFC support OLE control
  4317.                     containment?
  4318.  
  4319.                     MFC 4.0 supports OLE control containment. Earlier
  4320.                     versions of MFC don't unless you roll your own. (yuck!)
  4321.  
  4322.                     8.2.4. How do I get application specific control bars
  4323.                     to disappear when in-placed editing.
  4324.  
  4325.                     Add CBRS_HIDE_INPLACE to Create() of the toolbar.
  4326.  
  4327.                     Example:
  4328.  
  4329.                     m_wndFormBar.Create(this,
  4330.  
  4331.                                     WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_HIDE_INPLACE,IDW_FORMBAR)
  4332.  
  4333.                     Paul Rony, 102615.601@compuserve.com
  4334.  
  4335.                     -------------------------------------------------------
  4336.  
  4337.                     9. WOSA Class Questions
  4338.  
  4339.                     9.1. CRecordSet
  4340.  
  4341.                     9.1.1. When I add a CRecordSet class, I get tons of
  4342.                     linker errors..
  4343.  
  4344.                     If you haven't told the AppWizard to use Database
  4345.                     Support when you created your project, the AppWizard
  4346.                     doesn't include the database headers. If you add
  4347.                     "#include " in your stdafx.h, CRecordSet will be
  4348.                     "legalized". Then open the Linker Options window and
  4349.                     add the library: "odbc". This avoids tons of linker
  4350.                     errors.
  4351.  
  4352.                     bessler@highland.swb.de (Wolfgang Bessler) 06/05/95,
  4353.                     comp.lang.c++
  4354.  
  4355.                     9.1.2. I need a CRecordSet::Find(), what should I do?
  4356.  
  4357.                     Use the WHERE clause in SQL.
  4358.  
  4359.                     mikeblas@interserv.com - mfc-l, 10/10/95
  4360.  
  4361.                     9.2. WinSock
  4362.  
  4363.                     9.2.1. I'm having problems with CSocket blocking,
  4364.                     what's up?
  4365.  
  4366.                     I've worked around this by creating a dialog box that I
  4367.                     pop up after calling Connect()... i.e.:
  4368.  
  4369.                     CMySocket MySocket;
  4370.  
  4371.                     MySocket.Create();
  4372.  
  4373.                     MySocket.Connect("mysmtphost",25);
  4374.  
  4375.                     DummyDlg DummyDialog;
  4376.  
  4377.                     MySocket.m_pDialog=&DummyDialog;
  4378.  
  4379.                     DummyDialog.DoModal();
  4380.  
  4381.                     This suspends the thread until MySocket sends a
  4382.                     WM_CLOSE message to DummyDialog. I'd rather it look
  4383.                     like:
  4384.  
  4385.                     MySocket.m_hEvent=CreateEvent(...);
  4386.  
  4387.                     WaitForSingleObject(MySocket.m_hEvent,INFINITE);
  4388.  
  4389.                     But that stops all processing of MySocket.
  4390.  
  4391.                     Cynthia Jennings (idlewild@is.net), programmer.win32,
  4392.                     6/19/95
  4393.  
  4394.                     -------------------------------------------------------
  4395.  
  4396.                     10. DLL and Build Questions
  4397.  
  4398.                     If you have questions about extension and user DLLs, be
  4399.                     sure to read technical notes 11 and 33. Volume 2 of the
  4400.                     documentation has more info too. Finally, try searching
  4401.                     on the sample names dllhusk (extension DLL) and
  4402.                     dlltrace (user DLL) in books on-line.
  4403.  
  4404.                     10.1. Do I need a CWinApp object in a DLL?
  4405.  
  4406.                     The Microsoft Foundation Class Library supports two
  4407.                     types of DLLs: _USRDLL and _AFXDLL. The _USRDLL model
  4408.                     requires one CWinApp object to perform the
  4409.                     initialization and cleanup of the Microsoft Foundation
  4410.                     Class Library Windows classes that the DLL uses. This
  4411.                     requirement is described in MFC Tech Note 11; the
  4412.                     DLLTRACE sample demonstrates a _USRDLL that contains a
  4413.                     CWinApp object.
  4414.  
  4415.                     An _AFXDLL does not require a CWinApp object. Because
  4416.                     it shares the Microsoft Foundation Class Library
  4417.                     classes with the application, it does not require a
  4418.                     CWinApp to provide initialization and cleanup. Instead,
  4419.                     an _AFXDLL requires a special version of LibMain() and
  4420.                     a DLL initialization function.
  4421.  
  4422.                     MSVC Knowledge Base 6/4/95
  4423.  
  4424.                     10.2. How should I define the WEP in a MFC DLL?
  4425.  
  4426.                     In a dynamic-link library (DLL) built with Microsoft
  4427.                     Foundation Class Library version 2.0, the _USRDLL model
  4428.                     uses the WEP() (Windows exit procedure) function
  4429.                     provided in the C run-time library. Because the code
  4430.                     uses the C library WEP() function, the destructors for
  4431.                     static and global objects in the DLL are called and the
  4432.                     CWinApp::ExitInstance() function for the DLLapplication
  4433.                     object is called.
  4434.  
  4435.                     See MSVC Knowledge Base article Q98374 and Tech notes
  4436.                     11 and 33.
  4437.  
  4438.                     MSVC Knowledge Base 6/7/95
  4439.  
  4440.                     10.3. How do I build an 'extension DLL'?
  4441.  
  4442.                     1. When you're building a 32-bit extension DLL, define
  4443.                     _AFXEXT on the compiler command line. If you look in
  4444.                     AFXVER_.H, you'll see that this forces _AFXDLL to also
  4445.                     be defined. So an "AFXEXT" DLL is an AFXDLL.
  4446.  
  4447.                     2. When _AFXDLL is defined, AfxGetResourceHandle
  4448.                     returns a value stored in MFC's global data, which is
  4449.                     shared by the EXE, the extension DLL and the MFC DLL.
  4450.                     The handle returned identifies the module which will be
  4451.                     searched first when looking for a resource.
  4452.  
  4453.                     (See the source code for AfxFindResourceHandle() if
  4454.                     you're curious about the order of the search.)
  4455.  
  4456.                     3. Strictly speaking, what we need to load a resource
  4457.                     is a module handle rather than an instance handle.
  4458.                     (Instances share modules --- e.g., code and resources
  4459.                     --- but have different data.) A DLL has a module handle
  4460.                     which is distinct from the handle of the EXE.
  4461.  
  4462.                     4. You can use ::GetModuleHandle to get the handle for
  4463.                     your DLL, then pass it to AfxSetResourceHandle so that
  4464.                     your DLL is the first place searched for resources. But
  4465.                     note that this removes the EXE module from of modules
  4466.                     searched. You'll probably want to save a copy of the
  4467.                     handle returned by AfxGetResourceHandle before calling
  4468.                     AfxSetResourceHandle, then restore it once you're done
  4469.                     loading the DLL resource.
  4470.  
  4471.                     Charlie Kester, Microsoft Developer Support, MSMFC,
  4472.                     7/19/95
  4473.  
  4474.                     10.4. How can I manage resources in a resource only DLL
  4475.                     and still benefit from ClassWizard?
  4476.  
  4477.                     The following text is available as RESDLL.ZIP in the
  4478.                     MSMFC library on Compuserve (applies to MSVC20):
  4479.  
  4480.                     How To Manage An MFC Project Storing Its Resources Into
  4481.                                       A Resource-Only DLL
  4482.  
  4483.                     Software localization is much easier when your project
  4484.                     stores its resources in a resource-only DLL. There area
  4485.                     also many situations where storing the project's
  4486.                     resources in a DLL can be a good idea.
  4487.  
  4488.                     However, if this project is an MFC project, doing so
  4489.                     will generate a major drawback: you will not benefit
  4490.                     from the Class Wizard capabilities any longer because
  4491.                     the resources will be managed in a separate project.
  4492.  
  4493.                     However, there's a trick that you can use to develop
  4494.                     your project as if it were a standard project while
  4495.                     being able to quickly switch to the resource-only DLL
  4496.                     model. Here's how to proceed:
  4497.  
  4498.                     METHOD 1 :
  4499.  
  4500.                     1. Create your project as usual using AppWizard (we'll
  4501.                     name it TEST).
  4502.  
  4503.                     2. Close the project and create a new DLL project in
  4504.                     the same directory (call it RESDLL). When you click on
  4505.                     the Create button, VC++ opens the Add file dialog. Take
  4506.                     this opportunity to add the resource file of the
  4507.                     previous project (TEST.RC) to this new project.
  4508.  
  4509.                     3. Before being able to compile the resources of the
  4510.                     TEST project as a resource-only DLL, you must add the
  4511.                     /NOENTRY option to the linker. Unfortunately, the
  4512.                     settings dialog box of VC++ doesn't allow to do that in
  4513.                     a simple way:
  4514.  
  4515.                  3. Select Project|Settings from the man menu.
  4516.                  4. Click on the Link tab.
  4517.                  5. Select General from the category combobox.
  4518.                  6. In the Object/Library Modules field, remove all
  4519.                     references to any .LIB file (they are useless) and add
  4520.                     /NOENTRY. This option should then appear in the Common
  4521.                     Options display area.
  4522.                  7. Click OK and compile. You now have a DLL containing
  4523.                     only the resources for your project.
  4524.                  8. 4. Do not open the TEST.MAK project. Instead, copy
  4525.                     TEST.MAK to TEST_RES.MAK in your project directory.
  4526.  
  4527.                     5. Open TEST_RES.MAK and remove TEST.RC from the
  4528.                     project files.
  4529.  
  4530.                     6. Select Project|Settings, click on the General tab
  4531.                     and add "USE_RESDLL" to the list of Preprocessor
  4532.                     Definitions.
  4533.  
  4534.                  9. Open TEST.H and modify the class declaration of
  4535.                     CTestApp this way:
  4536.                 10.
  4537.                     public:
  4538.  
  4539.                             CTestApp();
  4540.  
  4541.                     #ifdef USE_RESDLL
  4542.  
  4543.                     public:
  4544.  
  4545.                             virtual int ExitInstance();
  4546.  
  4547.                     private:
  4548.  
  4549.                             HINSTANCE m_hInstDLL;
  4550.  
  4551.                     #endif //USE_RESDLL
  4552.  
  4553.                     8. Open TEST.CPP and modify CTestApp::InitInstance as
  4554.                     follows. Also, add the newly declared ExitInstance
  4555.                     member function:
  4556.  
  4557.                     BOOL CTestApp::InitInstance()
  4558.  
  4559.                     {
  4560.  
  4561.                     // Standard initialization
  4562.  
  4563.                     // If you are not using these features and wish to reduce the size
  4564.  
  4565.                     //  of your final executable, you should remove from the following
  4566.  
  4567.                     //  the specific initialization routines you do not need.
  4568.  
  4569.                     #ifdef USE_RESDLL
  4570.  
  4571.                             if ((m_hInstDLL = LoadLibrary("resdll.dll")) == NULL)
  4572.  
  4573.                             {
  4574.  
  4575.                                     return FALSE; // failed to load the localized resources
  4576.  
  4577.                             }
  4578.  
  4579.                             else
  4580.  
  4581.                             {
  4582.  
  4583.                                     AfxSetResourceHandle(m_hInstDLL);
  4584.  
  4585.                                     // get resources from the DLL
  4586.  
  4587.                             }
  4588.  
  4589.                     #endif
  4590.  
  4591.                     //à#ifdef USE_RESDLL
  4592.  
  4593.                             int CTestApp::ExitInstance()
  4594.  
  4595.                             {
  4596.  
  4597.                                     FreeLibrary(m_hInstDLL);
  4598.  
  4599.                                     return CWinApp::ExitInstance();
  4600.  
  4601.                             }
  4602.  
  4603.                     #endif
  4604.  
  4605.                     9. Compile. TEST_RES.EXE should work very nicely,
  4606.                     loading its resources from the DLL.
  4607.  
  4608.                     10. Close the project and open TEST.MAK. Compile.
  4609.                     TEST.EXE should also work very well but this time, the
  4610.                     resources are loaded from the .EXE file because you had
  4611.                     not defined USE_RESDLL in this version of the project.
  4612.  
  4613.                     BEWARE:
  4614.  
  4615.                     When switching from one model to another, you must
  4616.                     either Rebuild All or touch TEST.CPP. Otherwise, you'll
  4617.                     have problems.
  4618.  
  4619.                     Now, you are able to modify your resources and to use
  4620.                     Class Wizard when you work with TEST.MAK. To build the
  4621.                     resource-only DLL version of the project, just switch
  4622.                     to TEST_RES.MAK after recompiling RESDLL (RESDLL.MAK)
  4623.                     if changes have been made to the resources.
  4624.  
  4625.                     It's that easy!
  4626.  
  4627.                     METHOD 2 :
  4628.  
  4629.                     1. Proceeed like above for steps 1, 2 and 3
  4630.  
  4631.                     2. Instead of creating a new project, copy TEST.RC to
  4632.                     RESDLL.RC. Remove TEST.RC from your project and add
  4633.                     RESDLL.RC. A different name is somewhat safer.
  4634.  
  4635.                     3. Double-click RESDLL.RC to trigger a rebuild of the
  4636.                     .CLW file.
  4637.  
  4638.                     4. Apply the "Exclude File from Build" command to
  4639.                     RESDLL.RC. (Project|Settings, General Page, "Exclude
  4640.                     File From Build")
  4641.  
  4642.                     5. Delete TEST.CLW and TEST.RC.
  4643.  
  4644.                     Now TEST and RESDLL will work together through the
  4645.                     ClassWizard. The resources defined in RESDLL.RC will
  4646.                     not be added to TEST.EXE. This method is simpler but
  4647.                     doesn't allow you to test your program in both cases
  4648.                     (resources in the DLL or resources linked to the .EXE
  4649.                     file). I prefer the latter when developing because I do
  4650.                     not have to bother about orphaned DLLs when a GPF
  4651.                     occurs (although this is less a problem under NT).
  4652.  
  4653.                     Don't forget to recompile the DLL before testing your
  4654.                     program each time you modify the resources. A batch
  4655.                     file calling NMAKE installed in the Tools menu will
  4656.                     certainly be faster than switching from project to
  4657.                     project. Using the "New Target" facility won't help in
  4658.                     that case.
  4659.  
  4660.                     It would be nice if VC++ had the same capability as
  4661.                     Borland C++: a project can contain multiple independant
  4662.                     targets. So, the developer is able to manage DLL and
  4663.                     EXE creation from within the same project.
  4664.  
  4665.                     Patick Philippot, CIS Email, 8/3/95
  4666.  
  4667.                     10.5. I am having [some problem] with exports/imports
  4668.                     and extension DLLs.
  4669.  
  4670.                     This is a very complex subject. I actually wrote an
  4671.                     article on this and chapter 9 of MFC internals which
  4672.                     covers MFC and DLLS (extension and regular) in great
  4673.                     detail. The article is on-line at http://www.vcdj.com.
  4674.  
  4675.                     -scot@stingsoft.com - Scot Wingo
  4676.  
  4677.                     -------------------------------------------------------
  4678.  
  4679.                     11. MFC Tips Tricks and Caveats
  4680.  
  4681.                     11.1. What's the best way to convert my C Windows App
  4682.                     to MFC?
  4683.  
  4684.                     Microsoft and Symantec have jointly developed a tool
  4685.                     that helps you make the move from a C Windows
  4686.                     application to MFC. It's called the MFC migration kit.
  4687.                     You can find it on the MSVC 2.x CDROM in the MFCKIT
  4688.                     directory. The kit is also available from the Microsoft
  4689.                     Software Library (See section 2.1.4) and from Symantec.
  4690.  
  4691.                     11.2. Why is my MFC application running slow?
  4692.  
  4693.                     MFC Apps should be nice and snappy. Make sure you are
  4694.                     not building the debug version and that you have the
  4695.                     trace options off (MFCTRACE.EXE). If your application
  4696.                     continues to be slow, try doing some quick profiling to
  4697.                     see if you are making any redundant calls.
  4698.  
  4699.                     scot@stingsoft.com, 5/31/95
  4700.  
  4701.                     11.3. How can I create an application that is initially
  4702.                     maximized?
  4703.  
  4704.                     For new applications, this can be done with AppWizard
  4705.                     during Step 4. During Step 4, choose Advanced..., and
  4706.                     then select the Main Frame tab. Check the Maximized
  4707.                     option.
  4708.  
  4709.                     For an MDI application, in the CWinApp::InitInstance()
  4710.                     function, set CWinApp::m_nCmdShow to SW_SHOWMAXIMIZED
  4711.                     before calling pMainFrame->ShowWindow(m_nCmdShow). In
  4712.                     an application generated by AppWizard, the code is as
  4713.                     follows:
  4714.  
  4715.                             // create main MDI Frame window
  4716.  
  4717.                             CMainFrame* pMainFrame = new CMainFrame;
  4718.  
  4719.                             if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  4720.  
  4721.                                     return FALSE;
  4722.  
  4723.                             m_nCmdShow = SW_SHOWMAXIMIZED;  // ADD THIS LINE!
  4724.  
  4725.                             pMainFrame->ShowWindow(m_nCmdShow);
  4726.  
  4727.                             pMainFrame->UpdateWindow();
  4728.  
  4729.                             m_pMainWnd = pMainFrame;
  4730.  
  4731.                     In an SDI application, in the CWinApp::InitInstance()
  4732.                     function, set CWinApp::m_nCmdShow to SW_SHOWMAXIMIZED
  4733.                     before calling OnFileNew().For example, in an
  4734.                     application generated by AppWizard, the code is as
  4735.                     follows:
  4736.  
  4737.                             m_nCmdShow = SW_SHOWMAXIMIZED;
  4738.  
  4739.                             //
  4740.  
  4741.                             // create a new (empty) document
  4742.  
  4743.                             OnFileNew();
  4744.  
  4745.                     MSVC Knowledge Base, 6/4/95
  4746.  
  4747.                     11.4. How do I enable TRACE macros in my app?
  4748.  
  4749.                     If you use Visual C++ 1.0, run the TRACER application
  4750.                     from your Microsoft Visual C++ program group (its icon
  4751.                     has the title "MFC Trace Options"). Select "Enable
  4752.                     Tracing," then choose OK.
  4753.  
  4754.                     If you use Microsoft C/C++ 7.0, you must copy the
  4755.                     AFX.INI file from the Microsoft Foundation Class
  4756.                     Library source directory (by default, C:\C700\MFC\SRC)
  4757.                     to your Windows directory (by default, C:\WINDOWS).
  4758.                     This file should contain a section such as the
  4759.                     following:
  4760.  
  4761.                     [Diagnostics]
  4762.  
  4763.                        TraceEnabled = 1
  4764.  
  4765.                        TraceFlags = 0
  4766.  
  4767.                     As long as TraceEnabled is set to 1, tracing is
  4768.                     enabled.
  4769.  
  4770.                     This AFX.INI file is the same for both C/C++ 7.0 and
  4771.                     Visual C++ 1.0. In MSVC 2.x, the TRACE output
  4772.                     automatically goes to the 'Debug' window when you run
  4773.                     in the debugger.
  4774.  
  4775.                     VC+ Knowledge Base, 6/7/95
  4776.  
  4777.                     11.5. How do I perform background processing in my
  4778.                     application?
  4779.  
  4780.                     Many applications perform lengthy processing "in the
  4781.                     background" during intervals that the user is not
  4782.                     otherwise interacting with the application. In an
  4783.                     application developed for the Microsoft Windows
  4784.                     operating system, an application can perform background
  4785.                     processing by splitting a lengthy process into many
  4786.                     small fragments. After processing each fragment, the
  4787.                     application yields execution control to Windows using a
  4788.                     PeekMessage() loop.
  4789.  
  4790.                     An application developed with the Microsoft Foundation
  4791.                     Class Library can perform background processing either
  4792.                     by using the PeekMessage() loop in the library code's
  4793.                     main message loop or by embedding another PeekMessage()
  4794.                     loop in the application.
  4795.  
  4796.                     See MSVC Knowledge Base Q99999 for more info.
  4797.  
  4798.                     MSVC Knowledge Base 6/7/95.
  4799.  
  4800.                     11.6. How do I send a message to another thread?
  4801.  
  4802.                     Try using SendNotifyMessage() to send messages to
  4803.                     another thread.
  4804.  
  4805.                     null@diku.dk, Neils Ull Jacobsen via programmer.misc,
  4806.                     6/18/95
  4807.  
  4808.                     11.7. Does Microsoft use MFC in their products? Which
  4809.                     ones?
  4810.  
  4811.                     There are many Microsoft apps written in MFC. Sometimes
  4812.                     its just not obvious... (to name a few: Bookshelf,
  4813.                     Bob!, WordArt OLE server, Visual C++ (of course), Win95
  4814.                     paint, Win95 WordPad, some portions of Win95 FAX
  4815.                     software, some Win95 games I know of...).
  4816.  
  4817.                     In the future, there are more apps coming out using
  4818.                     MFC. I don't have a way to track all of these uses, so
  4819.                     there is certainly more that I'm not aware of or can't
  4820.                     remember. I don't expect Word or Excel to ever use MFC
  4821.                     -- they have way too much legacy code and they don't
  4822.                     see any customer benefit to rewriting to MFC. But my
  4823.                     point is -- definitely for new code, Microsoft is using
  4824.                     MFC. Even some "old" code is taking advantage of MFC in
  4825.                     future versions.
  4826.  
  4827.                     Dean McCrory, MSMFC, 6/8/95
  4828.  
  4829.                     11.8. How do I limit my MFC application to one
  4830.                     instance?
  4831.  
  4832.                     Look at the Microsoft sample ONETIME.EXE, (MSDN CD or
  4833.                     ftp.microsoft.com).
  4834.  
  4835.                     In Brief:
  4836.  
  4837.                     const char* MyMainWndClassName = "MyMainWndXQW"
  4838.  
  4839.                     BOOL CMyApp::InitApplication()
  4840.  
  4841.                     {
  4842.  
  4843.                             //Call base class.  Default version does nothing.
  4844.  
  4845.                             CWinApp::InitApplication();
  4846.  
  4847.                             WNDCLASS wndcls;
  4848.  
  4849.                             // start with NULL defaults
  4850.  
  4851.                             memset(&wndcls, 0, sizeof(WNDCLASS));
  4852.  
  4853.                             // Get class information for default window class.
  4854.  
  4855.                             ::GetClassInfo(AfxGetInstanceHandle(),"AfxFrameOrView",&wndcls);
  4856.  
  4857.                             // Substitute unique class name for new class
  4858.  
  4859.                             wndcls.lpszClassName = MyMainWndClassName;
  4860.  
  4861.                             //Register new class and return the result code
  4862.  
  4863.                             return ::RegisterClass(&wndcls);
  4864.  
  4865.                     }
  4866.  
  4867.                     And:
  4868.  
  4869.                     BOOL CMyApp::FirstInstance()
  4870.  
  4871.                     {
  4872.  
  4873.                             CWnd *PrevCWnd, *ChildCWnd;
  4874.  
  4875.                             // Determine if another window with our class name exists...
  4876.  
  4877.                             PrevCWnd = CWnd::FindWindow(MyMainWndClassName, NULL);
  4878.  
  4879.                             if (PrevCWnd != NULL)
  4880.  
  4881.                             {              // if so, does it have any popups?
  4882.  
  4883.                                     ChildCWnd=PrevCWnd->GetLastActivePopup();
  4884.  
  4885.                                     // Bring the main window to the top
  4886.  
  4887.                                     PrevCWnd->BringWindowToTop();
  4888.  
  4889.                                     // If iconic, restore the main window
  4890.  
  4891.                                     if (PrevCWnd->IsIconic())
  4892.  
  4893.                                             PrevCWnd->ShowWindow(SW_RESTORE);
  4894.  
  4895.                                     // If there are popups, bring them along too!
  4896.  
  4897.                                     if (PrevCWnd != ChildCWnd)
  4898.  
  4899.                                             ChildCWnd->BringWindowToTop();
  4900.  
  4901.                                     // Return FALSE.  This isn't the first instance
  4902.  
  4903.                                     // and we are done activating the previous one.
  4904.  
  4905.                                     return FALSE;
  4906.  
  4907.                             }
  4908.  
  4909.                             else
  4910.  
  4911.                                     // First instance. Proceed as normal.
  4912.  
  4913.                                     return TRUE;
  4914.  
  4915.                     }
  4916.  
  4917.                     CMyApp::InitInstance()
  4918.  
  4919.                     {      if (!FirstInstance())
  4920.  
  4921.                                     return FALSE;
  4922.  
  4923.                             //...
  4924.  
  4925.                     }
  4926.  
  4927.                     Niels Ull Jacobsen (null@diku.dk), programmer.tools,
  4928.                     6/19/95
  4929.  
  4930.                     See also MS Knowledge base article Q124134 ( "Allowing
  4931.                     Only One Application Instance on Win32s") and Advanced
  4932.                     Windows NT , chapter 7, "Prohibiting Multiple Instances
  4933.                     of an Application from Running: The MultInst Sample
  4934.                     Application" (available on the MSDN).
  4935.  
  4936.                     Niels Ull Jacobsen (null@diku.dk), email, 8/8/95
  4937.  
  4938.                 11. update - these were posted to mfc-l:
  4939.  
  4940. I have each InitApplication() create a semaphore. If GetLastError() returns
  4941. ERROR_ALREADY_EXISTS then I know that some other application is already
  4942. running and has gotten that far so I bail.
  4943.  
  4944. Yourapp::InitInstance()
  4945.  
  4946. {
  4947.  
  4948.         hMutexOneInstance =
  4949.  
  4950.         CreateMutex(NULL,TRUE,_T("PreventSecondInstance"));
  4951.  
  4952.         if(GetLastError() == ERROR_ALREADY_EXISTS)
  4953.  
  4954.                 bFound = TRUE;
  4955.  
  4956.         if(hMutexOneInstance)
  4957.  
  4958.                 ReleaseMutex(hMutexOneInstance);
  4959.  
  4960.         return (bFound == TRUE) ? FALSE : TRUE;
  4961.  
  4962. }
  4963.  
  4964. mcontest@universal.com
  4965.  
  4966. There is a nice section in Jeffrey Richter's book Advanced Windows NT about
  4967.  
  4968. this. Essentially, it uses shared data segments between processes.
  4969.  
  4970. Step1:
  4971.  
  4972. =====
  4973.  
  4974. In your main file, add:
  4975.  
  4976. #pragma data_seg(".SharedData")
  4977.  
  4978. LONG nUsageCount = -1;
  4979.  
  4980. #pragma data_seg()
  4981.  
  4982. Step 2 :
  4983.  
  4984. =======
  4985.  
  4986. In your Application's InitInstance(), call:
  4987.  
  4988. InterlockedIncrement ( &nUsageCount );
  4989.  
  4990. This function returns the incremented value of the variable. If it is
  4991.  
  4992. non-zero, you know that you are not the first App.
  4993.  
  4994. In your Application's ExitInstance() call:
  4995.  
  4996. InterlockedDecrement( &nUsageCount );
  4997.  
  4998. Step3:
  4999.  
  5000. ====
  5001.  
  5002. In your DEF file, have the following lines: Note that the segment name you
  5003.  
  5004. give here should match the one in the application's main file.
  5005.  
  5006. SEGMENTS
  5007.  
  5008. .SharedData shared
  5009.  
  5010. abalakri@us.oracle.com
  5011.  
  5012. You'd better use one of the built-in synchronisation methods.
  5013.  
  5014. See Q124134 : Allowing Only One Application Instance on Win32s for a sample
  5015.  
  5016. of using a memory mapped file for synchronisation.
  5017.  
  5018. It doesn't include starting the previous instance, but if you detect
  5019.  
  5020. that you're not the only one running, it should be pretty simple:
  5021.  
  5022. if CreateFileMapping fails, try to find the previous instance from the
  5023.  
  5024. window class name. If it's not found, sleep for a while and start over
  5025.  
  5026. (with CreateFileMapping).
  5027.  
  5028. In this way, either you will find the other instance when it gets
  5029.  
  5030. around to creating it's window or CreateFileMapping will eventually
  5031. succeed.
  5032.  
  5033. The advantage of using CreateFileMapping instead of CreateObject is
  5034.  
  5035. that it also works on Win32s.
  5036.  
  5037. - nuj@kruger.dk
  5038.  
  5039. Note: There's a sample of this that was contributed by john@jing.com (John
  5040. Xu) called onetime4.zip that is in the MFC FAQ archive (see section 2.2.6
  5041. for MFC FAQ archive details).
  5042.  
  5043. 11.9. How do I get my MFC app to use the Registry on Win32 platforms?
  5044.  
  5045. Just make a call to SetRegistryKey("MyCompany") in your CWinApp class and
  5046. pass it a string (typically your company name). This string will define
  5047. where in the registry the data goes:
  5048. HKEY_CURRENT_USER\Software\MyCompany\\\
  5049.  
  5050. After making this call just use the normal WriteProfilexxx() routines and
  5051. the data will go to the registry instead of to an INI file. It works well
  5052. and is simple!
  5053.  
  5054. Brett Robichaud, brett_robichaud@tallysys.com, 6/23/95, programmer.win32
  5055.  
  5056. 11.10. How do I programmatically terminate my MFC application?
  5057.  
  5058. MFC does not provide a public function to gracefully exit an application. A
  5059. method for dealing with this is to create a function in your application
  5060. like the following:
  5061.  
  5062. void ExitApp()
  5063.  
  5064. {
  5065.  
  5066.         // same as double-clicking on main window close box
  5067.  
  5068.         ASSERT(AfxGetApp()->m_pMainWnd != NULL);
  5069.  
  5070.         AfxGetApp()->m_pMainWnd->SendMessage(WM_CLOSE);
  5071.  
  5072. }
  5073.  
  5074. As you can see, this is implemented as a global function, which can be
  5075. called from anywhere in your application. It simply sends a WM_CLOSE
  5076. message to your application's mainframe window. This initiates an orderly
  5077. shutdown of the application.
  5078.  
  5079. If you are using MFC, version 2.5 or later, you can take advantage of a new
  5080. global MFC function, "AfxGetMainWnd", to simplify the code:
  5081.  
  5082. void ExitMFCApp()
  5083.  
  5084. {
  5085.  
  5086.         // same as double-clicking on main window close box
  5087.  
  5088.         ASSERT(AfxGetMainWnd() != NULL);
  5089.  
  5090.         AfxGetMainWnd()->SendMessage(WM_CLOSE);
  5091.  
  5092. }
  5093.  
  5094. NOTE: Always call CDocument::SetModifiedFlag() after changing your document
  5095. data. This will ensure that the framework prompts the user to save before
  5096. shutdown. If you need more extensive control over the shutdown procedure,
  5097. you can override CDocument::SaveModified().
  5098.  
  5099. MS FAQ, 6/25/95
  5100.  
  5101. 11.11. What's the difference between IMPLEMENT_DYNAMIC, IMPLEMENT_DYNCREATE
  5102. and IMPLEMENT_SERIAL?
  5103.  
  5104. IMPLEMENT_DYNAMIC provides run time type information to support macros such
  5105. as IsKindOf and GetRuntimeClass.
  5106.  
  5107. IMPLEMENT_DYNCREATE adds the ability to allow MFC to create the type on the
  5108. fly. This is required for any concrete data type that will be serialized to
  5109. a file.
  5110.  
  5111. IMPLEMENT_SERIAL also provides a version number for the class and adds the
  5112. ability to use the >> operator to read the type from a file.
  5113.  
  5114. As an example, if a derived class Dog uses IMPLEMENT_DYNCREATE and a base
  5115. class Animal uses IMPLEMENT_SERIAL, then a Dog can be written with a
  5116. pointer to either but can only be read by a pointer to Animal.
  5117.  
  5118. MFC 3.x provides a constant called VERSIONABLE_SCHEMA to be used with
  5119. IMPLEMENT_SERIAL to support multiple versions at the same time. The
  5120. implementation in MFC is broken and fails at runtime.
  5121.  
  5122. jimb@turningpoint.com, email, 7/11/95
  5123.  
  5124. 11.11.1. MFC 4.0 4.0 NOTE
  5125.  
  5126. It is not true that the versionable schema is broken anymore, and has been
  5127. fixed in MFC 4.0.
  5128.  
  5129. 11.12. How can I declare an abstract base class to be IMPLEMENT_SERIAL?
  5130.  
  5131. You need a special form of IMPLEMENT_SERIAL that looks like this: Use the
  5132. regular DECLARE_SERIAL but use IMPLEMENT_SERIAL_ABC shown below instead of
  5133. IMPLEMENT_SERIAL.
  5134.  
  5135. #define IMPLEMENT_SERIAL_ABC(class_name, base_class_name, wSchema)
  5136.  
  5137. _IMPLEMENT_RUNTIMECLASS(class_name, base_class_name, wSchema, NULL)
  5138.  
  5139. CArchive& AFXAPI operator>>(CArchive& ar, class_name* &pOb)
  5140.  
  5141. {
  5142.  
  5143.         pOb = (class_name*) ar.ReadObject(RUNTIME_CLASS(class_name));
  5144.  
  5145.                 return ar;
  5146.  
  5147. }
  5148.  
  5149. anonymous
  5150.  
  5151. 11.13. What is afx.inl and afxwin1.inl, etc..?
  5152.  
  5153. These files live in the msvcXX\mfc\include directory and include inline
  5154. functions. These functions are only 'inline' during non-debug (_DEBUG is
  5155. not defined) builts of MFC. They are prefaced with a special _AFX_INLINE
  5156. derective which gets turned into 'inline' for non-debug builds and '' for
  5157. debug builds.
  5158.  
  5159. MFC does this so you can debug into the functions in debug mode, but get
  5160. the benefits of inlining during release builds. That's one of the reasons
  5161. the library shrinks so much in release build mode.
  5162.  
  5163. scot@stingsoft.com, 7/20/95
  5164.  
  5165. 11.14. Is MFC available on the Macintosh?
  5166.  
  5167. Yes! Microsoft has something called the Visual C++ cross-platform edition.
  5168. This product lets you cross-compile for the 68000 based Macs and I think
  5169. they have a PowerPC version coming out soon. Contact Microsoft directly for
  5170. more info.
  5171.  
  5172. scot@stingsoft.com, 7/27/95
  5173.  
  5174. 11.15. Is MFC available on OS/2?
  5175.  
  5176. No!
  5177.  
  5178. 11.16. How should I learn/start learning MFC?
  5179.  
  5180. I see this posted lots. To start with, check out section 2.4.2 of this FAQ,
  5181. books always help. Another good point is that you can't really get down and
  5182. dirty in MFC without knowing and understanding the underlying Windows API,
  5183. so you might want to start with an overviewof that. (The 'Petzold' book is
  5184. the classic here) At the very least get a feel of what windows does and
  5185. what it's capable of.
  5186.  
  5187. Another hint I have is don't rely too much on the Wizards, these are great,
  5188. but they sometimes shield the newbie too much. Take a look at what
  5189. AppWizard/ClassWizard has done from you, run the debugger through a
  5190. mainfrm.cpp, etc.. You won't understand what the heck is going on until you
  5191. understand what your magically generated code is doing.
  5192.  
  5193. I thought the 'writing windows apps with MFC' book was a good merge between
  5194. Petzold and intro MFC stuff. 'Inside Visual C++' may move too fast for
  5195. someone that doesn't know Windows already..
  5196.  
  5197. scot@stingsoft.com, 7/27/95
  5198.  
  5199.    * There's no substitute for paying your dues.
  5200.    * Unfortunately MFC is set up so that you're never done paying your
  5201.      dues. (HAHAHAHA!!!)
  5202.  
  5203. raymond@btw.com, mfc-l, 7/23/95
  5204.  
  5205. Start with the VC++ User's Guide and work your way through the Scribble
  5206. Tutorial. You get an intro to VC++ and MFC and see how they work together.
  5207. Then there are numerous articles on the MSDN CD to help with basic
  5208. concepts. Try searching on MFC and Architecture. Don't shy away from
  5209. reading the MFC Encyclopedia articles (they take more of a 'how-to'
  5210. approach) and by all means become familiar with the MFC Technical Notes.
  5211. Also (hint), stay focused on the 32-bit stuff if you're just starting out.
  5212. There are also a number of excellent journals out there to help.
  5213.  
  5214. billb@microsoft.com, mfc-l, 7/23/95
  5215.  
  5216. The important points (of the top of my head) are:
  5217.  
  5218. If you're a windows programmer don't worry about graphics the CDC member
  5219. functions are an almost direct encapsulation of the Windows functions. Also
  5220. CWnd encapsulates much of the window manipulation functions.
  5221.  
  5222. Learn the Document-View architecture: document templates, the interaction
  5223. between the application, the documents and views (AfxGetApp, GetDocument,
  5224. UpdateAllViews etc).
  5225.  
  5226. Learn serialisation (scribble makes a good intro to it). DDX and DDV for
  5227. dialog boxes: there is a good tech note on this. WM_COMMAND handlers,
  5228. COMMAND_UI handlers (which allow you to enable/disable menu items as well
  5229. as applying check mark and radio button marks on menu items, it also gives
  5230. you one way to use status bars).
  5231.  
  5232. During all this you'll also learn how to use ClassWizard and see how it is
  5233. integrated with the editor and resource editor. Perhaps as part of the MFC
  5234. FAQ we could create a list of topics (ordered in terms of importance) to
  5235. learn? {Sure, this is a good start, no? -Scot}
  5236.  
  5237. grimes@parallax.co.uk, mfc-l, 7/24/95
  5238.  
  5239. 11.17. What DLLs should I distribute with my MFC app?
  5240.  
  5241. You should review the file REDISTRB.WRI on your Visual C++ CD. This file
  5242. explains what files are necessary for different kinds of applications; it
  5243. explains what to do about both Windows files and MFC files.
  5244.  
  5245. blaszczak@BIX.com, programmer.tools, 7/9/95
  5246.  
  5247. dumpbin /imports myapp.exe dll_one.dll dll_two.dll | grep -i dll And
  5248. recurse through the dll's you find. Won't find dll's loaded by
  5249. LoadLibrary() however.
  5250.  
  5251. null@diku.dk, programmer.tools, 7/10/95
  5252.  
  5253. 11.18. How do I intercept WM_SETTEXT messages
  5254.  
  5255. Because MFC didn't provide generic support for overriding WM_SETTEXT, you
  5256. can use OnMessage(WM_SETTEXT, OnSetText) in the message map and then define
  5257. your own method:
  5258.  
  5259.         LRESULT CMyClass::OnSetText(wParam, lParam);
  5260.  
  5261.         //
  5262.  
  5263. jfriend@collabra.com, programmer.tools, 8/17/95
  5264.  
  5265. 11.19. I can't create an instance because of DECLARE_DYNCREATE!
  5266.  
  5267. Question : ClassWizard generated a class for me but used
  5268. DECLARE_DYNCREATE(...) and declared my constructor as protected. Now, when
  5269. a try to create an instance of the class I get the compiler error:
  5270.  
  5271. error C2248: 'CChkTbl::~CChkTbl' : cannot access protected member declared
  5272. in class 'CChkTbl'
  5273.  
  5274. Answer : ClassWizard does this because the framework normally handles
  5275. instantiation for you. i.e. if this is a CView derived class, normally the
  5276. CDocumentTemplate instantiates the view during the default OnFileNew(), or
  5277. when you call CxxxDocTemplate->OpenDocumentFile() or something similar. The
  5278. framework does this so that it will give you an error message if you
  5279. accidentally try to instantiate it yourself. If you really need to do
  5280. instantiation outside of the CDocTempate framework, simply change the
  5281. contructor to be public.
  5282.  
  5283. chucks@skypoint.com, programmer.tools, 8/12/95
  5284.  
  5285. Answer : The answer is that the DECLARE_DYNCREATE macro lays down a
  5286. "protected:" directive and leaves it in place. One needs to make sure that
  5287. anything following DECLARE_DYNCREATE should be "protected" too; if not, one
  5288. needs to declare "public:" or "private:, as needed.
  5289.  
  5290. duane@anasazi.com, email, 8/15/95
  5291.  
  5292. 11.20. What the heck is this _T() thing I keep seeing?
  5293.  
  5294. _T is a macro to expand the string literal to support unicode.
  5295.  
  5296. Mike Oliver, MSMFC, 8/1/95
  5297.  
  5298. 11.21. How do I use CMemoryState?
  5299.  
  5300. In MFC 2.0 and above built in diagnostic facilities are provided. Hence it
  5301. is not neceesary to include CMemoryState explicitly in your app. The MFC
  5302. version 2.0 debugging libraries automatically perform memory leak
  5303. detection. The detection code is in AFXMEM.CPP. This code detects the case
  5304. in which an application dynamically allocates an object and fails to delete
  5305. the object before the program terminates.
  5306.  
  5307. In fact,CMemoryState may not function properly. You can refer to the
  5308. following article in KB(Go MDKB in CIS) for more details:
  5309.  
  5310. ID:Q99022 "Foundation Class Debug Library Detects Memory Leaks"
  5311.  
  5312. #define new DEBUG_NEW should be defined in every .CPP source file. Also,
  5313. insert the following code in InitInstance of the application:
  5314.  
  5315. #ifdef _DEBUG
  5316.  
  5317.                 afxMemDF |= checkAlwaysMemDF;
  5318.  
  5319. #endif
  5320.  
  5321. You can refer to the following article in KB for more details:
  5322.  
  5323. ID: Q117326, Foundation Classes Common Asserts, Causes and Solutions.
  5324.  
  5325. Muniraju, netquest, MSMFC, 8/1/95
  5326.  
  5327. 11.22. How do I handle my own registered messages?
  5328.  
  5329. [Editor Note: In this FAQ, Dean is telling a guy how to handle
  5330. WM_CHKTBLTOGGLE, which is some message that dude is trying to handle. The
  5331. guy was doing it a wrong way before, I've left that in for educational
  5332. reasons.]
  5333.  
  5334. Use ON_MESSAGE:
  5335.  
  5336.         ON_MESSAGE(WM_CHKTBLTOGGLE, OnChkTblToggle)
  5337.  
  5338. In your class definition:
  5339.  
  5340.         afx_msg LRESULT OnChkTblToggle(WPARAM wParam, LPARAM lParam);
  5341.  
  5342. In your message map:
  5343.  
  5344.  #define ON_WM_CHKTBLTOGGLE()
  5345.  
  5346. {
  5347.  
  5348. WM_CHKTBLTOGGLE, 0, AfxSig_vwp, (AFX_PMSG)(AFX_PMSGW)(BOOL
  5349.  
  5350. (AFX_MSG_CALL CWnd::*)(BYTE, BYTE))OnChkTblToggle
  5351.  
  5352. },
  5353.  
  5354. In your code:
  5355.  
  5356. LRESULT CMyView::OnChkTblToggle(WPARAM wParam, LPARAM lParam)
  5357.  
  5358. {
  5359.  
  5360.         // TODO: write your code here
  5361.  
  5362. }
  5363.  
  5364. You told MFC that your fuction is:
  5365.  
  5366.          void CMYView::OnChkTblToggle(UINT, CPoint)
  5367.  
  5368. That's what the signature AfxSig_vwp means... and definitely not what you
  5369. want.
  5370.  
  5371. ON_MESSAGE and ON_REGISTERED_MESSAGE are intended to allow you to extend
  5372. the message handlers to your own custom message handlers. Please don't rely
  5373. on specific AfxSig_* values or on the message map structure -- it may
  5374. change without notice.
  5375.  
  5376. Dean McCrory, mfc-l, 8/19/95
  5377.  
  5378. 11.23. How do I customize the MFC idle time processing?
  5379.  
  5380. In my opinion, MFC's idle processing happens too often. Unfortunately, we
  5381. can't change it because it might break apps when not necessary. But.. we
  5382. have built in to the code a way for applications to customize the times in
  5383. which they "enter idle". The secret? CWinThread::IsIdleMessage!!
  5384.  
  5385. Here's an example which disables idle entry for mouse & timer messages:
  5386.  
  5387. BOOL CMyApp::IsIdleMessage(MSG* pMsg)
  5388.  
  5389. {
  5390.  
  5391.         if (!CWinApp::IsIdleMessage(pMsg))
  5392.  
  5393.         return FALSE;
  5394.  
  5395.         if ((pMsg->message >= WM_MOUSEFIRST &&
  5396.  
  5397.                 pMsg->message <= WM_MOUSELAST) ||
  5398.  
  5399.                 (pMsg->message >= WM_NCMOUSEMOVE &&
  5400.  
  5401.                 pMsg->message <= WM_NCMBUTTONDBLCLK))
  5402.  
  5403.                         return FALSE;
  5404.  
  5405.         if (pMsg->message == WM_TIMER)
  5406.  
  5407.                 return FALSE;
  5408.  
  5409.         // otherwise msg must kick in idle processing...
  5410.  
  5411.         return TRUE;
  5412.  
  5413. }
  5414.  
  5415. Now, what would happen if you had a clock on your status bar, and were
  5416. relying on a WM_TIMER to kick in a call to your update handler for that
  5417. pane? Well... as you might have guessed, the above code would break you.
  5418. There is an easy way to fix that, as there is a backdoor method of forcing
  5419. an idle to kick in: WM_KICKIDLE defined in afxpriv.h can be
  5420.  
  5421. used to make this happen.
  5422.  
  5423. So, in your timer handler (most likely a handler in your derived
  5424.  
  5425. CStatusBar class), you would add some code which does:
  5426.  
  5427. if (TimeIsDifferentEnough())
  5428.  
  5429.         PostMessage(WM_KICKIDLE);
  5430.  
  5431. If you take a look at CWinThread::IsIdleMessage, you'll see that we go
  5432.  
  5433. through a fair amount of pane to avoid unecessary OnIdle calls. Like
  5434.  
  5435. checking for mouse moves to the same location as last time (I don't
  5436.  
  5437. know why NT does that, but it does... everytime the caret flashes). We
  5438.  
  5439. are doing just about everything we can without breaking backward
  5440. compatibility.
  5441.  
  5442. -deanm@microsoft.com, via email.
  5443.  
  5444. 11.24. How do I create non-resizable (static AND fixed) splitter bars?
  5445.  
  5446. See KB article Q105150 "Preventing Static Splitters from Tracking". It
  5447. describes how to do this. Basically, derive a class from the CSplitterWnd
  5448. and override the left button and mouse move messages: call the CWnd
  5449. versions rather than CSplitterWnd versions. Finally, remove menu items that
  5450. may generate ID_WINDOW_SPLIT commands.
  5451.  
  5452. bills@anest4.anest.ufl.edu, via mfc-l 9/28/95
  5453.  
  5454. 11.25. How do I add 'What's this' menus to my application - like Win95 hip
  5455. apps have?
  5456.  
  5457. Here's some steps to get you started->
  5458.  
  5459. 1. Put the following menu into a resource script:
  5460.  
  5461. IDR_WHAT_IS_THIS_MENU   MENU    DISCARDABLE
  5462.  
  5463. BEGIN
  5464.  
  5465.         BEGIN
  5466.  
  5467.                 POPUP "a"
  5468.  
  5469.                 BEGIN
  5470.  
  5471.                         MENUITEM "What's this?", ID_WHAT_IS_THIS
  5472.  
  5473.                 END
  5474.  
  5475.         END
  5476.  
  5477. END
  5478.  
  5479. 2. Add to your dialog a right-click handler (OnRButtonDown) with menu
  5480. IDR_WHAT_IS_THIS_MENU. You need to store the point of the last click in
  5481. some variable - for example
  5482.  
  5483.         CPoint          m_cLastRClickPoint;
  5484.  
  5485. and store here the client coordinates of the last right click.
  5486.  
  5487. 4. Put the following code into your dialog class (or probably the parent
  5488. class of all your dialogs):
  5489.  
  5490. BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
  5491.  
  5492.         //{{AFX_MSG_MAP(CMyDialog)
  5493.  
  5494.         // whatever
  5495.  
  5496.         //}}
  5497.  
  5498.         ON_COMMAND(ID_WHAT_IS_THIS, OnWhatIsThis)
  5499.  
  5500. END_MESSAGE_MAP()
  5501.  
  5502. void CMyDialog::OnWhatIsThis()
  5503.  
  5504. {
  5505.  
  5506.         CWnd* pControl = ChildWindowFromPoint (m_cLastRClickPoint);
  5507.  
  5508. // if the click wasn't on one of the controls - open help for dialog
  5509.  
  5510.         if (pControl == NULL || pControl->m_hWnd == m_hWnd)
  5511.  
  5512.                 WinHelp (HID_BASE_RESOURCE + m_nIDHelp,
  5513.  
  5514.                 HELP_CONTEXTPOPUP);
  5515.  
  5516.         else
  5517.  
  5518.                 WinHelp (HID_BASE_CONTROL + pControl->GetDlgCtrlID(),
  5519.  
  5520.                         HELP_CONTEXTPOPUP);
  5521.  
  5522. }
  5523.  
  5524. - and finally add the following lines to the makehelp.bat file:
  5525.  
  5526. echo. >>hlp\wr.hm
  5527.  
  5528. echo // Controls (IDC_*) >>hlp\wr.hm
  5529.  
  5530. makehm IDC_,HIDC_,0x50000 resource.h >>hlp\wr.hm
  5531.  
  5532. This wires everything to your help system.
  5533.  
  5534. Poul A. Costinsky(PoulACost@msn.com).
  5535.  
  5536. 11.26. How do I display a choose directory dialog, instead of a choose file
  5537. dialog?
  5538.  
  5539. /* Work's only if we're 95 capable */
  5540.  
  5541. if (afxData.bWin4)
  5542.  
  5543. {
  5544.  
  5545.         LPMALLOC pMalloc;
  5546.  
  5547.         /* Get's the Shell's default allocator */
  5548.  
  5549.         if (::SHGetMalloc(&pMalloc) == NOERROR)
  5550.  
  5551.         {
  5552.  
  5553.                 BROWSEINFO bi;
  5554.  
  5555.                 char pszBuffer[MAX_PATH];
  5556.  
  5557.                 LPITEMIDLIST pidl;
  5558.  
  5559. // Get help on BROWSEINFO struct - it's got all the bit settings
  5560.  
  5561.                 bi.hwndOwner = GetSafeHwnd();
  5562.  
  5563.                 bi.pidlRoot = NULL;
  5564.  
  5565.                 bi.pszDisplayName = pszBuffer;
  5566.  
  5567.                 bi.lpszTitle = _T("Select a Starting Directory");
  5568.  
  5569.                 bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
  5570.  
  5571.                 bi.lpfn = NULL;
  5572.  
  5573.                 bi.lParam = 0;
  5574.  
  5575.                 // This next call issues the dialog box
  5576.  
  5577.                 if ((pidl = ::SHBrowseForFolder(&bi)) != NULL)
  5578.  
  5579.                 {
  5580.  
  5581.                         if (::SHGetPathFromIDList(pidl, pszBuffer))
  5582.  
  5583.                         {
  5584.  
  5585.                         //At this point pszBuffer contains the selected path */
  5586.  
  5587.                                 DoingSomethingUseful(pszBuffer);
  5588.  
  5589.                         }
  5590.  
  5591.                         // Free the PIDL allocated by SHBrowseForFolder
  5592.  
  5593.                         pMalloc->Free(pidl);
  5594.  
  5595.                 }
  5596.  
  5597.                 // Release the shell's allocator
  5598.  
  5599.                 pMalloc->Release();
  5600.  
  5601.         }
  5602.  
  5603. }
  5604.  
  5605. NOTE: This code will work on Win95 only - it's part of the shell.
  5606.  
  5607. bradw@netnet.net mfc-l, 9/9/95
  5608.  
  5609. 11.27. I'm having problems using MFC 4.0 and the STL, what could be wrong?
  5610.  
  5611. The trick is to include "new.h" (and also "iostream.h" for similar reasons)
  5612. before you include any stl headers. For example:
  5613.  
  5614.         #include <new.h>
  5615.  
  5616.         #include <iostream.h>
  5617.  
  5618.         namespace std {
  5619.  
  5620.         #include <map.h>
  5621.  
  5622.         }
  5623.  
  5624. <dave_bickford@compuware.com>, mfc-l
  5625.  
  5626. 11.28. How do I make a window stay on top of the others?
  5627.  
  5628. SetWindowPos(&wndTopMost,NULL,NULL,NULL,NULL,SWP_NOMOVE|SWP_NOSIZE)
  5629.  
  5630. (like DBWIN does)
  5631.  
  5632. lee@usa.nai.net, via mfc-l, 1/19/95
  5633.  
  5634. 11.29. How do I make a window move in front of another?
  5635.  
  5636. Call either:
  5637.  
  5638.         SetWindowPos(&wndTop,NULL,NULL,NULL,NULL,SWP_NOMOVE|SWP_NOSIZE)
  5639.  
  5640. Or
  5641.  
  5642.         BringWindowToFront();
  5643.  
  5644. lee@usa.nai.net, via mfc-l, 1/19/95
  5645.  
  5646. 11.30. Is MFC Dead?
  5647.  
  5648. No. MFC continues to grow and change as the operating system grows and
  5649. changes, and as th eneeds of our users continue to grow and mature. During
  5650. the summer of 1997, some MFC team members will provide presentations under
  5651. strict non-disclosure agreements that explain some of the planning that's
  5652. happening for the next version of the product. But the caveat in the above
  5653. question still strongly applies: the development of the product might
  5654. change directions to fill an unforseen pressing need, but the product is by
  5655. no means dead.
  5656.  
  5657. -mikeblas@microsoft.com
  5658.  
  5659. 11.31. Does ATL Replace MFC?
  5660.  
  5661. No. ATL and MFC are designed to solve two very different problems.
  5662.  
  5663. -mikeblas@microsoft.com
  5664.  
  5665. 11.32. How do I implement docking windows like DevStudio has?
  5666.  
  5667. MFC does not easily let you do this. The problem is that the
  5668. dockbar/control bar architecture is built for basic toolbars, not windows.
  5669. We have solved the problem in our Objective Toolkit product -
  5670. http://www.stingsoft.com has demos and white papers - check it out!
  5671.  
  5672.  
  5673.  
  5674. 11.33. Will the next version of MFC support [some particular feature]?
  5675.  
  5676. The MFC Team grows MFC's feature set as time and resource allow.
  5677.  
  5678. MFC features are added when the MFC team feels that MFC can provide a clear
  5679. win for C++ programmers over using some API or some system feature
  5680. directly. MFC tracks features in the operating system as well as new
  5681. strategic technologies that Microsoft introduces.
  5682.  
  5683. Unfortunately, some people in the industry have irresponsibly begun
  5684. predicting what MFC will or won't support. If someone not on the MFC Team
  5685. claims to know wether MFC will or wont support a particular feature,
  5686. they're wrong: they don't know. If someone who _is_ on the MFC Team says
  5687. that the team is planning support for a feature, they're probably right--at
  5688. that particular moment in time. Because software development schedules
  5689. change and are influenced by all sorts of surprises, the feature may or may
  5690. not make the final version of the product despite the best efforts of the
  5691. team members.
  5692.  
  5693. -mikeblas@microsoft.com
  5694.  
  5695.  
  5696.  
  5697.  
  5698.  
  5699. ------------------------------------------------------------------------
  5700.  
  5701. 12. Wizard Questions
  5702.  
  5703. 12.1. How can I change the AppWizard options I selected for my application?
  5704.  
  5705. Unfortunately, AppWizard will not modify already created and modified
  5706. applications. You need to generate a new skeleton application using
  5707. AppWizard and either merge your code into that or compare that skeleton
  5708. with your original to see what's different. The good news is that it's
  5709. mostly just a minor tweak to add/remove OLE support or MDI or something
  5710. like that. It usually is just changing your CWinApp derivate, your frame
  5711. window, or something like that.
  5712.  
  5713. scot@stingsoft.com, 5/31/95
  5714.  
  5715. ------------------------------------------------------------------------
  5716.  
  5717. 13. Visual C++ Questions
  5718.  
  5719. I'm trying to keep these as generic as possible, but these types of
  5720. questions tend to be very release-specific, so where possible, I've
  5721. included the version that's being questioned.
  5722.  
  5723. 13.1. Windows 95 questions
  5724.  
  5725. 13.1.1. I'm running MSVC 2.0 and I can't get Windows 95 look and feel in my
  5726. dialogs, what's wrong?
  5727.  
  5728. In MSVC 2.0, go to the Project/Options dialog, select "Linker" and change
  5729. the linker command line to include: /subsystem:windows,4.0 This is the
  5730. default in MSVC 2.1.
  5731.  
  5732. Chris Marriott, chris@chrism.demon.co.uk, 5/25/95, via programmer.misc
  5733.  
  5734. 13.1.2. When I compile under Windows 95, it flashes in and out of DOS mode.
  5735.  
  5736. Remove or rename any dosprmpt.pif files in your win95 and windows
  5737. directories. If this doesn't work, do the same with all pif files.
  5738.  
  5739. scot@stingsoft.com, 5/25/95
  5740.  
  5741. In the Win95\system directory there is a pif for Conagent. It is this pif
  5742. file that a person has to change to Window screen mode instead of Full
  5743. Screen mode. Worked like a charm on mine after running about a month with
  5744. the screen blanking...
  5745.  
  5746. RockyMoore@aol.com, email, 7/16/95
  5747.  
  5748. 13.1.3. Can MSVC 1.5 or 2.0 be used for Windows 95?
  5749.  
  5750. You can run both versions under Windows 95. Visual C++ 1.5x can ONLY
  5751. generate 16-bit applications. You 'can' run these on Windows 95, but it's
  5752. more desirable to have true 32-bit applications, which MSVC 2.0 generates.
  5753. These same rules apply to NT.
  5754.  
  5755. scot@stingsoft.com 6/5/95
  5756.  
  5757. 13.2. Configuration Questions
  5758.  
  5759. 13.2.1. What are the memory requirements of MSVC?
  5760.  
  5761. MSVC 1.5.x will work on a 486 class machine with a minimum of 4MB of RAM.
  5762. 8MB will make your life much better. MSVC 2.x needs at least 16MB.
  5763. Microsoft recommends 20MB on the box.
  5764.  
  5765. Note: VC 1.5 takes a big (3x) performance hit under all operating systems
  5766. if you have less than 16 Meg. I published an article about this (and other
  5767. performance enhancements) in Windows/DOS Developers Journal in May, 95.
  5768.  
  5769. jimb@turningpoint.com, email, 7/11/95
  5770.  
  5771. 13.2.2. How can I get MSVC 2.1, I can't find it in stores?
  5772.  
  5773. The point releases are part of the MSVC subscription (See section 2.1.1.).
  5774. Only major releases are sold through retail, so you'll need to buy a
  5775. subscription to get the point releases. Subscriptions are available from
  5776. Microsoft, Programmer's Paradise and Programmer's shop. (See section 2.1
  5777. for info)
  5778.  
  5779. 13.2.3. Should I run under Win 95 or NT?
  5780.  
  5781. Life is a bunch of trade offs. The trade offs here are if you run under 95,
  5782. you won't need as much memory, but the OS is not as robust as NT, so you
  5783. will probably crash more. On the flip side, if you run under NT (a full
  5784. 32-bit OS), you won't crash as much, but alas, you will need more memory.
  5785. Personally, I prefer the NT route. NT catches all memory problems and
  5786. handles them nicely for you without destabilizing the system.
  5787.  
  5788. scot@stingsoft.com, 6/18/95
  5789.  
  5790. 13.2.4. How do I set the include/lib/exe directories?
  5791.  
  5792. MSVC versions < 2.0 used environment variables INCLUDE/LIBDIR/EXEDIR. MSVC
  5793. versions > 2.0 uses settings in the Visual C++ Tools menu. Select "Tools"
  5794. and then "Options" menu item. A dialog opens, and select "Directories" tab
  5795. button. There you can set Include directories, Library directories,
  5796. Executable directories...
  5797.  
  5798. lee@sam1.info.samsung.co.kr (Lee, Jin Woo), via programmer.win32, 6/10/95
  5799.  
  5800. 13.2.5. I can't compile any programs! Help!
  5801.  
  5802. Question: I just installed VC1.51 on my system. Installation proceeded
  5803. smoothly without any errors. However, I can't compile any programs! Even
  5804. when I try to compile thesimplest and shortest programs, I get this error
  5805. message:
  5806.  
  5807. Can't open the compilation response file
  5808.  
  5809. Answer : A common cause of this type of error is having a TMP or TEMP
  5810. environmentvariable which isn't pointing at a valid directory. Eg your
  5811. AUTOEXEC.BAT file says:
  5812.  
  5813. set TMP=C:\TMP
  5814.  
  5815. and you don't have a "C:\TMP" directory.
  5816.  
  5817. Chris Marriott, chris@chrism.demon.co.uk, programmer.misc, 6/18/95
  5818.  
  5819. 13.2.6. Can I setup a project to search different paths for source?
  5820.  
  5821. I would like to have my projects first search for the source in a local
  5822. directory, and if it can't find it there, search a network drive.
  5823.  
  5824. TODO: Find answer to this one, seems good. Asked on tools 6/21 by
  5825.  
  5826. Joe Kinsella, jkinsella@procd.com
  5827.  
  5828. 13.2.7. How do I build a browser file for all of MFC?
  5829.  
  5830. It's nice to be able to browse the MFC classes and source code, the best
  5831. way to do this is via some Microsoft supplied .BAT files for the Microsoft
  5832. Software Library:
  5833.  
  5834. BLDBSC15.BAT - for VC++ 1.5
  5835.  
  5836. BLDBSC20.BAT - for VC++ 2.0
  5837.  
  5838. BLDBSC21.BAT - for VC++ 2.1
  5839.  
  5840. Basically, you want invoke the compiler on every file with /Zs as the
  5841. option, which means generate the .sbr file and no .obj. Next, you want to
  5842. run bscmake.exe on the generated .sbr files to create your .bsc file. The
  5843. MFC makefile will complain about the obj's being missing, but you can
  5844. ignore that warning. It will take significantly longer and more time to
  5845. create both .sbrs and .objs.
  5846.  
  5847. scot@stingsoft.com, 6/25/95
  5848.  
  5849. It is worth noting that VC 2.1 has a pre-built browser file that is on the
  5850. CD-ROM but is not installed. It can be loaded at any time into the IDE with
  5851. the File/Open command.
  5852.  
  5853. jimb@turningpoint.com, email, 7/11/95
  5854.  
  5855. If you are using the 32-bit versions, you can get more information in the
  5856. README.TXT file in the \msvc20\mfc\src directory. What is tells you is to
  5857. move to that directory and from the dos prompt run:
  5858.  
  5859. nmake DEBUG=1 BROWSEONLY=1
  5860.  
  5861. billb@microsoft.com, mfc-l, 7/17/95
  5862.  
  5863.  
  5864.  
  5865. 13.2.8. When I compile I get: "fatal error C1010: unexpected end of file
  5866. while looking for precompiled header directive" - why?
  5867.  
  5868. You need to #include "stdio.h" at the top of your file.
  5869.  
  5870. - hrubin@nyx.net
  5871.  
  5872. 13.3. Language feature questions
  5873.  
  5874. 13.3.1. Does MSVC support templates and exception handling?
  5875.  
  5876. The 32-bit Visual C++ 2.0 release introduced templates and exception
  5877. handling. There is no support for these C++ features in 16-bit versions of
  5878. the product.
  5879.  
  5880. It is worth noting that the 16 bit implementation of THROW and CATCH are
  5881. brain-damaged. They do not clean up the stack as it unwinds.
  5882.  
  5883. jimb@turningpoint.com, email, 7/11/95
  5884.  
  5885. 13.3.2. Does MSVC support the Standard Template Library?
  5886.  
  5887. Yes! See FAQ 11.27 for some hints. This support was added with 4.0
  5888.  
  5889. 13.3.3. Does VC++ support RTTI?
  5890.  
  5891. Yes, version 4.0 does.
  5892.  
  5893. scot@stingsoft.com, 6/7/95
  5894.  
  5895. 13.4. Religious questions
  5896.  
  5897. 13.4.1. Which is better OWL or MFC, BC++ or MS MSVC?
  5898.  
  5899. This is constantly getting asked on Usenet. The answer really depends on
  5900. what you are doing. If you demand the latest C++ features such as
  5901. templates, RTTI, etc.. BC++ usually has these first. But be careful, when
  5902. Borland went from OWL 2 to 3 (or was it 1 to 2?) they made everybody
  5903. completely rewrite their applications. Applications that were written with
  5904. MFC 1.0 still work with the newer versions of MFC today! The best advice is
  5905. to get the features from each vendor and see what's best for your
  5906. situation.
  5907.  
  5908. scot@stingsoft.com 6/8/95, comp.lang.c++
  5909.  
  5910. 13.4.2. Should I use Visual C++ or Visual Basic?
  5911.  
  5912. (Here's a funny analogy I saw posted->) Well, the principle is the same
  5913. (create interface, add code to respond to events, add code to do something
  5914. useful). But programming in VB is like riding a kiddy bike, while
  5915. programming in C++ is like driving a Formula 1 racing car - be prepared for
  5916. accidents.
  5917.  
  5918. But seriously, VB is interpreted, MSVC is compiled, therefore MSVC programs
  5919. should be much faster (if written well). It's generally believed that VB is
  5920. the best way to 'prototype' a user-interface, but when it comes to code
  5921. reuse and solving larger problems, VB breaks down. Visual C++ on the other
  5922. hand is not as easy to use as VB, but once you learn it, you can write much
  5923. more complex programs than with VB. The readers digest version of all this
  5924. is: It depends on the application you are writing.
  5925.  
  5926. scot@stingsoft.com, 6/18/95
  5927.  
  5928. 13.4.3. MFC philosophy (from a microsoftie!)
  5929.  
  5930. Just a note about the classes provided in MFC... keep in mind that these
  5931. classes are designed as "general-purpose" classes, not "all-purpose"
  5932. classes. No one implementation can have performance characteristics that
  5933. are ideal for *all* possible applications. It is up to you, the programmer,
  5934. to evaluate a provided implementation and decide whether it is appropriate
  5935. for the task at hand. If it is not, you have several alternatives: modify
  5936. or subclass the provided implementation; find a more appropriate class from
  5937. another source; or write one from scratch.
  5938.  
  5939. elsbree@msn.com, mfc-l, 7/15/95
  5940.  
  5941. 13.4.4. Should I use the MFC collections or the STL collections?
  5942.  
  5943. %%TODO: Get a good insightful answer to this one: please contribute!
  5944.  
  5945. 13.5. Advanced Visual C++ tips and tricks
  5946.  
  5947. 13.5.1. How do I see the MSVC 'Easter Eggs'?!
  5948.  
  5949. FYI: Easter eggs are hidden screens that usually have secret initials,
  5950. development team names, etc..
  5951.  
  5952.   1.
  5953.        1.
  5954.             1.
  5955.                  1. To see the spinning PLUS with the MSVC team members:
  5956.  
  5957. In MSVC 2.0 or 2.1->
  5958.  
  5959. A. Bring up the about box: help/about
  5960.  
  5961. B. Press control-tab and double click in the middle of the box at the same
  5962. time.
  5963.  
  5964. NOTE: You must have the MSVC CD loaded for this to work, I think.
  5965.  
  5966. 2. If above does not work, try this-> copy the MSVCCRD.DLL from the CD to
  5967. msvc\binCTRL+Double-click the picture in the dialog
  5968.  
  5969. note: release the CTRL key at the same time as the second click.
  5970.  
  5971. ohallorj@pwc-tpc.ca, Jeff O'Halloran
  5972.  
  5973. To see the Visual C++ 4.0 about box, double click in the about box while
  5974. the CDROM is in the drive and you are holding the control key down. The OK
  5975. button should go away. Wait about 3-5 minutes and you should see a pretty
  5976. neat flight simulator! You can browse the picture by opening msdevcrd.dll
  5977. which lives in msdev\bin.
  5978.  
  5979. scot@stingsoft.com
  5980.  
  5981. 13.5.2. What are the command line options to MSVC?
  5982.  
  5983.    * MSVC /V - Runs the compiler in a dos box (version 1.5 only?)
  5984.  
  5985. mark@techop.demon.co.uk
  5986.  
  5987.    * MSVC /NOLOGO - Runs MSVC without the about box, saves second or 2.
  5988.    * MSVC /bppassc:yes - Enables a cool breakpoint counter in the
  5989.      'breakpoints' dialog (under the Debug menu).
  5990.  
  5991. jimb@turningpoint.com, email 7/11/95
  5992.  
  5993.    * MSVC -p - attaches VC++ to a process.
  5994.  
  5995. 13.5.3. How to change the color of ClassWizard generated code!
  5996.  
  5997. The default color for text modified by the ClassWizard is black print on a
  5998. white background. Visual C++ is aware of the code that the ClassWizard
  5999. modifies and can highlight these changes for you using a different color.
  6000.  
  6001. Highlighting the text ClassWizard modifies makes the new modifications very
  6002. obvious and easy to find. To do this, from the Tools menu, choose Options.
  6003. Then select the Format tab in the Options dialog box. From the Colors
  6004. Listbox, select Wizard Code. Then define the colors for text and the
  6005. background.
  6006.  
  6007. NOTE: Only applies to VC++ 2.x (and 4.x), but it's waaaay cool!
  6008.  
  6009. MS FAQ, 6/25/95
  6010.  
  6011. 13.5.4. Ten cool things you can do in the VC++ editor!
  6012.  
  6013.   1.
  6014.        1.
  6015.             1.
  6016.                  1. CTRL+ALT+T shows your tab characters
  6017.                  2. SHIFT+ESC closes the active dockable window
  6018.                  3. CTRL+F3 finds the next occurrence of the current word
  6019.                  4. CTRL+M finds the matching bracket
  6020.                  5. CTRL+> and CTRL+< find the next/prev matching
  6021.                     #ifdef/#else/#endif
  6022.                  6. CTRL+SHIFT+R starts/stops macro recording
  6023.                  7. CTRL+SHIFT+P plays recorded macro
  6024.                  8. Right-click #includes to open the header file
  6025.                  9. TAB/SHIFT+TAB indent or unindent selected lines
  6026.                 10. Hold ALT key down to select columns
  6027.                 11. Jeff Henshaw, borrowed of MFC PDC slide, 6/25/95
  6028.  
  6029.                     NOTE: Not all of these work in VC++ 1.5x, most do in
  6030.                     2.x and 4.x
  6031.  
  6032.                     13.5.5. How do I speed up VC++ compiles?
  6033.  
  6034.                     Use precompiled headers, turn off the browser
  6035.                     (Options:Project:Compiler:Listing Files:Browser
  6036.                     Information), increase and/or decrease the size of your
  6037.                     disk cache, tinker with the INCLUDE and LIB environment
  6038.                     variable directory orders. That's about it.
  6039.  
  6040.                     ebarb@iadfw.net, programmer.tools, 8/19/95
  6041.  
  6042.                     13.5.6. Make all MFC keywords a different color!
  6043.  
  6044.                     Download the file USERTYPE.DAT from the FAQ Archive
  6045.                     (See 2.2.6) and follow the directions in there. Try it,
  6046.                     you'll like it!
  6047.  
  6048.                     NOTE: This has been updated for 4.0
  6049.  
  6050.                     scot@stingsoft.com, 8/31/95
  6051.  
  6052.                     13.5.7. Easy way to launch 4.x projects without mdp
  6053.                     files.
  6054.  
  6055.                     For very large projects you might not bank or put mdp
  6056.                     files into the version control system. You just want to
  6057.                     grab the makefile and go. The problem is that Visual
  6058.                     C++ does not easily recognize .mak files. Here's an
  6059.                     easy way to launch right from a makefile to VC4.0 and
  6060.                     have a .mdp file created.
  6061.  
  6062.                     1. Bring up the registry edit (registry.exe for Windows
  6063.                     95 and regedt32.exe for Window NT 3.51)
  6064.  
  6065.                     2. Activate the HKEY_CLASSES_ROOT window
  6066.  
  6067.                     3. Add a new key
  6068.  
  6069.                     .mak
  6070.  
  6071.                     4. Add a new string value
  6072.  
  6073.                     mdpfile
  6074.  
  6075.                     5. Close the registry
  6076.  
  6077.                     That's it. Now you can just select any Visual C++ 4.0
  6078.                     makefile from the file manager or the explorer and the
  6079.                     Visual C++ IDE will come up and a project workspace
  6080.                     (.mdp) will be create for that makefile. You no longer
  6081.                     have to go into the visual environment do a "file
  6082.                     open", enter a filename, and select "open
  6083.                     as...makefile". This is definitely a time saver.
  6084.  
  6085.                     G_LEDONNE@msn.com
  6086.  
  6087.                     13.6. Miscellaneous Visual C++ questions
  6088.  
  6089.                     13.6.1. What are all these files that MSVC is
  6090.                     creating?!
  6091.  
  6092.                     Here's a table that explains the common extensions and
  6093.                     what MSVC uses them for:
  6094.  
  6095.                     -------------------------------------------------------
  6096.  
  6097.                     Extension          Use                       Notes
  6098.  
  6099.                     APS                App Studio File
  6100.  
  6101.                     BSC                Browser File              SBR's combined into 1 BSC
  6102.  
  6103.                     CLW                Class Wizard File
  6104.  
  6105.                     ILK                Incremental Linker File
  6106.  
  6107.                     NCB                Contains the ClassView    Added in 4.0, delete if you
  6108.  
  6109.                                        information               have problems.
  6110.  
  6111.                     PCH                Pre-Compiled Header File
  6112.  
  6113.                     PDB                Debugging Info            /Z7 Affects This
  6114.  
  6115.                     RES                RC 'object' File          Linked Into EXE
  6116.  
  6117.                     SBR                Browser Info for 1 File   Combined Into BSC
  6118.  
  6119.                     VCP                Visual C++ State File
  6120.  
  6121.                     -------------------------------------------------------
  6122.  
  6123.                     %%TODO: Fill this table in more completely.
  6124.  
  6125.                     13.6.2. How do I change from using MFCXX.DLL to using a
  6126.                     statically linked library?
  6127.  
  6128.                     You need to flick a few settings in the build settings
  6129.                     windows:
  6130.  
  6131.                     In the C/C++ tab, select the "General" Category. Remove
  6132.                     "_AFXDLL" from the list of preprocessor definitions. In
  6133.                     the"Code Generation" tab, select "Multithreadded' or
  6134.                     "Debug
  6135.  
  6136.                     Multithreadded", which ever is appropriate for your
  6137.                     build.
  6138.  
  6139.                     In the "Resources" tab, make sure that "_AFXDLL"
  6140.                     doesn't appear in the list that's in the "Preprocessor
  6141.                     Definitions" edit.
  6142.  
  6143.                     -Mike B - blaszczak@BIX.com
  6144.  
  6145.                     13.6.3. How do I report a bug to Microsoft?
  6146.  
  6147.                     [ed. note: Here's a fun answer from Mike B on this one,
  6148.                     seems Mike gets lots of "how do I", or "is this a bug"
  6149.                     emails. This FAQ actually has good info, I kept some of
  6150.                     the personal stuff because it livens it up somewhat.]
  6151.  
  6152.                     I think need to explain something about bug reporting.
  6153.  
  6154.                     While everyone on this list knows that I work at
  6155.                     Microsoft, and most people know that I work on MFC, it
  6156.                     seems that very few people understand how bugs should
  6157.                     be reported to Microsoft about Microsoft products.
  6158.  
  6159.                     If you're a Microsoft Select customer, or you're
  6160.                     involved with Microsoft Consulting Services, you should
  6161.                     talk to your Corporate Account Manager or Engagement
  6162.                     Manager about how you should get information about bugs
  6163.                     to and from Microsoft.
  6164.  
  6165.                     If you're a user who has bought Visual C++, you need to
  6166.                     use the "Technical Support" command in the "Help" menu
  6167.                     of Visual C++. This help topic explains a lot about
  6168.                     contacting PSS, Microsoft's Product Support Services.
  6169.  
  6170.                     If you have a support agreement with PSS, or if you
  6171.                     _don't_ have an agreement with PSS, you can call to
  6172.                     report a bug without charge. You _will_ have to pay for
  6173.                     your own long-distance phone call, but you'll not be
  6174.                     debited for the time you spend making the report by
  6175.                     Microsoft.
  6176.  
  6177.                     Everyone should have understood this, but I guess many
  6178.                     don't. Further:
  6179.  
  6180.                     Microsoft certainly encourages third-party and peer
  6181.                     support for Microsoft products. You should be able to
  6182.                     find certified Microsoft consultants near where you
  6183.                     work, and you should be able to find peer-support
  6184.                     places to talk about Microsoft products. MFC-L is an
  6185.                     example of one, and the MSMFC forum on CompuServe is
  6186.                     another.
  6187.  
  6188.                     The problem is, though, that a few people have written
  6189.                     to me (and, I suppose, other MS-people on the list)
  6190.                     personally requesting that I handle a bug report or
  6191.                     requesting that I provide one-on-one help.
  6192.  
  6193.                     Frankly, I just don't have the time to do that. I try
  6194.                     to answer lots of questions in public places (like on
  6195.                     MFC-L, or on MSMFC, or in the occasional book) to help
  6196.                     out and encourage the peer-support communities. But I
  6197.                     don't have time to hand-hold people through problems,
  6198.                     and I don't have the time to accept bug reports.
  6199.  
  6200.                     "Accepting a bug report", if you don't realize it,
  6201.                     means that I would get from you a complete reproduction
  6202.                     case, figure out what is wrong, reproduce it myself,
  6203.                     and report it to the appropriate folks. I can't skip
  6204.                     those steps because it makes noise for the appropriate
  6205.                     folks if they've already heard about the problem
  6206.                     before.
  6207.  
  6208.                     I really don't mean to be a prick: I just can't make
  6209.                     (or even imply) promises that I know I'm not capable of
  6210.                     keeping.
  6211.  
  6212.                     Now, on the other hand, if you report a problem to a
  6213.                     public place (like MFC-L or to CompuServe) and I see
  6214.                     it, I might try to reproduce it. I'll steal it from the
  6215.                     list and take it to work, where I can see if it was
  6216.                     reported before. And when I have time, I can fool with
  6217.                     it. But I can _NOT_ imply any obligation--I can't
  6218.                     promise that I'l do even this much... but since
  6219.  
  6220.                     I'm interested in MFC, I usually try. It's
  6221.                     unofficial--all it is some guy who wants to go out of
  6222.                     his way to help out.
  6223.  
  6224.                     So, if you find what you think is a bug, here's what
  6225.                     you should do:
  6226.  
  6227.                     1) Panic.
  6228.  
  6229.                     2) Threaten to nuke my neighborhood.
  6230.  
  6231.                     3) Try to consolidate the problem.
  6232.  
  6233.                     4) Take that consolidation to another project on
  6234.                     another machine and try it
  6235.  
  6236.                     5) If it still is a problem, step through the code.
  6237.                     THINK..
  6238.  
  6239.                     6) THINK some more..
  6240.  
  6241.                     If you're still sure its a bug, do one or more of these
  6242.                     things:
  6243.  
  6244.                     a) Call PSS.
  6245.  
  6246.                     b) Talk to a support professional, like a certified
  6247.                     consultant.
  6248.  
  6249.                     c) Write to MFC-L or the MSFMC group, or the MFC
  6250.                     bulletin board on MSN.
  6251.  
  6252.                     but realize that only (A) is the official, guaranteed
  6253.                     way to get help.
  6254.  
  6255.                     My job is to write software, and I try to be pretty
  6256.                     good at that. (I'm pretty good at going to hockey
  6257.                     games, too.) But I really can't also do the job of
  6258.                     product support on a full-time, full-responsibility
  6259.                     basis. Sending bug reports directly to me will do
  6260.                     nothing more than make me feel awkward and say "Sorry,
  6261.                     can't help" to you.
  6262.  
  6263.                     Thanks for understanding,
  6264.  
  6265.                     - mikeblas@interserv.com
  6266.  
  6267.                     13.7. Visual C++/MFC 4.0 specific hints, problems,
  6268.                     etc..
  6269.  
  6270.                     13.7.1 Why aren't my windows being created in MFC 4.0?
  6271.  
  6272.                     The problem is probably that you are relying on one of
  6273.                     the MFC 3.x and earlier registered window classes for
  6274.                     the class name passed to your ::Create(). For example,
  6275.                     a very popular way to create a window with a white
  6276.                     background is to use "AfxViewOrFrame". In MFC 4.0, not
  6277.                     only have all of the window class names been changed,
  6278.                     but they also happen dynamically when needed!
  6279.  
  6280.                     The solution is to use AfxRegisterWndClass() and pass
  6281.                     the results to Create(). Be sure to specify the right
  6282.                     flags to get the desired results. Also check out tech
  6283.                     note number 1, which has been revised for 4.0.
  6284.  
  6285.                     - scot@stingsoft.com, 1/20/96
  6286.  
  6287.                     13.7.2. How do I convert a VC++ 2.x makefile over to
  6288.                     4.x?
  6289.  
  6290.                     1. Select File/Open...
  6291.  
  6292.                     2. Select your *.mak file
  6293.  
  6294.                     3. Select Open as: Makefile
  6295.  
  6296.                     4. Select Open, then VC will offer you to convert it to
  6297.                     a VC workspace - this is what you want.
  6298.  
  6299.                     13.7.3. ClassWizard has problems wiring controls to
  6300.                     members in international 4.0 versions, what the heck do
  6301.                     I do?
  6302.  
  6303.                     To test and see if you have the problem:
  6304.  
  6305.                     1. In VC version 4.0 use the app wizard to create a
  6306.                     dialog based application.
  6307.  
  6308.                     2. then use the dialog resource editor to add controls
  6309.                     etc onto the dialog box generated above.
  6310.  
  6311.                     3. Then fire up the class wizard to associate member
  6312.                     variables to the added controls. The control ID's are
  6313.                     NOT listed in the command ID windows (the IDCANCEL and
  6314.                     IDOK are there and thats it!) of the member variables
  6315.                     property page.
  6316.  
  6317.                     The control ID's ARE in the messagemap property page
  6318.                     but not on the member variables property page! Huh?
  6319.  
  6320.                     The fix:
  6321.  
  6322.                     The fix is to change the language property of the
  6323.                     dialog template (highlight the name of the dialog box
  6324.                     in the resource window and click right mouse button).
  6325.                     For me I had to change the language property from
  6326.                     English (US) to English (Australian), only after doing
  6327.                     this do the member variables of control's appear. I
  6328.                     assume this property must match your Win95 chosen
  6329.  
  6330.                     language, in anycase the change fixed it for me and a
  6331.                     German user who had the same problem.
  6332.  
  6333.                     doug@psy.uwa.edu.au, email, 12/13/95
  6334.  
  6335.                     13.7.4. VC++ 4.0 crashes all the time on me!!!
  6336.                     HELP!?!?!?!?!
  6337.  
  6338.                     I haven't personally experienced these problems, but
  6339.                     here's some solutions (some are probably wives tales)
  6340.                     for solving the problems:
  6341.  
  6342.                 12. Make sure you have downloaded the service update from:
  6343.                     http://www.microsoft.com/visualc.
  6344.                 13. If you're using subprojects, this is probably the
  6345.                     culprit, they're very unstable.
  6346.                 14. If you're using 200+ files, try and carve your project
  6347.                     into DLLs.
  6348.                 15. Try removing the .ncb file, this is where the ClassView
  6349.                     info is stored.
  6350.                 16. If you converted your project over from 2.x and are
  6351.                     having problems - start fresh with a 4.0 project and
  6352.                     insert your files into it.
  6353.                 17. 13.7.5. How do I add components (not just classes) to
  6354.                     the Component Gallery?
  6355.  
  6356.                     The APIs used for the Component Gallery have not been
  6357.                     made public yet by Microsoft.
  6358.  
  6359.                     13.7.6. What is up with the Visual C++ 5.0 help
  6360.                     system!?
  6361.  
  6362.                     -------------------------------------------------------
  6363.  
  6364.                     It is widely known (at least everyone I talk to) that
  6365.                     the VC++ 5.0 help system is very very bad! Microsoft
  6366.                     replaced the wonderful, speedy RTF based WinHelp viewer
  6367.                     system with an HTML based IE viewer system. Why is it
  6368.                     slow? Well now you have to basically have a Alta Vista
  6369.                     on your desktop to search since it is basically HTML.
  6370.                     There is an indexing system, it is suppose to get
  6371.                     better, but it is really bad right now.
  6372.  
  6373.                     Here's what I doà
  6374.  
  6375.                       1. Remove all of the help files.
  6376.                       2. Install Visual C++ 4.2, choose only the IDE and
  6377.                          help file options. Install into some unique
  6378.                          directory like c:\vc42_help.
  6379.                       3. Now use VC++ 4.2 for help and VC++ 5.0 for
  6380.                          compiles.
  6381.  
  6382. Sounds cheesy and it is, but the 5.0 help is really that bad if you are a
  6383. heavy user like I am (not sure if that is a good or bad thing).
  6384.  
  6385. 14. Third Party MFC Products
  6386.  
  6387. This section lists products that make the MFC developer's life easy. No
  6388. OCX/VBX type products are listed here, go check some catalog. Where
  6389. possible, I've put a review by someone!
  6390.  
  6391.    * Stingray Software, Inc.
  6392.    *
  6393.         o (800) 924-4223
  6394.         o (919) 461-0672
  6395.         o sales@stingsoft.com
  6396.         o http://www.stingsoft.com
  6397.         o Company that develops and markets MFC extension class libraries.
  6398.           Co-founded by me - the MFC FAQ dude. We have a full family of MFC
  6399.           extensions that should save you tons of time in your MFC
  6400.           projects. Many of our products were inspired by FAQs!
  6401.         o %%TODO: get a review
  6402.    * Premia CodeWright Fusion
  6403.    *
  6404.         o (800) 547-9902
  6405.         o (503) 641-6000
  6406.         o Great add-in editor for MSVC, they have both 16 and 32-bit
  6407.           versions.
  6408.  
  6409. %%TODO: Get a review, anyone?
  6410.  
  6411.    * Nu-Mega Bounds-Checker
  6412.    *
  6413.         o (800) 468-6342
  6414.         o (603) 889-2386
  6415.         o Lets you know if you've clobbered memory, has a special MFC
  6416.           feature so you can see class names and paths through message
  6417.           maps.
  6418.         o %%TODO: Review? We use it at Stingray all the time. Still not as
  6419.           good as Purify on Unix, but all we've got right now.
  6420.    * Rogue Wave Tools.h++ - There's been a looong thread on the mfc-l about
  6421.      how hard this is to use with MFC, people are trying everything and it
  6422.      doesn't seem to help. Evidently they use a totally different memory
  6423.      model, internationalization and persistence. -various, mfc-l 7/18/95 -
  6424.      7/27/95
  6425.  
  6426. Update - they were going to come out with Tools.h for MFC, but decided not
  6427. to. Can anyone say "LAME"?!
  6428.  
  6429. ------------------------------------------------------------------------
  6430.  
  6431. 15. MFC FAQ Revision History
  6432.  
  6433.    * 1.0 Beta 5/25/95
  6434.    *
  6435.         o Did heavy work on TOC, more info, history. Not many FAQs yet.
  6436.    * 1.0 Final Beta 6/2/95
  6437.    *
  6438.         o Put in some FAQs I keep seeing. Integrated feedback from mfc-l
  6439.           posting.
  6440.         o Posted one last time to mfc-l for final feedback before FCS...
  6441.    * 1.0 FCS! 6/8/95
  6442.    *
  6443.         o Put in some FAQs from MSVC KB
  6444.         o Got lots of good feedback from mfc-l
  6445.         o Got some new FAQs from Usenet
  6446.         o Integrated news from MFC Conference, MSVC 4/2.2, etc..
  6447.         o Posted to Usenet and CompuServe for first time.
  6448.    * 1.1 6/25/95
  6449.    *
  6450.         o Lot's of new stuff from MFC PDC
  6451.         o Lot's of cserve and usenet FAQs too
  6452.         o redid VC++ section
  6453.         o Lots of good book reviews coming out.
  6454.         o Grabbed some stuff from new MS FAQ too.
  6455.    * 1.2 7/30/95
  6456.    *
  6457.         o Updated from 1.1
  6458.         o Lots of book reviews got emailed and added.
  6459.         o Windows common controls section added.
  6460.         o 11.x - probably needs new hierarchy soon.
  6461.         o Introducing "Instant-FAQ (TM)"
  6462.         o Added article section to complement book section.
  6463.         o Updated VC++ 2.2 information.
  6464.    * 1.3 8/30/95
  6465.    *
  6466.         o Updated from 1.2
  6467.         o Distribution for 1.2:
  6468.         o Instant-FAQ: 241
  6469.         o Web hits for Aug: 2966
  6470.         o ftp: ???
  6471.         o CIS: 684
  6472.         o Total circ: 3500-4000
  6473.    * 4.0 1/15/96
  6474.    *
  6475.         o Updated from 1.3
  6476.         o Converted over to Word format - using Word Internet Assist for
  6477.           html output.
  6478.         o Instant-FAQ: 700
  6479.         o Web hits: 5000/month+
  6480.         o Total circ: 10,000+
  6481.         o Coming soon: MSDN and 'Mastering VC++ CDROM" appearances of the
  6482.           MFC FAQ.
  6483.    * 5.0 - 5/15/97
  6484.  
  6485.      It's been over a year, I freshened up major sections most heavily in
  6486.      2/3.
  6487.  
  6488.         o Added some cool stuff from .B ekiM.
  6489.         o Added many cool FAQs that were emailed or posted over the last
  6490.           couple of months.
  6491.         o Turning this beast over to Justin Rudd - the new MFC stud-puppy.
  6492.         o Instant-FAQ - 4000 (yikes!)
  6493.         o Ciao!
  6494.  
  6495.  
  6496.  
  6497.      ----------------------------------------------------------------------
  6498.  
  6499.                              Looking for a job?
  6500.  
  6501. Stingray now has a ton of job openings and if you are at the top of the
  6502. MFC/ActiveX food chain - we need you!
  6503.  
  6504.  
  6505.  
  6506.                                   THE END
  6507.