Welcome to PixieLib.NET!

C++ Class Library for MFC — Copyright 2005 Paul DiLascia

Thank you for your support!

PLEASE READ CAREFULLY!

THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

LICENSE AGREEMENT: You may compile PixieLib.NET into applications that you distribute to others provided that you include the following text along with your own Copyright notice in every source file that uses PixieLib: "Portions of this program borrowed from PixieLib.NET, Copyright 2005 Paul DiLascia." You may not remove the Copyright message or credits in the PixieLib source files.

You may NOT distribute the PixieLib.NET source code in whole or part to others. You may NOT include PixieLib source code as part of an open-source project or place it under GPL (General Public License) or public domain! For example, you may NOT publish a CD of "101 Programming Gems" that includes portions of PixieLib as one of the gems. This restriction is inherited from Microsoft.

Portions of PixieLib.NET were first published in Microsoft Systems Journal and MSDN Magazine.

In this document:

This document provides capsule descriptions automatically generated from the source code. The best documentation is the source code itself!

Installation
Requirements
Building PixieLib
Building the Sample Programs
Building Your Own Programs
Additional Build Notes
Release History
Classes
CAppProcessList, CCaptionPainter, CCoolBar, CCoolMenuManager, CCoolMenuWindow, CDlgTemplateBuilder, CDragDropData, CDragDropMgr, CDragDropText, CFileTrace, CFindWinList, CFixMFCToolBar, CFlatToolBar, CFolderButton, CFolderFrame, CFolderTab, CFolderTabCtrl, CFolderView, CFontUI, CHourglass, CHtmlCtrl, CHyperlink, CInterfaceNames, CInternetHandle, CListBoxTipHandler, CLoadLibrary, CLockBars, CLockData, CMDIMenuMgr, CMainWinList, CMenuBar, CMenuBarFrameHook, CMenuItemInfo, CMenuTipManager, CModuleVersion, CNonClientMetrics, CPLCommandLineInfo, CPalMsgHandler, CPicture, CPictureCtrl, CPixieDebug, CPopupText, CProcessList, CProcessModuleList, CRebarBandInfo, CRebarInfo, CRegex, CRegexForm, CRgxFieldNotFoundException, CSTAThread, CSizeableDlg, CSizerBar, CSplash, CSplashWnd, CStaticLink, CStringDialog, CSubclassWnd, CSysCmdRouter, CTraceFn, CTrayIcon, CWebVersion, CWinGroupIterator, CWinList, CWinMgr, CWinRect, CWindowPlacement, DBGINTERFACENAME, DRAGDROPINFO, DRAGDROPWND, GCursor, GKeyboard, GMouse, HTMLCMDMAP, NMFOLDERTAB, NMWINMGR, PAINTCAP, RGXFIELD, SIZEINFO, WINRECT
Functions
Sample Programs
CoolEdit, DragList, ImgView4, MultiWin, MySplash, RegexTest, TraceWin, TrayTest
Debugging Tools
Index
Classes
Functions
Sample Apps

Happy Programming!
Paul DiLascia
January 2005


Installation

Requirements

Building PixieLib

PixieLib does not come with pre-built libraries. You have to build them yourself!

Building the Sample Programs

I encourage you to build the sample programs to see what they do. Each program shows how to use one or several classes and features of PixieLib.NET. To build the sample programs, first build the libraries as above, then:

(A) From a command prompt: cd to the PixieLib directory and type

MakeSamp

(B) From Visual Studio.NET: Open the solution file for the sample you want to build and build it.

MakeSamp is easier, it builds all the samples with one command. Note, you can specify dbg (debug), rel (release) or all (both) as the target. For example:

MakeSamp rel

to make a Release build for all the samples. The default is dbg (Debug build).

Building Your Own Programs

To build your own programs that use PixieLib, you need to do the following:

Additional Build Notes:

Classes

 

CAppProcessList

Application process list—gets all processes associated with a given module. For example:

   CAppProcessList apl("Outlook");
   apl.Fill();
   for (CAppModuleList::iterator it=apl.begin(); it!=apl.end(); it++) {
      DWORD pid = *it;
      CAppProcessList::KillProcess(pid);     // kill process
   }

This will find and kill processes whose main module name is "Outlook" or "Outlook.exe". KillProcess tries to kill the process gracefully, by sending WM_QUERYENDSESSION and WM_CLOSE to all its main windows.

Implemented in PLProcess.h, Process.cpp.

 

CCaptionPainter

Generic caption painter. Handles WM_NCPAINT, WM_NCACTIVATE, etc. to draw custom captions. To use:

  • Call Install from your frame's OnCreate function. You must specify a callback message to send when it's time to paint.
   // Install caption painter
   m_captionPainter.Install(this, WM_PAINTMYCAPTION);
  • Handle the callback message: Respond by painting your caption.
  nMsg   = your callback message specified in Install;
  wParam = whether caption is active (TRUE) or not (FALSE);
  lParam = ptr to PAINTCAP struct above, or NULL if Windows sent
           WM_SETTINGSCHANGE: you should update your colors, fonts, etc.
  • The PAINTCAP struct contains a memory DC the size of the caption bar. CCaptionPainter maintains a bitmap for the caption to do flicker-free drawing. All you have to do is paint into the supplied DC when you get the callback message.
  • In your handler, you MUST call DrawIcon and DrawButtons to draw the caption icon and buttons, or else they will not appear. If you are drawing custom caption buttons as well, you must handle WM_NCLBUTTONDOWN & co. yourself. CCaptionPainter does not handle the mouse for custom caption buttons. DrawIcon/DrawButtons both return the width of the area painted.

Implemented in PLDraw.h, PaintCap.cpp.

Used in sample program: CoolEdit

 

CCoolBar

