1 / 20

Chapter 7

Chapter 7. The Modeless Dialog and Windows Common Dialogs. Modeless Dialogs.

afia
Télécharger la présentation

Chapter 7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 7 The Modeless Dialog and Windows Common Dialogs

  2. Modeless Dialogs • In the Microsoft Foundation Class (MFC) Library version 6.0, modal and modeless dialogs share the same base class, CDialog, and they both use a dialog resource that you can build with the dialog editor. If you're using a modeless dialog with a view, you'll need to know some specialized programming techniques.

  3. Creating Modeless Dialogs • For Modal Dialogs • Use CDialog Constructor • Call DoModal Auto Destroy on Return • For Modeless Dialogs • Use CDialog Constructor • Call CDialog::Create Function • You Must track the ID, Messages etc. • You must provide for the Destructor call

  4. User-Defined Messages • The Dialog must send the message to the application • Two Options • CWnd::SendMessage • Immediate call to Message Handler • PostMessage • Delayed call to Message Handler it uses the Windows Message Queue

  5. Dialog Ownership • Being a Pop-Up style window, Windows thinks the MainFrame is the owner • You must provide pointer to provide the message path back to the view class

  6. Example 7c • A simple Dialog with one edit control and, OK and Cancel buttons

  7. Windows Common Dialogs • CColorDialog • CFileDialog • CFindReplaceDialog • CPageSetupDialog • CFontDialog • CPrintDialog • CPrintDialog

  8. CFileDialog Example • Using CFileDialog Directly CFileDialog dlg(TRUE, "bmp", "*.bmp"); if (dlg.DoModal() == IDOK) { CFile file; VERIFY(file.Open(dlg.GetPathName(), CFile::modeRead)); }

  9. CFileDialog • Nested Dialogs • Yes you can Nest the Dialogs • Create a dialog with a hole in it. • Example 7b File Delete

  10. Chapter 8 Common Controls • Other controls included in a DLL named COMCTL32.DLL • Example 8a

  11. Common Controls • Example 8b

  12. Quick look at 9 and 10 • Active X • Small controls • Child windows • IE 4 Common Controls • IP Address • Extended Combo Box • May need to include COMCTL32.DLL to dist. Your apps

  13. Memory Managment Chapter 10

  14. Processes • 4 Gig Memory Space • Top 1/2 is shared in win 95 • Bottom 1/2 stacks, heaps global var, exe, and DLL

  15. Virtual Memory • 4K units (page) • Code or data • Swapped if not used • CR3 Register used to switch processes using Dir Page

  16. Functions for memory • VirtualAlloc • Dynamic memory usage • May not be used by most Apps • Most use the C Run Time or Windows Heap • Reserved • Committed

  17. Memory Functions cont. • GlobalAlloc win16 • Fixed • Moveable • C++ new delete • Supplied by CRT • Reserved in 4M Regions • Committed in 64K Blocks (16 pages)

  18. More • Memory Mapped Files (DIB) • _heapmin used if program runs and runs and runs • Use of const • Var Data • Const Data • Program space (like ROM)

More Related