友情提示:如果本网页打开太慢或显示不完整,请尝试鼠标右键“刷新”本网页!
富士康小说网 返回本书目录 加入书签 我的书架 我的书签 TXT全本下载 『收藏到我的浏览器』

深入浅出MFC第2版(PDF格式)-第121部分

快捷操作: 按键盘上方向键 ← 或 → 可快速上下翻页 按键盘上的 Enter 键可回到本书目录页 按键盘上方向键 ↑ 可回到本页顶部! 如果本书没有阅读完,想下次继续接着阅读,可使用上方 "收藏到我的浏览器" 功能 和 "加入书签" 功能!





                        CALCDRIV           Automation client。 



                        CATALOG            Illustration of direct calls to ODBC functions in general; and the ODBC 

                                           functions SQLTables and SQLColumns in particular。 



                        CATALOG2           Illustration of direct calls to ODBC functions in general using Windows 

                                           mon Controls。 



                        CHATSRVR           Discussion server application for CHATTER。 



                        CHATTER            Client application that uses Windows Sockets。 



                        CHKBOOK            Record…based (nonserialized) document。 



                        CIRC               Tutorial sample that teaches you how to create a simple ActiveX control 

                                           called Circle。 



                        CMNCTRLS           Demonstrates how to create and change the styles of 7 of the Windows 

                                           mon Controls。 



                        COLLECT            MFC C++ template…based collection classes; and standard prebuilt collection 

                                           classes。 



                        CONTAINER          Tutorial example illustrating ActiveX Visual Editing container features in 

                                           Visual C++ Tutorials。 



                        COUNTER            Using an ISAPI DLL to send image data (rather than HTML data) back to a 

                                           Web browser。 



                        CTRLBARS           Custom toolbar and status bar; dialog bar; and floating palette。 



916 


…………………………………………………………Page 979……………………………………………………………

                                                          附錄C    Visual C++ 5。0 範例程式樱А�



程式名稱              說明 



CTRLTEST          Owner…draw list box and menu; custom control; bitmap button; spin control。 



CUBE              OpenGL application using MFC device contexts along with OpenGL's 

                  resource contexts。 



DAOCTL            DAO database class functionality and ActiveX controls let you examine a 

                  database。 



DAOENROL          Based on ENROLL; but migrated to the DAO database classes。 Also serves as 

                  Step 4 of the DaoEnrol tutorial。 



DAOTABLE          Creates a Microsoft Access database (。MDB file) and its tables; fields; 

                  queries; and indexes using MFC DAO database classes。 



DAOVIEW           DAO database classes and Windows mon Controls let you view the 

                  schema of a database。 



DBFETCH           Demonstrates the use of bulk row fetching in the ODBC database classes。 



DIBLOOK           Device…independent bitmap and color palette。 



DLGCBR32          Adding a toolbar and a status bar to a dialog…based application。 



DLGTEMPL          Shows how to create dialog templates dynamically。 



DLLHUSK           Sharing the DLL version of the Foundation class library with an application 

                  and custom DLL。 



DLLTRACE          Statically linking the MFC library to a custom DLL。 



DOCKTOOL          Dragging and floating toolbars that are 〃dockable〃。 



DRAWCLI           Full…featured object…oriented drawing application that is also an ActiveX 

                  Visual Editing container。 



DRAWPIC           Getting a Windows handle to a bitmap or icon from an LPPICTUREDISP。 



DYNABIND          Dynamic binding of database columns to a recordset。 



DYNAMENU          Dynamically modifying list of items in menus; handling mands not 

                  known at pile time; and updating the status bar mand prompt for such 

                  mands。 



ENROLL            Tutorial example illustrating database features in Visual C++ Tutorials。 



                                                                                                         917 