CCoolBar wraps the IE common coolbar (also called rebar). To use it:

  • Derive your own CMyCoolBar from CCoolBar.
  • Implement OnCreateBands to create whatever bands you want. If you're using coolbars, your toolbars and menubars are children of the coolbar, so you should instantiate/create these control bars in CCoolBar/OnCreateBands instead of CMainFrame/OnCreate.
   // in CMyCoolBar::OnCreateBands
   VERIFY(m_wndMenuBar.CreateEx(...);     // create menu bar
   InsertBand(&m_wndMenuBar, ...);        // add to coolbar
   m_wndToolBar.CreateEx(...);            // create toolbar
   VERIFY(m_wndToolBar.LoadToolBar(IDR_TOOLBAR1)); // load it
   InsertBand(&m_wndToolBar, ...);        // add to coolbar
  • Instantiate and create CMyCoolBar in your main frame as you would a toolbar.
   // in CMainFrame::OnCreate
   m_wndCoolBar.Create(...);
   m_wndCoolBar.SetColors(...);
   m_wndCoolBar.SetBackgroundBitmap(...);

See CoolEdit for example of how to use.

Implemented in PLCoolUI.h, CoolBar.cpp.

Used in sample program: CoolEdit

 

CCoolMenuManager

CCoolMenuManager implements "cool" menus (menus with toolbar buttons in them). CCoolMenuManager also automatically finds accelerators and appends them to your menus; eg "Open" ==> "Open\tCtrl+O". To use:

  • Instantiate in your CMainFrame, then call Install and LoadToolbar from your OnCreate handler. For example:
   // in CMainFrame::OnCreate
   m_menuManager.Install(this);
   m_menuManager.LoadToolbar(IDR_TOOLBAR1);

CCoolMenuManager converts your menus to owner-draw menus. For each toolbar that you load, if CCoolMenuManager finds a button for a particular command, it draws the same bitmap in that command's menu item wherever it appears in menus, including context menus.

If you want to use the same menu manager in child windows like views and MDI children that also have menus (including context menus), use CCoolMenuWindow in your child window class instead of instantiating a whole new CCoolMenuManager. See the MDI version of CoolEdit for an example of this. CoolEdit uses a single CCoolMenuManager in the main frame, and each child view has its own CCoolMenuWindow.

Implemented in PLCoolUI.h, CoolMenu.cpp.

Used in sample programs: MultiWin, MySplash, CoolEdit, RegexTest, ImgView4

 

CCoolMenuWindow

Companion class to CCoolMenuManager adds cool menu support for child windows too. Add one of these for each child window class that has its own menus, including context menus. Call Install to hook up. See CoolEdit/view.cpp.

Implemented in PLCoolUI.h, CoolMenu.cpp.

Used in sample program: CoolEdit

 

CDlgTemplateBuilder (internal)

Helper class to build a dialog template in memory. Only supports what's needed for CStringDialog.

Implemented in PLCoolUI.h, StringDlg.cpp.

 

CDragDropData

Abstract drag/drop data knows how to draw itself. Used with CDragDropMgr. Override for specific data types like text or image. PixieLib already has CDragDropText for text.

Implemented in PLDragDrop.h. Used internally in DragDrop.cpp.

 

CDragDropMgr

Intra-app drag-drop manager. To use it, instantiate in your main window or dialog, create a drag-drop map and call Install from your OnCreate or OnInitDialog handler:

   // table describing which child windows are sources and targets
   // in OnInitDialog or OnCreate
   BEGIN_DRAGDROP_MAP(MyDragDropWindows)
      DRAGDROP_WINDOW(IDC_LIST1, DDW_SOURCE)
      DRAGDROP_WINDOW(IDC_LIST2, DDW_SOURCE|DDW_TARGET)
      DRAGDROP_WINDOW(IDC_EDIT1, DDW_TARGET)
   END_DRAGDROP_MAP()
   m_ddm.Install(this, MyDragDropWindows, WM_MYDRAGDROP);

The table says which windows are sources (DDW_SOURCE) and which targets (DDW_TARGET). A window can be both.

You must also override your main window's PreTranslateMessage to call CDragDropMgr::PreTranslateMessage:

   BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
   {
      return m_ddm.PreTranslateMessage(pMsg) ? TRUE :
         CDialog::PreTranslateMessage(pMsg);
   }

When you install the drag/drop manager, you give it a callback message (WM_MYDRAGDROP). CDragDropMgr sends this message when stuff happens, with:

   WPARAM = notification code (DD_ENTER, DD_DRAG, DD_DROP, DD_ABORT)
   LPARAM = pointer to a DRAGDROPINFO struct.

Typically you should handle these notifications like so:

   DD_ENTER:   set DRAGDROPINFO::data to a new CDragDropData object.
   DD_DRAG:    scroll if necessary
   DD_DROP:    do something with the contents of CDragDropData.
   DD_ABORT:   cleanup if necessary

See the DDTest sample for details. PixieLib has a CDragDropText for text data. If you want to drag other kinds of data—for example, and image, you'll have to derive from CDragDropData and override the pure virtual functions.

Implemented in PLDragDrop.h, DragDrop.cpp.

Used in sample program: DragList

 

CDragDropText

Concrete class for drag-drop text data. Virtual functions calculate the size, draw the text and get the data (string).

Implemented in PLDragDrop.h, DragDrop.cpp.

Used in sample program: DragList

 

CFileTrace (internal)

CFileTrace is a CFile that "writes" to the trace window. TraceWin.h creates a singleton instance of this class and installs it in MFC as afxDump.m_pFile to route TRACE diagnostics to the TraceWin.exe applet, if it's running. You shouldn't need to use this class; all you have to do is #include <TraceWin.h> somewhere in your app, usually in your main application module.

Implemented in TraceWin.h.

 

CFindWinList

CFindWinList finds all windows with a given class name at top level or as a descendant of a given window. To use it, instantiate like so:

   CFindWinList fwl(hwndParent, classname);
   fwl.Fill();

CFindWinList is now an array of HWNDs with the desired classname. Use hwndParent=NULL to search top-level windows only; otherwise CFindWinList does a deep search. Iterate using STL as for CWinList.

Implemented in PixieLib.h, WinList.cpp. Used internally in HtmlCtrl.cpp.

 

CFixMFCToolBar (internal)

This internal class fixes sizing bugs in older versions of MFC that calculate the size of toolbars incorrectly for modern toobars (comctl32 version >= 4.71). It also has several useful wrappers for functions that CToolBar doesn't have (so you don't have to use GetToolBarCtrl), like GetButton. Generally, you should never use this class directly — use CFlatToolBar instead.

Implemented in PLCoolUI.h, FixTB.cpp.

 

CFlatToolBar

CFlatToolbar is a drop-in replacement for CToolBar that supports flat-style buttons with gripper handles. Use instead of CToolBar in your CMainFrame. CFlatTooBars don't actually require the flat style, but they have it by default. If you don't want the flat look, call

   m_wndToolBar.ModifyStyle(TBSTYLE_FLAT, 0);

CFlatToolBar overcomes various MFC drawing bugs that cause it not to work with flat-style buttons. CFlatToolBar Can also be used inside a coolbar (unlike CToolBar). CFlatToolBar has other good stuff too, like an easy way to handle drop-down toolbar buttons. See the CoolEdit sample app for details.

Implemented in PLCoolUI.h, FlatBar.cpp. Used internally in MenuBar.cpp.

Used in sample programs: MultiWin, MySplash, CoolEdit, RegexTest, ImgView4

 

CFolderButton (internal)

Class to implement next/prev folder buttons to navigate tabs when they don't all fit in the tab window. You shouldn't have to use this class yourself, it's used internally by the folder tab control.

Implemented in PLFolderTab.h, Ftab.cpp.

 

CFolderFrame

CFolderFrame manages the combined folder tab control, view and scroll bars. The main frame contains this window as a child/client, and it holds the view, tab control and scroll bars. To use, create an instance in your main frame, then override OnCreateClient like so:

   BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT, CCreateContext* pcc)
   {
      return m_wndFolderFrame.Create(this,
         RUNTIME_CLASS(CMyView), pcc, IDR_FOLDERTABS);
   }

You must derive your view from CFolderView. IDR_FOLDERTABS is the resource ID of a string with the names of the folder tabs separated by newlines. For example:

   STRINGTABLE PRELOAD DISCARDABLE 
   BEGIN
      IDR_FOLDERTABS "Tab 1\nTab 2\nTab 3"
   END

This creates three folder tabs: Tab 1, Tab 2 and Tab 3.

Finally, you must override CFolderView::OnChangedFolder in your view. PixieLib calls this function when the user selects a different tab.

   void CMyView::OnChangedFolder(int iPage)
   {
      m_iPage = iPage;        // 0-based index of tab selected.
      UpdateScrollSizes();    // scroll sizes potentially different for this page
      Invalidate();           // repaint
   }