…………………………………………………………Page 980……………………………………………………………

                        第五篇    附錄  



                        程式名稱               說明 



                        EXTBIND            Shows how to bind data…aware controls across a dialog box boundary。 



                        FIRE               Dialog…based application that demonstrates five Windows mon Controls。 



                        FTPTREE            Displays the contents of an FTP site in a tree control。 



                        GUIDGEN            A dialog…based MFC application used to generate globally unique identifiers; 

                                           or GUIDs; which identify OLE classes; objects; and interfaces。 



                        HELLO              Simple application with frame window but no document or view。 



                        HELLOAPP           Minimal 〃Hello World〃 application。 



                        HIERSVR            ActiveX Visual Editing server application with drag and drop。 



                        HTTPSVR            Uses MFC Windows Socket classes to implement an Internet HTTP server。 



                        IMAGE              Demonstrates an ActiveX control that is capable of downloading data 

                                           asynchronously。 



                        INPROC             An in…process Automation server that can be loaded as a DLL in the client's 

                                           address space。 



                        IPDRIVE            A simple Automation client application that drives the INPROC sample 

                                           application。 



                        MAKEHM             mand line utility for associating resources with Help contexts。 



                        MDI                MDI application that does not use documents and views。 



                        MDIBIND            Demonstrates data binding in CWnd…derived windows; but only at run time。 



                        MDIDOCVW           New version of the MDI sample that uses the document/view architecture。 



                        MFCCALC            An Automation server that implements a simple calculator。 



                        MFCUCASE           Demonstrates MFC support for Internet Server filter DLLs。 



                        MODELESS           Demonstrates the use of an MFC CDialog object as a modeless dialog。 



                        MTGDI              Multithread illustration; where GDI resources are converted to MFC objects 

                                           and back。 



                        MTMDI              Multithread illustration; where user…interface events are processed in a 

                                           separate user…interface thread。 



918 


…………………………………………………………Page 981……………………………………………………………

                                                         附錄C    Visual C++ 5。0 範例程式樱А�



程式名稱              說明 



MTRECALC          Multithread illustration; where recalculations are done in a worker thread。 



MULTIPAD          Simple MDI text editor using the CEditView class。 



MUTEXES           Demonstrates the use of the Cmutex class for multithreading。 



NPP               Editor demonstrating toolbars; status bars; and other controls。 



OCLIENT           ActiveX Visual Editing container application; with drag and drop。 



ODBCINFO          Shows how to determine various ODBC driver capabilities at run time。 



OLEVIEW           Implementing an OLE object browser through custom OLE interfaces。 



PROPDLG           Property sheets (dialogs)。 



ROWLIST           Illustrates full row selection in a list…view mon control。 



SAVER             Screen saver written with MFC。 



SCRIBBLE          Main tutorial example in Visual C++ Tutorials。 



SMILEY            Modifying properties; calling methods; and handling events from the SMILE 

                  control in the SMILEY container。 



SNAPVW            Shows how to use property pages in a MDI child frame window。 



SPEAKN            Multimedia sound using user…defined resources。 



STDREG            Tool for populating the Student Registration database (used by the Enroll 

                  database tutorial) in any format supported by an ODBC driver。 Illustrates 

                  SQL table creation。 



SUPERPAD          ActiveX Visual Editing server that edits text using CEditView。 



TEAR              MFC console application that uses the WININET。DLL。 



TEMPLDEF          mand line tool that expands source files similar to C++ templates。 



TESTHELP          An ActiveX control that has its own help file and tooltips。 



TRACER            Tool that sets the Foundation class application trace flags kept in AFX。INI。 



TRACKER           Illustration of the various CRectTracker styles and options。 



                                                                                                        919 


…………………………………………………………Page 982……………………………………………………………

                       第五篇    附錄  



                       程式名稱             說明 



                       VCTERM           Simple terminal emulation program illustrating the use of the 

                                        MSM32。OCX ActiveX control。 



                       VIEWEX           Multiple views; scroll view; splitter windows。 



                       WORDPAD          Uses MFC's support for rich edit controls to create a basic word processor。 



                       WWWQUOTE         Retrieves information from a database and provides it to the user via an HTTP 

                                        connection to the server。 



920 


…………………………………………………………Page 983……………………………………………………………

                                              附錄D    以MFC 重建DBWIN  



    附錄D 



               以MFC 重建 DBWIN 



     洠в小 BWIN  ,TRACE  唱什麼獨角戲?Visual C++  的  TRACE  字串輸出必須在整合環境的除錯視 



     窗看到。這太過份了。我們只不過想在射擊撸穲鐾嫱妫④泤s要我們扛尊  155  加農砲。 



                                      侯俊傑 

                                             /  1997。01 發表於Run!PC 雜誌 



     我自己常喜歡在程式加個  printf  ,觀察程式的流程或變數的內容。簡簡單單,不必驚動除 



     錯器之類的大傢伙。 



printf  AfxMessageBox           TRACE 

      、                     與 



     printf     C                       text mode     Windows  

         是  語言的標準函式,但只能在文字模式(                 )執行。         圖形介 



     面差可比擬的是  AfxMessageBox  ,可以輕輕鬆鬆在對話盒列印出你的字串。然而 



     AfxMessageBox                                  OK 

               有個缺點:它會打斷程式的行進,非得使用者按【  】按鈕不可。再 



     者,如果  AfxMessageBox  對話盒畫面侵佔了原程式的視窗畫面,旦對話盒結束,系統 



                           WM PAINT               OnDraw 

                              _          View            

     會對程式視窗發出原本不必要的                ,於是      類別的         會被呼叫。如 



     果你的  AfxMessageBox  正是放在  OnDraw  函式,這惡性循環可有得瞧了。 



     TRACE  洠в羞@種缺點,它的輸出集到個特定視窗,它不會打斷你測試程式的雅 



                                                                      921 


…………………………………………………………Page 984……………………………………………………………

               第五篇    附錄  



                                                         OK 

               興,不會在你全神貫注思考程式邏輯時還要你分神來按【  】鈕。更重要的是,它不會 



               干擾到程式的視窗畫面。 



               Visual C++ 1。5  時代,TRACE  的字串輸出是送到個名為  DBWIN  的視窗。你可以 



                                      TRACE                            Visual C++ 

               邊執行程式,邊即時觀察其               輸出。許多早已發現件不幸的事實: 



               4。x  之洠в小 BWIN  ,生活的步眨虼藖y了,寫程式的生命有些狼狽不堪。 



                     DBWIN TRACE           Visual C++    TRACE  

               洠в小       。     〕颤N獨角戲?             的       字串輸出必須在整合環境 



               的除錯視窗看到。TRACE  巨集只在除錯模式的程式碼才能生效,而  Visual C++  竟 



               還要求程式必須在整合環境的除錯器內執行,內含的  TRACE  巨集才有效。這太過份了。 



               我只不過想在撸穲鐾纥c射擊撸颍麄儏s要我扛尊  155  加農砲來。不少朋友都對這 



               種情況相當不滿。 



          Paul DiLascia 



               Microsoft Systems Journal MSJ               TRACE  

                                  (  )的兩篇文章,彌補了                的這點小小遺憾: 



               第篇文章出現在  MSJ  1995。10  的  C/C++  專欄,第篇文章出現在  MSJ  1996。01  的 



               C/C++  專欄。兩篇都出自  Paul DiLascia  之手,這位先生在  C++ / MFC  享有盛名,著有 



                Windows++  書。 



               Paul  DiLascia  發明了種方法,讓你的  TRACE  巨集輸出到個視窗(他把它命名為 



               Tracewin  視窗),這個視窗就像  Visual C++ 1。5  的  DBWIN  樣,可以收集來自八方的 



               TRACE  字串,可以把內容清除,或存檔,或做其他任何文字編輯的處理。你的程式只 



               要是除錯模式就行。至於除錯器,把它丟開,至少在這個時刻。 



               我將在這篇文章敘述  Paul DiLascia  的構想和作法,並引用部份程式碼。完整程式碼可 



                     MSJ    ftp site ftp。microsoft。    MSDN  Microsoft Developer's 

               以從       的     (            )免費載,也可以從          ( 



               Network )光碟片獲得。 



               此法富有巧思,可以豐富我們的  MFC  技術經驗。所有榮耀都屬於作者  Paul DiLascia 。 



922 


…………………………………………………………Page 985……………………………………………………………

                                               附錄D    以MFC 重建DBWIN  



     我呢,我只是向大家推耍K介紹這兩篇文章、這個、這個好工具,並且儘量豐富稍嫌 



     簡陋的兩篇原文。當文章使用第稱來描述  Tracewin  的程式設計理念時,那個「我」 



     代表的是  Paul DiLascia  而不是侯俊傑。 



擒偾芡酢�



     要把  TRACE  的輸出字串導向,得先明白  TRACE  巨集到底是怎麼回事。TRACE  事實 



          Win32 API  OutputDebugString                hooking Win32 API 

     呼叫了          函式              。好,可能你會想到以類似 



     的作法,把  OutputDebugString  函式導到你的某個函式來,再予取予求。這種方法在 



     Windows  NT             Windows  NT    copy…on…write  裕А�

               不能湊效,因為               的           分頁機制( )使得我 



               OutputDebugString                 OutputDebugString  

     旦修改了                 ,我就擁有了份屬於自己的                     副本。 



     我可以高高興興盡情使用這副本(渾然不覺),但其他程式呼叫的卻仍然是那未�
返回目录 上一页 下一页 回到顶部 9 10
快捷操作: 按键盘上方向键 ← 或 → 可快速上下翻页 按键盘上的 Enter 键可回到本书目录页 按键盘上方向键 ↑ 可回到本页顶部!
温馨提示: 温看小说的同时发表评论,说出自己的看法和其它小伙伴们分享也不错哦!发表书评还可以获得积分和经验奖励,认真写原创书评 被采纳为精评可以获得大量金币、积分和经验奖励哦!