Your OnDraw function should draw the contents of the view based on which tab (m_iPage) is selected. Note that each "folder" uses the same window—in the example, there's only one view window, not three.

   void CMyView::OnDraw(CDC* pDC)
   {
      if (m_iPage==PAGE1) {
         // draw it
   } else if (m_iPage==PAGE2) {
         // draw it
   } else {
         // etc
   }

Implemented in PLFolderTab.h, FolderFrame.cpp.

Used in sample program: ImgView4

 

CFolderTab (internal)

Private (internal) class to represent one folder tab. This class draws the trapezoidal tab. Used in CFolderTabCtrl. Generally you shouldn't have to create this class, only use it by calling GetText or SetText to get/set the tab name.

Implemented in PLFolderTab.h, Ftab.cpp. Used internally in FolderFrame.cpp.

 

CFolderTabCtrl

Folder tab control, similar to the Windows common tab control, but draws upside-down Excel-style "folder" tabs. Use this if you want to create a folder tab control as a child window in a view or other compound window. Incorporates next/prev folder buttons used when the tabs don't all fit within the window.

You don't need to use this class if you use CFolderFrame/CFolderView. CFolderFrame has its own CFolderTabCtrl.

Implemented in PLFolderTab.h, Ftab.cpp. Used internally in FolderFrame.cpp.

Used in sample program: ImgView4

 

CFolderView

CScrollView-based folder view. Derive your view from this. Override OnChangedTab to process event when the user selects a new tab. Typically, you'll save the tab index somewhere. Your view's OnDraw method can then use this value to draw the appropriate view. See CFolderFrame.

Implemented in PLFolderTab.h, FolderFrame.cpp.

Used in sample program: ImgView4

 

CFontUI

CFontUI manages the user interface to changing a font. Handy for Edit | Font... command and Font Bigger/Font Smaller buttons. For example, to run the Windows common font dialog:

   CFontUI fui;
   if (fui.ChangeFont(m_font,CFontUI::OP_DLG,this,/* flags */) {
      // now m_font holds the new font
   }

The same function can be used to increase or decrease the a font size one step:

   CFontUI fui;
   fui.ChangeFont(m_font,CFontUI::OP_BIGGER);

See the source code for the bigger/smaller algorithm used.

CFontUI also has handy functions to get/set the font point size (automatic conversion to logical pixels), and to save/restore a font in the user's profile (INI file or registry).

Implemented in PLCoolUI.h, FontUI.cpp.

Used in sample programs: TraceWin, ImgView4

 

CHourglass

Implements a wait cursor (hourglass). The constructor changes the cursor to an hourglass and captures the mouse; the destructor restores it when the function/scope ends. Just instantiate it at the top of any function or code block that does something lengthy. For example:

   SomeTimeConsumingFn(...)
   {
      CHourglass(pMyWnd);  // optional window to capture mouse
      .
      .
      .
   }

Implemented in PixieLib.h.

Used in sample program: ImgView4

 

CHtmlCtrl

CHtmlCtrl makes CHtmlView usable as a child window without doc/frame. Use it to display HTML in any child window—for example, inside a dialog. Call CreateFromStatic to create a CHtmlCtrl control in the same location as a static control in your dialog. For example:

   BOOL CAboutDialog::OnInitDialog()
   {
      VERIFY(CDialog::OnInitDialog());
      VERIFY(m_wndHtml.CreateFromStatic(IDC_HTMLVIEW, this));
      m_wndHtml.LoadFromResource(_T("about.htm"));
      m_wndHtml.SetCmdMap(MyHtmlCmds);
      return TRUE;
   }

Here IDC_HTMLVIEW is the control ID of a static text control and "about.htm" is an HTML resource embedded in the resource file like so:

      // in .rc file:
      ABOUT.HTM HTML DISCARDABLE "res\\about.htm"

If your HTML file has <IMG> tags, the images must also appear as HTML resources:

      // in .rc file:
      PD.JPG    HTML DISCARDABLE "res\\pd.jpg"
      OKUP.GIF  HTML DISCARDABLE "res\\okup.gif"

You can invoke commands from your HTML page by creating a command map and adding an A element with the special pseudo-protocol "app:". See the description for HTMLCMDMAP.

Implemented in PLCoolUI.h, HtmlCtrl.cpp.

Used in sample programs: MultiWin, RegexTest, ImgView4

 

CHyperlink

Simple text hyperlink derived from CString. Used in CStatlicLink, rarely by itself. But you could use it to launch an URL like so:

   CHyperlink link(_T("http://www.dilascia.com"));
   link.Navigate();

Implemented in PLStatLink.h.

 

CInterfaceNames (internal)

Private class used to manage tables of DBGINTERFACENAMEs. Don't use this class; use DEBUG_BEGIN/END_INTERFACE_NAMES. See DBGINTERFACENAME.

Implemented in PLDebug.h, Debug.cpp.

 

CInternetHandle

This handy class encapsulates an internet handle so you never have to remember to call CloseInternetHandle. More importantly, CInternetHandle lets you postpone the call to CloseInternetHandle until control leaves the scope of your function, so you can get error information when something bad happens before CloseInternetHandle clears the error code.

Implemented in PLInet.h. Used internally in WebVersion.cpp.

 

CListBoxTipHandler

Generic listbox tip handler to display tip for list box items too wide for list box. To use: instantiate one of these for each list box and call Init.

   // in your dialog's OnInitDialog
   m_lbTipHandler.Init(&m_wndListBox);

Implemented in PLCoolUI.h, ListBoxTip.cpp.

Used in sample program: DragList

 

CLoadLibrary

CLoadLibrary loads a DLL. Destructor frees for automatic cleanup.

Implemented in PLProcess.h. Used internally in Process.cpp.

 

CLockBars

Plug-in class to support locking toolbars. To use: instantiate one of these in your main frame and call Install.

   // in CMainFrame::OnCreate
   m_lock.Install(this);

Then call m_lock.SetLocked(TRUE/FALSE) to lock/unlock the toolbars. CLockBar finds all the control bars that have a docking context, and when the lock is ON, it traps mouse messages sent to the control bars to disallow moving them.

Implemented in PLCoolUI.h, LockBar.cpp.

Used in sample program: CoolEdit

 

CLockData

Handy class to lock a critical section. Constructor/destructor locks/unlocks the critical section. You can put this at the top of a function or code block to lock the data for the scope of the function/code block. For example:

   void CMyClass::MyMethod(...)
   {
      static CCriticalSection here;
      CLockData lock(here);
      // ...manipulate class data members safely
   }

Implemented in PixieLib.h. Used internally in Splash.cpp.

 

CMDIMenuMgr (internal)

CMDIMenuMgr manages the icon and min/restore/close buttons in the menu for a maximized MDI window. It's designed to work with CMenuBar. Used internally. You shouldn't need to use this class.

Implemented in PLCoolUI.h, MdiMenuMgr.cpp. Used internally in MenuBar.cpp.

 

CMainWinList

Get list of main windows for a process. To use:

   CMainWinList wl(pid);   // process ID
   wl.Fill();              // fill it

Now wl is an STL array of HWNDs for windows that belong to the given process.

Implemented in PixieLib.h, WinList.cpp. Used internally in Process.cpp.

 

CMenuBar

CMenuBar implements Office 97-style menu bars. A Menu bar is a menu that works like a toolbar: you can move it around, and you can move other toolbars next to it, to conserve space on the screen. Use it the way you would a CToolBar:

  • Instantiate and create the menu bar in your CMainFrame/OnCreate or CCoolBar/OnCreateBands.
   m_wndMenuBar.Create(this)
  • Call LoadMenu to load a menu. This will set your frame's menu to NULL. The menu bar replaces your normal window menu.
   m_wndMenuBar.LoadMenu(IDR_MAINFRAME);
   m_wndMenuBar.SetBarStyle(CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  • Override your frame's PreTranslateMessage function to call CMenuBar::TranslateFrameMessage. This is required to translate kbd mnemonics.
   BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
   {
      return m_wndMenuBar.TranslateFrameMessage(pMsg) ? TRUE :
         CFrameWnd::PreTranslateMessage(pMsg);
   }

A CMenuBar can be docked or floating, but it can't be docked vertically.

Implemented in PLCoolUI.h, MenuBar.cpp. Used internally in MdiMenuMgr.cpp.

Used in sample program: CoolEdit

 

CMenuBarFrameHook (internal)

CMenuBar uses this private class to intercept messages on behalf of its owning frame as well as the MDI client window. Conceptually, these should be two different hooks, but I want to reuse code.

Implemented in PLCoolUI.h, MenuBar.cpp.

 

CMenuItemInfo

Programmer-friendly MENUITEMINFO initializes itself.

Implemented in PLCoolUI.h. Used internally in CoolMenu.cpp.

 

CMenuTipManager

Implements menu tips for MFC main window. Menu tips are tooltips that appear next to the menu item when you hold the mouse over it. To use: instantiate in your CMainFrm, then call Install from your OnCreate handler.

   // in CMainFrame::OnCreate
   m_menuTipManager.Install(this);

You also have to implement prompt strings for each menu item ID the normal MFC way: as resource strings with the same command ID. If you're using MFC, you should already have done this.

Implemented in PLCoolUI.h, MenuTipper.cpp.

Used in sample programs: MultiWin, MySplash, TraceWin, CoolEdit, RegexTest, ImgView4

 

CModuleVersion

CModuleVersion provides easy access to read version info from module's resource file. For example, to get the VERSIONINFO in the current running module:

   CModuleVersion ver;
   if (ver.dwProductVersionMS>2) {
      CString s = ver.GetValue(_T("CompanyName"));
      ...
   }

You can also read the version info for another file like so:

   CModuleVersion ver("foo.exe");
   ...

You can also call the static fn DllGetVersion to get the DLLVERSIONINFO.

Implemented in PLProcess.h, Process.cpp. Used internally in FixTB.cpp.

Used in sample programs: TraceWin, CoolEdit

 

CNonClientMetrics

Get NONCLIENTMETRICS info: ctor calls SystemParametersInfo. Just instantiate and use.

   CNonClientMetrics ncm;
   // now ncm is filled with NONCLIENTMETRICs

Implemented in PixieLib.h. Used internally in MenuBar.cpp, CoolMenu.cpp, PupText.cpp.

Used in sample program: CoolEdit

 

CPLCommandLineInfo

Improved CCommandLineInfo parses arbitrary switches. Use instead of CCommandLineInfo:

   // E.g., in CMyApp::InitInstance
   CPLCommandLineInfo cmdinfo;
   ParseCommandLine(cmdinfo);

After parsing, you can call GetOption to get the value of any switch. Eg:

   if (cmdinfo.GetOption("nologo")) {
      // user invoked program with -nologo option
   }

To get the value of a string option, type

   CString filename;
   if (cmdinfo.GetOption("f", filename)) {
      // now filename is string following -f option
   }

Used in CSplash to automatically parse the -nologo option to suppress the splash screen.

Implemented in PLCoolUI.h, CmdLine.cpp. Used internally in Splash.cpp.

 

CPalMsgHandler

Generic palette message handler makes handling/realizing palettes easy. Handles WM_PALETTECHANGED, WM_QUERYNEWPALETTE, WM_SETFOCUS. Note that this class is more or less obsolete now since hardly anyone has monitors incapable of 16-bit color. To use:

  • Instantiate a CPalMsgHandler in your main frame and every CWnd class that needs to realize palettes (e.g., your view).
  • Call Install to install.
  • Call DoRealizePalette(TRUE) from your view's OnInitialUpdate fn.

Implemented in PLDraw.h, PalHook.cpp.

 

CPicture

Picture object wraps GDI+ Image class. Use it to display GIF, JPG, BMP, TIF and other kinds of images. To display the image, call Render with your device context (pDC). For example:

   CPicture pic;
   pic.Load("pixie.jpg");
   pic.Render(pDC);

If you want a window that displays an image, use CPictureCtrl. Make sure you don't forget to initialize GDI+ !

Implemented in PLDraw.h, Picture.cpp. Used internally in PictCtrl.cpp.

Used in sample program: ImgView4

 

CPictureCtrl

Implements a picture control based on CPicture. A picture control is a child window you can use in a frame, view, dialog or any other kind of window to display an image. CPictureCtrl is like a static bitmap, only it can display any of the image formats supported by CPicture/GDI+ such as JPG, GIF, TIF and so on.

Implemented in PLDraw.h, PictCtrl.cpp.

Used in sample programs: CoolEdit, ImgView4

 

CPixieDebug

Implemented in PLDebug.h, Debug.cpp.

 

CPopupText

Popup text window is similar to a tooltip but eaiser to use. Just instantiate and Create. For example:

   m_wndTip.Create(CPoint(0,0), pParent);    // create popup text
   m_wndTip.m_szMargins = CSize(4,0);        // set margins
   m_wndTip.SetWindowText("hello, world");   // set tip text
   m_wndTip.ShowDelayed(200);                // show in 200 milliseconds

To cancel (hide) the tip:

   m_wndTip.Cancel();

Used in CMenuTipManager to display menu tips. You can change m_font and/or m_color for different font/color (default=tooltip font/color), or override virtual DrawText function to do custom drawing.

Implemented in PLCoolUI.h, PupText.cpp. Used internally in MenuTipper.cpp, ListBoxTip.cpp, RegexForm.cpp.

 

CProcessList

Process list. Creates STL vector of process IDs. Use standard STL iterator to enumerate items in the array.

   CProcessList pl;
   pl.Fill();
   for (CProcessList::iterator it=pl.begin(); it!=pl.end(); it++) {
      DWORD pid = *it;
      // do something
   }

You can derive and override OnProcess to filter specific processes.

Implemented in PLProcess.h, Process.cpp.

Used in sample program: MultiWin

 

CProcessModuleList

Process module list. The first module is the main EXE that started the process. To use:

   CProcessModuleList pml(pid);
   pml.Fill();
   for (CProcessModuleList::iterator it=pml.begin(); it!=pml.end(); it++) {
      HANDLE  hProcess = pml.GetProcessHandle();
      HMODULE hMod = *it;
      // do something
   }

You can derive and override OnModule to filter specific modules.

Implemented in PLProcess.h, Process.cpp.

Used in sample program: MultiWin

 

CRebarBandInfo

Programmer-friendly REBARBANDINFO initializes itself.

Implemented in PLCoolUI.h. Used internally in CoolBar.cpp.

 

CRebarInfo

Programmer-friendly REBARINFO initializes itself.

Implemented in PLCoolUI.h.

 

CRegex

CRegex encapsulates CAtlRegExp<> to make ATL regular expressions a little more usable. CRegex hides CAtlRegExp and CAtlREMatchContext and also implements useful functions like Replace and Split. Assumes you are using default CAtlRECharTraits (ie, TCHARs). See the RegexTest sample program.

Implemented in PLRegex.h, Regex.cpp. Used internally in RegexForm.cpp.

Used in sample program: RegexTest

 

CRegexForm

Regex Form Manager. Provides DDX support and regex-based validation for MFC dialogs.

   -Validates dialog input using regular expressions.
   -Can display field hints
   -Can validate fields immediately (not recommended)
   -Can enforce legal characters in edit controls
   -Can do min/max validation using pseudo-regex expressions.

For example of how to use, see the form validation dialog in the RegexTest sample program.

Implemented in PLRegex.h, RegexForm.cpp.

Used in sample program: RegexTest

 

CRgxFieldNotFoundException

Exception thrown if field not found

Implemented in PLRegex.h.

 

CSTAThread

Use this class to force STA (single thread apartment model) threading in mixed-mode .NET apps so ShellExecute will work correctly launching an URL. Constructor calls CoInitialize(NULL) to force STA. To use, instantiate at top-level in your main application module or anywhere the constructor will run before the CLR.

   // in main module
   CSTAThread forceSTA;

Implemented in PLStatLink.h.

 

CSizeableDlg

Generic WinMgr-based sizeable dialog. To create a sizeable dialog, derive from this, create a window map using BEGIN/END_WINDOW_MAP, and pass it to your constructor. Otherwise (if you don't derive from CSizeableDlg), mimic OnInitDialog, OnSize, OnGetMinMaxInfo. See MultWin sample for details.

Implemented in PLWinMgr.h, SizeableDlg.cpp.

Used in sample program: MultiWin

 

CSizerBar

CSizerBar (a better splitter window) lets users adjust the size of two siblings. See MultiWin for example how to use.

Implemented in PLWinMgr.h, SizerBar.cpp.

Used in sample program: MultiWin

 

CSplash

CSplash implements a splash screen in a separate thread. To use it, write:

   static CSplash *MySplash = new CSplash(
      IDB_MYBITMAP,        // bitmap resource ID (can be JPG, GIF, etc.)
      duration,            // time to display, in msec
      flags,               // see below
      &MySplash);          // address of pointer (back pointer to self)

To kill the splash, you can call

   CSplash::Kill(pSplash);
  • —but this is usually unecessary. You don't have to call delete either, since CSplash deletes itself when the splash times out or you kill it. When it does, it sets your pointer to NULL so you won't try to call Kill on a bad pointer.

NOTE: the back pointer (MySplash) MUST be a static variable or class data member, not a local variable that can go out of scope, since CSplash will set it to NULL when the splash dies.

Implemented in PLCoolUI.h, Splash.cpp.

Used in sample program: MySplash

 

CSplashWnd (internal)

Private class to implement the actual splash window that CSplash creates. Don't use it unless you're doing some hairy stuff to override the splash window, like create animated effects, etc.

Implemented in PLCoolUI.h, Splash.cpp.

 

CStaticLink

CStaticLink implements a static control in a dialog that clicks to a web page, just like an <A> tag in HTML. If you want to let users click using the keyboard as well as mouse, don't forget to turn on WS_TABSTOP for the static control in your dialog. You can do this using dialog editor or by adding WS_TABSTOP in your .rc file. To use CStaticLink, add a member in your dialog class, and subclass it in your OnInitDialog handler.

   class CAboutDialog : public CDialog {
   protected:
      CStaticLink m_wndLink;
      virtual BOOL OnInitDialog() {
         m_wndLink.SubclassDlgItem(IDC_MYURL, this);
         return CDialog::OnInitDialog();
      }
   };

IDC_MYURL is the control ID of a static control (text or image) in your dialog, and CStaticLink looks for a string resource with the same ID to get the URL.

CStaticLink does all the things you'd expect: it draws the link text in the default link color (blue) and underlines it, it changes the cursor to a pointing finger when the user moves the mouse over the link, and so on. You can changed g_colorUnvisited and g_colorVisited to change the default colors.

Implemented in PLStatLink.h, StatLink.cpp. Used internally in PictCtrl.cpp.

Used in sample programs: MultiWin, MySplash, TrayTest, TraceWin, DragList, CoolEdit, RegexTest

 

CStringDialog

Class to implement a simple string input dialog. Kind of like MessageBox but it accepts a single string input from user. You provide the prompt. To use:

   CStringDialog dlg;                  // string dialog
   dlg.m_bRequired = m_bRequired;      // if string is required
   dlg.Create(_T("Title"), _T("Enter a string:"), this, IDI_QUESTION);
   dlg.DoModal();                      // run dialog
   CString result = dlg.m_str;         // whatever the user typed

Implemented in PLCoolUI.h, StringDlg.cpp.

Used in sample program: ImgView4

 

CSubclassWnd

Generic class to subclass a CWnd. Once subclassed, all messages go to CSubclassWnd::WindowProc before going to the window. Specific subclasses can trap messages and do something. This very powerful class lets you write a plug-in classes that handle windows messages without deriving a new window class. To use:

  • Derive from CSubclassWnd.
  • Override CSubclassWnd::WindowProc to handle messages. Make sure you call CSubclassWnd::WindowProc if you don't handle the message, or your window will never get messages. If you write separate message handlers, you can call Default() to pass the message to the window.
  • Instantiate your derived class somewhere and call HookWindow(pWnd) to hook your window, AFTER it has been created. To unhook, call Unhook or HookWindow(NULL).

Many PixieLib classes derive from this very important class. To see how it works, look at the Hook sample program.

Implemented in PixieLib.h, Subclass.cpp. Used internally in PalHook.cpp, MenuTipper.cpp, PaintCap.cpp, TrayIcon.cpp, MenuBar.cpp, ListBoxTip.cpp, CoolMenu.cpp, SysCmdRouter.cpp, RegexForm.cpp, LockBar.cpp.

Used in sample program: MySplash

 

CSysCmdRouter

Class to route user-defined WM_SYSCOMMAND messages through the normal MFC command routing system, so you can handle them the normal MFC way with ON_COMMAND and ON_UPDATE_COMMAND_UI handlers. The simplest way to achieve this is to translate the system commands to ordinary WM_COMMAND messages. To use: instantiate in your CMainFrame and call Init from OnCreate.

   // In CMainFrame::OnCreate: add system menu items, then Init
   CMenu* pMenu = GetSystemMenu(FALSE);
   ASSERT(pMenu);
   pMenu->AppendMenu(MF_SEPARATOR); 
   pMenu->AppendMenu(MF_STRING,(UINT_PTR)ID_APP_ABOUT, _T("&About ImgView..."));
   m_sysCmdRouter.Init(this);

Now if the user invokes ID_APP_ABOUT from your system menu, your handler will get it. Without CSysCmdRouter, you'd have to handle WM_SYSCOMMAND yourself since MFC doesn't route system commands through its command-routing mechanism.

Implemented in PLCoolUI.h, SysCmdRouter.cpp.

Used in sample program: ImgView4

 

CTraceFn (internal)

This class is used by TRACEFN to do intended stack-TRACE output. Don't use directly, use TRACEFN instead.

Implemented in PLDebug.h, Debug.cpp.

 

CTrayIcon

CTrayIcon manages an icon in the Windows system tray. To use, instantiate in your CMainFrame class. For example:


   class CMainFrame : public CFrameWnd {
   protected:
      CTrayIcon m_trayIcon;      // my tray icon
      ...
   }

You must initialize the CTrayIcon with a resource ID like so:

   CMainFrame::CMainFrame() : m_trayIcon(IDR_TRAYICON)
   {
      ...
   }

The resource ID identifies the context menu CTrayIcon uses when the user right-clicks on your tray icon. Once you initialize the tray icon, you must call SetIcon to specify which the icon is displayed:

   m_trayIcon.SetIcon(IDI_MYICON);

IDI_MYICON is the resource ID of an ICON resource. CTrayTest also looks for a string resource with the same ID to use as the tray icon tooltip. If you want to receive notifications when the user clicks the tray icon, you can call SetNotificationWnd with a callback message ID.

   m_trayIcon.SetNotificationWnd(this, WM_MY_TRAY_NOTIFICATION);

Now Windows will send your window a WM_MY_TRAY_NOTIFICATION message when something happens. The notifications are as described in the Windows documentation for NOTIFTYICONDATA. WPARAM is the tray icon id (Eg, IDR_TRAYICON) and LPARAM is a mouse, keyboard or balloon tip message. You can call ShowBalloonTip to show a balloon tip; See TrayTest for details.

CTrayIcon automatically handles WM_TASKBARCREATED to recreate your tray icon if Windows restarts Explorer.

Implemented in PLCoolUI.h, TrayIcon.cpp.

Used in sample program: TrayTest

 

CWebVersion

CWebVersion encapsulates over-the-web version checking. It downloads a text file that contains 4 numbers separated by commas, the same format used for FILEVERSION and PRODUCTVERSION in VS_VERSION_INFO. ReadVersion reads these numbers into dwVersionMS and dwVersionLS. For example, you could add the following in your startup code or About dialog to read the latest program version number from the FTP area on your web site:

   // read current version number from web
   DWORD dwLatestVersion = 0; // assume failure
   if (CWebVersion::Online()) {  // if connected to internet:
      CWebVersion ver(_T("ftp.mysite.com"));
      if (ver.ReadVersion(_T("MyProgramVer")))
         m_dwLatestVersion = ver.dwVersionMS;
   }

Now dwLatestVersion contains the latest major version number. You can compare it to the version compiled into the code like so:

   CVersionInfo ver;
   if (dwLatestVersion > ver.dwProductVersionMS) {
      // prompt user to download update...
   }

Implemented in PLProcess.h, WebVersion.cpp.

Used in sample program: TraceWin

 

CWinGroupIterator (internal)

CWinMgr uses this internal class to iterate the WINRECT entries in a group. You don't need to use this class unless you override CWinMgr to do something hairy.

   CWinGroupIterator it;
   for (it=pGroup; it; it.Next()) {
      WINRECT* wrc = it;
      ..
   }

Implemented in PLWinMgr.h. Used internally in WinMgr.cpp.

 

CWinList

Top-level window list, STL vector of HWNDs. To use:

   CWinList wl;      // window list
   wl.Fill();        // fill it
   for (CWinList::iterator it=wl.begin(); it!=wl.end(); it++) {
      HWND hwnd = *it;
      // do something with it
   }

Derived classes can override OnWindow to filter windows—eg, only visible. If you specify a parent window, CWinList will generate a deep child window list:

   CWinList wl(hwndParent);
   wl.Fill();

In this case, CWinList uses EnumChildWindows instead of EnumWindows.

Implemented in PixieLib.h, WinList.cpp.

Used in sample program: MultiWin

 

CWinMgr

CWinMgr implements automatic rule-based sizing for child windows. Use the macros BEGIN/END_WINDOW_MAP to define a window map that describes the layout of the child windows, and call the CalcLayout method from your OnSize handler to automatically resize your child windows based on the rules. For main frames, override CMainFrame::RecalcLayout; for dialogs, derive your dialog from CSizeableDlg.

To use CWinMgr, you first define a table that describes the rules for sizing your child windows. For example:

   BEGIN_WINDOW_MAP(MyViewMap)
    BEGINCOLS(WRCT_REST,0,RCMARGINS(4,4)) // whole view: 4 pixel margins
     BEGINROWS(WRCT_TOFIT,0,0)            //   left pane
      RCTOFIT(ID_WIN_LOGO2)               //     bitmap
      RCTOFIT(ID_WIN_LOGO1)               //     bitmap
      RCREST(ID_WIN_LICENSE)              //     text
     ENDGROUP()
     RCFIXED(ID_WIN_SIZERBAR_VERT,4)      //  vertical sizer bar
     BEGINROWS(WRCT_REST,0,0)             //   right half
      RCREST(ID_WIN_EDIT)                 //     edit view
      RCFIXED(ID_WIN_SIZERBAR_HORZ,4)     //     horizontal sizer bar
      RCTOFIT(ID_WIN_DOPEY)               //     dopey pane
     ENDGROUP()
    ENDGROUP()
   END_WINDOW_MAP()

Each entry in the table is a WINRECT that describes either a group or a single child window. Groups can be groups of rows or columns. Each WINRECT has one of the following types (see above for details):

   WRCT_FIXED - height/width is fixed
   WRCT_PCT   - height/width is percent of total
   WRCT_REST  - height/width is whatever remains, only one per group
   WRCT_TOFIT - height/width to fit window contents

Note that the type refers to the height for rectangles within a row group and the width for rectangles in column groups. For WRCT_TOFIT entries, CWinMgr uses the current window size and sends a NMWINMGR notification with code GET_SIZEINFO to get the desired size. You should set NMWINMGR::sizeinfo.szDesired to the desired window size.

For a detailed description of how CWinMgr, see my article in the July 2001 MSDN Magazine: http://msdn.microsoft.com/msdnmag/issues/01/07/winmgr/. The version in PixieLib has new features and bug fixes implemented since the original article.

Implemented in PLWinMgr.h, WinMgr.cpp. Used internally in SizerBar.cpp.

Used in sample program: MultiWin

 

CWinRect

Like CRect, but constructor gets client/window dimensions in various coords depending on value of "which". Lets you write

   CWinRect rc(this); // get window client rectangle
   SomeFn(rc);

or

   // get window (as opposed to client) rect
   CWinRect rc(this, CWinRect::WINDOW); 

where "this" is your window (view, frame, etc).

Implemented in PixieLib.h, WinRect.cpp. Used internally in FlatBar.cpp.

 

CWindowPlacement

CWindowPlacement reads and writes WINDOWPLACEMENT from/to application profile or CArchive. This lets you save and restore the position of a window across user sessions. For an example of how to use it, see the TraceWin sample program.

Implemented in PixieLib.h, WinPlace.cpp.

Used in sample program: TraceWin

 

DBGINTERFACENAME (internal)

This structure is used to implement a table for displaying the human-readable names of COM interfaces in TRACE diagnostics. PixieLib already knows the names of many common interfaces (see Debug.cpp for a list). To add more interfaces, put them in a table like so:

   DEBUG_BEGIN_INTERFACE_NAMES()
      DEBUG_INTERFACE_NAME(IFoo)
      DEBUG_INTERFACE_NAME(IBar)
      DEBUG_INTERFACE_NAME(ISomeOtherInterface)
   DEBUG_END_INTERFACE_NAMES();

Now you can write

   REFIID iid = // some interface ID
   TRACE("Interface: %s\n", _TR(iid));

And see the interface name instead of a pointer or GUID. All the macros generate no code in Release builds.

Implemented in PLDebug.h. Used internally in Debug.cpp.

 

DRAGDROPINFO

Drag-drop structure passed as LPARAM in callback notification. WPARAM is notification code.

Implemented in PLDragDrop.h. Used internally in DragDrop.cpp.

Used in sample program: DragList

 

DRAGDROPWND

Single entry in drag/drop window map. Map is an array of these structs, each entry specifies a child window ID and whether the window is a source, target, or both.

Implemented in PLDragDrop.h.

 

GCursor

Global Cursor class with singleton instance TheCursor. Use it to manipulate the cursor. For example:

   TheCursor = ID_MYCURSOR;   // change cursor icon
   CPoint p = TheCurser;      // get cursor pos
   TheCursor = CPoint(10,50); // move cursor pos

Implemented in PixieLib.h. Used internally in PixieLib.cpp.

 

GKeyboard

Global Keyboard class with singleton object TheKeyboard. Use it to get information about the keyboard.

   int nfnkey = TheKeyboard.NumFnKeys();
   int cp = TheKeyboard.CodePage();

Implemented in PixieLib.h. Used internally in PixieLib.cpp.

 

GMouse

Global mouse class with singleton instance TheMouse. Use it to capture the mouse.

   TheMouse.Capture(pWnd);       // capture mouse input
   TheMouse.Release();           // release the mouse

Implemented in PixieLib.h. Used internally in PixieLib.cpp.

 

HTMLCMDMAP

This struct defines one entry in the command map that maps text strings to command IDs for HTML controls. Don't use it directly; instead, use the macros provided to create your command map:

   BEGIN_HTML_COMMAND_MAP(MyHtmlCmds)
      HTML_COMMAND(_T("about"), ID_APP_ABOUT)
      HTML_COMMAND(_T("exit"),  ID_APP_EXIT)
   END_HTML_COMMAND_MAP()

Call CHtmlCtrl::SetCmdMap to use the map, usually just after you create the HTML control in your main frame's OnCreate handler.

   // in CMainFrame::OnCreate
   m_wndView.SetCmdMap(MyHtmlCmds, this);

Now to invoke the About command from HTML in your CHtmlCtrl, you can add an HTML link using the "app" pseudo-protocol like so:

   ...<A HREF="app:about">About</A>....

Clicking the link will be the same as sending the ID_APP_ABOUT command to whatever window you specified in SetCmdMap—in this case, the main frame. In general, you can use HREF="app:cmdname" where cmdname is any string appearing in your command map. See MultiWin for an example.

Implemented in PLCoolUI.h.

Used in sample program: RegexTest

 

NMFOLDERTAB

Notification struct used by folder tabs.

Implemented in PLFolderTab.h. Used internally in Ftab.cpp, FolderFrame.cpp.

 

NMWINMGR

Notification struct sent by CWinMgr as LPARAM in the WM_WINMGR message. Currently there are two notifications sent: GET_SIZEINFO when CWinMgr wants to know the desired size of one of your TOFIT windows; and SIZEBAR_MOVED when the user moves a sizer bar.

  • When you receive GET_SIZEINFO, you should set the desired size for your window in NMWINMGR::sizeinfo.
   LRESULT CMyView::OnWinMgr(WPARAM wp, LPARAM lp)
   {
      ASSERT(lp);
      NMWINMGR& nmw = *(NMWINMGR*)lp;
      if (nmw.code==NMWINMGR::GET_SIZEINFO) {
         CRect rc = // calculate desired size
         nmw.sizeinfo.szDesired = rc.Size();
         return TRUE; // handled -- important!
      }
   }
  • You should also set szMin and/or szMax if you want to restrict your window's minimum/maximum size.
  • When you get SIZEBAR_MOVED, all you typically have to do is call CWinMgr to move the affected windows:
   LRESULT CMyView::OnWMWinMgr(WPARAM wp, LPARAM lp)
   {
      ASSERT(lp);
      NMWINMGR& nmw = *(NMWINMGR*)lp;
      if (nmw.code==NMWINMGR::SIZEBAR_MOVED) {
         // wp is child window ID
         m_winMgr.MoveRect(wp, nmw.sizebar.ptMoved, this);
         m_winMgr.SetWindowPositions(this);
      }
   }

See MultiWin for details.

Implemented in PLWinMgr.h. Used internally in WinMgr.cpp, FolderFrame.cpp, SizerBar.cpp.

Used in sample program: MultiWin

 

PAINTCAP

The caption painter (CCaptionPainter) will call your window proc with a pointer to this structure as LPARAM if you specify a callback message. Use it to do custom painting.

Implemented in PLDraw.h. Used internally in PaintCap.cpp.

Used in sample program: CoolEdit

 

RGXFIELD

This internal structure is used to create the field map that describes your form. Each RGXFIELD entry specifies an edit control ID and optional parameters. You don't need to use RGXFIELD directly; use the macros below to build your regex form map. See the form validation example in RegexTest.

Each field ID is expected to have a corresponding resource string with the format:

"FieldName\nRegex\nLegalChars\nHint\nErrorMsg"

   FieldName   = name of field, required
   Regex       = regular expression used to validate input, optional
   LegalChars  = regex describing legal chars to type (eg "[\d.-]" numbers)
   Hint        = format hint, eg "#####-####" for zip code
   ErrorMsg    = error message if input doesn't match. Defaults to "Should
                 be [Hint]" if there's a hint, where "Should be" is another
                 resource substring for the whole form--see description of
                 Init method and TestForm.rc for examples.

Implemented in PLRegex.h. Used internally in RegexForm.cpp.

Used in sample program: RegexTest

 

SIZEINFO

Size info about a WinMgr rectangle/row/column. CWinMgr sends your window a WM_WINMGR message with one of these in NMWINMGR::sizeinfo with the NMWINMGR::GET_SIZEINFO notification. You can change the members szDesired, szMin or szMax for custom sizing.

Implemented in PLWinMgr.h. Used internally in WinMgr.cpp, FolderFrame.cpp, SizerBar.cpp.

 

WINRECT (internal)

This structure is used to hold a rectangle and describe its layout. Each WINRECT corresponds to a child rectangle/window. Each window that uses WinMgr provides a table (C array) of these to describe its layout. Generally, you don't need to use this struct directly; instead, use DECLARE_WINDOW_MAP(name) to declare your window map and BEGIN/END_WINDOW_MAP to implement it. See MultWin.

Implemented in PLWinMgr.h, WinMgr.cpp. Used internally in SizeableDlg.cpp, SizerBar.cpp.

Functions

 
extern HBITMAP PLLoadSysColorBitmap(LPCTSTR lpResName, BOOL bMono=FALSE) 

Load bitmap from resource name, converting grays to system colors.

 
extern void PLDrawEmbossed(CDC& dc, CImageList& il, int i, CPoint p, BOOL bColor=FALSE) 

Draw image list item with embossed look.

 
extern void PLFillRect(CDC& dc, const CRect& rc, COLORREF color) 

Paint a rectangle a given color.

 
extern void PLFillRect3DLight(CDC& dc, const CRect& rc) 

Fill rectangle with 3D light color.

 
extern void PLPrompt(LPCTSTR lpText, BOOL bUpdateNow=FALSE) 

Write text or resource string to MFC status bar. For example:

   PLPrompt("hello, world");

writes "hello, world" to the satus line.

 
extern void PLPrompt(UINT nResID, BOOL bUpdateNow=FALSE) 

Sample Programs

Each sample program lives in a subdirectory of the SAMPLES directory. The name of the sample is the same as the subdirectory name. Each sample has its own solution (.sln) file you can use to build it, or you can use MakeSamp.bat in the PixieLib root to build all the samples at once.
 
CoolEdit  CoolEdit is a text editor that illustrates how to use many of the "Cool UI" classes in PixieLib: coolbars, menu bars, cool menus (with bitmap buttons and accelerator mnemonics), menu tips, toolbar lock and so on. You can build CoolEdit either as and SDI or MDI app, depending on the setting of the preprocessor symbol _MDIAPP.
Uses: CCaptionPainter, CCoolBar, CCoolMenuManager, CCoolMenuWindow, CFlatToolBar, CLockBars, CMenuBar, CMenuTipManager, CModuleVersion, CNonClientMetrics, CPictureCtrl, CStaticLink, PAINTCAP
 
DragList  DragList shows how to use CDragDropMgr to implement drag-drop between controls within an app. DragList also shows how to use CListBoxTipHandler to show tooltips for list box items that are too long to be seen.
Uses: CDragDropMgr, CDragDropText, CListBoxTipHandler, CStaticLink, DRAGDROPINFO
 
ImgView4  ImgView implements an image viewer that shows how to use CPictureCtrl to display GIF, JPG, BMP, TIF and all the other image formats supported by CPicture/GDI+. It also shows how to use CFolderView to implement Excel-style folder tabs. ImgView uses CHtmlCtrl to display an HTML-based About dialog, and uses CStringDialog to generate an input dialog on the fly to get a URL from the user.
Uses: CCoolMenuManager, CFlatToolBar, CFolderFrame, CFolderTabCtrl, CFolderView, CFontUI, CHourglass, CHtmlCtrl, CMenuTipManager, CPicture, CPictureCtrl, CStringDialog, CSysCmdRouter
 
MultiWin  MultiWin illustrates how to use CWinMgr, a class that implements rule-based window sizing. MultiWin has a view class that comprises with several panes and splitters, all automatically managed by CWinMgr. MultiWin also has a dialog that uses CWinMgr to automatically resize its child controls as the user sizes the dialog. MultiWin's main view includes a CHtmlCtrl that shows how to generate HTML on the fly. You can open any HTML file, or press a button to have it generate a list of top-level windows as HTML, or press another button to read HTML help from the resource file.
Uses: CCoolMenuManager, CFlatToolBar, CHtmlCtrl, CMenuTipManager, CProcessList, CProcessModuleList, CSizeableDlg, CSizerBar, CStaticLink, CWinList, CWinMgr, NMWINMGR
 
MySplash  MySplash shows how to use CSplash to implement a splash screen in MFC.
Uses: CCoolMenuManager, CFlatToolBar, CMenuTipManager, CSplash, CStaticLink, CSubclassWnd
 
RegexTest  RegexTest shows how to use CRegex to do regular expression matching and CRegexForm to do regex-based form validation for MFC dialogs. The program has three dialogs to illustrate different uses of CRegex: 1) A test dialog where you can enter a regular expression and input string and see the Match results; 2) a WordMess dialog that uses dynamic regex-replace with a callback function to implement a dynamic replace algorithm; and 3) a Form Test dialog that uses CRegexForm to validate user input using regular expressions in a table.
Uses: CCoolMenuManager, CFlatToolBar, CHtmlCtrl, CMenuTipManager, CRegex, CRegexForm, CStaticLink, HTMLCMDMAP, RGXFIELD
 
TraceWin  TraceWin is a program that displays TRACE diagnostics from other programs that include <TraceWin.h>, so you can see TRACE output without running your program in the debugger. Programs that include TraceWin.h send WM_COPYDATA messages to TraceWin. When TraceWin gets such a message, it displays the TRACE text in its main window. Also shows how to use CFontUI to select a font, and CWebVersion to check for latest updates on the web. You don't need to use PixieLib to use TraceWin; you can download it separately from my web site at http://www.dilascia.com/TraceWin.htm. What PixieLib provides is the source, so you can see how TraceWin works.
Uses: CFontUI, CMenuTipManager, CModuleVersion, CStaticLink, CWebVersion, CWindowPlacement
 
TrayTest  TrayTest illustrates how to use CTrayIcon to display your own icon in the system tray. All the action happens in MainFrm.cpp.
Uses: CStaticLink, CTrayIcon

Debugging Tools

PixieLib comes with a number of tools to help debugging.

Index

Classes

name header used in samples
CAppProcessList PLProcess.h
CCaptionPainter PLDraw.h CoolEdit
CCoolBar PLCoolUI.h CoolEdit
CCoolMenuManager PLCoolUI.h MultiWin, MySplash, CoolEdit, RegexTest, ImgView4
CCoolMenuWindow PLCoolUI.h CoolEdit
CDragDropData PLDragDrop.h Used internally in DragDrop.cpp.
CDragDropMgr PLDragDrop.h DragList
CDragDropText PLDragDrop.h DragList
CFindWinList PixieLib.h Used internally in HtmlCtrl.cpp.
CFlatToolBar PLCoolUI.h MultiWin, MySplash, CoolEdit, RegexTest, ImgView4 Used internally in MenuBar.cpp.
CFolderFrame PLFolderTab.h ImgView4
CFolderTabCtrl PLFolderTab.h ImgView4 Used internally in FolderFrame.cpp.
CFolderView PLFolderTab.h ImgView4
CFontUI PLCoolUI.h TraceWin, ImgView4
CHourglass PixieLib.h ImgView4
CHtmlCtrl PLCoolUI.h MultiWin, RegexTest, ImgView4
CHyperlink PLStatLink.h
CInternetHandle PLInet.h Used internally in WebVersion.cpp.
CListBoxTipHandler PLCoolUI.h DragList
CLoadLibrary PLProcess.h Used internally in Process.cpp.
CLockBars PLCoolUI.h CoolEdit
CLockData PixieLib.h Used internally in Splash.cpp.
CMainWinList PixieLib.h Used internally in Process.cpp.
CMenuBar PLCoolUI.h CoolEdit Used internally in MdiMenuMgr.cpp.
CMenuItemInfo PLCoolUI.h Used internally in CoolMenu.cpp.
CMenuTipManager PLCoolUI.h MultiWin, MySplash, TraceWin, CoolEdit, RegexTest, ImgView4
CModuleVersion PLProcess.h TraceWin, CoolEdit Used internally in FixTB.cpp.
CNonClientMetrics PixieLib.h CoolEdit Used internally in MenuBar.cpp, CoolMenu.cpp, PupText.cpp.
CPLCommandLineInfo PLCoolUI.h Used internally in Splash.cpp.
CPalMsgHandler PLDraw.h
CPicture PLDraw.h ImgView4 Used internally in PictCtrl.cpp.
CPictureCtrl PLDraw.h CoolEdit, ImgView4
CPixieDebug PLDebug.h
CPopupText PLCoolUI.h Used internally in MenuTipper.cpp, ListBoxTip.cpp, RegexForm.cpp.
CProcessList PLProcess.h MultiWin
CProcessModuleList PLProcess.h MultiWin
CRebarBandInfo PLCoolUI.h Used internally in CoolBar.cpp.
CRebarInfo PLCoolUI.h
CRegex PLRegex.h RegexTest Used internally in RegexForm.cpp.
CRegexForm PLRegex.h RegexTest
CRgxFieldNotFoundException PLRegex.h
CSTAThread PLStatLink.h
CSizeableDlg PLWinMgr.h MultiWin
CSizerBar PLWinMgr.h MultiWin
CSplash PLCoolUI.h MySplash
CStaticLink PLStatLink.h MultiWin, MySplash, TrayTest, TraceWin, DragList, CoolEdit, RegexTest Used internally in PictCtrl.cpp.
CStringDialog PLCoolUI.h ImgView4
CSubclassWnd PixieLib.h MySplash Used internally in PalHook.cpp, MenuTipper.cpp, PaintCap.cpp, TrayIcon.cpp, MenuBar.cpp, ListBoxTip.cpp, CoolMenu.cpp, SysCmdRouter.cpp, RegexForm.cpp, LockBar.cpp.
CSysCmdRouter PLCoolUI.h ImgView4
CTrayIcon PLCoolUI.h TrayTest
CWebVersion PLProcess.h TraceWin
CWinList PixieLib.h MultiWin
CWinMgr PLWinMgr.h MultiWin Used internally in SizerBar.cpp.
CWinRect PixieLib.h Used internally in FlatBar.cpp.
CWindowPlacement PixieLib.h TraceWin
DRAGDROPINFO PLDragDrop.h DragList Used internally in DragDrop.cpp.
DRAGDROPWND PLDragDrop.h
GCursor PixieLib.h Used internally in PixieLib.cpp.
GKeyboard PixieLib.h Used internally in PixieLib.cpp.
GMouse PixieLib.h Used internally in PixieLib.cpp.
HTMLCMDMAP PLCoolUI.h RegexTest
NMFOLDERTAB PLFolderTab.h Used internally in Ftab.cpp, FolderFrame.cpp.
NMWINMGR PLWinMgr.h MultiWin Used internally in WinMgr.cpp, FolderFrame.cpp, SizerBar.cpp.
PAINTCAP PLDraw.h CoolEdit Used internally in PaintCap.cpp.
RGXFIELD PLRegex.h RegexTest Used internally in RegexForm.cpp.
SIZEINFO PLWinMgr.h Used internally in WinMgr.cpp, FolderFrame.cpp, SizerBar.cpp.

Functions

name header used in samples
HBITMAP PLLoadSysColorBitmap(LPCTSTR lpResName, BOOL bMono=FALSE) PLDraw.h
void PLDrawEmbossed(CDC& dc, CImageList& il, int i, CPoint p, BOOL bColor=FALSE) PLDraw.h
void PLFillRect(CDC& dc, const CRect& rc, COLORREF color) PLDraw.h
void PLFillRect3DLight(CDC& dc, const CRect& rc) PLDraw.h
void PLPrompt(LPCTSTR lpText, BOOL bUpdateNow=FALSE) PixieLib.h
void PLPrompt(UINT nResID, BOOL bUpdateNow=FALSE) PixieLib.h

Sample Apps

name classes used
CoolEditCCaptionPainter
CCoolBar
CCoolMenuManager
CCoolMenuWindow
CFlatToolBar
CLockBars
CMenuBar
CMenuTipManager
CModuleVersion
CNonClientMetrics
CPictureCtrl
CStaticLink
PAINTCAP
 
DragListCDragDropMgr
CDragDropText
CListBoxTipHandler
CStaticLink
DRAGDROPINFO
 
ImgView4CCoolMenuManager
CFlatToolBar
CFolderFrame
CFolderTabCtrl
CFolderView
CFontUI
CHourglass
CHtmlCtrl
CMenuTipManager
CPicture
CPictureCtrl
CStringDialog
CSysCmdRouter
 
MultiWinCCoolMenuManager
CFlatToolBar
CHtmlCtrl
CMenuTipManager
CProcessList
CProcessModuleList
CSizeableDlg
CSizerBar
CStaticLink
CWinList
CWinMgr
NMWINMGR
 
MySplashCCoolMenuManager
CFlatToolBar
CMenuTipManager
CSplash
CStaticLink
CSubclassWnd
 
RegexTestCCoolMenuManager
CFlatToolBar
CHtmlCtrl
CMenuTipManager
CRegex
CRegexForm
CStaticLink
HTMLCMDMAP
RGXFIELD
 
TraceWinCFontUI
CMenuTipManager
CModuleVersion
CStaticLink
CWebVersion
CWindowPlacement
 
TrayTestCStaticLink
CTrayIcon
 

 

PixieLib.NET Copyright 2005 Paul DiLascia. All rights reserved.
www.dilascia.com
Happy Programming!