Samples

You can access sample code files in one of two ways:
  • Look through the documentation abstracts. When you find an interesting sample, click on the link at the top of the abstract to view or download sample files.
  • Browse the Visual C++ samples directory structure on the MSDN CD-ROM.
There are seven categories of sample code:

Add-ins
ATL
Compiler COM Support
Custom AppWizard
MFC
OLE DB Templates
SDK

Interesting home pages
Visual C++ Home Page The entire Visual C++ product.
Visual Studio 6.0 Samples Explore Visual Studio's Island Hopper News sample.


Visual C++ Developer Studio Add-in Samples

Visual C++ Developer Studio add-ins are in-process COM components (DLLs) that you write in Visual C++ or Visual Basic. With add-ins, you can automate tasks in Visual C++ by adding commands to perform these tasks, by adding toolbar buttons to carry out these commands, and by responding to events inside the development environment.

For information about creating add-ins, see Overview: Add-ins for the Visual C++ Developer Studio.

Additional Visual C++ Developer Studio add-in samples will be available on the Visual C++ website, in the owner’s area. See http://www.microsoft.com/visualc/.

The following table describes the add-in samples:

Sample | Description
API2Help | Documents a function prototype. When you select the prototype, API2Help creates a .rtf file. You can use this .rtf file to create Help for the function.
AutoBld | Builds a Visual C++ project at a specified time. When the build is done, AutoBld emails the user with the name of the configuration and the number of build warnings and errors.
BldRec | Records build information in a text file.
BookNote | Lets you record notes (like permanent bookmarks), associating them with code.
BrkPntMgr | A breakpoint manager that will save and load breakpoints from files. You can add comments to make your breakpoints more understandable. This is useful in working on many bugs at one time, or over time.
CmdWnd | Creates a modeless command window into which you can enter three types of commands: CmdWnd commands, IDE menu command, and DOS commands.
Pipe | Lets you process text by selecting it in the Visual C++ Text editor, pressing a button, choosing or setting a command, and applying the command to your selection. Pipe (or Filter as it is called in the Customize dialog box) is useful in sorting.
ReplAll | Resembles the Find and Replace dialog box but will find and replace text in all open text files.
VB4Addin | Shows how to create a Visual C++ 6.0 add-in with Visual Basic 4.0.
VB5Addin | Shows how to create a Visual C++ 6.0 add-in with Visual Basic 5.0. You should also be able to build this sample in Visual Basic 6.0.
Wins | A window manager that will find, minimize, make visible, activate, and close windows, and also close any windows opened in a debug session. You can use Wins to create files that, when loaded, will open selected windows.

See Also

Tips for Using Add-ins


Tips for Using Add-ins

Visual C++ Developer Studio Add-in Samples

The following tips will help you use add-ins:

  • Place the .dll output files from an add-in project in the Common\MSDev98\Addins folder. Visual C++ looks in this folder, by default, for add-ins.

  • To make an add-in’s functionality available in a toolbar, click Customize from the Tools menu. The Add-ins and Macro Files tab will display a list of the .dll files in the Common\MSDev98\Addins folder. You will also see a list of the .dsm files ( VBScript Macros) that are in the Common\MSDev98\Macros folder.

  • If an add-in .dll is not in the Common\MSDev98\Addins folder, you can click the Browse button and search for it. Make sure the Show all files option is checked in the View tab of the Folder options dialog box (View menu) in Windows Explorer. You need to show all files because .dll files are considered system files.

  • By default, an add-in may not display all of its toolbar buttons. To see all toolbar buttons associated with your add-ins, click Customize from the Tools menu. Then click the Commands tab and select the Add-ins category. All the add-in toolbar buttons will be displayed. You can click and drag the buttons onto a toolbar.

  • Add-in toolbars, like other toolbars, can be closed. To display a toolbar, right-click in an unused part of the menu bar and select the desired toolbar.


API2Help: Creates an HTML or RTF File to Include in a Help System

Click to open or copy the API2Help project files.

This add-in creates documentation for a function prototype. Simply open a source code file in Visual C++ and highlight a function prototype. Then click the add-in. You will be prompted to create either a .rtf file or a .htm file. You can use the resulting file to create help for the function.

To build the sample

  1. Click the link at the beginning of this topic to download the sample files.

  2. In Visual C++, open the project file API2Help.dsp.

  3. Choose an appropriate configuration (Win32 Release is best if you plan to use this add-in).

  4. Click Rebuild All from the Build menu.

To run the add-in

  1. From the Tools menu, click Customize.

  2. Click the Add-ins and Macro Files tab.

  3. Select the API2Help.dll file or browse for it. See Tips for Using Add-ins.

    API2Help creates a small toolbar that is visible when you close the Customize dialog box.

  4. Highlight a function prototype in a source file.

  5. Click the API2Help button on the newly created toolbar, follow the prompts, and fill in the appropriate information in the File Generation Options dialog box.

  6. Modify your help system to include the newly generated files.

This sample demonstrates the following keywords:

CComModule.Init; CWinApp::ExitInstance; CComModule.GetClassObject; CComModule.RegisterServer; CRegKey.Open; CString.LoadString; CRegKey.SetKeyValue; CComModule.UnregisterServer; CFile.Write; CString.LoadString; WriteString; CString.TrimLeft; CString.TrimRight; CString.Find; CString.SetAt; Iapplication; CCommandsObj::CreateInstance; EnableWindow; SetWindowText; CString::GetLength; DoModal


AutoBld: Builds One or More Workspaces at Specified Times and Dates

Click to open or copy the AutoBld project files.

This sample builds a Visual C++ project at a specified time. When the build is done, AutoBld emails the user with the name of the configuration and the number of build warnings and errors. The code demonstrates working with various parts of the Developer Studio object model, placing multiple commands into an add-in, and invoking commands from a command line.

For the Send Email function to work, you either need a non-password email account, or you need to be logged into the email account at the time AutoBld runs.

To build the sample

  1. Click the link at the beginning of this topic to download the sample files.

  2. In Visual C++, open the project file AutoBld.dsp.

  3. Choose an appropriate configuration (Win32 Release is best if you plan to use this add-in).

  4. Click Rebuild All from the Build menu.

  5. Place AutoBld.dll in \Microsoft Visual Studio\Common\MSDev98\AddIns so it can be located by Visual C++ when it launches.

To run the sample on Windows NT

  1. From the Tools menu, click Customize.

  2. Click the Add-ins and Macro Files tab.

  3. Select the AutoBld.dll file or browse for it. See Tips for Using Add-ins.

  4. Once the AutoBld add-in has been loaded, clicking the button on the add-in toolbar opens a dialog box that lets you specify where build time information is to be logged. The file is persistent; any changes to it will be used next time.

  5. Click the Configure button on the newly created toolbar, and set your preferences in the AutoBuild Configuration dialog box.

  6. Exit Visual C++ to save this configuration.

  7. From Control Panel, open the Services dialog box. Find Scheduling Agent in the list box, and make sure its Status column indicates Started and its Startup column indicates Automatic. If the Scheduling Agent's Status is not set to Started, highlight the Scheduling Agent and click the Start button. If its Startup is not set to Automatic, click the Startup button and select Automatic in the Startup Type field on the Service dialog box.

  8. From a command prompt, use the at utility to set the time and date to build your workspaces. When giving the at utility a command line to execute, enter the following line (making sure that msdev.exe is on your path):

Example

at 06:00 /interactive msdev.exe /EX AutoBuildTest

This will launch Visual C++ and execute the AutoBuild command at 06:00 am, which starts the build of your workspaces.

To run the sample on Windows 95 with Microsoft PLUS!

  1. Follow the procedure earlier in this topic on running the sample through Step 6 (where you exit Visual C++ to save the configuration).

  2. Click the Scheduling Agent on the system tray, and add the following line to the list of tasks to perform:
    msdev /EX AutoBuildTest

    Note The Scheduling Agent icon appears next to the clock in the system tray in the lower-right corner of your screen (on the Start taskbar). This is only visible if Microsoft PLUS! is installed.

  3. Set the time and how often you want to execute the build.

This sample demonstrates the following keywords:

CString::LoadString; CComModule::Init; CWinApp::InitInstance; CComModule::Term; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::RegisterServer; CRegKey::Open; CoTaskMemFree; CComModule::UnregisterServer; GetProfileString; GetProfileInt; AddRef; AfxGetStaticModuleState; LoadLibrary; GetProcAddress; CString::Format; FreeLibrary; CCommandsObj::CreateInstance; GetLastErrorDescription; GetNextItem


BldRec: Uses Automation to Record Time and Length of a Build

Click to open or copy the BLDREC project files.

BldRec records the following build information in a text file:

  • Length of time

  • Number of errors

  • Number of warnings

The sample also shows using the registry to persist a setting. BldRec was created with the ATL COM AppWizard. Support MFC was checked in the wizard, and then an Add-in object was added to the project with the ATL Object Wizard.

To build the sample

  1. Click the link at the beginning of this topic to download the sample files.

  2. In Visual C++, open the project file BldRec.dsp.

  3. Choose an appropriate configuration (Win32 Release is best if you plan to use this add-in).

  4. Click Rebuild All from the Build menu.

To run the add-in

  1. From the Tools menu, click Customize.

  2. Click the Add-ins and Macro Files tab.

  3. Select the BldRec.dll file or browse for it. See Tips for Using Add-ins.

  4. Once the BldRec add-in has been loaded, clicking the button on its toolbar displays a dialog box that lets you specify a location to log build time information. The file is persistent; any changes to it will be used next time.

Output of BldRec is similar to:

09:48:11 PM 02/19/98 :             Build Started  -- bldrec - Win32 Debug
09:48:25 PM 02/19/98 : 00:00:14    Build Finished! Errors=0, Warnings=0 -- bldrec - Win32 Debug

This sample demonstrates the following keywords:

CTimeSpan; CTime::GetCurrentTime; CTime::Format; CRegKey::QueryValue; CRegKey::Create; CRegKey::SetValue; addin; customize; IApplication; IConfiguration; IApplicationEvents


BookNote: Uses Automation to Make Persistent Bookmarks and Add Notes About Code

Click to open or copy the BookNote project files.

BookNote lets you record notes (like permanent bookmarks), associating them with code. The sample also shows using the registry to persist a number of items in an MRU list. BookNote was created with the ATL COM AppWizard. Support MFC was checked in the wizard, and then an Add-in object was added to the project with the ATL Object Wizard. Most of the code added is in MarkIt.cpp.

If you modify the sample, precede each function that could be called from an external interface with the following code:

AFX_MANAGE_STATE(AfxGetStaticModuleState());

This allows you to access your resources and is necessary because of the MFC support.

The CMRUStrings class is used to do the persistence for a drop-down combo box. You can use this class and other classes from the add-ins in other projects. See Reusing Code Topics and Adding Classes to the Gallery for information on how to reuse code.

To build the sample

  1. Click the link at the beginning of this topic to download the sample files.

  2. In Visual C++, open the project file BookNote.dsp.

  3. Choose an appropriate configuration (Win32 Release is best if you plan to use this add-in).

  4. Click Rebuild All from the Build menu.

To run the add-in

  1. From the Tools menu, click Customize.

  2. Select the BookNote.dll file or browse for it. See Tips for Using Add-ins.

  3. Visual C++ will load the add-in. When you close the Customize dialog box, BookNote’s toolbar will appear.

  4. Run the BookNote add-in by clicking the toolbar button. Once the add-in has been loaded, it will open a dialog box. It will record the current selection (file, line, end of selection if applicable). You can type a note into the main edit box. When you click OK, the current selection will be copied into a file, which you can specify in this dialog box via a combo box that holds up to 10 file names. You can also immediately dump the current note to the output window. You can then use this with the F4 key. F4 will navigate to the line of code.

There is a check box for indenting notes that is on by default. If you copy text out of the output window and want to navigate to it, turn indenting off.

There is a button that dumps the file to the output window. The button does not close the dialog box. This is useful for putting any file into the output window; clicking Cancel stops recording a note.

Sample output

C:\VC98\VC98\CRT\SRC\DBGHEAP.C(328) : (09:16:04 PM  02/09/1998)
328: set _crtDbgFlag and _crtBreakAlloc to find memory leaks

Before dumping files into the output window, you may want to clear the output window first. Use the context menu (right-click and choose Clear).

This sample demonstrates the following keywords:

CTimeSpan; CTime::GetCurrentTime; CTime::Format; CRegKey::QueryValue; CRegKey::Create; CRegKey::SetValue, ITextSelection, IApplication, CRegKey; ITextSelection::get_TopLine; CComPtr, CComQIPtr, ITextDocument::get_FullName; CComBSTR, IApplication::PrintToOutputWindow; addin; customize.


BrkPntMgr: Uses Automation to List and Control Breakpoints

Click to open or copy the BrkPntMgr project files.

BrkPntMgr is a breakpoint manager. It will save and load breakpoints from files. You can add comments to make your breakpoints more understandable. This is useful in working on many bugs at one time, or over time.

BrkPntMgr was created with the ATL COM AppWizard. Support MFC was checked in the wizard and then an Add-in object was added to the project with the ATL Object Wizard. The code that was added is mostly in BrkPnts.cpp. There is code for loading, saving, and closing, and a function that will get a pointer to an IGenericDocument interface for a given file.

To build the sample

  1. Click the link at the beginning of this topic to download the sample files.

  2. In Visual C++, open the project file BrkPntMgr.dsp.

  3. Choose an appropriate configuration (Win32 Release is best if you plan to use this add-in).

  4. Click Rebuild All from the Build menu.

To run the add-in

  1. From the Tools menu, click Customize.

  2. Click the Add-ins and Macro Files tab.

  3. Select the BrkPntMgr.dll file or browse for it. See Tips for Using Add-ins.

    Visual C++ will load the add-in. When you close the Customize dialog box, BrkPntMgr’s toolbar will appear.

  4. Run the BrkPntMgr add-in by clicking the toolbar button. BrkPntMgr puts up a single button in a toolbar. Clicking this button opens a dialog box. This dialog box has a check box for Save Only Enabled, an edit box File:, a Browse button, another edit box labeled Comment, and four more buttons labeled Clear, Save, Load, and To Output Wnd. The text at the top of the dialog box reports how many breakpoints are set and enabled.

If you put a file name in the File: edit box (or browse for one), you can either load or save breakpoints. If the Save Only Enabled check box is enabled, you will not save any disabled breakpoints. When you save, you can add a comment, such as "This set of breakpoints are for finding a memory leak in the bipartite graph program."

When you load a file, all files with breakpoints set will be opened and then all the breakpoints will be set.

Click Clear to clear all of the breakpoints.

If you click To Output Wnd, the breakpoints will be printed to the output window, which is under the Macro tab. You might want to clear the window first using the context menu (right-click in the output window). This is useful as you can then navigate to your breakpoints easily, much as you do for errors in compilation.

One caveat: if you edit code heavily, the breakpoint may not be on the correct line. In this case, remove the wrong breakpoints and reset them.

This sample demonstrates the following keywords:

IApplication, CComPtr, CComQIPtr, ITextDocument::get_FullName; CStringArray::Add; CStringArray::GetAt; CComBSTR; CComVariant; IDocuments::get__NewEnum; IEnumVARIANT::Next; CComVariant; ITextSelection::GoToLine; IDebugger::AddBreakpointAtLine; IApplication::put_Active; IDebugger::RemoveBreakpointAtLine; IDebugger::get_Count; IDebugger::get_Breakpoints IBreakPoint::get_Enabled; IBreakPoint::get_File; IBreakPoint::get_Type; IBreakPoint::get_Function; IBreakPoint::get_Executable IBreakPoint::get_Location; IBreakPoints::Item; IApplication::PrintToOutputWindow; debugger; breakpoint; addin; customize; CregKey; IapplicationEvents; IdebuggerEvents; Carchive; ITextSelection, CStringArray; IBreakpoint; IGenericDocument; ITextDocument


CmdWnd: Issue IDE Command in a Command Window

Click to open or copy the CmdWnd project files.

The CmdWnd add-in sample creates a command window into which you can enter three types of commands:

CmdWnd commands

You can display a list of the CmdWnd commands by typing a question mark (?) in the command window. Note that several CmdWnd commands start the debugger.

IDE commands

Any command issued in the command window that is not a CmdWnd command will next be evaluated as an IDE command. Any command that you see in the Commands list in the Keyboard tab of the Customize dialog box, which is accessed from the Tools menu, can be issued in the command window to access the functionality of the menu option. An example of such a command is NewText. Another useful one is DebugBreak. Note that case is sensitive here.

MS-DOS commands

Any command issued in the command window that is neither a CmdWnd command nor an IDE command will next be evaluated as a command issued from an MS-DOS prompt.

The CmdWnd add-in sample shows how to create a modeless dialog box add-in. Add-ins are normally required to be modal dialog boxes. One problem encountered in making a modeless add-in is that some keystrokes get translated and sent to msdev.exe and the add-in’s dialog box does not receive them. This is particularly dangerous since keys like DEL are in this list. This sample shows how to create an add-in in two basic pieces: a stub add-in, and an exe that opens a dialog box. This results in a modeless dialog box for msdev.exe.

To build the sample

  1. Click the link at the beginning of this topic to download the sample files.

  2. In Visual C++, open the project file cmdwnd.dsw.

  3. Choose an appropriate configuration (Win32 Release is best if you plan to use this add-in).

  4. Make the All project the active project.

  5. Click Rebuild All from the Build menu.

This project builds a proxy stub, called devcmd.dll, and is built in the msdevcmdstubs subproject. There is one other subproject called the _interface project; this project facilitates the build process and must be built first. If you change devcmd.idl, rebuild _interface.

To run the add-in

  1. From the Tools menu, click Customize.

  2. Click the Add-ins and Macro Files tab.

  3. Select the cmdstub.dll file or browse for it. See Tips for Using Add-ins.

    Visual C++ will load the add-in. When you close the Customize dialog box, CmdWnd’s toolbar will appear.

  4. Run the CmdWnd add-in by either:
    • Running msdevcmd.exe. msdevcmd.exe finds the first msdev.exe that you are running and uses it.

    • Clicking the toolbar button (the preferred method, especially if you sometimes run more than one msdev.exe). The proxy stub ensures that the add-in uses the correct msdev.exe process.


Pipe: Uses Automation to Filter or Pipe Output from the Text Editor

Click to open or copy the Pipe project files.

Pipe (or Filter as it is called in the Customize dialog box) lets you process text by selecting it in the Visual C++ Text editor, pressing a button, choosing or setting a command, and applying the command to your selection. It is useful in sorting.

Pipe was created with the ATL COM AppWizard. Support MFC was checked in the wizard, and then an Add-in object was added to the project with the ATL Object Wizard. Most of the code added is in MarkIt.cpp.

If you modify the sample, precede each function that could be called from an external interface with the following code:

AFX_MANAGE_STATE(AfxGetStaticModuleState());

This allows you to access your resources and is necessary because of the MFC support.

The CMRUStrings class is used to do the persistence for a drop-down combo box. You can use this class and other classes from the add-ins in other projects. See Reusing Code Topics and Adding Classes to the Gallery for information on how to reuse code.

To build the sample

  1. Click the link at the beginning of this topic to download the sample files.

  2. In Visual C++, open the project file Pipe.dsp.

  3. Choose an appropriate configuration (Win32 Release is best if you plan to use this add-in).

  4. Click Rebuild All from the Build menu.

To run the add-in

  1. From the Tools menu, click Customize.

  2. Click the Add-ins and Macro Files tab.

  3. Select the Pipe.dll file or browse for it. See Tips for Using Add-ins.

    Visual C++ will load the add-in. When you close the Customize dialog box, Pipe’s toolbar will appear.

  4. Run the Pipe add-in by clicking the toolbar button, which will display a dialog box where you can set the command line. For example, you can sort the selection by setting the command to c:\winnt\system32\sort.exe. Or you could issue a dir command with the output inserted into your current file.

Pipe will work on a selection size of 0, on a column selection (SHIFT+ALT and select), whole lines, or partial lines. It will pipe the selection into your command, or allow you to use the selection as a file passed as an argument. You can write or append to a specified file instead of replacing the text in your editor. The buttons in the box named Add To Command are helpers that put strings that will be replaced with file names or a number. These are: the current text editor’s file name; the selection from that file written out to a temporary file as a file name; the starting line of the selection; the ending line of the selection. If you put a file in the Output To edit box, you will turn off the filter feature, and all output from the command will go into this file. Setting the Append to this File check box prevents this file from being destroyed before being written to.

Consider writing your own filters by creating a simple console application. For instance, you could write a filter to remove extra carriage returns and line feeds. Another useful filter would convert hexadecimal numbers to decimal, or the opposite. As a last suggestion, a column organizer is a useful tool for formatting lines by field.

This sample demonstrates the following keywords:

CTimeSpan; CTime::GetCurrentTime; CTime::Format; CRegKey::QueryValue; CRegKey::Create; CRegKey::SetValue, ITextSelection, IApplication, CRegKey; ITextSelection::get_TopLine; CComPtr, CComQIPtr, ITextDocument::get_FullName; CComBSTR, IApplication::get_ActiveDocument; ITextSelection::MoveTo; ITextSelection::put_Text; ITextSelection::get_Text; ITextSelection::EndOfLine; ITextSelection::get_CurrentColumn; ITextSelection::get_TopLine; ITextSelection::get_BottomLine; ITextDocument::get_Selection; ITextDocument::get_Name; CString::Remove; CString::Replace; pipe; filter; addin; customize; CComboBox


ReplAll: Uses Automation to Implement Replace Across Open Text Files

Click to open or copy the ReplAll project files.

ReplAll resembles the Find and Replace dialog box but will find and replace text in all open text files.

To build the sample

  1. Click the link at the beginning of this topic to download the sample files.

  2. In Visual C++, open the project file ReplAll.dsp.

  3. Choose an appropriate configuration (Win32 Release is best if you plan to use this add-in).

  4. Click Rebuild All from the Build menu.

To run the add-in

  1. From the Tools menu, click Customize.

  2. Click the Add-ins and Macro Files tab.

  3. Select the ReplAll.dll file or browse for it. See Tips for Using Add-ins.

    Visual C++ will load the add-in. When you close the Customize dialog box, ReplAll’s toolbar will appear.

  4. Run the ReplAll add-in by clicking the toolbar button. Clicking this button opens a dialog box that resembles the Find and Replace dialog box in Visual C++:
    • It has check boxes for Match whole word only, Match case, and Regular Expression as well as buttons for Replace All and Cancel.

    • It has two edit boxes: Find what and Replace with.

ReplAll deals with the various emulation modes, such as the Brief and Epsilon editors.

This sample demonstrates the following keywords:

IApplication, CComPtr, CComQIPtr; CComBSTR; CComVariant; IDocuments::get__NewEnum; IEnumVARIANT::Next; CComVariant; IDocuments::get_Count; Item; ITextDocument::ReplaceText; ITextEditor::get_Emulation ; IApplication::get_ActiveDocument ; addin; customize; ItextDocument; ITextSelection


VB4Addin: Add-in Created with Visual Basic 4.0

Click to open or copy the VB4Addin project files.

This sample demonstrates the minimal hooks needed to create a Visual C++ 6.0 add-in using Visual Basic 4.0 (32 bit) Enterprise edition.

To build the sample

  1. Start Visual Basic 4.0.

  2. Load the project file (addin.vbp) and build the project.

  3. Place the vb4addin.dll in \Microsoft Visual Studio\Common\MSDev98\addins.

To run the sample

  1. Start Visual C++ and click Customize on the Tools menu.

  2. Choose the Add-ins and Macro Files tab, and select the VBAddin Sample in the list box

    VB4Addin.dll creates a small toolbar that is visible when you close the Customize dialog box.

  3. Click the VB4Addin button on the newly created toolbar. A dialog box will appear indicating that the Addin is correctly installed and working.


VB5Addin: Add-in Created with Visual Basic 5.0

Click to open or copy the VB5Addin project files.

This sample demonstrates the minimal hooks needed to create a Visual C++ 6.0 add-in using Visual Basic 5.0 Enterprise edition. This sample should also build in Visual Basic 6.0.

To build the sample

  1. Start Visual Basic 5.0.

  2. Load the project file (addin.vbp) and build the project.

  3. Place the vb5addin.dll in \Microsoft Visual Studio\Common\MSDev98\addins.

To run the sample

  1. Start Visual C++ and click Customize on the Tools menu.

  2. Choose the Add-ins and Macro Files tab, and select the VBAddin Sample in the list box

    VB5Addin.dll creates a small toolbar that is visible when you close the Customize dialog box.

  3. Click the VB5Addin button on the newly created toolbar. A dialog box will appear indicating that the Addin is correctly installed and working.


Wins: Uses Automation to List and Control Windows

Click to open or copy the Wins project files.

Wins is a window manager that you can use to find, minimize, make visible, activate, and close windows, and also close any windows opened in a debug session. It will create files that, when loaded, will open selected windows.

Wins was built using the ATL COM AppWizard with the Support MFC option. The code that does the work with Automation objects is in WindowsList.cpp. It has some functions you may be able to reuse. For example, FindDoc, given a path to a document, returns a pointer to an IGenericDocument interface, opening it if requested.

Wins also demonstrates how to add sorting to a list control and handling various messages from the list control that are mirrored. MyListCtrl.cpp has some useful functions for using list controls.

To build the sample

  1. Click the link at the beginning of this topic to download the sample files.

  2. In Visual C++, open the project file Wins.dsp.

  3. Choose an appropriate configuration (Win32 Release is best if you plan to use this add-in).

  4. Click Rebuild All from the Build menu.

To run the add-in

  1. From the Tools menu, click Customize.

  2. Click the Add-ins and Macro Files tab.

  3. Select the Wins.dll file or browse for it. See Tips for Using Add-ins.

    Visual C++ will load the add-in. When you close the Customize dialog box, the Wins toolbar will appear.

  4. Run the Wins add-in by clicking the toolbar button. Clicking this button opens a dialog box. Wins is a window manager with controls that represent various window management functions:
    • The Windows Manager button opens a dialog box that lets you look at all your windows, sort them according to file name, file extension, directory, time activated, rectangle coordinates (top, left, bottom, right), and rectangle coordinates in debug mode. It will let you do selections on this, invert selections, and select all. It will save selected files out to a .nfl (named file list) file, and let you reload .nfl files, opening windows as it does. You can minimize, close, or activate windows. The list persists through time, so you can close all windows, and then reopen them.

    • The Refresh button updates all information; you lose debug rect and opened state though.

    • Two check boxes are at the top of the dialog box. One turns on autosize, which will let you set a size that all activated windows will be set to. This is useful if you have a large monitor and windows open with too much white space. The other check box turns on the auto directory feature. This feature causes the currently active directory to follow the active window. If you open a file in c:\dir1, and one in c:\dir2, the current directory will switch from c:\dir1 to c:\dir2 as you activate c:\dir2's file(s), and so on.

    • The Minimize Windows button minimizes all windows.

    • The Set AutoSize button sets the size you expect activated windows to be based on the size of the currently active window if auto-size is set in the windows manager dialog box. If your current window is 400 pixels across when you click this button, the next window activated will automatically be sized to 400 pixels across.

    • The Set All Visible button causes all windows on the screen to become visible. That is, docked windows, such as the output window, watch windows, or workspace windows will not obscure them. This is useful in debug mode and, in fact, will do a show next statement for you just in case the resize caused this to be off-window.

    • The Close Debug Windows button closes all windows that are marked as opened in debug mode.

This sample demonstrates the following keywords:

CTime::GetCurrentTime; CTime::Format; CRegKey::QueryValue; CRegKey::Create; CRegKey::SetValue, ITextSelection, IApplication, CRegKey; ITextSelection::get_TopLine; CComPtr, CComQIPtr, ITextDocument::get_FullName; CComBSTR; IDocuments::get__NewEnum; IEnumVARIANT::Next; CComVariant; IGenericWindow::get_Width; IGenericWindow::get_Height; IGenericWindow::get_Left; IGenericWindow::get_Top; IGenericWindow::put_Width; IGenericWindow::put_Height; IGenericWindow::put_Left; IGenericWindow::put_Top; CRect::IntersectRect; CRect::SetRect; CRect::OffsetRect; IWindows::get__NewEnum; IDebugger::ShowNextStatement; IDebugger::get_State; IGenericWindow::get_Caption; IGenericWindow::get_Width; IGenericWindow::get_WindowState; IGenericWindow::put_WindowState; IApplication::get_Windows; IApplicationEvents::DocumentOpen; IApplicationEvents::DocumentSave; IApplicationEvents::WorkspaceOpen; IApplicationEvents::WindowActivate; CToolTipCtrl::SetToolInfo; CListCtrl::SortItems; window; minimize; close; list; sort; addin; customize; IGenericDocument; IDocuments; CComVariant; IWindows


ATL Samples Index

Listed in the following table are the ATL source code samples currently available. See the Active Template Library (ATL) Reference for more information about ATL.

Sample | Description
ACTIVEDOC | Implements an ActiveX Document Server.
ASYNC | Downloads data asynchronously from a URL.
ATLBUTTON | Creates a button that displays itself with three different bitmaps depending on its state.
ATLCON | Demonstrates a simple control container.
ATLDUCK | Demonstrates using connection points with ATL controls.
ATLFIRE | Demonstrates how to build a windowed control using ATL. This sample is adapted from the MFC FIRE sample.
ATLMOVIE | Demonstrates using compiler COM support and the Active Movie interfaces to play a movie. in an ATL control.
ATLTangram | Demonstrates managing a large ATL project with multiple project dependencies in the IDE. Also demonstrates some basic COM concepts.
BEEPER | Implements a tearoff interface — a collection/enumeration of BSTRs.
CDINFO | Plays CD audio tracks and displays information about the tracks in tooltips and a piechart display.
CIRC | Creates a control that demonstrates property pages and draws a circle.
CIRCCOLL | Implements a collection/enumeration of objects using ATL and STL (C++ Standard Template Library).
COMMAP | Shows how different COM interface map entry macros are used.
CONNECT | Illustrates the implementation and use of connection points (the IconnectionPointContainer and IConnectionPoint interfaces) in a multithreaded environment.
DCOM | Demonstrates how to call a COM object implemented in an NT service from multiple clients running on different machines.
DIRECT3D | Creates a control that draws a spinning triangle using the Direct3D graphics library.
LABRADOR | Implements an EXE server that does not have any user interface.
MFCATL | Illustrates how ATL COM objects can be used in an MFC server EXE.
MINIMAL | Implements a minimalist DLL server as an illustration of how small a DLL can be when created with ATL.
OPENGL | Creates a control that draws a spinning cube using the OpenGL graphics library.
POLYGON | The project files for the ATL Tutorial. Builds a control that implements custom properties, events, property pages, and object safety.
SUBEDIT | Creates a subclassed Windows Control.


ACTIVEDOC: Demonstrates How to Implement an ActiveX Document Server

Click to open or copy the ACTIVEDOC project files.

This sample demonstrates how to implement an ActiveX Document Server. The program demonstrates the following:

  • How to implement the interfaces IOleDocument and IOleDocumentView

  • How to perform menu merging with the container

  • How to implement a toolbar in your object

  • How to override the IPersistStreamInit methods Load and Save to perform custom saving and loading

  • How to use CDialogImpl to implement an About dialog box.

  • How to subclass the Rich Text Edit Control

Running the Sample

Build the project, then start Microsoft Office Binder. On the Section menu click Add. An icon labeled ActiveDoc Class appears. Select this icon and click OK. You should see the object embedded in Office Binder. Notice that the menus have been merged and the ActiveDoc object's toolbar is shown. You can enter text and use the menu and toolbar buttons to change the color of the text that is typed.

The sample contains the following main files:

  • ActiveCtl.h

  • ActiveCtl.cpp — implements CActiveDoc, which represents the overall ActiveDoc object.

  • OleDocument.h — contains the implementation of the IOleDocument and IOleDocumentView interfaces.

  • Toolbar.h — contains CToolbar, which helps with the implementation of the toolbar.

This sample uses the following keywords:

ActiveXDocActivate; ALT_MSG_MAP; ATLASSERT; ATLTRACE; BEGIN_COM_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; BEGIN_TOOLBAR_MAP; CAboutDlg::DoModal; CanInPlaceActivate; CComCoClass; CComControl; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; CComObjectRootEx::InternalQueryInterface; CComPtr; CHARFORMAT; CMenu; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; COMMAND_ID_HANDLER; COMMAND_RANGE_HANDLER; CreateMenu; CreateRTFWindow; CreateToolbar; CreateWindowEx; CToolbar; CWindow::DestroyWindow; CWindow::ModifyStyle; CWindow::SetFocus; CWindow::SetParent; CWindow::SetWindowPos; DECLARE_REGISTRY_RESOURCEID; DestroyMenu; DestroyToolbar; DisableThreadLibraryCalls; DllMain; DoesVerbUIActivate; EDITSTREAM::dwCookie; EDITSTREAM::dwError; EDITSTREAM::pfnCallback; Ellipse; END_COM_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; END_TOOLBAR_MAP; EndDialog; ExtTextOut; FreeLibrary; GetMenuItemCount; GetMenuItemID; GetMenuState; GetMenuString; GetResourceInstance; GetStockObject; GetSubMenu; GetTextMetrics; GetWindow; GetWindowContext; GetWindowRect; HDC; hdcDraw;; IDataObjectImpl; IDispatchImpl; InitCommonControls; InlineIsEqualGUID; InPlaceDeactivate; InPlaceMenuCreate; InPlaceMenuDestroy; InsertMenu; InterfaceSupportsErrorInfo; InternalQueryInterface; IOleControlImpl; IOleDocument::GetDocMiscStatus; IOleDocumentImpl; IOleDocumentView::ApplyViewState; IOleDocumentView::SetInPlaceSite; IOleDocumentViewImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceFrame* pFrame;; IOleInPlaceFrame::InsertMenus; IOleInPlaceFrame::Release; IOleInPlaceFrame::SetMenu; IOleInPlaceObjectWindowlessImpl; IOLEInPlaceSite::GetWindowContext; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IQuickActivateImpl; ISupportErrorImpl; IViewObjectExImpl; LoadLibrary; LoadMenu; LoadString; MAKEINTRESOURCE; MergeMenus; MESSAGE_HANDLER; NOTIFY_CODE_HANDLER; OBJECT_ENTRY; OleCreateMenuDescriptor; OLEINPLACEFRAMEINFO; OnInPlaceActivate; OnUIActivate; prcBounds; RECT rcPos, rcClip;; RemoveMenu; SelectObject; SendMessage; SetActiveObject; SetBkMode; SetBorderSpace; SetControlFocus; SetFocus; SetInPlaceSite; SetMenu; SetObjectRects; SetTextColor; ShowObject; ShowWindow; UIActivate; UIDeactivate; UnmergeMenus; ZeroMemory


ASYNC: Demonstrates Downloading Data Asynchronously

Click to open or copy the ASYNC project files.

This sample creates a control that downloads data asynchronously from a URL. The control implements the IBindStatusCallback interface. Typically, you asynchronously download large binary objects or properties. This allows the control's user interface to remain unblocked during potentially lengthy network operations. The use of asynchronous downloading also gives the user a chance to abort the download. ATL uses WinInet functions internally to implement asynchronous downloading.

ASYNC creates a subclassed edit control with one property called URL. The URL property is a BSTR that represents a URL that points to data. The ASYNC sample uses the ATL CBindStatusCallback class to implement asynchronous downloading. When the control user sets the URL property, ASYNC creates a CBindStatusCallback object. The CBindStatusCallback::StartAsyncDownload method is then called and passed both the URL and a pointer to a callback function. This function, CAtlAsync::OnData, is called by the CBindStatusCallback object and is passed the binary data from the URL as it is received. CAtlAsync::OnData simply sends the received data to the subclassed edit control, where it is displayed.

Running the Sample

Load the AtlAsync.htm file into your web browser. Type a URL into the edit control and press the Go button. This sets the ASYNC control's URL property to the URL you typed and starts the download. As data is downloaded, you will see it displayed in the ASYNC control.

For an example of how to subclass Windows controls using ATL, see the ATL SubEdit sample.

This sample uses the following keywords:

ALT_MSG_MAP; ATLTRACE ; BEGIN_COM_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CBindStatusCallback::Download; CComBSTR::Append; CComCoClass; CComControl; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; DECLARE_REGISTRY_RESOURCEID; DisableThreadLibraryCalls; DLL_PROCESS_ATTACH; DLL_PROCESS_DETACH; DllMain; END_COM_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; IDataObjectImpl; IDispatchImpl; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleInPlaceObjectWindowlessImpl::SetObjectRects; IOleObjectImpl; IPerPropertyBrowsingImpl; IPersistPropertyBagImpl; IPersistStorageImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IQuickActivateImpl; IsWindow; IViewObjectExImpl; MESSAGE_HANDLER; OBJECT_ENTRY; PROP_ENTRY; SendMessage; USES_CONVERSION


ATLBUTTON: Demonstrates a Button with Bitmaps for Different States

Click to open or copy the ATLBUTTON project files.

This sample creates a button that displays itself with one of three different bitmaps, depending on its state. The button has a bitmap for: the unpushed state; the hover state (when the mouse moves over the button); and the pushed state. Default bitmaps are included with the sample, but you can override these properties to use your own bitmaps.

This sample uses the following keywords:

Apartment; ATLTRACE; AtlWaitWithMessageLoop; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComControl::FireViewChange; CComControl::InPlaceActivate; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; CloseHandle; CoGetInterfaceAndReleaseStream; CoInitialize; COleControl::OnClick; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL_IID; CoMarshalInterThreadInterfaceInStream; CONNECTION_POINT_ENTRY; CProxy_ATLButton; CreateDIBPalette; CreatePalette; CreateThread; CTimer; DECLARE_HANDLE; DECLARE_REGISTRY_RESOURCEID; DIBNumColors; DisableThreadLibraryCalls; DLL_PROCESS_DETACH; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; GetCursorPos; GetFileSize; GetWindow; GlobalAlloc; GlobalFree; GlobalLock; GlobalSize; GlobalUnlock; IConnectionPointContainerImpl; IConnectionPointImpl; IDispatchImpl; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleInPlaceObjectWindowlessImpl::InPlaceDeactivate; IOleObjectImpl; IPersistPropertyBagImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IViewObjectExImpl; LPLOGPALETTE; MESSAGE_HANDLER; OBJECT_ENTRY; PaintDIB; PaletteSize; PROP_ENTRY; PtInRect; PutImage; ReadDIBFile; ReadFile; RealizePalette; ScreenToClient; SelectPalette; SetDIBitsToDevice; SetStretchBltMode; Sleep; StretchDIBits; TimerOff; TimerOn; Unlock; USES_CONVERSION


ATLCON: Demonstrates Creating a Simple Container

Click to open or copy the ATLCON project files.

This sample demonstrates creating a simple container. The container implements the IOleClientSite, IOleWindow, and IOleInPlaceSite interfaces.

To successfully run the ATLCON sample under a MinCRT configuration, you must remove the WinMain entry point as follows:

  1. Click Settings on the Projects menu.

  2. In the Settings For: drop-down list, choose one of the MinCRT configurations.

  3. On the Link tab, choose the Output category.

  4. Remove the text in the Entry-point symbol edit box.

This sample uses the following keywords:

ATLASSERT; ATLTRACENOTIMPL; BEGIN_COM_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; CComCoClass; CComModule::Unlock; CComObjectRoot; CComQIPtr; CExeModule::Init; CExeModule::RegisterClassObjects; CExeModule::RegisterServer; CExeModule::RevokeClassObjects; CExeModule::Unlock; CExeModule::UnregisterServer; CExeModule::UpdateRegistryFromResource; Close; CoCreateInstance; CoInitialize; COM_INTERFACE_ENTRY; COMMAND_ID_HANDLER; CoUninitialize; CWindowImpl; DECLARE_REGISTRY_RESOURCEID; DispatchMessage; DoVerb; END_COM_MAP; END_MSG_MAP; END_OBJECT_MAP; GetClientRect; GetCommandLine; GetCurrentThreadId; GetDesktopWindow; GetMessage; GetResourceInstance; IAtlCon; IOleClientSite; IOleInPlaceSite; LoadMenu; LPOLEINPLACEFRAMEINFO; LPRECT; MESSAGE_HANDLER; MessageBox; OBJECT_ENTRY; PostQuitMessage; PostThreadMessage; SetClientSite; SetObjectRects; ShowWindow; TranslateMessage; ZeroMemory


ATLDuck: Uses Connection Points with ATL

Click to open or copy the ATLDuck project files.

The ATLDuck sample consists of two projects: atlduck and duck. The duck project creates an instance of an object that implements the IDuckInt interface. This interface includes four member functions: Flap, Paddle, Quack, and Walk.

The second project, atlduck, has a connection point for the IDuckInt interface (that is, it knows how to use the interface but does not implement it). Only a single instance of this object will be created. Once the connection is established between the two applications, atlduck will call the functions in IDuckInt interface for sinks which have called IConnectionPoint::Advise.

This sample also makes use of the marshalling code needed to connect interfaces in different processes.

Building the Sample

  1. Open workspace atlduck.dsw, which includes the two projects: duck and atlduck. From the command line, and having the correct folder as current directory, build the DLLs for the marshalling code:
    nmake –f duckps.mk
nmake –f atlduckps.mk

    These commands will build the files duckps.dll and atlduckps.dll, respectively.

  2. Register the DLLs by issuing the following commands:
    regsvr32 duckps.dll
regsvr32 atlduckps.dll

  3.
Register the atlduck local server, running the application with the following command:
    atlduck /regserver

    4.

The sample is ready use.

Running the Sample

Start one or more instances of duck.exe.

Note   Opening several instances of duck.exe demonstrates connection points most effectively.

A dialog box appears. In the dialog box, click the button Create DoDuck Object. When you click this button, the application creates an instance of an object with class ID CLSID_DuckDoer, running atlduck. A new dialog box, issued by atlduck.exe, appears. This dialog box shows a button for each one of the functions in the IDuckInt interface, as well as a list box with all the connections to active sinks, and their cookies. From the duck dialog boxes, you can either Advise or Unadvise the connection point. Depending on your choice, you will receive or not receive notifications from the sources. The notification, when you receive it, will show in the status edit field. Additionally, ATLDuck demonstrates the value of the cookie supplied by the connection point when the connection is advised.

The sample use the following classes:

CDialog (MFC), CComObject (ATL), IConnectionPointImpl<CDuckDoer> (ATL)

This sample uses the following keywords:

_ASSERTE; _tcslen; _VERIFY; AddRef; Advise; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; CComCoClass; CComModule::Unlock; CComObjectRootEx; CDialogImpl; CenterWindow; CoInitialize; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; COMMAND_HANDLER; COMMAND_ID_HANDLER; CONNECTION_POINT_ENTRY; CoSuspendClassObjects; CoUninitialize; Create; DECLARE_CLASSFACTORY_SINGLETON; DECLARE_NOT_AGGREGATABLE; DECLARE_REGISTRY_RESOURCEID; DestroyWindow; DispatchMessage; EnableWindow; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MSG_MAP; END_OBJECT_MAP; ExitProcess; FindConnectionPoint; GetCommandLine; GetDC; GetDlgItem; GetMessage; GetTextExtentPoint32; IConnectionPointContainerImpl; IConnectionPointImpl; Init; IsWindowVisible; MESSAGE_HANDLER; MessageBox; OBJECT_ENTRY; OleInitializeCoCreateInstance; OnCancel; OnFlap; OnInitDialog; OnOK; OnPaddle; OnWalk OnQuack; PostThreadMessage; QueryInterface; RecalcListboxExtent; RegisterClassObjects; RegisterServer; reinterpret_cast; ReleaseDC; RevokeClassObjects; SendMessage; SetOwner; SetWindowText; ShowStatus; ShowWindow; Unadvise; UnregisterServer; UNUSED_ALWAYS; UpdateRegistryFromResource; UpdateWindow; USES_CONVERSION


ATLFire: Demonstrates Building a Windowed Control

Click to open or copy the ATLFire project files.

AtlFire is an ActiveX control that is adapted from the MFC Fire sample. The sample demonstrates how to build a windowed control using ATL by setting the m_bWindowedOnly flag to TRUE. It also shows what needs to be done to the MFC drawing code to convert it into straight Win32 code. The sample uses the ATL support for Win32 dialog boxess and property sheets and also demonstrates how to use a Win32 tab control in an ActiveX control. The sample also demonstrates several of the ATL macros.

The sample uses the following ATL classes:

CComObjectRootEx, CComCoClass, CComControl, IDispatchImpl, IProvideClassInfo2Impl, IPersistStreamInitImpl, IPersistStorageImpl, IPersistPropertyBagImpl, IPerPropertyBrowsingImpl, IQuickActivateImpl, IObjectSafetyImpl, IOleControlImpl, IOleObjectImpl, IOleInPlaceActiveObjectImpl, IViewObjectExImpl, IOleInPlaceObjectWindowlessImpl, IDataObjectImpl, ISupportErrorInfo, ISpecifyPropertyPagesImpl, IConnectionPointContainerImpl, IPropertyNotifySinkCP, CDialogImpl

The sample uses the following keywords:

_ASSERTE; _itot; _tcstol; ALT_MSG_MAP; Apply; ATLTRACE; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRootEx; CDialogImpl; ClientToScreen; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; COM_INTERFACE_ENTRY_IMPL_IID; COMMAND_HANDLER; COMMAND_ID_HANDLER; CONNECTION_POINT_ENTRY; CPropDlg::DoModal; CreateBitmap; CreatePalette; DECLARE_REGISTRY_RESOURCEID; DeleteDC; DeleteObject; DestroyMenu; DisableThreadLibraryCalls; EnableWindow; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; EndDialog; FillRect; FireOnChanged; GetActiveWindow; GetClientRect; GetDlgItem; GetDlgItemText; GetModuleInstance; GetWindowRect; IConnectionPointContainerImpl; IDataObjectImpl; IDispatchImpl; InitFire; InlineIsEqualGUID; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleObjectImpl; IPersistPropertyBagImpl; IPersistStorageImpl; IPersistStreamInitImpl; IPropertyNotifySinkCP; IProvideClassInfo2Impl; IQuickActivateImpl; ISpecifyPropertyPagesImpl; ISupportErrorInfo; IViewObjectExImpl; memcpy; MESSAGE_HANDLER; MessageBox; NOTIFY_CODE_HANDLER; OBJECT_ENTRY; OnActivate; OnApply; OnCancel; OnCreate; OnDestroy; OnEraseBackground; OnInitDialog; OnOK; OnPaint; OnPaletteChanged; OnProperties; OnPropertyChanged; OnQueryNewPalette; OnRButtonDown; OnSelChanged; OnSelChanging; OnSize; OnTimer; PAINTSTRUCT ; PeekMessage; PROP_ENTRY; RealizePalette; SelectObject; SendMessage; SetTimer; SetWindowPos; TrackPopupMenuEx; UnregisterClass


ATLMovie: Uses Compiler COM Support and Active Movie Interfaces in an ATL Control

Click to open or copy the ATLMovie project files.

This ATL control demonstrates how to use compiler COM support and the Active Movie interfaces to play a movie. It implements the following COM properties and methods on its IMovieCtl interface.

Properties

Name | Description
FileName | The filename of the movie to play.

Methods

Name | Description
Pause | Pause the currently playing movie.
Play | Play the movie pointed to by the FileName property.
Reset | Reset the playing position to the beginning of the movie.
Stop | Stop the movie.

This sample uses the following keywords:

BEGIN_COM_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRootEx; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; COM_INTERFACE_ENTRY_IMPL_IID; CreateBrushIndirect; CreateFilterGraph; CWindow::GetDC; DECLARE_REGISTRY_RESOURCEID; DeleteObject; DisableThreadLibraryCalls; END_COM_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; FillRect; GetProperty; IDispatchImpl; IMediaControlPtr::Pause; IMediaControlPtr::Release; IMediaControlPtr::RenderFile; IMediaControlPtr::Run; IMediaControlPtr::Stop; IMediaPositionPtr::CurrentPosition; IMediaPositionPtr::Duration; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleInPlaceObjectWindowlessImpl::SetObjectRects; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IVideoWindowPtr ::Owner IVideoWindowPtr::.CreateInstance; IVideoWindowPtr::Owner ; IVideoWindowPtr::SetWindowPosition; IVideoWindowPtr::Visible ; IVideoWindowPtr::WindowStyle ; IViewObjectExImpl; MESSAGE_HANDLER; OBJECT_ENTRY; OffsetRect; OleTranslateColor; Reset; SetWindowPosition; SysFreeString


ATLTangram: Demonstrates Managing Large Projects That Use ATL, MFC, and COM

Click to open or copy the ATLTangram project files.

ATLTangram is a port of the Tangram example found in the last chapter of Dale Rogerson's Inside Com (http://mspress.microsoft.com). Many thanks to Dale for doing all the hard work and allowing us to use the code in an ATL sample. This sample will help you convert a legacy COM application to one that uses ATL for its infrastructure.

ATLTangram is a large project consisting of the ATLTangram workspace, which is the master controller for seven subprojects: MFCTangram, ATLModel, ATLGdiWorld, ATLGLWorld, ATLModelps, ATLModelExe, and ATLTangramCanvas. The sample demonstrates several features of the Visual C++ Integrated Development Environment (IDE) and several concepts of COM. The sample also demonstrates using MFC as the client of ATL COM servers.

Managing a Large Project

All of the project settings are already established for the sample. Follow these steps to examine the project interdependencies.

  1. From the Project menu, click Project Settings.

  2. Click the Custom Build tab to examine the rules used for idl files and for various projects

  3. Click the C/C++ tab, and in the Category drop-down, select Preprocessor. Examine the Additional Include Directories edit box.

  4. Click the Post-Build Step tab to examine the post-build commands to copy files to the ATLModelps directory. The sample requires several files after the MIDL compiler runs in the ATLModel project.

  5. From the Project menu, click Project Dependencies and examine the dependent project names.

The ATLModel and ATLModelExe projects demonstrate how to set up a COM server so you can build it as either an in-proc server or a local server using the same set of files and two project files. Using two project files allows dependencies to exist on both the DLL and the EXE.

COM/ATL Features

This sample is a COM system that consists of several COM servers and an MFC application that uses the servers. The sample exhibits the intermodule communication via the connection point mechanism and demonstrates local and in-proc servers.

Other Demonstrated Features

  • The ATL servers use Standard Template Library for collections.

  • The MFC driver uses MFC template classes.

  • The MFC driver, an example of a non-document/view application, uses a class derived from CFrameWnd as the output window for the drawing the Tangram pieces.

The sample uses the following ATL classes:

CComObjectRootEx, CComCoClass, CComControl, IDispatchImpl, IProvideClassInfo2Impl, IPersistStreamInitImpl, IPersistStorageImpl, IPersistPropertyBagImpl, IPerPropertyBrowsingImpl, IQuickActivateImpl, IObjectSafetyImpl, IOleControlImpl, IOleObjectImpl, IOleInPlaceActiveObjectImpl, IViewObjectExImpl, IOleInPlaceObjectWindowlessImpl, IDataObjectImpl, ISupportErrorInfo, ISpecifyPropertyPagesImpl, IConnectionPointContainerImpl, IPropertyNotifySinkCP, CDialogImpl

The sample uses the following MFC classes:

CFrameWnd, CTypedPtrList<>, CDialog, CWinApp, and additional supporting classes.

This sample uses the following keywords:

_ASSERTE; AddRef; AddUpdateRect; Advise; assert; ASSERT; ATLTRACE; auxSolidSphere; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MESSAGE_MAP; BEGIN_OBJECT_MAP; BitBlt; CATEGORYINFO ; CComCoClass; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRootEx; CExeModule::Init; CExeModule::RegisterClassObjects; CExeModule::RegisterServer; CExeModule::RevokeClassObjects; CExeModule::UnregisterServer; CExeModule::UpdateRegistryFromResource; CFrameWnd::AssertValid; CFrameWnd::Dump; CFrameWnd::PreCreateWindow; ChoosePixelFormat; CModelList; CoCreateInstance; CoInitializeEx; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_AGGREGATE; COM_INTERFACE_ENTRY_IMPL; CONNECTION_POINT_ENTRY; CopyRect; CoTaskMemFree; CProxyIATLTangramModelEvent; CreateCompatibleDC; CreatePalette; CWnd::CreateEx; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_MESSAGE_MAP; DECLARE_ONLY_AGGREGATABLE; DECLARE_REGISTRY_RESOURCEID; DeleteObject; DescribePixelFormat; DisableThreadLibraryCalls; DispatchMessage; DoButtonDown; DoModal; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MESSAGE_MAP; END_OBJECT_MAP; EqualRect; ErrorMessage; GdiFlush; GetBoundingRect; GetClientRect; GetCommandLine; GetControllingUnknown; GetDC; GetMessage; GetModuleFileName; GetObject; GetPalette; GetPaletteEntries; GetPixelFormat; GetRotation; GetVertices; glBegin; glClearColor; GLdouble CoCreateInstance; glEnable; glEnd; glFlush; glGetIntegerv; glInitNames; glLightfv; glLightModelfv; glLoadIdentity; glMatrixMode; glNormal3d; glPolygonMode; glPopMatrix; glPopName; glPushMatrix; glPushName; GLRender; glRenderMode; GLResize; glRotated; glSelectBuffer; GLSetup; glTranslated; glTranslatef; gluPerspective; gluPickMatrix; gluUnProject; glVertex2d; glVertex3d; glViewport; HPALETTE; ICatInformation::EnumClassesOfCategories; ICatRegister::QueryInterface; ICatRegister::RegisterCategories; ICatRegister::RegisterClassImplCategories; ICatRegister::UnRegisterCategories; ICatRegister::UnRegisterClassImplCategories; IConnectionPointContainer::FindConnectionPoint; IConnectionPointContainer::Release; IConnectionPointContainerImpl; InitInstance; InvalidateRect; IsCurrent; IsValidAddress; IUnknown::Release; LoadIcon; LoadStandardCursor; LocalFree; MakeCurrent; OBJECT_ENTRY; ON_COMMAND; ON_WM_DESTROY ; OnCancel; OnDestroy; OnInitDialog; OnOK; OnQueryNewPalette; OutputDebugString; OutputGlError; Polygon; PreCreateWindow; PtInRegion; QueryInterface; RealizePalette; Release; ReleaseConnectionPoint; ReleaseDC; Rotate; SelectObject; SelectPalette; SetPixelFormat; SetRectEmpty; specifyMaterial; StringFromCLSID; SubkeyExists; va_end; wcscpy; wglCreateContext; wglGetCurrentContext; wglMakeCurrent

Building the Sample

The project has established all the interdependencies in the IDE. These interdependencies work with the default directory structure for the sample and are path-relative.

The MFCTangram project drives all of the other projects. By building this project, you will build all of the necessary, interdependent projects:

  1. In ClassView, right-click MFCTangram classes. Click Set as Active Project.

  2. On the menu bar, click Build. Click Build MFCTangram.exe. Building MFCTangram will build all of the necessary projects that MFCTangram is dependent upon.

The dependency hierarchy looks roughly like this:

MFCTangram
   ATLGLWorld
      ATLGdiWorld
         ATLTangramCanvas
            ATLModel
   ATLModelExe
      ATLModel
   ATLModelps
      ATLModel


BEEPER: Demonstrates a Tearoff Interface

Click to open or copy the BEEPER project files.

This basic sample illustrates the implementation of a tearoff interface - a collection/enumeration of BSTR values. It can be built as a DLL and as an EXE.

The sample MINIMAL shows how to build a DLL that does not link in the C run-time libraries (how to use #define _ATL_MIN_CRT).

Running the Sample

Build BEEPER (.exe or .dll) and make sure it is registered. Load the .vbp file into Visual Basic and run the program. Press the button to activate the application. With the DLL version, you can also run the application from Beeper.htm (an HTML file that uses VB Script) in Internet Explorer 3.0 or 4.0.

This sample uses the following keywords:

BEGIN_COM_MAP; CComCoClass; CComModule::Unlock; CComObjectRoot; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_TEAR_OFF; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_NOT_AGGREGATABLE; DECLARE_REGISTRY; END_COM_MAP; FinalConstruct; IDispatchImpl; ISupportErrorInfo; PostThreadMessage; return Error; SysAllocString; THREADFLAGS_BOTH


CDINFO: Plays and Displays Information about CD Audio Tracks

Click to open or copy the CDINFO project files.

This sample uses the Media Control Interface (MCI) APIs to retrieve the length of the audio tracks on the CD currently in your CD-ROM drive. CDINFO then draws a piechart to display track length. CDINFO also demonstrates how to use the ToolTip common control to implement a tool tip. This tool tip displays the audio track length corresponding to the cursor's location in the piechart.

There is a VB sample in the VBTEST subdirectory that demonstrates use of the control.

The control implements the following methods:

Read Reads the track length information from the CD currently in the drive and displays the information in the form of a piechart.

Redraw Redraws the piechart for the current CD.

Play Starts playing the CD at the specified track number. The control also rotates the piechart so that the track playing is at the top.

The following properties are available:

Tracks The number of tracks on the CD

Length The length of the specified track number in seconds

TotalLength The total length of the CD in seconds

This sample uses the following keywords:

BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComObjectRoot; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; CONNECTION_POINT_ENTRY; CProxyCDEvents; CreateBrushIndirect; CreateRectRgn; DECLARE_REGISTRY_RESOURCEID; DeleteDC; DeleteObject; DrawCD; Ellipse; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; IConnectionPointContainerImpl; IConnectionPointImpl; IDataObjectImpl; IDispatchImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleLinkImpl; IOleObjectImpl; IPerPropertyBrowsingImpl; IPersistStorageImpl; IPersistStreamInitImpl; IPropertyNotifySinkCP; IProvideClassInfo2Impl; IQuickActivateImpl; IRunnableObjectImpl; IViewObjectExImpl; LineTo; mciSendCommand; MESSAGE_HANDLER; MoveToEx; OBJECT_ENTRY; ReduceRect; RelayEvent; SelectClipRgn; SelectObject; VariantInit; ZeroMemory


CIRC: Demonstrates Using Property Pages

Click to open or copy the CIRC project files.

This sample shows how to use ATL to make a simple ActiveX control. The CIRC sample creates a control that draws a circle and demonstrates property pages, control painting, use of color and caption properties, Click and KeyPress events, and a Color Property page.

Running the Sample

Build CIRC.DLL and make sure it is registered. Insert it in a control container and test the properties and events.

This sample uses the following keywords:

AtlCreateTargetDC; ATLTRACE; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CCircPropertyPageDlg ; CComCoClass; CComControl; CComControl::SetDirty; CComObjectRoot; CDialogImpl; CHAIN_MSG_MAP; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IID; COM_INTERFACE_ENTRY_IMPL; COMMAND_ID_HANDLER; CONNECTION_POINT_ENTRY; CProxy_CircEvents; CreateEllipticRgn; CreatePen; CreateSolidBrush; CStockPropImpl; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_REGISTRY_RESOURCEID; Ellipse; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; GetClientRect; GetDialogBaseUnits; GetStockObject; GetTextMetrics; IConnectionPointContainerImpl; IConnectionPointImpl; IDataObjectImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleLinkImpl; IOleObjectImpl; IOleObjectImpl::DoVerb; IPerPropertyBrowsingImpl; IPersistPropertyBagImpl; IPersistStorageImpl; IPersistStreamInitImpl; IPropertyNotifySinkCP; IPropertyPageImpl; IPropertyPageImpl::SetObjects; IProvideClassInfo2Impl; IQuickActivateImpl; IQuickActivateImpl::QuickActivate; IRunnableObjectImpl; ISpecifyPropertyPagesImpl; IViewObjectExImpl; MESSAGE_HANDLER; OBJECT_ENTRY; OleTranslateColor; PROP_ENTRY; SelectObject; SendDlgItemMessage; SetBkMode; SetTextColor; SetWindowRgn; USES_CONVERSION


CIRCCOLL: Demonstrates a Collection/Enumeration

Click to open or copy the CIRCCOLL project files.

This sample shows how to implement a collection/enumeration of objects using ATL and STL (C++ Standard Template Library). Three object classes are implemented: the collection creator, the collection, and the object inside the collection. Only the collection creator has a coclass associated with it (see Circcoll.idl for the coclass declaration). The collection creator has a method to return a collection of circle objects. The collection object implements the Item, Count, and _NewItem methods, so that the object can be manipulated from Visual Basic using both the For...Next and For Each... syntax.

Running the Sample

Build Circcoll.dll and make sure it is registered. Load the .vbp file into Visual Basic and run the program. Press the button to activate the application.

This sample uses the following keywords:

AddRef; ATLASSERT; ATLTRACE; BEGIN_COM_MAP; BEGIN_OBJECT_MAP; CComCoClass; CComObject::CreateInstance; CComObjectRoot; CComVariant; COM_INTERFACE_ENTRY; DECLARE_NOT_AGGREGATABLE; DECLARE_REGISTRY; END_COM_MAP; END_OBJECT_MAP; glBegin; glEnd; glNormal3d; glPolygonMode; glVertex2d; glVertex3d; IConnectionPointContainerImpl::FindConnectionPoint; IConnectionPointImpl::Advise; IDispatchImpl; ISupportErrorInfo; OBJECT_ENTRY; QueryInterface; Release; USES_CONVERSION; VariantCopy; VariantInit


COMMAP: Demonstrates COM Interface Map Entry Macros

Click to open or copy the COMMAP project files.

This basic sample shows how different COM interface map entry macros are used.

Running the Sample

Build Aggreg.dll first, then build Commap.dll. Use Commap.htm (an HTML file that uses VB Script) from Internet Explorer 3.0 or 4.0. Commap.htm includes comments about each type of map entry. You can also load the .vbp file into Visual Basic and run the program.

The COMMAP sample will not register correctly when its path contains spaces. One solution to this problem is to edit the corresponding .rgs file and add single quotes around all occurrences of %MODULE%. For example, you would change a line containing the following:

InprocServer32 = s %MODULE%

to the following:

InprocServer32 = s '%MODULE%'

This sample uses the following keywords:

BEGIN_COM_MAP; CComCoClass; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; CComTearOffObjectBase; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_AGGREGATE; COM_INTERFACE_ENTRY_AGGREGATE_BLIND; COM_INTERFACE_ENTRY_AUTOAGGREGATE; COM_INTERFACE_ENTRY_AUTOAGGREGATE_BLIND; COM_INTERFACE_ENTRY_CACHED_TEAR_OFF; COM_INTERFACE_ENTRY_TEAR_OFF; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_REGISTRY_RESOURCEID; DisableThreadLibraryCalls; END_COM_MAP; IDispatchImpl; ISupportErrorInfo; SysAllocString


CONNECT: Demonstrates Implementation and Use of Connection Points

Click to open or copy the CONNECT project files.

This sample illustrates the implementation and use of connection points (the IConnectionPointContainer and IConnectionPoint interfaces) in a multithreaded environment.

The server is implemented in the Connect.dll. This DLL allows the creation of a CoRandom COM object, implemented by the CRandom C++ class. The COM object supports IRandom (a dual interface) and IConnectionPointContainer, and it accepts connections for the IRandomEvent interface.

The IRandom interface supports the following methods:

  • Start — starts a thread inside the object

  • Stop — stops a thread inside the object

  • StopAll — stops all the running threads

When running, the secondary threads inside the object keep firing events through the connection point.

Two clients are provided: DRIVE and MDRIVE. They can be found in the DRIVE and MDRIVE subdirectories.

Drive.exe is a simple console application that provides a single object implementing the IRandomEvent interface. It creates a CoRandom object, calls Advise/Unadvise on the connection point, and makes the CoRandom object fire events into the drive's object.

Mdrive.exe is an MFC dialog-based application can create multiple advise sinks and control the number of threads the server creates. When you run Mdrive.exe, click the Start button at least once, then click the Advise button several times. Each click of the Advise button adds a connection point, which makes the display wider. If you do not click the Advise button, you will see no activity in the display.

Running the Sample

Build Connect.dll and register it. You can build and run Drive.exe from the command line, or build and run Mdrive.exe from Visual C++.

The CONNECT sample will not register correctly when its path contains spaces. One solution to this problem is to edit the corresponding .rgs file and add single quotes around all occurrences of %MODULE%. For example, you would change a line containing the following:

InprocServer32 = s %MODULE%

to the following:

InprocServer32 = s '%MODULE%'

This sample uses the following keywords:

AfxGetApp; AfxMessageBox; AtlAdvise; ATLASSERT; AtlUnadvise; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MESSAGE_MAP; BEGIN_OBJECT_MAP; CComCoClass; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObject::CreateInstance; CComObjectRoot; CDialog::OnCancel; CDialog::OnOK; CloseHandle; CoCreateInstance; COleTemplateServer::RegisterAll; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; COM_INTERFACE_ENTRY2; CONNECTION_POINT_ENTRY; CoUninitialize; CreateEvent; CreateThread; DECLARE_REGISTRY_RESOURCEID; DisableThreadLibraryCalls; DoModal; DrawIcon; Enable3dControls; Enable3dControlsStatic; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MESSAGE_MAP; END_OBJECT_MAP; GdiFlush; GetClientRect; GetDlgItem; GetTickCount; GetUnknown; IConnectionPointContainerImpl; IConnectionPointImpl; IDispatchImpl; ISupportErrorInfo; LoadIcon; Lock; memset; OBJECT_ENTRY; ON_COMMAND; puts; ReleaseDC; SendMessage; SetEvent; SetIcon; SetPixel; Sleep; Unadvise; Unlock; WaitForSingleObject


DCOM: Demonstrates Remotely Calling a COM Object

Click to open or copy the DCOM project files.

This sample demonstrates how to call a COM object implemented in a Windows NT service from multiple clients running on different machines. It is composed of three parts:

  • DrawServ — The Windows NT service that implements the COM object.

  • ATLDraw — The client that connects to the DrawServ COM object.

  • DrawCtl — A control version of ATLDraw.

Running the Sample

For this sample to work, all machines must be running Windows NT 4.0 or later.

  1. Build the DrawServ, ATLDraw, and DrawCtl samples.

  2. Copy the DrawServ.exe and ATLDraw.exe or DrawCtl.dll to each machine on which you want to run the sample. Register the server on each machine by running DrawServ with the command-line argument /RegServer or -RegServer (this is case-insensitive). For example: C:\ATL> DrawServ /RegServer

    (ATL.DLL must be registered for this to work.) You must copy the server to each client to register the CLSID for the server and the server type library on each client.

  3. Start the service on the server by using the Services icon in Control Panel.

  4. Using DCOMCNFG on each client, select the Properties of the DrawServ Class. From the Location tab, select Run application on the following computer. Enter the name of the computer on which you are running the server object.

  5. Run ATLDraw and select Server. Connect from the menu on each client. Draw on the client window by holding the left mouse button down and dragging a line. The drawn line should appear on each client that is connected to the same server. You can also use the View/Color menu option to change the color for each client.

The DRAWSERV sample will not register correctly when its path contains spaces. One solution to this problem is to edit the corresponding .rgs file and add single quotes around all occurrences of %MODULE%. For example, you would change a line containing the following:

InprocServer32 = s %MODULE%

to the following:

InprocServer32 = s '%MODULE%'

This sample uses the following keywords:

AfxMessageBox; ASSERT_VALID; ATLASSERT; AtlUnadvise; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_INTERFACE_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; CComCoClass; CComControl; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::Unlock; CComModule::UnregisterServer; CComModule::UpdateRegistryFromResource; CComObjectRoot; CDocument::OnNewDocument; CFrameWnd::AssertValid; CFrameWnd::DockControlBar; CFrameWnd::Dump; CFrameWnd::EnableDocking; CFrameWnd::OnCreate; CFrameWnd::PreCreateWindow; CloseServiceHandle; CoCreateInstance; CoCreateInstanceEx; CoInitialize; CoInitializeSecurity; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; COM_INTERFACE_ENTRY_IMPL_IID; COM_INTERFACE_ENTRY2; CONNECTION_POINT_ENTRY; ConnectSink; ControlService; CoUninitialize; CProxyIDrawServ; CreatePen; CreateService; CStatusBar::SetIndicators; CToolBar::EnableDocking; CToolBar::LoadToolBar; CView::DoPreparePrinting; CView::OnLButtonUp(nFlags, point);; CView::PreCreateWindow; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::Enable3dControlsStatic; CWinApp::LoadStdProfileSettings; CWinApp::ParseCommandLine; CWinApp::ProcessShellCommand; CWindow::SetCapture; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_REGISTRY_RESOURCEID; DeleteObject; DeregisterEventSource; DisableThreadLibraryCalls; Disconnect; DisconnectSink; END_COM_MAP; END_CONNECTION_POINT_MAP; END_INTERFACE_MAP; END_OBJECT_MAP; GetModuleFileName; IConnectionPointContainerImpl; IDataObjectImpl; IDispatchImpl; IMPLEMENT_DYNCREATE; Install; INTERFACE_PART; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IQuickActivateImpl; ISupportErrorInfo; IViewObjectExImpl; IViewObjectExImpl::Draw; LineTo; LoadString; LogEvent; MESSAGE_HANDLER; MessageBox; MoveToEx; OBJECT_ENTRY; OffsetRect; OpenSCManager; OpenService; PostThreadMessage; PtInRect; QueryInterface; RegisterEventSource; ReleaseDC; ReportEvent; SelectObject; SetCapture; SetServiceStatus; SetWindowOrgEx; StartServiceCtrlDispatcher; Uninstall


DIRECT3D: Demonstrates Using Direct3D

Click to open or copy the DIRECT3D project files.

This sample creates a control that draws a spinning triangle using the Direct3D graphics library.

This sample uses the following keywords:

Apartment; ATLASSERT; ATLTRACE; AtlWaitWithMessageLoop; BEGIN_COM_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComControlBase::InPlaceActivate; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; CException::ReportError; CoGetInterfaceAndReleaseStream; CoInitialize; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; COM_INTERFACE_ENTRY_IMPL_IID; CoMarshalInterThreadInterfaceInStream; CopyMemory; CoUninitialize; CreatePalette; CreateRectRgn; CreateThread; D3DEXECUTEBUFFERDESC; DDSURFACEDESC; DDSURFACEDESC; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_REGISTRY_RESOURCEID; DirectDrawCreate; DirectDrawCreateClipper; DisableThreadLibraryCalls; END_OBJECT_MAP; GetClientRect; GetOurWindow; GetSystemPaletteEntries; IDataObjectImpl; IDirect3D::CreateLight; IDirect3D::CreateMaterial; IDirect3D::CreateViewport; IDirect3DDevice::AddViewport; IDirect3DDevice::BeginScene; IDirect3DDevice::CreateMatrix; IDirect3DDevice::DeleteMatrix; IDirect3DDevice::EndScene; IDirect3DDevice::Execute; IDirect3DViewport::AddLight; IDirect3DViewport::CreateMatrix; IDirect3DViewport::SetBackground; IDirect3DViewport::SetMatrix; IDirectDraw2::EnumDevices; IDirectDraw2::SetCooperativeLevel; IDirectDrawClipper::SetHWnd; IDirectDrawSurface2::AddAttachedSurface; IDirectDrawSurface2::GetSurfaceDesc; IDirectDrawSurface2::Restore; IDirectDrawSurface2::SetClipper; IDispatchImpl; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleInPlaceObjectWindowlessImpl::InPlaceDeactivate; IOleInPlaceObjectWindowlessImpl::SetObjectRects; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IQuickActivateImpl; ISupportErrorInfo; IViewObjectExImpl; LPD3DDEVICEDESC; LPD3DINSTRUCTION; LPD3DPROCESSVERTICES; LPD3DSTATE; LPD3DTRIANGLE; LPD3DVERTEX; LPDIRECTDRAWCLIPPER ; MessageBox; OBJECT_ENTRY; OffsetRect; OnEraseBackground; PALETTEENTRY; QueryInterface; RenderScene; SelectClipRgn; SetPalette; WindowFromDC; ZeroMemory


LABRADOR: Implements a Server with No User Interface

Click to open or copy the LABRADOR project files.

This sample shows how to use ATL to implement an EXE server without any user interface. The server allows creation of an object that supports two custom interfaces, defined in Labrador.idl.

Running the Sample

You need to build and set up three components: the server, the marshalling DLL, and the driver.

The Server

  1. Open the Labrador.dsw file in Visual C++ and build the Labrador.exe.

  2. Run the server once with the /RegServer command-line option to set up the registry (for convenience, a custom build rule does this for you).

The Marshalling DLL

  1. Build the proxy/stub marshalling DLL, Labps.dll, by running NMAKE from the command line:
    NMAKE -f labps.mak

  2. Register the DLL by running REGSVR32 from the command line:
    REGSVR32 labps.dll

The Driver

  1. Go to the LABDRIV subdirectory open the Labdriv.dsw project file in Visual C++ and build Labdriv.exe.

  2. Run the driver from the debugger or from the command line. The driver will create an object, make a few calls into it, and then release it.

This sample uses the following keywords:

_CrtDumpMemoryLeaks; _tcsicmp; _tcstok; _tprintf; _vstprintf; ATLASSERT; BEGIN_COM_MAP; BEGIN_OBJECT_MAP; CComModule::Init; CComModule::RegisterClassObjects; CComModule::RevokeClassObjects; CComModule::Unlock; CComModule::UnregisterServer; CComObjectRoot; CoCreateInstance; COM_INTERFACE_ENTRY; CoUninitialize; DECLARE_NOT_AGGREGATABLE; DECLARE_REGISTRY; DispatchMessage; END_OBJECT_MAP; GetCurrentThreadId; GetMessage; OBJECT_ENTRY; OutputDebugString; PostThreadMessage; Trace; va_end; va_list; va_start; wcscpy


MFCATL: Uses ATL COM Objects in an MFC Server

Click to open or copy the MFCATL project files.

This sample illustrates how ATL COM objects can be used in an MFC server EXE.

The server allows the creation of two objects, ObjectOne (implemented in MFC and supporting a dispinterface) and ObjectTwo (implemented in ATL and supporting a dual interface).

Running the Sample

  1. Build the Mfcatl.exe server and run it standalone to register it.

  2. Load the Mfcatl.vbp Visual Basic 4.0 project, run it, and press the buttons in the form.

Note that if you are running the sample on NT 3.51, only the release build will work.

Remarks

Originally, MFCATL had both objects implemented in MFC. Both were derived from CCmdTarget. ObjectTwo was then reimplemented using ATL by following these steps:

  1. Include the ATL header files (Atlbase.h and Atlcom.h) into Premfcat.h.

  2. Include Atlimpl.cpp into Premfcat.cpp.

  3. Add a CComModule derived class to Prefcat.h (similar to the BEEPER EXE sample). The derived class implements the Lock and Unlock methods to forward lock counts to MFC by calling AfxOleLockApp and AfxOleUnlockApp).

  4. Add an object map macro pair (BEGIN_OBJECT_MAP/END_OBJECT_MAP) into the Mfcatl.cpp and add a static instance of the module class called _Module.

  5. Call _Module.Init and Term from InitInstance and ExitInstance

  6. Add the typelib as a resource

  7. Call _Module.RegisterServer(TRUE) from InitInstance to match the MFC call to COleObjectFactory::UpdateRegistryAll

  8. Call _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE) to match the REGCLS_MULTIPLEUSE of MFC's class factories, as implicitly done by the IMPLEMENT_OLECREATE macro

  9. Reimplement ObjectTwo in ATL by following these steps:
    • Change the ODL file from dispinterface to dual interface

    • Have the ODL compilation generate a header file (Interf.h) needed by ATL

    • Rewrite .h and .cpp files (the quickest way is to run ATL Wizard and copy, paste, and rename the automatically generated code in place of the original MFC code)

    • Add an OBJECT_ENTRY(CLSID_ObjectTwo, CObjectTwo) to the ATL object map

Additional conversion steps (not covered here) might include:

  • Porting the ODL file to IDL format

  • Adding support for -RegServer and -UnregServer command-line arguments

This sample uses the following keywords:

AfxMessageBox; AfxOleInit; AfxOleLockApp; AfxOleUnlockApp; ASSERT; BEGIN_COM_MAP; CCmdTarget; CCmdTarget::OnFinalRelease; CComCoClass; CComModule; CComModule::GetLockCount; CComModule::Lock; CComModule::Unlock; CComObjectRoot; CDialog; CMenu::AppendMenu; COleObjectFactory::RegisterAll; COleObjectFactory::UpdateRegistryAll; COM_INTERFACE_ENTRY; CString::IsEmpty; CString::LoadString; CWindow::GetSystemMenu; DECLARE_DYNCREATE; DECLARE_NOT_AGGREGATABLE; DECLARE_REGISTRY; DestroyWindow; Enable3dControls; Enable3dControlsStatic; EnableAutomation; GetClientRect; GetSystemMetrics; IDispatchImpl; PostMessage; SendMessage; SetIcon; ShowWindow; SysAllocString


MINIMAL: Implements a Minimalist DLL Server

Click to open or copy the MINIMAL project files.

This sample implements a minimalist DLL server to show how DLLs developed with ATL can be very small.

The server has a single COM object, which contains one custom interface with one method.

Running the Sample

  1. Build MINIMAL.DLL.

    The DLL is not self-registering, so you must use REGEDIT to merge the provided Minimal.reg file. Minimal.dll does not have a path specified under the InProcServer32 key (that is, InProcServer32 = minimal.dll). You must either modify the entry with a full path (for example, InProcServer32 = C:\<your path>\minimal.dll) or have your DLL in the system path.

  2. Open the MINDRIV project (a console application) in the MINIMAL\MINDRIV subdirectory.

  3. Build and run the application from the debugger or the command line.

Remarks

The MINIMAL sample does not make use of an ODL or an IDL file to define the interfaces. Instead, it shows how to define custom interfaces directly from C++ (see Minimal.h).

The DLL server's size is reduced because:

  • The DLL has no resources associated with it (no RC file)

  • There is no registration code (it uses a separate .reg file), and no DllRegisterServer/DllUnregisterServer entry points.

  • The project uses #define _ATL_MIN_CRT and specifies DllMain as the entry point. C run-time libraries are not linked in

  • Exception handling is disabled.

  • The project uses #define _ATL_NO_FORCE_LIBS and links in only the needed libraries (to avoid Uuid.lib). The IIDs being used are defined in Minimal.cpp.

This sample uses the following keywords:

_CrtDumpMemoryLeaks; _tprintf; _vstprintf; ATLASSERT; BEGIN_COM_MAP; BEGIN_OBJECT_MAP; CComCoClass; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::Term; CComObjectRoot; CoCreateInstance; COM_INTERFACE_ENTRY; CoUninitialize; DECLARE_NO_REGISTRY; DECLARE_NOT_AGGREGATABLE; DisableThreadLibraryCalls; END_COM_MAP; END_OBJECT_MAP; OBJECT_ENTRY; OutputDebugString; va_end; va_list; va_start


OPENGL: Demonstrates Using OpenGL

Click to open or copy the OPENGL project files.

This sample creates a control that draws a spinning cube using the OpenGL graphics library.

This sample uses the following keywords:

ATLASSERT; ATLTRACE; auxWireSphere; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; ChoosePixelFormat; CoTaskMemAlloc; CreateContext; CreateRGBPalette; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_REGISTRY_RESOURCEID; DeleteObject; DescribePixelFormat; DisableThreadLibraryCalls; DrawText; END_CONNECTION_POINT_MAP; END_OBJECT_MAP; FireViewChange; GetClientRect; GetPixelFormat; glBegin; glClear; glClearColor; glClearDepth; glColor3f; glEnable; glEnd; glFinish; glLoadIdentity; glMatrixMode; glPopMatrix; glPushMatrix; glRotatef; glTranslatef; gluPerspective; glVertex3f; IDispatchImpl; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl ; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IViewObjectExImpl; joyReleaseCapture; joySetThreshold; memcpy; OBJECT_ENTRY; PIXELFORMATDESCRIPTOR; RealizePalette; ReleaseCapture; SelectPalette; SetBkMode; SetCapture; SetTextColor; SwapBuffers; USES_CONVERSION; wglCreateContext; wglDeleteContext; wglGetCurrentDC; wglMakeCurrent


POLYGON: The ATL Tutorial

Click to open or copy the POLYGON project files.

This sample shows how to implement custom properties, events, a property page, and object safety for an ATL control. Go through the ATL Tutorial to create this control step by step.

Running the Sample

Build Polygon.dll and make sure it is registered. Open the Polyctl.htm file from Internet Explorer. If you click inside the polygon, the number of sides increases. If you click outside the polygon, the number of sides decreases.

This sample uses the following keywords:

ATLASSERT; ATLTRACE; auxWireSphere; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; ChoosePixelFormat; CoTaskMemAlloc; CreateContext; CreateRGBPalette; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_REGISTRY_RESOURCEID; DeleteObject; DescribePixelFormat; DisableThreadLibraryCalls; DrawText; END_CONNECTION_POINT_MAP; END_OBJECT_MAP; FireViewChange; GetClientRect; GetPixelFormat; glBegin; glClear; glClearColor; glClearDepth; glColor3f; glEnable; glEnd; glFinish; glLoadIdentity; glMatrixMode; glPopMatrix; glPushMatrix; glRotatef; glTranslatef; gluPerspective; glVertex3f; IDispatchImpl; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl ; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IViewObjectExImpl; joyReleaseCapture; joySetThreshold; memcpy; OBJECT_ENTRY; PIXELFORMATDESCRIPTOR; RealizePalette; ReleaseCapture; SelectPalette; SetBkMode; SetCapture; SetTextColor; SwapBuffers; USES_CONVERSION; wglCreateContext; wglDeleteContext; wglGetCurrentDC; wglMakeCurrent


SUBEDIT: Superclasses a Standard Windows Control

Click to open or copy the SUBEDIT project files.

This sample demonstrates how to create an ATL control that superclasses the standard Windows Edit control.

ATL provides the ability to create a control that superclasses a standard Windows control. Superclassing allows you to create a window class that is based on an existing class but uses a different window procedure. You then create a window based on this new window class. When you superclass a control, messages are first processed by an ATL message map before being sent to the control's original window procedure. This allows you to modify the default behavior of standard Windows controls.

When you use the ATL Object Wizard to create an ActiveX control, you can choose to add a control based on a standard window class. In this case, the wizard adds a member variable of type CContainedWindow to your ActiveX control's class. CContainedWindow::Create then creates a window that superclasses the window class you specified. This window uses CContainedWindow::WindowProc to route its messages through a message map. If a message needs further processing, it is sent to the original window procedure of the window class.

Building the SUBEDIT Control

Download the sample files, build the control, and insert it into a container.

Examining the SUBEDIT Sample Code (AtlEdit.h)

  1. The constructor for the CAtlEdit class sets the m_bWindowOnly member variable to TRUE. This ensures the control will never activate as a windowless control.

  2. The CContainedWindow member variable, m_EditCtrl, is initialized by the CAtlEdit constructor. The CContainedWindow constructor takes three parameters: the name of the window class to be superclassed (in this case, "EDIT"); a pointer to the CAtlEdit class, which contains the message map; and the identifier of the message map that will process m_EditCtrl's messages. By default, m_EditCtrl uses an alternate message map, declared with the ALT_MSG_MAP macro.

  3. The default message map declares the names of the handler functions for WM_CREATE and WM_CTLCOLOREDIT messages sent to the CAtlEdit control. The OnCreate handler calls CContainedWindow::Create to create m_EditCtrl's window. The OnCtlColorEdit handler specifies a new background and text color for m_EditCtrl.

  4. The alternate message map declares a handler function for WM_CHAR messages sent to m_EditCtrl. This handler only accepts characters, not symbols or numbers, and then passes the WM_CHAR message to the original window procedure defined by the Windows Edit class.

This sample uses the following keywords:

CComCoClass; CComControl; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; CContainedWindow::DefWindowProc; DisableThreadLibraryCalls; GetStockObject; GetWindowRect; IDataObjectImpl; IDispatchImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleInPlaceObjectWindowlessImpl::SetObjectRects; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IQuickActivateImpl; ISpecifyPropertyPagesImpl; IViewObjectExImpl; SetBkColor; SetTextColor; SetWindowPos


Compiler COM Support Samples Index

Listed in the following table are the COM source code samples currently available. See the Compiler COM Support for more information about compiler COM support.

Sample | Description
ACDUAL | Adds dual interfaces to an automation application
ADOSAMP | Implements a three-tier client/server application.
ALLINONE | Implements a server using ATL, exposing STL collections, and controlled by Compiler COM Support in an MFC application.
COMEXCEL | Demonstrates an automation client application with Microsoft Excel and compiler COM support.
COMIDE | Demonstrates an automation client application with Microsoft Visual C++ and compiler COM support.
COMMAIL | Demonstrates an automation client application with MAPI for Microsoft Exchange (or Outlook) and compiler COM support.
COMMAP | Demonstrates COM interface map entry macros with compiler COM support.
CONNECT | Illustrates the use and implementation of connection points (the IconnectionPointContainer and IConnectionPoint interfaces) in a multithreaded environment.
DCOM | Demonstrates how to call a COM object implemented in a Windows NT service from multiple clients running on different machines.
FREETHRD | Demonstrates multithreaded client and free-threaded server with compiler COM support.
INPROC | Demonstrates an in-process automation server application with compiler COM support.
LABRADOR | Implements an EXE server that does not have any user interface.
MFCCALC | Demonstrates an automation server application with compiler COM support.


ACDUAL: Adds Dual Interfaces to an Automation Application

Click to open or copy the ACDUAL project files.

ACDUAL demonstrates how to add dual-interface support to an MFC-based Automation (formerly OLE Automation) application with the native compiler COM support. See the MFC ACDUAL sample for more information.

The differences between this sample and the MFC sample with the same name are:

  1. The COleDispatchDriver class is no longer necessary. Instead, #import is used to import a type library.

  2. The _bstr_t and _variant_t wrapper classes are used to simplify operations of BSTR and VARIANT types.

  3. The __declspec(property) is used to simplify assignment operations for properties of COM objects.

  4. COM error handling is now performed by using the _com_error class.

With the Visual C++ native compiler COM support, the resulting sample code is shorter and more efficient. The MFC-based ACDUAL sample uses both dual interfaces and dispinterfaces only. Compare this sample with the MFC version to see the differences in source code.

This sample demonstrates the following keywords:

dispinterface; #import; _com_ptr_t; _variant_t; _bstr_t; _com_error.

See also Compiler COM Support, MFC ACDUAL sample.


ADOSAMP: Implements a Three-Tier Client/Server Application

Click to open or copy the ADOSAMP project files.

This sample implements a three-tier client/server application using ADO, ATL, and Compiler COM support.

The sample demonstrates how you can use Compiler COM support with ADO to create a client/server database application. The application creates a small database of information about motorcycles and their top speeds. The application inserts rows, deletes rows, adds a new column, and searches on top speeds greater than a specified value.

To run the sample

  1. In Windows NT 4.0, open ODBC Data Source Administrator in Control Panel. Using either Microsoft Access or SQLServer, add a (User) DSN with Data Source Name "HotBikes" If you are using Microsoft Access, create a database called Test.

  2. For SQLServer, provide the server name and under Options specify a Database Name, for example, HotBikesDB.

  3. Open ADOSamp.dsw in Visual C++.

  4. In StdAfx.h, edit the path of MsADO10.dll in the #import statement to point to the copy on your machine.

  5. If either OLE DB or ADO has not been installed, install it from the Visual Studio CD. It will most likely be installed in:

    \Program Files\Common Files\System\ADO\MsADO10.dll

  6. Build ADOSamp either as an in-proc (DLL) or local (EXE) server. Registration should be automatic. However, if necessary, run:

    regsvr32 ADOSamp.dll or ADOSamp.exe /RegServer

To build the client

  1. Open RunADO.dsw in Visual C++. Near the top of RunADO.cpp is the line:
    //#define SQLSERVER
  2. Uncomment this line if you created a SQLServer data source for this sample. This disables a SQL command that Microsoft Access can understand but SQLServer cannot:

    "ALTER TABLE HotBikes DROP COLUMN ID"

  3. Run RunADO.exe. A table will be created (deleting the existing one) and several rows added, deleted, and updated. A new column is added, populated with data, and, in the case of Microsoft Access, a column is deleted.

    The contents of the table are displayed after each modification.


ALLINONE: Implements a Server Using ATL, Exposing STL Collections, Controlled by Compiler COM Support in an MFC Application

Click to open or copy the ALLINONE project files.

This sample demonstrates the ability of ATL/STL/VCCOM/MFC to coexist in a single application. Building on the COLLECT MFC example, nine collections are implemented in STL by using map, multimap, list, vector, deque and set. They are exposed as custom interfaces by using ATL with multiple types of aggregation. The MFC controller uses compiler COM support.

Compare this sample with the COLLECT MFC sample.

Running the sample

The Server:

  1. Build STLCOLL.DLL using the STLCOLL project in SAMPLES\COM\ALLINONE\SERVER.

  2. Self-registration should take place in the custom build step. Otherwise, run REGSVR32 Stlcoll.dll.

The Controller: Build Collect.exe using the collect project in samples\com\allinone\collect.

This sample demonstrates the following keywords:

map, vector, set, multimap, list, deque, _com_ptr_t, _bstr_t, _com_error

See also Compiler COM Support.


COMEXCEL: Demonstrates an Automation Client Application with Compiler COM Support

Click to open or copy the COMEXCEL project files.

COMEXCEL is a stand-alone Automation (formerly OLE Automation) client. It creates a new Microsoft Excel spreadsheet and generates a pie chart of the data stored on that spreadsheet. This sample works only with Microsoft Excel, which exposes the dispinterfaces.

There is a Visual Basic project that controls the server in a way analogous to the COM code in Visual C++. You can compare the Visual Basic code with the code of this sample to see the similarities. You can use Visual Basic-specific object model documentation to write COM controllers in Visual C++.

To build this sample within Visual C++ for Excel 7.0, the file Xl5en32.olb must be in an accessible directory. To build this sample within Visual C++ for Excel 8.0, the files mso97.dll, vbeext1.olb, and excel8.olb must be in accessible directories. To ensure that a directory is accessible to the build process, select Options from the Tools menu and then the Directories tab. You can then review and add directories in which the build process can find project files.

If you get an access violation while running the COMEXCEL sample in Visual Basic under Windows NT 4.0, please install the Windows NT Service Pack 3.

This sample demonstrates the following keywords:

dispinterface; #import; _com_ptr_t; _variant_t; _bstr_t; _com_error.

See also Compiler COM Support.


COMIDE: Demonstrates an Automation Client Application with Compiler COM Support

Click to open or copy the COMIDE project files.

COMIDE is a stand-alone Automation (formerly OLE Automation) client. It automates Microsoft Visual C++. This sample generates copies of itself to be built and run by Visual C++ for the number of times specified by the nLives variable. By default, the sample runs comide1 twice and comide2 twice.

For more information, see the article "Automating Tasks in Visual C++".

There is a Visual Basic project that controls the server in a way analogous to the COM code in Visual C++. You can compare the Visual Basic code with the code of this sample to see the similarities. You can use Visual Basic-specific object model documentation to write COM controllers in Visual C++. In fact, this is how this sample was written.

To run this sample:

Run samples\com\comide\comide1\comide1.exe
which edits samples\com\comide\comide2\comide2.cpp and runs it
which edits samples\com\comide\comide1\comide1.cpp and runs it
which edits samples\com\comide\comide2\comide2.cpp and runs it
and so on.

This sample demonstrates the following keywords:

dispinterface; #import; _com_ptr_t; _variant_t; _bstr_t; _com_error.

See also Compiler COM Support.


COMMAIL: Demonstrates an Automation Client Application with Compiler COM Support

Click to open or copy the COMMAIL project files.

COMMAIL is a stand-alone Automation (formerly OLE Automation) client. It automates MAPI for Microsoft Exchange 4.0 (or later) or Microsoft Outlook. This sample sends an e-mail, which contains its source code, to a specified e-mail recipient. In order to run this sample, you must do the following:

  1. Modify paths in the source code by following the instructions given in the //To DO lines.

  2. Change the recipient e-mail name and other e-mail parameters. Search the source code for #pragma for instructions on what you have to modify.

Look at the type library header files (.tlh and .tli). Compare the COM interfaces in the header files with interfaces of the same type library displayed by OLEVIEW.

There is a Visual Basic project that controls the server in a way analogous to the COM code in Visual C++. You can compare the Visual Basic code with the code of this sample to see the similarities. You can use Visual Basic-specific object model documentation to write COM controllers in Visual C++. In fact, this is how this sample was written.

This sample demonstrates the following keywords:

dispinterface; #import; _com_ptr_t; _variant_t; _bstr_t; _com_error.

See also Compiler COM Support.


COMMAP: Demonstrates COM Interface Map Entry Macros with Compiler COM Support

Click to open or copy the COMMAP project files.

This basic sample shows how different COM interface map entry macros are used. This sample uses the smart pointer mechanism (_com_ptr_t) of Visual C++ native compiler COM support. The #import mechanism is used instead of the MIDL generated .h and .c files to provide marshaling information.

Running the Sample

Build Aggreg.dll first, then build Commap.dll. CTLCOMM is an MFC wrapped VCCOM controller of the COMMAP ATL server. Use Commap.htm (an HTML file that uses VBScript) from Internet Explorer 3.0 or 4.0. Commap.htm includes comments about each type of map entry. You can also load the .vbp file into Visual Basic and run the program.

This sample demonstrates the following keywords:

dispinterface; #import; _com_ptr_t; _variant_t; _bstr_t; _com_error.

See also Compiler COM Support and ATL COMMAP sample.


CONNECT: Use of Connection Points

Click to open or copy the CONNECT project files.

Note This is a modification of the ATL sample Connect, to demonstrate Compiler COM support for connection point sinks. The DRIVE client is a native implementation, whereas the MDRIVE client slightly belabors COM-correctness in using a ClassFactory to create sink objects. Neither DRIVE nor MDRIVE are dependent upon ATL or MFC for any COM support.

This sample illustrates the use and implementation of connection points (the IConnectionPointContainer and IConnectionPoint interfaces) in a multithreaded environment.

The server is implemented in Connect.dll. This DLL allows the creation of a CoRandom COM object, implemented by the CRandom C++ class. The COM object supports IRandom (a dual interface) and IConnectionPointContainer, and it accepts connections for the IRandomEvent interface.

The IRandom interface supports the following methods.

Start

Starts a thread inside the object.

Stop

Stops a thread inside the object.

StopAll

Stops all running threads.

When running, the secondary threads inside the object keep firing events through the connection point.

Two clients are provided: DRIVE and MDRIVE. They can be found in the DRIVE and MDRIVE subdirectories.

  • Drive.exe is a simple console application that provides a single object implementing the IRandomEvent interface. It creates a CoRandom object, calls Advise and Unadvise on the connection point, and has the CoRandom object fire events into the drive's object.

  • Mdrive.exe is an MFC dialog-based application, able to create multiple advise sinks and to control the number of threads the server creates. When you run Mdrive.exe, click the Start button at least once, then click the Advise button several times. Each click of the Advise button adds a connection point, which makes the display wider. If you do not click the Advise button, you will see no activity in the display.

To run, build Connect.dll and register it. You can build and run Drive.exe from a console, or build and run MDrive.exe directly from Visual C++.


DCOM: Call COM Object in Windows NT Service from Multiple Clients

Click to open or copy the DCOM project files.

This sample demonstrates how to call a COM object implemented in a Windows NT service from multiple clients running on different machines. It is composed of several parts:

  • DrawServ The Windows NT service that implements the COM object.

  • ATLDraw The client that connects to the DrawServ COM object.

  • DrawCtl A control version of ATLDraw. It has a Connect method (that takes a machine name string parameter), a Disconnect method, and a Clear method.

  • MFCCont An MFC container for DrawCtl. Enter the name of the (possibly remote) server without quotes or slashes.

  • ATLCont An ATL container for DrawCtl. Enter the name of the (possibly remote) server without quotes or slashes.

All machines must be running Windows NT 4.0 Beta 2 or later for this sample to work.

To build and run the sample

  1. Build the DrawServ and ATLDraw samples.

  2. Copy Drawserv.exe and Atldraw.exe to each machine that you want to run the sample from. Register the server on each machine by running DrawServ with the command-line argument /RegServer or -RegServer (case-insensitive). For example:

    DrawServ /RegServer

    (Register.dll must be registered for this to work.) The reason you need to copy the server to each client is that the CLSID for the server and the server type library need to be registered on the client.

  3. Start the service on the server by using the Services icon in Control Panel.

  4. Using DCOMCNFG on each client, select the Properties of the DrawServ Class. From the Location tab, select Run application on the following computer, then enter the name of the computer that you are running the server object on. Clear the Run application on this computer check box.

  5. Run ATLDRAW and select Server. Connect from the menu on each client. Draw on the client window by holding the left mouse button down and dragging a line. The drawn line should appear on each client that is also connected to the same server. You can also use the Color command from the View menu to change the color for each client.

  6. If there is any problem connecting to a remote server (for example, if Tstcon32.exe does not call CoInitializeSecurity), run DCOMCNFG on the client and open the tab Default Properties. Set Default Authentication Level to None and Default Impersonation Level to Anonymous.


FREETHRD: Multithreaded Client and Free-Threaded Server with Compiler COM Support

Click to open or copy the freclien project files.

Click to open or copy the freserve project files.

This sample consists of the following parts.

  1. FRECLIEN, a multithreaded client

  2. FRESERVE, a free-threaded in-process server

The FRECLIEN sample spawns multiple threads to create and use the COBall COM object provided by the FRESERVE free-threaded server. The COBall object itself spawns no threads; instead, it passively responds to IBall interface requests from many possible client threads. The FRECLIEN client creates and controls one COBall object through the IBall interface that the object exposes. As three of FRECLIEN's threads move the ball through calls to IBall::Move, the remaining main thread uses a system timer to obtain timed updates of the COBall object's position, size, and color. This main thread uses that data, obtained by calling the IBall::GetBall method, to display graphical snapshot images of the ball in the client's main window.

In the FRESERVE sample, the COBall object internally updates its color property to reflect the last thread that called the object's Move method. The display thread uses this data for each ball image it displays. As the ball moves, it changes color to reflect each thread that moves the ball. As the ball moves, it also leaves a trail that provides a striking visual history of these passing threads. This trail demonstrates that, with COM's free threading model, every thread that makes interface requests to the same object accesses the object on the calling thread. Each different color of the single ball object represents a different calling thread.

This sample uses native compiler COM support. It gives an example of a custom COM interface that marshals the RECT and POINT structures with the free-threaded model. It demonstrates the use of the exclude attribute of the #import directive.

See also Compiler COM Support, the SDK FRESERVE sample, and the SDK FRECLIEN sample.


INPROC: Demonstrates an In-Process Automation Server Application

Click to open or copy the INPROC project files.

INPROC is an in-process Automation (formerly OLE Automation) server. Unlike the other automation server samples provided, INPROC can be loaded as a dynamic-link library (DLL) in the client's address space. This sample uses the native compiler COM support. See the MFC INPROC sample for more information.

The differences between this sample and the MFC sample with the same name are:

  1. The COleDispatchDriver class is no longer necessary. Instead, #import is used to import a type library.

  2. The _bstr_t and _variant_t wrapper classes are used to simplify operations of BSTR and VARIANT types.

  3. The __declspec(property) is used to simplify assignment operations for properties of COM objects.

  4. COM error handling is now performed by using the _com_error class.

With the Visual C++ native compiler COM support, the resulting sample code is shorter and more efficient. The MFC-based INPROC sample uses dispinterfaces only. Compare this sample with the MFC version to see the differences in source code.

This sample demonstrates the following keywords:

dispinterface; #import; _com_ptr_t; _variant_t; _bstr_t; _com_error.

See also Compiler COM Support, MFC INPROC sample.


LABRADOR: Implements a Server with an Out-of-Proc Custom Interface and Compiler COM Support

Click to open or copy the LABRADOR project files.

This sample shows how to use ATL to implement an EXE server. The server allows creation of an object that supports two custom interfaces, defined in Labrador.idl. Compiler COM support is used to implement custom interfaces that perform non-trivial marshaling of a C-style array.

Compare this sample with the LABRADOR sample in the ATL directory.

Running the Sample

You need to build and set up three components: the server, the marshaling DLL, and the driver.

The Server

  1. Build Labrador.exe from within Visual C+ using the Labrador.dsw project file.

  2. Run the server once with the /RegServer command-line option to set up the registry (for convenience, a custom build rule does this for you).

The Marshalling DLL

  1. Build the proxy/stub marshaling DLL, Labps.dll, by running NMAKE from the command line:
    NMAKE -f labps.mak

  2. Register the DLL by running REGSVR32 from the command line:
    REGSVR32 labps.dll

The Driver

  1. Go to the LABDRIV subdirectory, open the Labdriv.dsw project file within Visual C++ and build Labdriv.exe.

  2. Run the driver from the debugger or from the command line. The driver will create an object, make a few calls into it, and then release it.

This sample demonstrates the following keywords:

#import; _com_ptr_t; _com_error.

See also Compiler COM Support and ATL LABRADOR sample.


MFCCALC: Demonstrates an Automation Server Application

Click to open or copy the MFCCALC project files.

MFCCALC is an Automation (formerly OLE Automation) server. It implements a simple calculator similar to the CALC application in Windows. It can be driven via Automation with the CALCDRIV sample or run stand-alone. This sample uses the native compiler COM support. See the MFC MFCCALC sample for more information.

The differences between this sample and the MFC sample with the same name are:

  1. The COleDispatchDriver class is no longer necessary. Instead, #import is used to import a type library.

  2. _bstr_t and _variant_t wrapper classes are used to simplify operations of BSTR and VARIANT types.

  3. __declspec(property) is used to simplify assignment operations for properties of COM objects.

  4. COM error handling is now performed by using the _com_error class.

With the Visual C++ native compiler COM support, the resulting sample code is shorter and more efficient. The MFC-based MFCCALC sample uses dispinterfaces only. Compare this sample with the MFC version to see the differences in source code.

This sample demonstrates the following keywords:

dispinterface; #import; _com_ptr_t; _variant_t; _bstr_t; _com_error.

See also Compiler COM Support, MFC MFCCALC sample.


Custom AppWizard Samples Index

A customized AppWizard lets you customize the creation of VC++ applications with a look and feel that is similar to the MFC AppWizard.

The Custom AppWizard Samples are comprised of:

CUSTOMWZ is an example of a custom AppWizard, which contains features that the standard AppWizard does not provide.

HIERWIZ is an example of how to write a custom AppWizard that is based solely on your own steps.

LOGOWIZ is an example of how to write a custom AppWizard that is a variant on the standard MFC AppWizard.


CUSTOMWZ: A Custom AppWizard

Click to open or copy the CUSTOMWZ project files.

CUSTOMWZ is an example of a custom AppWizard, which contains features that the standard AppWizard does not provide.

When creating a new application, you can use AppWizard to quickly generate the starter files you need for the most common application types. But for special applications that are unique to your work, you can create custom AppWizards.

Custom AppWizards are useful for creating generic application project types that can repetitively generate common functionality — application types that can be used multiple times. Custom AppWizards are not useful for creating one-off project types.

Like AppWizard, a custom AppWizard presents the user with choices, tracks their decisions, and uses those decisions to generate the code, resources, and project files that the Visual C++ build tools require to build a skeletal, working application.

For example, if you work for a company whose employees commonly need special views of database information, you can create a custom AppWizard to generate generic dialog-based front ends to a database. You can even ensure that the dialog box is always embellished with a company logo.

Possibilities for custom AppWizards include:

  • Creating a custom AppWizard that is based on the code and resources in an existing project

  • Modifying code in existing AppWizard templates

  • Adding one or more steps to the existing AppWizard’s steps

  • Creating a custom set of steps

For more information on creating a custom AppWizard, see Overview of Creating a Custom AppWizard.

This sample demonstrates the following keywords:

AfxFormatString1; AfxMessageBox; AfxThrowUserException; CBitmap::LoadBitmap; CDC::BitBlt; CDC::CreateCompatibleDC; CDC::DPtoLP; CDC::FillRect; CDC::SelectObject; CDialog::MapDialogRect; CFileDialog::DoModal; CFileDialog::GetPathName; CGdiObject::GetObject; CListBox::AddString; CListBox::GetItemData; CListBox::GetSelCount; CListBox::GetSelItems; CListBox::SelItemRange; CListBox::SetItemData; CListBox::SetSel; CStdioFile::ReadString; CString::Find; CString::Format; CString::GetBuffer; CString::Left; CString::LoadString; CString::MakeLower; CString::Mid; CString::ReleaseBuffer; CloseHandle; CreateFile; CreateFileMapping; EnableWindow; FindClose; FindFirstFile; FindNextFile; GetDlgItem; GetFileAttributes; GetFileSize; GetWindowText; MapViewOfFile; RedrawWindow; SetWindowText; UnmapViewOfFile; sscanf


HIERWIZ: Custom AppWizard Based Solely on Custom Steps

Click to open or copy the HIERWIZ project files.

HIERWIZ is an example of how to write a custom AppWizard that is based solely on your own steps. The techniques it demonstrates include:

  • Converting an existing project into a Custom AppWizard

  • Adding custom pages to a wizard which started out with no pages

  • Validating the user entries before going from one page to the next

  • Changing the state of the Next button depending on user options

  • Conditional manipulation of project templates

  • Adding a second view to an otherwise single view MDI application

  • Adding code to open a default document on startup

This sample demonstrates the following keywords:

AfxAbort; AfxGetApp; AfxMessageBox; CDC::BitBlt; CDC::CreateCompatibleDC; CDC::SelectObject; CEdit::SetTabStops; CFileDialog::DoModal; CFileDialog::GetPathName; CString::LoadString; CWnd::GetDC; CWnd::GetWindowRect; CWnd::SubclassDlgItem; DebugBreak; GetActiveWindow; GetDlgItem; GetLastActivePopup; InterlockedDecrement; InterlockedIncrement; LoadBitmap; MessageBox; OutputDebugString; va_end; va_start; wsprintf


LOGOWIZ: Custom AppWizard Variant of the Standard MFC AppWizard

Click to open or copy the LOGOWIZ project files.

LOGOWIZ is an example of how to write a custom AppWizard that is a variant on the standard MFC AppWizard. The techniques it demonstrates include:

  • Removing a page from an otherwise standard AppWizard,

  • Modifying defaults on standard AppWizard pages,

  • Adding a custom page to an otherwise standard AppWizard,

  • Conditional manipulation of project templates,

  • Adding controls to the main window of a dialog-based application,

  • Adding files to the new project, and

  • Adding code to otherwise standard templates.

Removing Standard AppWizard Pages

You can remove any AppWizard pages from the standard list that you like. While it is possible to rearrange the sequence as well, that is not recommended. This is done in the constructor for CDialogChooser in Chooser.cpp.

In this custom AppWizard, the ODBC page has been removed if this is an MDI/SDI-based app. You can find further details about how this was done in comments near the code itself (see CDialogChooser::CDialogChooser() in Chooser.cpp). If you want, you can set the defaults as desired for a page that you remove; this makes the defaults mandatory rather than optional.

Changing Default Settings

You can change default settings for standard AppWizard pages. This is done in your main custom AppWizard class (in this case, CLogoWizAppWiz in Logowaw.cpp) InitCustomAppWiz function. The list of settings you can change is found in LOGOWIZ Help.

In LOGOWIZ, the application type has been defaulted to dialog-based, and context-sensitive help has been turned on.

This sample demonstrates the following keywords:

AfxAbort; AfxGetApp; BitBlt; CBitmap::LoadBitmap; CDC::CreateCompatibleDC; CDC::DPtoLP; CDC::FillRect; CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CGdiObject::GetObject; DebugBreak; GetActiveWindow; GetDC; GetLastActivePopup; InterlockedDecrement; InterlockedIncrement; MapDialogRect; MessageBox; OutputDebugString; RedrawWindow; va_end; va_start; wsprintf


Microsoft Foundation Class Library Samples Index

Information about the Microsoft Foundation Class Library source code samples is organized as follows:

  • Categorical List of MFC Samples (programming technique)

  • Alphabetical List of MFC Samples

Batch Building the Samples from the Command Line

Each MFC sample contains a link to download the sample and instructions for building and running the sample in the development environment. Under some circumstances, you might want to build and examine all MFC samples, but to build each one individually in the development environment would be very time-consuming.

To build all of the MFC samples at once, use Mksample.bat from the command line. Mksample.bat is located in the MFC directory, under the Visual C++ Samples directory on the MSDN Library CD.


Categorical List of MFC Samples

To find a source code sample that illustrates a Microsoft Foundation Class Library feature or programming technique, select one of the following areas.

application object | OLE
collections | ActiveX controls
context-sensitive help | OpenGL
databases | printing/preview
databound controls | rectangle tracker (mouse)
dialogs and controls | resources
documents | splitter windows
dynamic-link libraries (DLLs) | toolbars, status bars, dialog bars, and floating palettes
graphical display classes | views
Internet | window objects
menus | Windows Extensions
multithreading | Windows Common Controls

See Also

Microsoft Foundation Class Library Samples Index


Application Object Samples

Every Windows application using the Microsoft Foundation Class Library must implement a CWinApp derived class and create only one object of that class. See the SCRIBBLE tutorial sample and Visual C++ Tutorials for an introduction to application objects and for an example of an application that relies on document template (CDocTemplate) objects to manage the creation of frame windows, document objects, and view objects.

Note For an example of a console application that uses the Microsoft Foundation Class Library but does not have a CWinApp derived class, see the MAKEHM sample.

CWinApp provides the WinMain function required by Windows, implements the main message loop, and coordinates the creation of frame windows, documents, and views using document template objects. CWinApp also provides secondary functionality at the high application level. The following samples illustrate some of these secondary CWinApp features:

  • HIERSVR shows how to register an application's document type with the Window or Windows NT Explorer.

  • SUPERPAD shows how to use a wait cursor during long operations.

  • SUPERPAD and CHKBOOK show how to use a private .ini file using member functions provided by CWinApp.

  • SUPERPAD and CTRLBARS shows how to override CWinApp::OnIdle.

If your application does not lend itself to a document/view architecture, you do not have to use document templates, documents, and views, as illustrated in the following samples:

  • HELLO is an application that has a single application window, without documents and views. HELLO is slightly more complicated than the minimal HELLOAPP sample.

  • HELLOAPP is a minimal MFC application.

  • MDI has a multiple document interface (MDI) application without documents and views.

  • TRACER and SPEAKN are applications that have a single dialog box as the user interface.

See Also

Microsoft Foundation Class Library Samples Index


Collections Samples

Some of the samples rely on MFC collection classes in the course of illustrating other MFC features. The COLLECT sample is specifically designed to illustrate the MFC collection classes, including the C++ template-based collection classes.

See Also

Microsoft Foundation Class Library Samples Index


Context-Sensitive Help Samples

Step 6 of the SCRIBBLE tutorial sample, presented Visual C++ Tutorials, shows how to implement context-sensitive Help in an application. The easiest way to get a quick preview of the framework's context-sensitive Help support is to run AppWizard with the Help option, build the skeleton application, and run it. Try out F1 and SHIFT+F1 on various user interface items such as menus and toolbar buttons.

MAKEHM ("Make Help Map") is an MS-DOS tool that produces a mapping between resource identifications and Help contexts. This tool is called by the custom build rule on the resource.h file. For backward compatibility with older projects, Visual C++ 6.0 projects also have a Makehelp.bat file produced by AppWizard if you choose the Context-Sensitive Help option.

The Makehm.exe is included in \Program Files\Microsoft Visual Studio\VC98\bin, so you do not need to build it from the sources in the MAKEHM sample directory. Microsoft provides the sources to demonstrate MS-DOS applications that use the Microsoft Foundation Class Library and to let you modify the tool.

See Also

Microsoft Foundation Class Library Samples Index


Databases Samples

MFC has two kinds of database classes: those based on Open Database Connectivity (ODBC) and those based on Data Access Objects (DAO).

DAO Database Class Samples

DAOCTL shows how to build an OLE control container which contains data-bound controls. The container provides the controls with data from an Access database via DAO

DAOENROL is a sample that is based on the ENROLL sample, but migrated to the DAO database classes. DAOENROL also functions as Step 4 of the DaoEnrol tutorial.

DAOTABLE demonstrates using the MFC Data Access Objects (DAO) database classes to create common database objects: databases, tables, queries, fields, and indexes.

DAOVIEW is a moderately sophisticated browser that lets you examine the schema of a database.

ODBC Database Class Samples

DBFETCH demonstrates the use of bulk row fetching and shows how to use the ODBC SQLSetPos API call for updating records.

ENROLL is the tutorial sample application discussed in Visual C++ Tutorials. The ENROLL sample has four subdirectories — ENROLL\STEP1, ENROLL\STEP2, ENROLL\STEP3, and ENROLL\STEP4.

The first three subdirectories correspond to the tutorial, in which the development of ENROLL is broken up into three overall steps. STEP4 is not discussed in the tutorial, but it adds more advanced features to the ENROLL database application, which are beyond the scope of the tutorial.

The DYNABIND sample illustrates dynamic binding of database columns to a recordset. The techniques demonstrated by DYNABIND are useful for adding a customer site customization capability to a database application.

ODBCINFO shows how to determine various ODBC driver capabilities at run time. ODBCINFO opens a selected ODBC data source and displays information about it in a set of property pages.

MFCROWS shows how to use COleDBRecordView to scroll through a table in a database. It also demonstrates how to use multiple accessors so you can update an Access table that contains an AutoNumber field to be retrieved.

STDREG is a tool for populating the Student Registration database, which is used by the Enroll database tutorial, in any format supported by an ODBC driver. As a sample, STDREG illustrates how to dynamically create tables and columns in a database using direct SQL.

The CATALOG sample shows the following:

  • Calling Open Database Connectivity (ODBC) functions directly in general, and the ODBC functions SQLTables and SQLColumns in particular.

  • Displaying all the tables in a selected database and, for each table, a list of the columns and information about each column.

  • A reusable CColumns class that represents the result set of a call to the ODBC function SQLColumns. Each record describes one column of a specified table.

CATALOG2 also lets you browse the schema of a data source, but also uses Windows Common Controls to display the information.

See Also

Microsoft Foundation Class Library Samples Index


Databound Controls

In addition to the MFC database classes, MFC includes databound controls which do not use the database classes. These samples illustrate the use of databound controls:

  • BINDENRL is a dialog application based on property pages, and it shows how to bind data-aware controls with a data source control created outside the current property page. The sample uses the same database as the ENROLL sample.

  • EXTBIND shows how to bind data-aware controls across a dialog box boundary.

  • MDIBIND demonstrates that data binding can be done with any CWnd-derived windows, but only at run-time.

See Also

Microsoft Foundation Class Library Samples Index


Dialogs and Controls Samples

Many of the samples use dialogs, controls, and the framework's dialog data exchange (DDX) support. The following samples illustrate special common dialog (COMMDLG.DLL supported) classes and control classes and some special techniques for using dialogs and controls:

  • CHKBOOK illustrates custom data exchange (DDX) functions.

  • COLLECT coordinates the adding and removal of entries in a list box with the adding and removal of entries in a collection.

  • CTRLTEST and SPEAKN use a bitmap button.

  • CTRLTEST also illustrates:
    • A spin control.

    • Implementing and using custom controls and subclassing a control.

    • Owner drawing of menus and list boxes.
  • DLGCBR32 shows how to add a toolbar and a status bar to a dialog-based application.

  • DLGTEMPL illustrates how to create a dialog template dynamically.

  • MDI shows the COMMDLG color dialog box.

  • MDIDOCVW is a new version of the MDI sample that uses the document/view architecture.

  • MODELESS demonstrates the use of an MFC CDialog object as a modeless dialog.

  • PROPDLG illustrates property sheet dialogs, also known as tabbed dialogs.

  • SCRIBBLE and TRACER show simple use of dialog data exchange.

  • SNAPVW shows how to use property pages in a MDI child frame window.

  • SUPERPAD has an About dialog box that shows system resource usage. This sample also shows the COMMDLG font dialog box.

  • TRACER and SPEAKN are applications that have a single dialog box as the user interface.

  • WIZARD97 demonstrates implementing a wizard that supports background bitmaps and wide header titles and images. This wizard design is supported for Windows 98 and Windows NT 5.0; you must be using Windows 98 or Windows NT 5.0 for this sample to work properly.

See Also

Microsoft Foundation Class Library Samples Index


Documents Samples

The SCRIBBLE sample, presented in Visual C++ Tutorials, shows how to implement a CDocument derived class. SCRIBBLE is a good model for any application that can rely on the framework's standard user interface for file handing (for example, New, Open, Close, and Save on the File menu) and the framework's automatic serialization of documents.

The following samples are cases in which you might need to override the framework's standard document behavior:

  • CHKBOOK has a record-based document. In the default implementation of the framework, the document serializes itself to and from the disk. The application updates the CHKBOOK document each time the user adds or modifies a record.

  • ENROLL has a database application that has no file-based document. Instead, ENROLL's data is kept in an external database. The role of the document in ENROLL is not to hold the data but to maintain the CRecordset objects that provide access to the database.

  • DIBLOOK has a document with an external file format. This document uses the Windows device-independent bitmap file format.

  • MULTIPAD and SUPERPAD have documents that delegate memory management of the document data to a CEditView object. The SUPERPAD sample is more advanced than the MULTIPAD sample.

See Also

Microsoft Foundation Class Library Samples Index


Dynamic-Link Libraries (DLLs) Samples

DLL support is illustrated in the following samples.

  • DLLTRACE demonstrates a DLL that is statically linked to the Microsoft Foundation Class Library.

  • DLLHUSK shows an application that is dynamically linked to the DLL version of the Microsoft Foundation Class Library. DLLHUSK also illustrates a user DLL that is dynamically linked to the DLL version of the Microsoft Foundation Class Library. Such a user DLL is called an "MFC Extension DLL."

Note For information about dynamic-link library support, see the article DLL Topics in the Visual C++ Programmer's Reference.

See Also

Microsoft Foundation Class Library Samples Index


Graphical Display Objects Samples

Most of the samples show how to use GDI classes — CDC and CDC derived classes and GDI object classes (CPen, CBrush, and so on). The following samples illustrate some special GDI techniques that use the Microsoft Foundation Class Library:

  • DIBLOOK shows how to use device-independent bitmaps (DIBs) and color palettes.

  • MDI shows how to use a memory display context to hold a bitmap and BitBlitting the bitmap to a window's client display context.

  • MDIDOCVW is a version of the MDI sample that uses the document/view architecture.

  • SAVER shows how to use GDI objects in a screen saver.

  • Also, see samples illustrations of printing and print preview.

See Also

Microsoft Foundation Class Library Samples Index


Internet Samples

MFC has classes that wrap the Microsoft Internet Server API (ISAPI) and the Windows Internet (WinInet) API. The following samples illustrate ways to use these classes.

  • COUNTER shows how to use an ISAPI DLL to send image data (rather than HTML data) back to a Web browser.

  • FTPTREE is a dialog-based application that displays the contents of an FTP site in a tree control.

  • HTTPSVR demonstrates the use of MFC and its Windows Sockets (WinSock) classes in implementing a simple World Wide Web HTTP server.

  • MFCIE uses MFC's CHtmlView and CReBar classes to implement a subset of the functionality provided by Microsoft Internet Explorer.

  • MFCUCASE demonstrates the use of MFC support for Internet Server filter DLLs. The sample shows how to build a filter project whether or not it uses MFC.

  • PINBALL is an Internet Server Extension DLL that provides graphics and also redirects users to a Web site for further research.

  • StockTicker is an MFC and ATL application that retrieves stock quotes from companies' Web pages and displays them in an ATL control. The user can set the display's properties, including rate of data refresh.

  • TEAR is an MFC console application that uses the WININET.DLL to communicate with the Internet.

  • WWWQUOTE illustrates the development of an Internet Server Extension using MFC. The sample shows proper use of the parse map macros, the CHttpServer class, and thread-safe programming techniques.

See Also

Microsoft Foundation Class Library Samples Index


Menus Samples

Most of the samples illustrate the use of resource-based menus and message map entries for ON_COMMAND and ON_UPDATE_COMMAND_UI handlers.

CTLRBARS illustrates the use of ON_COMMAND_RANGE and ON_UPDATE_COMMAND_UI_RANGE for handling commands assigned a range of adjacently numbered command IDs.

DYNAMENU illustrates dynamically modifying the list of items in a menu; handling commands not known at compile time; and updating the status bar command prompt for such commands.

See Also

Microsoft Foundation Class Library Samples Index


Multithreading Samples

MFC distinguishes two types of threads: worker threads and user-interface threads. A user-interface thread has its own message pump for handling user-interface events separately from other threads. A worker thread does not have its own message pump.

  • MTGDI illustrates the use of GDI resources with MFC objects.

  • MTMDI is a multithreaded version of the MDI sample. MTMDI illustrates user-interface threads.

  • MTRECALC illustrates a worker thread.

  • MUTEXES demonstrates the use of the CMutex class. The sample is an MFC version of a sample included in the book Advanced Windows by Jeffrey Richter, published by Microsoft Press.

See Also

Microsoft Foundation Class Library Samples Index


OLE Samples

The following three samples are the basis for MFC OLE tutorials in Visual C++ Tutorials:

  • The AUTOCLIK sample is the basis for the tutorial on developing an application that supports Automation (formerly OLE Automation).

  • CONTAINER is the basis for the tutorial on developing an ActiveX Visual Editing container application.

  • Step 7 of SCRIBBLE shows how to develop an ActiveX Visual Editing server application.

The TSTCON sample implements an ActiveX control container using MFC's support for OLE embedding. You can use TSTCON to test ActiveX controls, change their properties, and invoke their methods.

The following samples illustrate additional MFC OLE programming techniques not covered in the above tutorials:

  • ACDUAL demonstrates how to add dual interface support to a MFC-based Automation server application.

  • AUTOCLIK Step 4 is a combination ActiveX Visual Editing server and Automation server. Step 4 is not discussed in the tutorial but is discussed here in the sample description.

  • AUTODRIV is a simple Automation client application that drives the AUTOCLIK tutorial sample application. AUTODRIV is also a good demonstration of how to write an Automation driver application.

  • BINDSCRB illustrates the use of new Component Object Model (COM) interfaces to components currently supported by the Microsoft Office suite of products.

  • CALCDRIV is an Automation client application. The description of CALCDRIV includes a procedure that shows how to use the Automation tab in ClassWizard to create dispatch classes from a type library.

  • CONTAINER Step 3 is a combination ActiveX Visual Editing container and Automation client. This version of CONTAINER drives the version Step 4 of AUTOCLIK, the combined ActiveX Visual Editing server and Automation server mentioned above. CONTAINER Step 3 is not discussed in the tutorial but is discussed here in the sample description.

  • DRAWCLI is a full-featured object-oriented drawing application with ActiveX Visual Editing container support. DRAWCLI provides the best illustration of integrating container support with application-specific features — in this case, drawing features. In addition, DRAWCLI demonstrates effective use of C++ object-oriented programming in the design of its "shape" and "drawing tool" classes.

  • GUIDGEN is a simple dialog-based MFC application that can be used to generate globally unique identifiers, or GUIDs, which identify OLE classes, objects, and interfaces.

  • HIERSVR is an ActiveX Visual Editing server application. HIERSVR also uses MFC OLE support for the Clipboard and for drag and drop.

  • INPROC is an in-process Automation server. Unlike the other Automation server samples provided, INPROC can be loaded as a DLL in the client's address space.

  • IPDRIVE is a simple Automation client application that drives the INPROC sample application. IPDRIVE can drive both the in-process version of INPROC as well as the EXE-based or local server version of INPROC, demonstrating the performance advantages of in-process servers.

  • MFCCALC is an Automation server that implements a simple calculator. It can be driven via Automation with the CALCDRIV sample or run stand-alone.

  • MFCBIND shows how to create an ActiveX document (formerly known as a DocObject) container using the ActiveX document container support classes.

  • OCLIENT is an ActiveX Visual Editing container application. It is essentially an extended version of the CONTAINER tutorial sample, which illustrates drag and drop, automatic scrolling during drag-and-drop operations, and Edit Paste Link.

  • SUPERPAD is an ActiveX Visual Editing server application that edits and saves text using the CEditView class.

See Also

Microsoft Foundation Class Library Samples Index


ActiveX Controls Samples

The following samples make use of MFC's support for ActiveX controls.

  • CIRC is the basis for the tutorial on building a simple ActiveX control called Circle.

  • DAOCTL shows how to build an ActiveX control container which contains data-bound controls. The container provides the controls with data from an Access database via DAO.

  • IMAGE is an ActiveX control that is capable of downloading data asynchronously.

  • SMILEY consists of the SMILE ActiveX control inserted into the SMILEY control container. The sample allows you to modify properties, call methods, and handle events from the SMILE control.

  • TESTHELP is an ActiveX control that has its own help file and tooltips.

  • VCTERM is a simple terminal emulation program illustrating the use of the MSCOMM32.OCX ActiveX control.

You can use the TSTCON sample to test ActiveX controls, change their properties, and invoke their methods. The TSTCON sample implements an ActiveX control container using MFC's support for OLE embedding.

See Also

Microsoft Foundation Class Library Samples Index


OpenGL Samples

OpenGL, originally developed by Silicon Graphics Incorporated (SGI) for their graphics workstations, lets applications create high-quality color images independent of windowing systems, operating systems, and hardware.

CUBE is an application that demonstrates how to use OpenGL's resource contexts with MFC's device contexts.

See Also

Microsoft Foundation Class Library Samples Index


Printing and Print Preview Samples

The SCRIBBLE sample, presented in Visual C++ Tutorials, illustrates the basics of framework's printing and print preview support. The following samples illustrate some very common printing tasks not covered by the SCRIBBLE sample:

  • CHKBOOK and SUPERPAD implement page breaks during printing.

  • SUPERPAD and SCRIBBLE add page headers and footers during printing.

  • SUPERPAD illustrates:
    • Starting print preview at the current selection in the document.

    • Returning from print preview to the same position in the document as last previewed.

See Also

Microsoft Foundation Class Library Samples Index


Rectangle Tracker Samples

Class CRectTracker implements a rectangle tracker, used to move and resize a rectangular shaped object in a window. Two samples illustrate CRectTracker:

  • DRAWCLI uses CRectTracker in a real-world drawing application.

  • TRACKER is a test application that provides an exhaustive illustration of CRectTracker's member functions, styles, and options.

See Also

Microsoft Foundation Class Library Samples Index


Resources Samples

Most of the samples use resources that are edited using the development environment resource editors. The following samples illustrate resources that are not directly edited by the resource editors:

  • CTRLTEST has a human-readable .RC file with user-defined symbols that cannot be directly maintained as human-readable script by the resource editors.

  • DRAWPIC shows how to get a handle to a bitmap or icon from an LPPICTUREDISP.

  • SPEAKN has user-defined resources that should not be restructured or reformatted into hexadecimal data by the resource editors.

The Clipart sample directory contains "clipart" resources you can add to your application using the resource editors. The clipart resources include common icons, bitmaps, and cursors that you might want to add to your application.

Note The framework relies on standard resources (distinct from the above clipart resources) that you can modify, subject to certain procedures. For more information, see Technical Note 23. Be sure to read this technical note if you want to customize the standard framework resources.

See Also

Microsoft Foundation Class Library Samples Index


Splitter Windows Samples

Class CSplitterWnd provides support for splitter windows with multiple panes, in which each pane is typically a view on the same document. The following samples show how to use splitter windows:

  • SCRIBBLE shows how panes are created and destroyed in a dynamic splitter window as the user splits new views and removes splits. As in most dynamic splitter windows, the panes represent views of the same CView derived class in SCRIBBLE.

  • VIEWEX shows how in a static splitter window, the order and number of panes never changes. As in most static splitter windows, the panes in these samples represent views of different CView derived classes.

See Also

Microsoft Foundation Class Library Samples Index


Toolbars, Status Bars, Dialog Bars, and Floating Palettes Samples

The Microsoft Foundation Class Library provides classes for common accessory windows that are typically located along the borders of frame windows — CToolBar, CStatusBar, and CDialogBar, all of which are derived from CControlBar. If you select the AppWizard Initial Toolbar option, your application will have a standard toolbar and status bar.

CTRLBARS shows the following:

  • Most of the interesting control bar illustrations

  • Advanced customization of toolbars and status bars

  • A floating tool palette

  • A dialog bar, which is a control bar whose layout is defined by a dialog template resource

DOCKTOOL illustrates:

  • Docking control bars to the outer sides of the client area of a frame window.

  • Undocking a control bar so that it becomes a floating control bar.

  • Adding tool tips to toolbar buttons. Tool tips are short textual prompts that are displayed when the user pauses over a toolbar button.

NPP demonstrates many features of toolbars and status bars.

OLDBARS provides support for applications that rely on the old implementations of CToolBar and CStatusBar by providing the source code for these classes.

SCRIBBLE shows how to add buttons to a toolbar.

See Also

Microsoft Foundation Class Library Samples Index


Views Samples

The SCRIBBLE tutorial sample, presented in Visual C++ Tutorials, shows how to coordinate a single CView derived class with a single CDocument derived class. Many of the other samples also use CView derived classes.

The following samples show specific techniques related to views as well as reusable CView derived classes:

  • CHKBOOK uses multiple views on the same document, in which each view is of a different CView derived class and is framed by a distinct MDI child window.

  • COLLECT and ENROLL switch between different views in the same single document interface (SDI) frame window.

  • DAOENROL tutorial sample uses record view (CDaoRecordView), which is a view laid out by a dialog template resource that displays data from a CDaoRecordset.

  • DYNABIND adds controls dynamically to the bottom of a CFormView (or CRecordView) and resizes the form.

  • ENROLL tutorial sample uses record view (CRecordView), which is a view laid out by a dialog template resource that displays data from a CRecordset.

  • MULTIPAD and SUPERPAD use an edit view (CEditView). The SUPERPAD sample is more advanced.

  • SCRIBBLE, CHKBOOK, OCLIENT, and STEP4 of ENROLL use CDocument::UpdateAllViews and the hint mechanism to inform multiple view objects about changes to a document.

  • SCRIBBLE, DRAWCLI, and CHKBOOK use a scrolling view (CScrollView).

  • VIEWEX uses a static splitter window, in which each pane is assigned to a different CView derived class.

  • VIEWEX and CHKBOOK use a form view (CFormView), which is a view laid out by a dialog template resource. VIEWEX illustrates synchronizing a form view with other views.

See Also

Microsoft Foundation Class Library Samples Index


Window Objects Samples

CWnd is the base class for all framework window classes, including view classes and frame window classes. CWnd offers member functions for almost all of the Windows HWND-based functions and WM_ messages. These CWnd functions and message handlers are illustrated in almost all of the samples.

The following samples illustrate some techniques for using window objects that are specific to using the Foundation classes or that are not covered in general Windows programming literature:

  • CTRLBARS implements a thin title bar, like that used for dragging a tool palette.

  • CTRLTEST and SUPERPAD subclass a window to associate a CWnd derived class with an HWND window.

  • MDI changes the default cursor or icon of a window by calling AfxRegisterWndClass and passing the WNDCLASS name to CWnd::Create.

  • PROPDLG illustrates a modeless mini-frame window, which has a thin title bar for dragging the window.

  • SUPERPAD implements persistent window placement by storing window position information in a private .INI file.

See Also

Microsoft Foundation Class Library Samples Index


Windows Extensions Samples

MFC provides classes that wrap two categories of Windows Extensions: Windows Sockets, for writing network communications programs, and the Messaging Application Programming Interface (MAPI), for client message application developers.

CHATTER is a Windows Sockets Client application. You can use CHATTER to send messages to a discussion server (CHATSRVR) which in turn sends them to multiple other CHATTER users simultaneously.

CHATSRVR is the discussion server for the CHATTER sample application.

The functionality in the MAPIPAD sample has been migrated to the NPP sample. NPP is an editor demonstrating toolbars, status bars, and other controls as well as the MAPI functionality.

See Also

Microsoft Foundation Class Library Samples Index


Windows Common Controls Samples

MFC provides support for many of the Windows Common Controls. Demonstrates Common Control MFC Classes (Part 1)

  • CMNCTRL1 demonstrates how to create and change the styles of Windows Common Controls using MFC classes (Part 1).

  • CMNCTRL2 demonstrates how to create and change the styles of Windows Common Controls using MFC classes (Part 2).

  • DAOVIEW uses two of the Windows Common Controls to let you examine the schema of a database.

  • DBVList demonstrates the virtual list view functionality available for the list view common control.

  • FIRE is a dialog-based application that demonstrates five of the Common Controls.

  • LISTHDR demonstrates the List View and Header Common Controls.

  • ROWLIST illustrates full row selection in the report mode of the CListView MFC common control class. Using toolbar buttons, you can toggle between views of the list items.

  • WORDPAD is a word processing application that uses the MFC rich edit control classes.

See Also

Microsoft Foundation Class Library Samples Index


Alphabetical List of MFC Samples

Sample | Illustrations
ACDUAL | Demonstrates how to add dual interface support to an MFC-based Automation server.
AUTOCLIK | Tutorial example illustrating Automation features in Visual C++ Tutorials.
AUTODRIV | A simple Automation client application that drives the AUTOCLIK tutorial sample application.
BINDENRL | Databound controls in a dialog-based application with property pages.
BINDSCRB | Illustration of the use of new COM interfaces to components currently supported by the Microsoft Office suite of products.
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 Common 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.
CMNCTRL1 | Demonstrates how to create and change the styles of Windows Common Controls using MFC classes (Part 1).
CMNCTRL2 | Demonstrates how to create and change the styles of Windows Common Controls using MFC classes (Part 2).
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.
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 Common Controls let you view the schema of a database.
DBFETCH | Demonstrates the use of bulk row fetching in the ODBC database classes.
DBVList | Demonstrates the virtual list view functionality available for the list view common control.
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 commands not known at compile time; and updating the status bar command prompt for such commands.
ENROLL | Tutorial example illustrating database features in Visual C++ Tutorials.
EXTBIND | Shows how to bind data-aware controls across a dialog box boundary.
FIRE | Dialog-based application that demonstrates five Windows Common 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.
LISTHDR | Demonstrates the List View and Header Common Controls.
MAKEHM | Command 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.
MFCBIND | Shows how to create an ActiveX document (formerly known as a DocObject) container using the ActiveX document container support classes.
MFCCALC | An Automation server that implements a simple calculator.
MFCIE | Uses MFC's CHtmlView and CreBar classes to implement a subset of the functionality provided by Microsoft Internet Explorer.
MFCRows | Shows how to use COleDBRecordView to scroll through a table in a database. Also how to use multiple accessors so you can update an Access table that contains an AutoNumber field to be retrieved.
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.
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.
OLDBARS | Provides support for applications that rely on the old implementations of CToolBar and CStatusBar by providing the source code for these classes.
OLEVIEW | Implementing an OLE object browser through custom OLE interfaces.
PINBALL | An Internet Server Extension DLL that provides graphics and also redirects users to a Web site for further research.
PROPDLG | Property sheets (dialogs).
ROWLIST | Illustrates full row selection in a list-view common 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.
StockTicker | An MFC and ATL application that retrieves stock quotes from the Web and displays them in an ATL control. The user can set the display's properties, including rate of data refresh.
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 | Command line tool that expands source files similar to C++ templates.
TSTCON | Implements an ActiveX control container using MFC's support for OLE embedding. You can use TSTCON to test ActiveX controls, change their properties, and invoke their methods.
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.
VCTERM | Simple terminal emulation program illustrating the use of the Mscomm32.ocx ActiveX control.
VIEWEX | Multiple views, scroll view, splitter windows.
WIZARD97 | Demonstrates implementing a wizard that supports background bitmaps and wide header titles and images. This wizard design is supported for Windows 98 and Windows NT 5.0; you must be using Windows 98 or Windows NT 5.0 for this sample to work properly.
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.

See Also

Microsoft Foundation Class Library Samples Index


CHATSRVR: Demonstrates a Windows Sockets Server

Click to open or copy the CHATSRVR project files.

CHATSRVR, a Windows Sockets Server sample application, is a single-document interface (SDI) application that implements a discussion server for clients of the CHATTER sample.

When you run CHATSRVR, a Discussion dialog box appears that asks for the Channel. The Channel is the number that identifies which discussion you want to support (a single machine could be running multiple discussion servers). Once you provide this information and click OK, the main application window appears.

CHATTER and CHATSRVR could have been written without using a client/server model by having the CHATTER applications send broadcast datagram packets instead of streaming messages to a server. However, this would produce a program with two serious limitations:

  1. Unlike stream sockets, datagram sockets are not guaranteed to be delivered; therefore, some messages may not reach all the other users in the discussion.

  2. CArchive does not support datagram sockets, so all data translation would have to be handled by the program itself, or the user could only chat with those who are using the same version of CHATTER. By using the stream sockets, users of Windows 95, Windows NT ANSI, and Windows NT Unicode versions can chat with each other without concerns of version compatibility.

This sample demonstrates the following keywords:

AfxMessageBox; CArchive::Flush; CArchive::IsStoring; CCmdUI::Enable; CCmdUI::SetText; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::DeleteContents; CDocument::OnNewDocument; CEditView::GetEditCtrl; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CObject::Serialize; CStatusBar::Create; CStatusBar::SetIndicators; CString::GetBuffer; CString::LoadString; CString::ReleaseBuffer; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::GetDocument; CView::OnDraw; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::ExitInstance; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DoDataExchange; CWnd::GetWindowTextLength; CWnd::OnCreate; SetWindowText; wsprintf


CHATTER: Demonstrates a Windows Sockets Client Application

Click to open or copy the CHATTER project files.

CHATTER is a Windows Sockets Client sample application. It is a single-document interface (SDI) application with a splitter window that lets the user send messages to a discussion server (CHATSRVR), which in turn sends them to multiple other CHATTER users simultaneously.

When you run CHATTER, a Setup dialog box asks for the following:

  • Handle — the name by which all your messages will be addressed. For example, you might choose <firstname lastname>; then all messages you send would automatically have the name <firstname lastnameprepended to them.

  • Server — the name of the machine on which the discussion > server is running; for example, ftp.microsoft.com. If you are using Windows Networking, your machine name is sufficient.

  • Channel — the number that identifies which discussion you want to join (a single machine could be running multiple discussion servers).

Once you provide all the information and click OK, the main application window appears. To send a message, type it in the bottom pane. Pressing enter will send it. To send a multiline message, use CTRL+ENTER.

It is important to note that CHATTER and CHATSRVR could have been written without using a client/server model by having the CHATTER applications send broadcast datagram packets instead of streaming messages to a server. However, this would produce a program with two serious limitations:

  1. Unlike stream sockets, datagram sockets are not guaranteed to be delivered; therefore, some messages may not reach all the other users in the discussion.

  2. CArchive does not support datagram sockets, so all data translation would have to be handled by the program itself, or the user could only chat with those who are using the same version of CHATTER. By using the stream sockets, users of Windows 95, Windows NT ANSI, and Windows NT Unicode versions can chat with each other without concerns of version compatibility.

This sample demonstrates the following keywords:

AfxGetApp; AfxMessageBox; CArchive::Flush; CArchive::IsStoring; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::DeleteContents; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnNewDocument; CEditView::GetEditCtrl; CEditView::SerializeRaw; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::OnCreateClient; CFrameWnd::SetActiveView; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; CRect::Size; CSplitterWnd::CreateView; CSplitterWnd::GetPane; CStatusBar::Create; CStatusBar::SetIndicators; CString::GetBuffer; CString::GetLength; CString::IsEmpty; CString::LoadString; CString::ReleaseBuffer; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::GetDocument; CView::OnDraw; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DestroyWindow; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetWindowText; CWnd::GetWindowTextLength; CWnd::KillTimer; CWnd::OnChar; CWnd::OnCreate; CWnd::OnTimer; CWnd::PreCreateWindow; CWnd::SetTimer; CWnd::SetWindowText; SetWindowText; rand; wsprintf


CHKBOOK: Illustrates a Record-Based Document

Click to open or copy the CHKBOOK project files.

The CHKBOOK sample application primarily serves to illustrate the following Microsoft Foundation Class Library (MFC) features and programming techniques:

  1. Transaction-based file I/O, where the document (file) is written to on a per-transaction basis rather than on a load/save basis.

  2. Multiple views of a document, where (a) each view is of a different CView-derived class, and (b) each view is in a separate MDI child window.

  3. Using the CScrollView class, which supports viewing a document in a scrolling window.

  4. Using the CFormView class, which supports viewing a document using a form with controls laid out in a dialog template resource.

  5. Implementing page breaks during printing.

  6. Writing custom data exchange and validation (DDX/V) functions.

  7. Using a private .ini file to open a document automatically when the application is started.

  8. Use of the registry to associate the CHKBOOK data files with the CHKBOOK application, and to define a particular icon to represent the data in the Explorer in Windows® 95 and File Manager in Windows NT®3.51.

The CHKBOOK sample is a single document application in the sense that it allows only one checkbook file to be open at a time. But CHKBOOK uses MDI features of MFC to provide multiple views of the document via views in separate MDI child windows. To enforce that only one document is open at a time, CHKBOOK simply removes the File New and File Open commands from the menus and toolbars of the MDI children, which represent an already opened document.

The two views of the document are a check view and a book view. The check view, implemented in class CCheckView, provides a form for entering or viewing the data for a single check. The book view, implemented in CBookView, provides a scrolling window showing a summary of each check.

The CHKBOOK application supports the concept of current selection. The user can change the current selection in the book view by using up and down arrow keys, and by clicking a check with the mouse. The second check view always shows the current selection in the book view.

The check amount field in the check form view validates and converts a textual representation such as "19.98" to an internal DWORD representation. The use of DWORD facilitates money arithmetic better than, for example, floating point. CHKBOOK does not happen to do money arithmetic, but it easily could, for example, add up all the check amounts and display the total on a bottom line.

The check view shows an English text presentation of the check amount, such as "Nineteen and 98/100ths Dollars" as the user types in the numeric field.

The larger concepts CHKBOOK demonstrates are a record-based document, multiple views in separate MDI child windows, and custom data exchange (DDX).

Record-Based Document

A record-based document is one whose persistent data is updated each time the user adds, deletes, or modifies some portion of its data. Doing so requires overriding the framework's default implementation for file-based documents that are read entirely into memory upon File Open and are written entirely back to disk upon File Close.

Although CHKBOOK's document is a DOS file, the techniques employed also apply to documents whose persistent data is maintained in a database. CHKBOOK uses CFile::Read and Write.

CHKBOOK relies on a simple fixed-length record format for its file. This sample does not attempt to illustrate more sophisticated file organization. We have factored the design of CHKBOOK's document class into a generally reusable CFixedLenRecDoc class and a CHKBOOK-specific CChkBookDoc class, which is derived from CFixedLenRecDoc. You can follow CHKBOOK's example to derive your own document class from CFixedLenRecDoc.

Multiple Views of Distinct CView-Derived Classes, in Separate MDI Child Windows

CHKBOOK implements multiple views of a document, in which each view object is of a different CView-derived class and each view object is framed by a distinct MDI child window. CHKBOOK has two distinct CMultiDocTemplate objects — one corresponding to the check view and one to the book view.

The typical use of CMultiDocTemplate objects is to create an independent set of document frame and view objects. CHKBOOK has two CMultiDocTemplate objects, both using the same CChkBookDoc document class but having distinct view classes. The CChkBookApp::InitInstance function calls AddDocTemplate for both template objects, although only one is needed. To prevent the framework from presenting the user with the File New dialog box that lists two candidate file types, the DocTemplate string resource for the second (IDR_BOOKFRAME) document template does not have an entry corresponding to CDocTemplate::fileNewName.

CHKBOOK shows both views when the document is first opened. The user can later close one or the other view. To create the second frame and view and to ensure that it is attached to the first document, CHKBOOK overrides CWinApp::OpenDocumentFile. The override first calls the base class OpenDocumentFile, and the framework creates the first MDI child window and view. The override then explicitly calls CMultiDocTemplate::CreateNewFrame using the second document template object.

Custom Data Exchange (DDX) Function

CHKBOOK's DDX_DollarsCents function, implemented in DOLLCENT.CPP, is a custom DDX function. The m_dwCents member of CCheckView has a data map entry in CCheckView::DoDataExchange that calls this custom DDX_DollarsCents function. CHKBOOK's ClassWizard file, CHKBOOK.CLW, includes a hand-edited ExtraDDX1 entry that registers this custom DDX function with ClassWizard. For more information, see Technical Note 26!Alink("_MFCNOTES_TN026",0,_topic_not_found).

CHKBOOK Simplifications

The CHKBOOK sample has several simplifications to keep the code focused on the MFC features and techniques the sample is designed to illustrate. For example:

  • CHKBOOK supports only checks and no other money transactions such as deposits. CHKBOOK does not support the deletion (voiding) of checks. The check data is written using fixed-length records rather than using more space-efficient variable length records. These simplifications allow the CChkBookDoc class to access individual check records according to the following very simple algorithm: The location of the check is equal to the length of the file header, plus n times the fixed length of a check record, where n is the number of sequentially issued checks before the check in question. The reusable class CFixedLenRecDoc implements the behavior of a fixed-length record document separately from the details about the particular check document, which are implemented in the CChkBookDoc class derived from CFixedLenRecDoc. Similarly, the reusable class CRowView implements the behavior of a scroll view with rows of fixed heights. The class CCheckView, derived from CRowView, implements the details about the row-based scroll view that are particular to CHKBOOK.

  • CHKBOOK does not fully support resource-based localization to other languages. In particular, the check amount field assumes dollars and cents, and the written-out check amount (e.g., "Nineteen and 98/100ths Dollars") is displayed in English.

  • CHKBOOK supports a limited number of checks, equal to the 32K divided by the pixel height of text on the display or printer.

  • You can update the data in the currently selected check by using the check view. This simple application, however, does not let you delete or void a check.

  • If either the check or the book view is already closed and you try to close the other, the file closes altogether.

Running CHKBOOK

To install the necessary entries in your registration database, you must:

  1. Edit the CHKBOOK.REG file to provide the full path to CHKBOOK.EXE wherever it appears.

  2. Double-click the CHKBOOK.REG icon to merge the edited entries with the database.

Once the entries have been added, the CHKBOOK data files (.chb) will have their own distinctive icons. Double-clicking a data file will then run the CHKBOOK application, opening that particular file for editing.

This sample demonstrates the following keywords:

AfxFormatString1; AfxMessageBox; AfxThrowArchiveException; CArchive::GetFile; CArchive::IsStoring; CBrush::CreateSolidBrush; CCmdUI::Enable; CDC::DPtoLP; CDC::FillRect; CDC::GetClipBox; CDC::GetDeviceCaps; CDC::GetTextMetrics; CDC::IntersectClipRect; CDC::IsPrinting; CDC::LPtoDP; CDC::SetBkColor; CDC::SetTextColor; CDC::SetViewportOrg; CDC::TextOut; CDialog::DoModal; CDocTemplate::InitialUpdateFrame; CDocument::DeleteContents; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnOpenDocument; CDocument::OnSaveDocument; CDocument::SaveModified; CDocument::UpdateAllViews; CFile::Close; CFile::GetStatus; CFile::Open; CFile::Read; CFile::Seek; CFile::Write; CFrameWnd::ActivateFrame; CFrameWnd::Create; CFrameWnd::GetActiveDocument; CFrameWnd::LoadFrame; CMDIChildWnd::GetMDIFrame; CMDIFrameWnd::MDIGetActive; CMDIFrameWnd::MDITile; CObject::IsKindOf; CObject::Serialize; CPrintInfo::SetMaxPage; CRect::Height; CScrollView::SetScrollSizes; CString::Format; CString::GetBufferSetLength; CString::GetLength; CString::IsEmpty; CString::LoadString; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnInitialUpdate; CView::OnPrepareDC; CView::OnPreparePrinting; CView::OnPrint; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::GetProfileString; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWinApp::OpenDocumentFile; CWinApp::WriteProfileString; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetDlgItem; CWnd::GetParentFrame; CWnd::GetScrollBarCtrl; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnKeyDown; CWnd::OnLButtonDown; CWnd::OnSize; CWnd::OnVScroll; CWnd::PreCreateWindow; CWnd::SetWindowText; CWnd::ShowWindow; CWnd::UpdateData; CWnd::UpdateWindow; GetFileTitle; GetSysColor; GetWindowText; LOWORD; LoadBitmap; MAKELONG; SetWindowText; free; malloc; max; min; wsprintf


COLLECT: Illustrates MFC Collection Classes

Click to open or copy the COLLECT project files.

COLLECT illustrates a wide variety of collection classes offered by the Microsoft Foundation Class Library (MFC).

The MFC collection classes can be classified according to shape and design. MFC offers classes for three types of collection shapes:

  • Lists

  • Arrays

  • Maps

and three types of designs:

  • No use of C++ templates.

  • Use of a C++ template–based collection of simple elements.

  • Use of a C++ template–based collection of type-safe pointers.

The following table identifies all the MFC collection classes sorted according to shape and design. The COLLECT sample illustrates nine of these collections, one from each cell in the table. Each represents a distinct combination of shape and design. Also, because usage of the CTypedPtrArray and CTypedPtrList template-based collections differs according to whether they are used to hold pointers to CObjects or to non-CObjects, the COLLECT sample illustrates both cases. The nine collections illustrated by COLLECT are indicated with an asterisk.

Collection shapes | Non-template based | Template-based simple elements | Template-based typeSafe pointers
List | CStringList* | CList* | CTypedPtrList
 | CObList |  | (of pointers)*
 | CPtrList |  | CTypedPtrList
 |  |  | (of CObjects)
Array | CByteArray | CArray* | CTypedPtrArray
 | CUIntArray |  | (of pointers)
 | CWordArray* |  |
 | CDWordArray |  | CTypedPtrArray
 | CStringArray |  | (of CObjects)*
 | CPtrArray |  |
 | CObArray |  |
Map | CMapWordToPtr | CMap* | CTypedPtrMap*
 | CMapWordToOb |  |
 | CMapStringToString* |  |
 | CMapStringToPtr |  |
 | CMapStringToOb |  |
 | CMapPtrToWord |  |
 | CMapPtrToPtr |  |

Additional COLLECT Features

In addition to illustrating the MFC collection classes, COLLECT also illustrates:

  • Coordinating the addition and removal of entries in a list box with the addition and removal of entries in a collection.

  • Switching between different views of a document, with only one shown at a time. That is, although COLLECT has many different views, it has a single-document interface (SDI) instead of a multiple-document interface (MDI).

The Example menu lists nine collection class illustrations organized according to the above table. Each example presents a form view that exercises many of the common collection operations:

  • Adding a new element.

  • Inserting a new element in the middle of a list.

  • Searching an element (by clicking its entry in the dialog box's list box).

  • Searching an entry in the map by entering the Key and clicking Find.

  • Updating the value of an element.

  • Removing an element.

  • Removing all the elements of the collection.

You can save changes to all the examples with File Save and read them back with File Open.

This sample demonstrates the following keywords:

AfxMessageBox; CCmdUI::SetCheck; CControlBar::EnableDocking; CDialog::DoModal; CDocument::DeleteContents; CDocument::OnNewDocument; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::GetActiveDocument; CFrameWnd::GetActiveView; CFrameWnd::RecalcLayout; CFrameWnd::SetActiveView; CListBox::AddString; CListBox::DeleteString; CListBox::FindString; CListBox::GetCurSel; CListBox::GetItemData; CListBox::GetItemDataPtr; CListBox::GetText; CListBox::InsertString; CListBox::ResetContent; CListBox::SetItemData; CListBox::SetItemDataPtr; CObject::AssertValid; CObject::Dump; CObject::Serialize; CStatusBar::Create; CStatusBar::SetIndicators; CString::Empty; CString::Format; CString::LoadString; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DestroyWindow; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::ShowWindow; CWnd::UpdateData; LoadString; SetWindowLong


CUBE: Demonstrates an OpenGL Application

Click to open or copy the CUBE project files.

CUBE is a simple OpenGL™ application. It demonstrates how to integrate OpenGL with the MFC single document interface (SDI), and how OpenGL's resource contexts are used in conjunction with device contexts.

For a more detailed explanation of OpenGL, refer to the Microsoft Win32 SDK and the October 1994, Volume 8, Number 10 issue of Microsoft System Journal. OpenGL is currently supported only on Windows NT, not on Windows 95.

When you start the sample, a 3-D colorful cube is drawn. To animate the cube, either click Play on the Edit menu or click the Play toolbar button.

Note Because the CUBE sample uses OpenGL graphics, which only run on Windows NT, this sample will not run on Windows 95.

This sample demonstrates the following keywords:

CCmdUI::SetCheck; CDC::GetSafeHdc; CDC::RealizePalette; CDC::SelectPalette; CDialog::DoModal; CDocument::OnNewDocument; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::GetActiveView; CObject::AssertValid; CObject::Dump; CObject::Serialize; CPalette::CreatePalette; CView::GetDocument; CView::OnDraw; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::InvalidateRect; CWnd::KillTimer; CWnd::MessageBox; CWnd::OnCreate; CWnd::OnDestroy; CWnd::OnEraseBkgnd; CWnd::OnPaletteChanged; CWnd::OnQueryNewPalette; CWnd::OnSize; CWnd::OnTimer; CWnd::PreCreateWindow; CWnd::RedrawWindow; CWnd::SetTimer; ChoosePixelFormat; DescribePixelFormat; GetPixelFormat; LoadBitmap; PIXELFORMATDESCRIPTOR; PeekMessage; SetPixelFormat; SwapBuffers; glBegin; glClear; glClearColor; glClearDepth; glEnd; glFinish; glLoadIdentity; glMatrixMode; glPopMatrix; glPushMatrix; glRotatef; glTranslatef; glViewport; gluPerspective; wglCreateContext; wglDeleteContext; wglGetCurrentContext; wglGetCurrentDC; wglMakeCurrent


DLLHUSK: Dynamically Links the MFC Library

Click to open or copy the DLLHUSK project files.

DLLHUSK dynamically links the Microsoft Foundation Class Library (MFC) to applications and custom dynamic-link libraries (DLLs) sharing the same class library code, thus reducing the total memory required by running multiple applications.

Dynamically linking to the class library also offers other possible application architectures in which part of the application is implemented in a custom DLL, and both the application and the custom DLL share the MFC DLL (Mfcxx.dll). A custom DLL that shares framework functionality with an application is called an "MFC extension DLL."

DLLHUSK demonstrates MFC extension DLLs with class exports. C++ classes in the DLLs (Testdll1.dll and Testdll2.dll) are exported using the AFX_EXT_CLASS macro. The first MFC Extension DLL (TESTDLL1) is one in which all C++ class interfaces of the custom DLL are accessed only by the framework, not directly by the application. The custom DLL exports only extern "C" functions to the application. The custom DLL does not need to export the functions of classes derived from framework classes. All calls from the framework to derived classes in the custom DLL are resolved via the C++ virtual function mechanism.

The second MFC Extension DLL (TESTDLL2) is one in which some C++ class interfaces of the custom DLL are exported to and accessed directly by the application.

Testdll1.dll

Testdll1.dll provides the implementation for DLLHUSK's document and view classes for both document types — the TEXT document type and the HELLO document type. The Dllhusk.exe implements the MDI frame window class, and the framework implements the MDI child window class (CMDIChildWnd). Two document template objects establish the associations among CTextDoc, CMDIChildWnd, and CEditView and among CDummyDoc, CMDIChildWnd, and CHelloView. DLLHUSK therefore illustrates that the framework can coordinate the relationships among framework-defined objects, even though the classes for those objects are implemented in the application, the custom (MFC extension) DLL, and the framework's Mfc42.dll.

TESTDLL1 actually calls the application object's AddDocTemplate member function twice to register the two document template objects. It does so in the implementation of TESTDLL1's InitTestDLL1 function, which is the only function that TESTDLL1 exports. This function is declared with extern "C" so that the DLLHUSK application can call it as a stand-alone C function.

The Testdll1.h header file (added as a #include by Dllhusk.cpp) includes not only the declaration of InitTestDLL1, but also the declarations of TESTDLL1's classes. Dllhusk.cpp refers directly to only the InitTestDLL1 function. Indirectly, however, DLLHUSK uses the document and view classes implemented in Testdll1.dll.

Testdll2.dll

Testdll2.dll provides the implementation for DLLHUSK's CListOutputFrame class. When the user chooses a diagnostic command by using the right-mouse-click pop-up menu, the application creates a CListOutputFrame object and then sends diagnostic messages to the List Output window by calling CListOutputFrame::AddString.

All the public member functions of CListOutputFrame are exported in the Testdll2.def file. The exports include not only AddString but also the public CListOutputFrame constructor and destructor.

It is more difficult to implement an MFC extension DLL that exports class member functions than one that exports only C functions. This is true particularly because you must manually add the C++ name-decorated function exports to the DLL's .def file. A technique for doing so is explained in Technical Note 33.

DLLHUSK also illustrates:

  • Splitting resources for a single application into multiple .RC files, which can be edited in the Visual C++ resource editor.

  • Using two global diagnostic functions, AfxDoForAllClasses and AfxDoForAllObjects.

  • Enumerating CDynLinkLibrary objects.

The DLLHUSK makefile builds both the Dllhusk.exe application and the two DLLs (TESTDLL1.DLL and TESTDLL2.DLL) to which the application is dynamically linked. DLLHUSK requires MFCxx.DLL or MFCxxD.DLL at run time. These DLLs are installed by default in your Microsoft Windows system directory.

This sample demonstrates the following keywords:

AfxDoForAllClasses; AfxDoForAllObjects; AfxGetApp; AfxGetResourceHandle; AfxMessageBox; AfxSetResourceHandle; AfxThrowMemoryException; CCmdUI::SetCheck; CColorDialog::DoModal; CColorDialog::GetColor; CDC::DrawText; CDC::SetBkColor; CDC::SetTextColor; CDialogBar::Create; CDocTemplate::GetDocString; CEditView::SerializeRaw; CFrameWnd::LoadFrame; CListBox::AddString; CListBox::Create; CListBox::GetCount; CListBox::GetText; CListBox::GetTextLen; CListBox::ResetContent; CListBox::SetCurSel; CMDIChildWnd::Create; CMenu::GetSubMenu; CMenu::LoadMenu; CMenu::TrackPopupMenu; CObject::AssertValid; CObject::Dump; CObject::Serialize; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::OnDraw; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWinApp::OpenDocumentFile; CWnd::GetClientRect; CWnd::GetCurrentMessage; CWnd::GetFont; CWnd::Invalidate; CWnd::OnCreate; CWnd::OnNcRButtonDown; CWnd::OpenClipboard; CWnd::SetFont; CWnd::ShowWindow; CWnd::UpdateWindow; CloseClipboard; EmptyClipboard; GetModuleFileName; GetSysColor; GlobalAlloc; GlobalLock; LOWORD; RGB; SetClipboardData; lstrlen; wsprintf


DLLTRACE: Writes a DLL Statically Linked to the Framework Library

Click to open or copy the DLLTRACE project files.

The DLLTRACE sample illustrates a dynamic-link library (DLL) version of the TRACER tool. DLLTRACE was introduced in Microsoft Foundation Class Library (MFC) version 1.0 to illustrate how to write a DLL that is itself statically linked to the framework library. This DLL provides a C-based program interface to the Microsoft Windows–based application to which it is dynamically linked. A DLL that is statically linked to the framework library cannot successfully export member functions of any classes that are derived from framework classes.

The technique of statically linking a custom DLL to the Foundation Class Library is discussed in Technical Note 11: Using MFC as Part of a DLL Before you decide to implement a custom DLL by statically linking to MFC, consider implementing it as an MFC extension DLL, as explained in Technical Note 33: DLL Version of MFC and as illustrated by the DLLHUSK sample.

A custom DLL that is statically linked to the MFC library needs to have a CWinApp-derived class and a single object of that application class, as does an executable MFC application. The CWinApp object of the DLL, however, does not have a main message pump, as does the CWinApp object of an application. If the DLL opens modeless dialogs or has a main frame window of its own, the application's main message pump must call a routine exported by the DLL, which in turn calls the CWinApp::PreTranslateMessage member function of the DLL's application object. This is illustrated by the FilterDllMsg function exported by Tracer.dll.

TRACEAPI.H shows that a way to provide a DLL interface to client applications is to use declare functions with extern "C". The use of extern "C" has several advantages. First, it makes your DLL usable by non-C++ client applications. Second, it reduces DLL overhead, because C++ name decoration will not be applied to the exported name. Third, it makes it easier to explicitly add to a .def file (for exporting by ordinal), without having to worry about C++ name decoration.

To run DLLTRACE, run HELLO1, which is built by the DLLTRACE makefile in the DLLTRACE sample directory. The HELLO1 window displays "Hello, Windows! (with DLL support)". Click Change Trace Flags on the Debug menu. This opens the same AFX Trace Options dialog box presented by the TRACER tool. See TRACER for an explanation of the trace options.

Converting DLLTRACE to Dynamically Link with the MFC DLL

DLLTRACE demonstrates how to create a Regular DLL with an exported function that can be called to display a modal dialog box. By default, DLLTRACE is set to statically link MFC to the DLL. In previous versions of Visual C++, this was the only option available for Regular DLLs. These kinds of DLLs were formerly known as _USRDLLs.

Now, it is possible for a Regular DLL to use MFC from the shared MFCx0 DLL. Because of the potential to reduce the size of the build, you might want to convert the DLLTRACE sample to use the shared MFC DLL. Converting the TRACE.DLL to use the Shared Library will reduce the size of a release-build DLL from around 95K to about 12K and will reduce the size of the debug build from nearly 1 megabyte to 25K. To convert DLLTRACE, it is necessary to use the macro AFX_MANAGE_STATE in order to switch the global MFC module state correctly.

Steps to Convert DLLTRACE to Use MFC in a Shared Library

  • On the Build Settings property sheet, click both the release and debug builds to change their settings.

  • On the General tab in the Microsoft Foundation Classes box, change the option to "Use MFC in a Shared DLL (mfc(d).dll)."

  • Add the following line of code to the beginning of every function exported from the DLL (see " Managing the State Data of MFC Modules" in the Visual C++ Programmer's Guide. for discussion):
     AFX_MANAGE_STATE(AfxGetStaticModuleState())

For example, Trace.dll exports only three functions: PromptTraceFlags( ), ProcessDLLIdle( ), and FilterDLLMsg( ). Here is what FilterDLLMsg( ) should look like in the converted form:

   extern "C" BOOL FAR PASCAL EXPORT FilterDllMsg(LPMSG lpMsg)
   {
      AFX_MANAGE_STATE(AfxGetStaticModuleState())
      TRY
      {
          return AfxGetApp()->PreTranslateMessage(lpMsg);
      }
      END_TRY
      return FALSE;
   }

After making these changes, rebuild the DLLTRACE project. The application will use the new DLL and work just as it did before.

This sample demonstrates the following keywords:

AfxGetApp; CDC::SetBkMode; CDC::SetTextAlign; CDC::TextOut; CDialog::DoModal; CWinApp::Enable3dControls; CWinApp::ExitInstance; CWinApp::InitInstance; CWinApp::OnIdle; CWinApp::PreTranslateMessage; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::OnPaint; MAKEINTRESOURCE; ShowWindow; UpdateWindow; afxTraceEnabled; afxTraceFlags


FIRE: Demonstrates Windows 95 Common Controls

Click to open or copy the FIRE project files.

FIRE is a Windows 95 Common Controls dialog-based sample application. It simulates fire and allows you to change various properties of the fire by adjusting Windows Common Controls on the dialog.

When you run FIRE, the Windows 95 Fire dialog box appears.

To change attributes of the fire, do any of the following.

  • Click Tab to change the palette that renders the fire.

  • Click and drag Vertical Slider along the right side of the fire to adjust the ceiling of the flames. Note the Progress Indicator control below the fire that tells you when the adjustment is complete.

To use the Tree control

  • Click one of the leaf nodes: Decay, Flammability, Maximum Heat, Spread Rate, or Size under the Fire node, or Smoothness, Distribution, or Chaos under the Render node.

  • Use the up and down arrows to adjust the value that appears in the Spin control.

  • Click Apply to update the value and watch the fire change accordingly.

This sample demonstrates the following keywords:

AfxGetApp; BitBlt; CDC::BitBlt; CDC::CreateCompatibleDC; CDC::DrawIcon; CDC::GetSafeHdc; CDC::RealizePalette; CDC::SelectObject; CDC::SelectPalette; CDialog::DoModal; CDialog::OnInitDialog; CGdiObject::Attach; CGdiObject::DeleteObject; CGdiObject::GetObject; CMenu::AppendMenu; CRect::Height; CRect::Size; CRect::Width; CString::IsEmpty; CString::LoadString; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::CenterWindow; CWnd::DoDataExchange; CWnd::EnableWindow; CWnd::GetClientRect; CWnd::GetCurrentMessage; CWnd::Invalidate; CWnd::IsChild; CWnd::IsIconic; CWnd::KillTimer; CWnd::OnActivate; CWnd::OnDestroy; CWnd::OnHScroll; CWnd::OnPaint; CWnd::OnPaletteChanged; CWnd::OnQueryDragIcon; CWnd::OnQueryNewPalette; CWnd::OnSysCommand; CWnd::OnTimer; CWnd::SendMessage; CWnd::UpdateData; CreateBitmap; CreateDIBSection; CreatePalette; DeleteObject; EnableWindow; GetActiveWindow; GetSystemMenu; GetSystemMetrics; LoadIcon; PeekMessage; RealizePalette; SelectPalette; SetTimer; memcpy; rand


MTGDI: Demonstrates Sharing GDI Resources Across Multiple Threads of Execution

Click to open or copy the MTGDI project files.

The MTGDI sample is a demonstration of sharing GDI resources among multiple threads using the framework's single document interface (SDI) support for documents and views.

To run MTGDI, just build the sample and run the application. You can use the Thread menu to add 1, 10, or 25 new threads at a time. Each thread displays either a moving ball, rectangle, or line in a random color.

MTGDI uses a set of CWinThread-derived classes, all of them implemented in Threads.cpp. The sample's own CGDIThread is the virtual base class for each of these GDI thread classes (one each for balls, rectangles, and lines). Since GDI resources cannot be shared among threads as MFC objects, this sample also demonstrates how to convert from standard GDI resources to MFC objects and back.

The application creates the desired number of threads when the user chooses to add new objects to those being displayed by the Thread menu. Each new object displayed is handled in its own thread. Any number of threads can be added to those already in progress. The number of threads currently being handled is shown in the title bar.

The threads are shut down all at once from the Thread menu, but you have a choice between whether this shutdown is done slowly or quickly. If there are fewer than 100 threads, it is difficult to tell the difference in speed between these two methods for MTGDI.

This sample demonstrates the following keywords:

CDC::Attach; CDC::Detach; CDocument::OnNewDocument; CGdiObject::Attach; CGdiObject::Detach; CObject::AssertValid; CObject::Dump; CObject::Serialize; CPoint::Offset; CRect::OffsetRect; CRect::SetRect; CString::Format; CString::LoadString; CView::GetDocument; CView::OnDraw; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::ExitInstance; CWinApp::InitInstance; CWinApp::OnFileNew; CWnd::DoDataExchange; CWnd::GetParentFrame; CWnd::Invalidate; CWnd::OnCreate; CWnd::OnDestroy; CWnd::OnSize; CWnd::PreCreateWindow; CWnd::SetWindowText; CloseHandle; CreateEvent; CreateThread; DeleteCriticalSection; Ellipse; EnterCriticalSection; GdiFlush; GetClientRect; InitializeCriticalSection; LeaveCriticalSection; LineTo; MoveTo; RGB; Rectangle; ResumeThread; SelectObject; SetEvent; SetThreadPriority; Sleep; WaitForSingleObject


MTMDI: Demonstrates an MFC User Interface Thread

Click to open or copy the MTMDI project files.

MTMDI illustrates a Microsoft Foundation Class Library (MFC) user interface thread, where user interface events are processed in a separate thread from the main application thread. This sample is a modified version of the single-thread MDI sample.

The MTMDI sample does not claim a strong rationale for putting the bouncing ball window in a separate thread. A user would not be able to detect the difference between the MDI and MTMDI samples on a single-processor computer. Even on a multiprocessor computer, the user would not be able to detect the difference, given that the ball movement is based on a window timer.

Nevertheless, MTMDI does illustrate techniques for implementing an MFC user interface thread. Compare the sources for the MDI and MTMDI samples to study the programming overhead associated with using MFC user interface threads.

The programming overhead in MTMDI should be a warning that you should have a good reason for using a user interface thread to justify the programming cost. The much more common type of thread in MFC is the worker thread, illustrated by the MTRECALC sample.

The user interface for MTMDI is very similar to the user interface of the MDI sample. However, MTMDI includes one additional user interface feature: you can click anywhere in the bounce window to change the position of the moving ball immediately.

You can use the File menu to create new windows of two different types. Once the windows are created, the application will let you change the attributes of the items in the window by using commands in one of these menus: Color, Speed, Window, and Help. Notice that the "Hello!" windows do not have a Speed menu.

MTMDI makes use of its own CWinThread-derived class, called CBounceThread. CBounceThread is implemented in the Mtbounce.cpp file. The thread contains all of the painting and timing code that the bouncing ball window needs to animate the ball in the window.

The application creates each thread just as the MDI child window is created. This happens in the CBounceMDIChildWnd::Create function, found in Bounce.cpp. This function creates both the window and the thread, associating the thread to the window.

Whenever you close a bounce window, the associated thread is automatically destroyed. The "Hello!" windows do not have a thread of their own; their messages are handled by the application's primary thread.

This sample demonstrates the following keywords:

AfxGetInstanceHandle; AfxMessageBox; AfxRegisterWndClass; CBitmap::CreateCompatibleBitmap; CCmdTarget::OnCmdMsg; CCmdUI::SetCheck; CColorDialog::DoModal; CColorDialog::GetColor; CDC::BitBlt; CDC::CreateCompatibleDC; CDC::DeleteDC; CDC::DrawText; CDC::Ellipse; CDC::FillRect; CDC::GetDeviceCaps; CDC::SelectObject; CDC::SetBkColor; CDC::SetTextColor; CFrameWnd::LoadFrame; CFrameWnd::rectDefault; CGdiObject::DeleteObject; CMDIChildWnd::Create; CMenu::LoadMenu; CRect::Height; CRect::Width; CWinApp::Enable3dControls; CWinApp::ExitInstance; CWinApp::InitInstance; CWnd::Create; CWnd::DestroyWindow; CWnd::GetClientRect; CWnd::GetCurrentMessage; CWnd::GetDC; CWnd::GetDlgItem; CWnd::GetWindow; CWnd::Invalidate; CWnd::KillTimer; CWnd::MessageBox; CWnd::OnCreate; CWnd::OnDestroy; CWnd::OnLButtonDown; CWnd::OnPaint; CWnd::OnSize; CWnd::OnTimer; CWnd::ReleaseDC; CWnd::SendMessage; CWnd::SetTimer; CWnd::SetWindowPos; CWnd::ShowWindow; CWnd::UpdateWindow; CloseHandle; CreateEvent; CreateThread; EnumChildWindows; GetSysColor; GetVersion; LOWORD; LoadCursor; LoadIcon; LoadMenu; MAKEINTRESOURCE; RGB; SetEvent; Sleep; WaitForSingleObject; max; min


MTRECALC: Supports Multithread Applications

Click to open or copy the MTRECALC project files.

MTRECALC illustrates Microsoft Foundation Class Library (MFC) support for multithread applications.

MFC distinguishes two types of threads: user interface threads and worker threads. A user interface thread has its own message pump for handling user interface events separately from other threads. A worker thread does not have its own message pump. MTRECALC illustrates a worker thread. The worker thread simulates a lengthy calculation by waiting for a timer before completing the calculation of adding two numbers.

MTRECALC displays a simple form for adding two integers, simulating a spreadsheet that recalculates whenever you update a cell or click Recalculate Now. The result field displays "Recalculating..." during the time MTRECALC is simulating a lengthy calculation. You can change the recalculation time by clicking Speed of Recalculation on the Demo menu.

Click Worker Thread or Single Thread on the Demo menu to compare the “feel” of recalculation in a separate worker thread versus recalculation in the same thread as the main application user interface thread. For example, in the Single Thread demonstration, you cannot access the menus of MTRECALC while it is recalculating, but in the Worker Thread demonstration you can. In the Single Thread demonstration you cannot update either of the integer fields while MTRECALC is recalculating, but in the Worker Thread demonstration you can. If you update a field while the worker thread is already recalculating, the active recalculation will be abandoned and a new one started.

The Kill Worker Thread command on the Demo menu is enabled only while the worker thread is recalculating. If you use the Kill Worker Thread command to interrupt the recalculation before it is done, then the result field displays a question mark ("?"). You can restart the calculation with the Recalculate Now command.

If you attempt to save the MTRECALC document before recalculation has completed, you will be prompted with "Do you wish to wait while recalculation finishes?" If you respond with yes, MTRECALC displays an hourglass while it waits for the recalculation to complete before saving the document. To exercise this demonstration, you will probably need to use the Speed of Recalculation command to increase the recalculation time from the default 5 seconds to 10 or 15 seconds. This will give you enough time to navigate through the File Save menu and dialog.

This sample demonstrates the following keywords:

AfxBeginThread; AfxGetMainWnd; AfxMessageBox; CArchive::IsStoring; CCmdTarget::BeginWaitCursor; CCmdTarget::EndWaitCursor; CCmdUI::Enable; CCmdUI::SetCheck; CDialog::DoModal; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnNewDocument; CDocument::OnSaveDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CObject::AssertValid; CObject::Dump; CObject::Serialize; CStatusBar::CommandToIndex; CStatusBar::SetPaneText; CString::Format; CString::LoadString; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnEndPrinting; CView::OnPreparePrinting; CView::OnPrint; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::OnKillFocus; CWnd::PostMessage; CWnd::SendMessage; CWnd::SetWindowText; CWnd::ShowWindow; CWnd::UpdateData; CWnd::UpdateWindow; CreateEvent; DragAcceptFiles; GetExitCodeThread; GetVersion; LoadBitmap; PostMessage; ResetEvent; SetEvent; Sleep; WaitForSingleObject


MUTEXES: Demonstrates the CMutex Synchronization Object

Click to open or copy the MUTEXES project files.

MUTEXES is an MFC sample that demonstrates the use of the CMutex synchronization object. MUTEXES is a dialog-based application that creates two CWinThread objects and uses them to perform a simple task under the user's control.

When the sample starts, it presents a list box that is being filled by one of two threads the program creates.

You can adjust the priority of the counter thread and the display thread independently using the combo boxes near the top of the dialog box. You can also adjust the process priority, which affects the behavior of both threads in the process relative to other processes in the system, by using the Process Priority dialog box.

When the application starts, the display thread begins converting an integer stored in the application to a string and then adds the string to a list box. The other thread in the application, meanwhile, is busy incrementing that integer by one in a tight loop.

If you check the Synchronize check box, the threads will use a CMutex and CSingleLock object to make sure both threads don't try to reference the string or the integer at the same time. When Synchronize isn't checked, you'll notice that the content of the list box is not very orderly. When Synchronize is checked, you'll find that the application smoothly increments the counter and that the strings added to the box are in numerical order.

By default, the Pause checkbox isn't checked. If you check it, the execution of both threads will be suspended. By pausing the threads, you can examine the output in the list box while the threads aren't busy adding more strings.

The counter thread generates no output unless you check the Show Counter Thread checkbox.

MFC MUTEXES Compared with Win32 API MUTEXES

MUTEXES is based on the MUTEXES sample from Jeffery Richter's book, Advanced Windows 32 from Microsoft Press, and is used with his permission. This MFC version of MUTEXES is written in C++ using MFC, while Richter's sample uses C and standard Windows API calls. Aside from the conversion, the programs function in the same way.

You can learn more about the details of the application's functionality by reviewing the MUTEXES source code or by reading Richter's commentary in his book.

The only major difference in the two samples is in the way they shut down the threads. Richter's example uses ::TerminateThread, and the MFC version of MUTEXES shuts down the threads when the application terminates.

The CWinThread object doesn't have a TerminateThread member function. The ::TerminateThread API is quite dangerous — it terminates a thread's execution without hesitation. A thread that is manipulating an internal data structure might leave that data structure in an indeterminate state as it terminates early.

As a result, the logic for the WM_CLOSE handler in the dialog box of the MFC sample is a bit more complicated than the similar handler in Advanced Windows 32 because it carefully orchestrates the termination of the threads.

This sample demonstrates the following keywords:

AfxBeginThread; AfxGetApp; CButton::GetState; CButton::SetCheck; CComboBox::AddString; CComboBox::GetCurSel; CComboBox::SetCurSel; CDC::DrawIcon; CDC::GetSafeHdc; CDialog::DoModal; CListBox::AddString; CListBox::DeleteString; CListBox::GetCount; CListBox::SetCurSel; CMenu::AppendMenu; CMultiLock; CMutex; CRect::Height; CRect::Width; CSemaphore; CString::Empty; CString::IsEmpty; CString::LoadString; CSyncObject; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetDlgItem; CWnd::IsIconic; CWnd::OnClose; CWnd::OnPaint; CWnd::OnQueryDragIcon; CWnd::OnSysCommand; CWnd::PostMessage; CWnd::SendMessage; GetCurrentProcess; GetDlgItem; GetExitCodeThread; GetSystemMenu; GetSystemMetrics; IsDlgButtonChecked; LoadIcon; PostMessage; ResumeThread; SetOwner; SetPriorityClass; SetThreadPriority; Sleep; SuspendThread


OLDBARS: Support for Old-Style CToolBar and CStatusBar

Click to open or copy the OLDBARS project files.

Starting with Visual C++® version 4.0, the CToolBar and CStatusBar classes use common controls built into Windows® 95 and Windows® NT 3.51.

The OLDBARS sample provides support for applications that rely on the old implementations of CToolBar and CStatusBar by providing the source code for these classes. The sample demonstrates how to use these classes, renamed COldToolBar and COldStatusBar, to maintain backward compatibility.

To use these classes in your own programs, rename them in your own source code to COldToolBar and COldStatusBar, then copy the following files to your project directory and add them to your project:

  • GLOBALS.H — declarations of global data for system metrics.

  • GLOBALS.CPP — definitions of global data for system metrics.

  • STATBAR.H — declaration of the COldStatusBar class.

  • STATBAR.CPP — definition of the COldStatusBar class.

  • TOOLBAR.H — declaration of the COldToolBar class

  • TOOLBAR.CPP — definition of the COldToolBar class.

This sample demonstrates the following keywords:

AfxIsValidAddress; AfxRegisterWndClass; AfxThrowResourceException; BitBlt; CCmdUI::Enable; CCmdUI::SetCheck; CCmdUI::SetText; CDC::GetTextExtent; CDC::GetTextMetrics; CDC::RectVisible; CDC::SelectObject; CDialog::DoModal; CDocument::OnNewDocument; CDumpContext::GetDepth; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CObject::AssertValid; CObject::Dump; CObject::Serialize; CRect::Height; CRect::InflateRect; CRect::OffsetRect; CRect::PtInRect; CRect::SetRectEmpty; CRect::Width; CStatusBar::CStatusBar; CStatusBar::CommandToIndex; CStatusBar::Create; CStatusBar::GetItemID; CStatusBar::GetItemRect; CStatusBar::GetPaneInfo; CStatusBar::GetPaneText; CStatusBar::SetIndicators; CStatusBar::SetPaneInfo; CStatusBar::SetPaneText; CString::GetLength; CString::LoadString; CToolBar::CToolBar; CToolBar::CommandToIndex; CToolBar::Create; CToolBar::GetButtonInfo; CToolBar::GetItemID; CToolBar::GetItemRect; CToolBar::LoadBitmap; CToolBar::SetButtonInfo; CToolBar::SetButtons; CToolBar::SetHeight; CToolBar::SetSizes; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::GetClientRect; CWnd::GetOwner; CWnd::GetParentFrame; CWnd::GetStyle; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::IsZoomed; CWnd::OnCancelMode; CWnd::OnCreate; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::OnSize; CWnd::OnSysColorChange; CWnd::OnSysCommand; CWnd::OnWinIniChange; CWnd::PreCreateWindow; CWnd::SendMessage; CWnd::ShowWindow; CWnd::UpdateDialogControls; CWnd::UpdateWindow; ClientToScreen; CreateBitmap; CreateCompatibleBitmap; CreateCompatibleDC; CreateDIBitmap; CreateFontIndirect; CreatePatternBrush; CreatePen; CreateSolidBrush; DeleteDC; DeleteObject; DragAcceptFiles; ExtTextOut; FindResource; FreeResource; GetBValue; GetClientRect; GetDC; GetDeviceCaps; GetGValue; GetObjectType; GetRValue; GetStockObject; GetSysColor; GetSystemMetrics; GetVersion; HIBYTE; HIWORD; InvertRect; LOBYTE; LOWORD; LineTo; LoadBitmap; LoadCursor; LoadResource; LockResource; MAKEINTRESOURCE; MoveTo; MulDiv; OffsetRect; PatBlt; RGB; RectVisible; ReleaseCapture; ReleaseDC; SelectObject; SendMessage; SetBkColor; SetBkMode; SetCapture; SetROP2; SetRect; SetTextAlign; SetTextColor; StretchDIBits; UpdateWindow; free; lstrcmp; lstrcpy; lstrlen; malloc; memcpy; memset; min


SPEAKN: Demonstrates Multimedia Sound Using User-Defined Resources

Click to open or copy the SPEAKN project files.

The SPEAKN sample brings together graphics output and sound output. The SPEAKN sample illustrates Multimedia extensions with the following programming techniques:

  • Implementing sound output using the multimedia APIs (application programming interfaces) defined in the Windows Software Development Kit MMSYSTEM.H header file.

  • SPEAKN uses user-defined resources to store multimedia data like sounds and bitmaps. See Technical Note 35: Using Multiple Resource Files and Header Files with Visual C++ for a discussion of maintaining user-defined resources in a separate .RC file not maintained directly by Microsoft Visual C++.

  • Using bitmap buttons. (The CTRLTEST sample application provides a more exhaustive illustration of using CBitmapButton.)

  • Implementing an application user interface that consists of a single dialog box. (The TRACER sample provides an even simpler illustration.)

A sound card is required if you want to hear the sound output, but you can run the application without a sound card.

When you first run SPEAKN, it plays a "welcome" sound and displays a What is this? dialog box. When the sound play completes, SPEAKN displays the first of a series of images — a picture of a dog. Type "dog" into the edit box. When you enter the correct word, SPEAKN rewards you with a sound and moves on to the next image.

The happy-face bitmap initially has no smile or frown. If the first character you type is correct, the face turns to a smile; if it is incorrect, the face turns to a frown.

This sample demonstrates the following keywords:

AfxGetResourceHandle; AfxMessageBox; CBitmapButton::AutoLoad; CBitmapButton::LoadBitmaps; CDialog::DoModal; CDialog::EndDialog; CDialog::OnInitDialog; CDialog::OnOK; CFont::CreateFontIndirect; CString::GetLength; CString::IsEmpty; CString::LoadString; CString::MakeUpper; CWinApp::Enable3dControls; CWinApp::InitInstance; CWnd::DoDataExchange; CWnd::EnableWindow; CWnd::GetDlgItem; CWnd::GetWindowText; CWnd::Invalidate; CWnd::SetFocus; CWnd::SetFont; CWnd::SetWindowText; CWnd::ShowWindow; CWnd::SubclassDlgItem; CWnd::UpdateData; CWnd::UpdateWindow; DestroyIcon; FindResource; FreeResource; LoadIcon; LoadResource; LockResource; MAKEINTRESOURCE; PlaySound; PostQuitMessage; lstrcpy; mbstowcs; memset; sndPlaySound; strlen


CONTROLS: MFC-Based ActiveX Controls

An ActiveX control (formerly OLE control) is an ActiveX object with an extended interface that lets it behave like a control for Microsoft Windows.

Adding ActiveX Controls to the Dialog Editor

To place ActiveX controls or objects on the dialog editor Controls toolbar, you must first add ActiveX controls to your project in the Component Gallery. Once inserted, the ActiveX controls appear on the dialog editor Controls toolbar and can be dragged to the dialog box that you are constructing. The controls that you apply are reloaded each time you start the project.

To add an ActiveX control to the project

  1. On the Project menu, choose Add To Project, then choose Components and Controls. The Gallery dialog box appears.

  2. Choose the Registered ActiveX Controls folder.

  3. Select the control you want by clicking an ActiveX control icon.

  4. Click Insert.

An icon representing each installed control appears on the dialog editor Controls toolbar.

Manual Registration of ActiveX Controls

For the following procedure to work, the ActiveX development tools must be installed and the development environment must be open.

  1. On the Tools menu, click Test Container.
    The Test Container application will start up.

  2. On the Tools menu, click Register Controls.
    The Controls Registry dialog box appears.

  3. Click Register.
    The Register Controls dialog box appears.

  4. Select the directory in which the ActiveX control is installed.

  5. In the File Name list, double-click the file of the control.
    Test Container will register the control and add it to the list in the Controls Registry box.

  6. Click Close to close Controls Registry.
    You can now insert your control in Test Container or in any dialog or form you want.

The following samples demonstrate ActiveX Controls:

Click to open or copy the BUTTON project files.

BUTTON: A control subclassed from a Windows button control. Demonstrates use of an in-place active menu, a stock property page, and the About box control option.

Click to open or copy the CIRC1 project files.

CIRC1: The Circle control just after it is created with ControlWizard.

Click to open or copy the CIRC2 project files.

CIRC2: The Circle control after several properties and events have been added.

Click to open or copy the CIRC3 project files.

CIRC3: The completed Circle control. Demonstrates ActiveX control basics, including control painting, stock and custom properties, stock and custom events, use of colors and fonts, the stock Font property page, the default property page, and versioning.

Click to open or copy the DB project files.

DB: A control that illustrates use of the CRecordSet and CDatabase classes.

Click to open or copy the LICENSED project files.

LICENSED: A control that enforces use of a design-time and run-time license.

Click to open or copy the LOCALIZE project files.

LOCALIZE: A control with a localized user interface. Demonstrates use of separate type libraries and resource dynamic-link libraries (DLLs) for localization.

Click to open or copy the PAL project files.

PAL: A control that displays the colors of a palette. Demonstrates read-only properties, persistent Get/Set properties, persistent parameterized properties, and picture properties.

Click to open or copy the PUSH project files.

PUSH: A control subclassed from a Windows owner-drawn button control. Demonstrates stock properties, custom events, and picture holders.

Click to open or copy the REGSVR project files.

REGSVR: This utility is used to invoke the self-registration code built into ActiveX Controls to add or remove a control's information in the registry.

Click to open or copy the SPINDIAL project files.

SPINDIAL: A control with the visual appearance of a spin-dial. Demonstrates property page data validation.

Click to open or copy the TIME project files.

TIME: A control that is invisible at run time and fires a timer event at set intervals. Demonstrates notification functions and ambient properties.

Click to open or copy the XLIST project files.

XLIST: A control, subclassed from a Windows list box, that displays text or bitmap items. Demonstrates methods, ambient properties, picture holders, and font holders.

The BUTTON sample demonstrates the following keywords:

AfxGetInstanceHandle; CDialog::DoModal; CMenu::LoadMenu; HIWORD; MAKELONG

The CIRC1 sample demonstrates the following keywords:

AfxGetInstanceHandle; CDialog::DoModal; Ellipse; FillRect; GetStockObject; MAKELONG

The CIRC2 sample demonstrates the following keywords:

AfxGetInstanceHandle; CDC::Ellipse; CDC::SelectObject; CDC::SelectStockObject; CDialog::DoModal; Ellipse; FillRect; GetClientRect; GetDC; MAKELONG; RGB; ReleaseDC; SelectObject

The CIRC3 sample demonstrates the following keywords:

AfxGetInstanceHandle; CDC::Ellipse; CDC::SelectObject; CDC::SelectStockObject; CDialog::DoModal; CString::AllocSysString; CString::GetLength; Ellipse; ExtTextOut; FillRect; GetClientRect; GetDC; GetVersion; MAKELONG; RGB; ReleaseDC; SelectObject; SetBkMode; SetTextAlign; SetTextColor

The DB sample demonstrates the following keywords:

AfxGetInstanceHandle; CComboBox::AddString; CComboBox::GetCount; CComboBox::GetCurSel; CComboBox::GetLBText; CComboBox::ResetContent; CComboBox::SelectString; CDialog::DoModal; CFieldExchange::SetFieldType; CRecordset::DoFieldExchange; CString::Empty; CString::IsEmpty; CWnd::EnableWindow; EnableWindow; GetDlgItem; HIWORD; MAKELONG; MessageBox; SendMessage; lstrlen; strcat; strchr; strcpy; strlen; strstr; wsprintf

The LICENSED sample demonstrates the following keywords:

AfxGetInstanceHandle; CDC::ExtTextOut; CDC::SelectObject; CDC::SetTextAlign; CDialog::DoModal; CString::GetLength; MAKELONG; MessageBox

The LOCALIZE sample demonstrates the following keywords:

AfxGetInstanceHandle; AfxGetResourceHandle; AfxSetResourceHandle; CDC::InvertRect; CDialog::DoModal; CString::GetLength; CString::LoadString; ExtTextOut; FreeLibrary; GetClientRect; GetDC; LibMain; LoadLibrary; MAKELONG; ReleaseCapture; ReleaseDC; SelectObject; SetCapture; SetTextAlign

The PAL sample demonstrates the following keywords:

AfxGetInstanceHandle; CBrush::CreateSolidBrush; CDC::IntersectClipRect; CDC::PatBlt; CDC::RealizePalette; CDC::SelectObject; CDC::SelectPalette; CDialog::DoModal; CGdiObject::Attach; CGdiObject::CreateStockObject; CGdiObject::Detach; CGdiObject::GetObject; CGdiObject::UnrealizeObject; COleDispatchDriver::AttachDispatch; COleDispatchDriver::GetProperty; CPalette::GetPaletteEntries; CRect::Height; CRect::Width; CreateBitmap; CreatePalette; GetBValue; GetDC; GetDeviceCaps; GetGValue; GetObject; GetPaletteEntries; GetRValue; GetStockObject; GlobalAlloc; GlobalFree; GlobalLock; MAKELONG; PALETTEINDEX; RGB; ReleaseDC; ResizePalette; SetPaletteEntries

The PUSH sample demonstrates the following keywords:

AfxGetInstanceHandle; CBitmap::LoadBitmap; CDC::DrawFocusRect; CDC::SelectObject; CDC::SelectStockObject; CDialog::DoModal; CGdiObject::GetObject; CString::GetLength; CopyRect; HIWORD; InflateRect; MAKELONG; min

The REGSVR sample demonstrates the following keywords:

FreeLibrary; GetLastError; GetProcAddress; LoadLibrary; LoadString; MessageBox; OleInitialize; OleUninitialize; WinMain; lstrcpy; lstrlen; wsprintf

The SPINDIAL sample demonstrates the following keywords:

AfxGetInstanceHandle; CBrush::CreateSolidBrush; CDC::Ellipse; CDC::FillRect; CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CDC::SelectStockObject; CDialog::DoModal; MAKELONG

The TIME sample demonstrates the following keywords:

AfxGetInstanceHandle; CBitmap::LoadBitmap; CDialog::DoModal; CGdiObject::GetObject; KillTimer; MAKELONG; SetTimer

The XLIST sample demonstrates the following keywords:

AddItem; AfxGetInstanceHandle; CBrush::CreateSolidBrush; CDC::DrawFocusRect; CDC::ExtTextOut; CDC::FillRect; CDC::InvertRect; CDC::SelectObject; CDC::SelectStockObject; CDC::SetBkMode; CDC::SetTextColor; CDialog::DoModal; CObArray::GetAt; CObArray::GetSize; CObArray::InsertAt; CObArray::RemoveAll; CObject::IsKindOf; COleDispatchDriver::AttachDispatch; COleDispatchDriver::DetachDispatch; COleDispatchDriver::GetProperty; CString::AllocSysString; GetDC; GetDeviceCaps; GetSystemMetrics; HIWORD; LOWORD; MAKELONG; ReleaseDC; SendMessage


DRAWPIC: Extracting a Bitmap or Icon from an LPPICTUREDISP

Click to open or copy the DRAWPIC project files.

At times it may be necessary in an ActiveX Control to obtain the handle to an icon or bitmap contained in a LPPICTUREDISP structure. The DRAWPIC sample demonstrates how to get a handle to a bitmap or icon from a LPPICTUREDISP.

The important lines of code in this sample are:

// get handle of the bitmap
    NewPicture.m_pPict->get_Handle((OLE_HANDLE FAR *) &hBitmap);
// create a temporary bitmap
    CBitmap * TempBmp = CBitmap::FromHandle(hBitmap);
// get handle of the icon
    NewPicture.m_pPict->get_Handle((OLE_HANDLE FAR *) &hIcon);

Running the Sample

To run this sample, first compile, link, and register the control. Next, create an .exe test application using the Visual Basic project that ships with the sample. You can then step through the ActiveX Control code by setting the Visual Basic executable as the executable for the debug session.


IMAGE: Creates an ActiveX Control That Downloads Asynchronously

Click to open or copy the IMAGE project files.

The IMAGE sample demonstrates how to use MFC to build an ActiveX control that is capable of downloading data asynchronously. The control has a property based on the CDataPathProperty class.

IMAGE can display a bitmap image from any .bmp file. The ImagePath property of the control provides a path to the image. If the image is large and the download takes place over a slow link, the asynchronous support built into the CDataPathProperty object managing the path becomes active and renders the data to the control's painting code without blocking other processing.

The control features a simple property page that gives access to the ImagePath property as well as the AutoSize property. The AutoSize property, if set TRUE, automatically snaps the size of the control to the size of the image it contains. If the AutoSize property is FALSE, the automatic sizing is disabled.

The image control also implements a read-only Boolean property named ReadyState. ReadyState is TRUE if the control has successfully read and presented all of the data in the image stream. ReadyState is FALSE until the control is fully initialized.


SMILEY: A Simple ActiveX Control Container

Click to open or copy the SMILEY project files.

The SMILEY sample is a simple ActiveX control container designed to show how easy it is to use MFC support to handle ActiveX controls. The sample consists of the SMILE ActiveX control inserted into the SMILEY control container. The sample allows you to modify properties, call methods, and handle events from the SMILE control.

SMILEY uses regular Windows calls to modify the ActiveX control's caption in CSmileyDlg::OnInitDialog. The caption is displayed directly above the control and is set to "Smile!" by default. SMILEY hooks up a check box that is tied to the ActiveX control's "Sad" property. Finally, it includes its own EVENTSINK map and handles the ClickIn and ClickOut events from the ActiveX control.

To build the sample requires you to first build the SMILE ActiveX control in the SMILECTL subdirectory beneath SMILEY. If you are building this sample on Windows 95®, you should build the non-Unicode version.

You can interact with the SMILEY sample in one of two ways:

  1. Click the Sad check box

  2. Click the face itself.

If you click the Sad check box, you will set the "Sad" Automation (formerly OLE Automation) property in the ActiveX control. This will cause the smiley face to smile or frown, depending upon the value of the check box.

If you click the face itself, the ActiveX control will fire a ClickIn event, which the dialog handles by calling the control's "Wink" automation method. If you click outside the face, the ActiveX control will fire a ClickOut event, which the dialog handles by returning the face to normal.

This sample demonstrates the following keywords:

AfxGetApp; CDC::DrawIcon; CDC::GetSafeHdc; CDialog::DoModal; CMenu::AppendMenu; CRect::Height; CRect::Width; CString::IsEmpty; CString::LoadString; CWinApp::Enable3dControls; CWinApp::InitInstance; CWnd::Create; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetFont; CWnd::IsIconic; CWnd::OnLButtonDblClk; CWnd::OnPaint; CWnd::OnQueryDragIcon; CWnd::OnSysCommand; CWnd::SendMessage; CWnd::SetFont; GetSystemMenu; GetSystemMetrics; LoadIcon; SetWindowText


TESTHELP: ActiveX Control with Tooltips and Help

Click to open or copy the TESTHELP project files.

The TESTHELP sample demonstrates how to use MFC to build an ActiveX control that has its own help file to display help for the user. Testhelp.ocx also shows how to add tooltips to an MFC ActiveX control. Specifically, this sample demonstrates how to:

  1. Display a tooltip for your ActiveX™ control.

  2. Toggle the tooltip on and off using the control's property page.

  3. Change the tooltip's text using the control’s property page.

  4. Enable the ActiveX control container's property frame Help button to display the control's help file when the Help button is clicked.

  5. Enable the "?" button in Developer Studio's Component Gallery so that the control's help file will be displayed when this control is chosen from Component Gallery and the "?" button is clicked.

  6. Display help at runtime when the control has the keyboard focus and F1 is pressed.

  7. Use the Font, BackColor, and ForeColor stock properties of an ActiveX control.

Running the Sample

The Help Project file and all of the Help Project's source files are also included in this sample. To build the help file, start Help Workshop, load the Testhelp.hpj file into Help Workshop, and click Compile on the File menu.

After you have built the TESTHELP sample, you will be able to use it in any ActiveX container application. Examples of ActiveX control containers are Visual C++, Visual Basic, and Test Container (Microsoft Developer Studio\VC98\bin\TSTCON32.EXE). Include the TESTHELP control in your container's project and run the project. The properties of the TESTHELP control can be set by bringing up the property dialog of your container. The properties you can set are described below.

General Property Page

  1. Type of Help to Use - This property determines how help will be used when the user presses F1 while the TESTHELP control has the keyboard focus. Help in a pop-up window means that when the user presses F1 while the TESTHELP control is running in a container and has the keyboard focus, a pop-up window with the "What is this thing?" topic from the Testhelp.hlp helpfile is displayed. Show the Whole Help File means that when the user presses F1 while the TESTHELP control is running in a container and has the keyboard focus, the entire Windows help program will come up displaying the contents topic of the Testhelp.hlp file.

  2. Use Control's Help File - When this box is checked, help will be displayed in the format determined by the Type of Help to Use property when the user presses F1 while the control is running in a container and has the keyboard focus.

  3. Use ToolTip for this Control - If this box is checked, a tooltip will be displayed over the control's window if the control is running in the container and the mouse cursor moves into and stops in the control's window. The text to be displayed is determined by the Tooltip Caption property.

  4. Tooltip Caption - This is the text to be displayed in a tooltip if the user chooses to show tooltips.

    Name1 - The name displayed at the top of the control.

    Name2 - The name displayed in the middle of the control.

    Name3 - The name displayed at the bottom of the control.

Color Property Page

Lets the user select colors to be used in painting this control.

Font Property Page

Lets the user specify the font used for the text on the control.


BINDENRL: Databound Controls Version of the ENROLL Sample

Click to open or copy the BINDENRL project files.

The BINDENRL sample shows how to build a dialog application based on property pages, and how to bind data-aware controls with a data source control created outside the current property page. BINDENRL uses databound controls instead of using the MFC ODBC database classes (as the ENROLL sample does) and shows an alternative method for displaying records.

BINDENRL is a dialog-based application that uses a CPropertySheet class in the main frame window. Several databound controls and their corresponding data source controls are added to the dialog template in each property page. In addition, one data source control (Courses) is created in the main property sheet at run time. This data source is bound to the controls in different property pages (CourseID, Hours, and Title in the Courses page, and CourseID in the Sections page). The data binding is performed at run time in the OnInitDialog member function for each property page.

BINDENRL uses the ON_DSCNOTIFY macro to pass notifications between different data sources. For example, the Sections page shows only the sections of the current course and only students enrolled in the current section. To select the desired records, the dynamic SQL filters are set to the Sections and Students data source controls at run time by adding the WHILE clause to the SQL string defined in the Sections and Students data source controls. This code is executed in response to the Move event fired by the Courses and Sections data source controls.

Running the Sample

To run the sample, copy the files from the Visual C++ distribution CD. This copies the source files and the sample database Stdreg32.mdb. Next, define the data source name (DSN) "Student Registration" in the ODBC Administrator Control Panel application. Select the Microsoft Access driver, then select the sample database Stdreg32.mdb located on your hard drive.

After compiling the application, you can browse through the records on each property page by clicking the corresponding data source control.

This sample demonstrates the following keywords:

CWnd::Create; ON_ DSCNOTIFY; CWnd::BindDefaultProperty; CWnd::BindProperty


CATALOG: Makes Calls Directly to ODBC Functions

Click to open or copy the CATALOG project files.

The CATALOG sample illustrates making calls directly to open database connectivity (ODBC) functions, particularly to SQLTables and SQLColumns. CATALOG shows all the tables in a selected database. For each table, it shows a list of the columns and information about each column.

CATALOG implements a reusable CRecordset-derived class, CColumns, which represents the results set of the call to SQLColumns. This reusable CColumns class is used by the DYNABIND sample, which dynamically examines the list of columns in a table and lets the user update columns not known at compile time.

CATALOG illustrates calling ODBC functions directly. CATALOG's CTables class represents the result set of a call to SQLTables. CColumns represents the result set of a call to SQLColumns. The specific calls to these ODBC functions are in CTables::Open and CColumns::Open. Both illustrations show how you can leverage the Microsoft Foundation Class Library (MFC) record field exchange (RFX) mechanism and CRecordset for result sets returned by ODBC functions that the default result set returns when CRecordset::Open is called.

The CColumns class, derived from CRecordset, is a reusable class that represents the result set of a call to the ODBC SQLColumns function. Each record describes one column of a specified table.

Retrieving Column Information

To retrieve the column information for a specific table, construct a CColumns object.

  • Specify the table by setting the value of m_strTableNameParam and, optionally, m_strQualiferParam and m_strOwnerParam. The qualifier and owner parameters are documented in the description of SQLColumns in the ODBC Programmer's Reference.

  • To select only one column of the table, also specify the m_strColumnNameParam; otherwise, leave the value empty to select all columns of the table.

  • Call the CRecordset-derived function OnSetOptions to set the HSTMT.

  • Call CColumns::Open, which calls SQLColumns to get the result set of column records.

Use the CRecordset-derived function Move to move from one column record to another. To get information about a column, examine the CColumns members m_strTypeName, m_lPrecision, m_lLength, and so on. The names of these members are similar to the parameters for the SQLColumns function documented in the ODBC Programmer's Reference.

When you run CATALOG, select an ODBC data source from the SQL Data Sources dialog box. If you have not registered at least one ODBC data source, see instructions for installing the Student Registration database in the ENROLL sample.

This sample demonstrates the following keywords:

AfxThrowDBException; CDialog::DoModal; CDocument::OnNewDocument; CFrameWnd::Create; CObject::AssertValid; CObject::Dump; CRecordView::OnGetRecordset; CRecordView::OnMove; CRecordset::Close; CRecordset::DoFieldExchange; CRecordset::GetDefaultConnect; CRecordset::GetDefaultSQL; CRecordset::IsOpen; CRecordset::MoveFirst; CRecordset::OnSetOptions; CRecordset::Open; CString::Empty; CString::IsEmpty; CView::GetDocument; CView::OnInitialUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DoDataExchange; CWnd::OnCreate; LoadBitmap; afxTraceFlags


CATALOG2: ODBC Data Source Schema Browser

Click to open or copy the CATALOG2 project files.

The CATALOG2 sample program is an ODBC data source schema browser. In response to selecting a data source, it shows all the tables in that data source. You can then select a table and it will show all the columns in that table, along with information about them. There is also a settings property sheet that gives you some control over the types of tables that are included in the display as well as what column information is displayed.

CATALOG2 primarily demonstrates how to wrap the ODBC API catalog functions in CRecordset objects. Although it doesn't use them all, CATALOG2 includes a header and .cpp file that does this for all the ODBC API catalog functions. Those functions are:

SQLColumnPrivileges
SQLColumns
SQLForeignKeys
SQLGetTypeInfo
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables

CATALOG2 also shows how to use a CListView as an application's main view, and how to make properties persistent across program invocations by saving them in the application's initialization file.

This sample demonstrates the following keywords:

AfxGetApp; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDatabase::Close; CDatabase::IsOpen; CDatabase::Open; CDialog::DoModal; CDocument::OnCloseDocument; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetTitle; CDocument::UpdateAllViews; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CObject::Serialize; CRecordset::Close; CRecordset::DoFieldExchange; CRecordset::GetDefaultConnect; CRecordset::GetDefaultSQL; CRecordset::IsEOF; CRecordset::IsFieldNull; CRecordset::IsOpen; CRecordset::MoveFirst; CRecordset::MoveNext; CRecordset::OnSetOptions; CRecordset::Open; CStatusBar::Create; CStatusBar::SetIndicators; CString::Find; CString::Format; CString::GetLength; CString::Left; CString::Right; CToolBar::Create; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::PreCreateWindow; GetProfileInt; WideCharToMultiByte; strcat; strcpy


DAOCTL: ActiveX Control Container with Data Bound Controls

Click to open or copy the DAOCTL project files.

This sample shows how to build an ActiveX™ control container that contains data bound controls. The container provides the controls with data from a Microsoft Access database via DAO.

To build the sample requires you to first build AccsPict and Control, which are two ActiveX controls found in the subdirectories beneath DAOCTL. Open a Project Workspace, go into each subdirectory and choose the .mdp file, then on the Build menu, click Build accspict.ocx or Build daoedit.ocx. If you are building this sample on Windows® 95, you should build the non-Unicode versions

Run the application and click DAO to open a data source. The sample database Sampdata.mdb is in the DAOCTL directory.

Once you have a database open, you will be able to use the tree control to navigate through the database structure. When you are at the "field" level, you can double-click any of the fields represented by a green color. The field chosen will then be dynamically bound to one of the ActiveX control edit fields below the tree control. Additionally, if a field contains a Microsoft Access object field that in turn contains an Access picture, it will be displayed on the right of the tree in the Access Picture ActiveX Control. You can move to the next or previous record using the spin buttons in the lower right corner.

Changing the contents of an edit field and tabbing out of that field will reflect your change in the database.

Points of Interest

Of particular interest is the way the ActiveX controls notify the container of changes made. This happens in two stages:

First, when a key is pressed while one of the edit controls has focus, the edit control will make a call to the function BoundPropertyRequestEdit. This call requests authorization from the container to allow changes to the data contained in the control. Only if this is granted will the key be allowed to pass through.

Finally, assuming that permission is granted, the control will call BoundPropertyChanged when the control loses focus. This notifies the container that the data has changed and should be stored in the database.


DAOENROL: Student Enrollment Tutorial for DAO

Click to open or copy the DAOENROL project files.

DAOENROL is based on the ODBC ENROLL (Step 3) database tutorial. It has been converted to use the Microsoft Foundation Class Library (MFC) DAO classes rather than the MFC ODBC classes.

The sample is functionally equivalent to the ODBC ENROLL sample (Step 3). However, the original ODBC version referenced databases using an ODBC data source name (DSN) and hence did not require a file name. The DAO version, on the other hand, requires the database to be specified as the path to an .mdb file. DAOENROL assumes that the database is called Stdreg32.mdb and is in the same directory as Daoenrol.exe. If this is not the case, you will be prompted to locate the database.

Points of Interest

Converting this sample from the ODBC original was relatively straightforward. The main differences in the two samples are:

  • ODBC parameters are represented by a question mark character in the SQL statement, whereas parameters are given names in DAO. This meant that some of the filter strings needed to be changed.

  • In DAO, Open does not return a Boolean value to represent success. Instead, exception handling code must be used.

This sample demonstrates the following keywords:

AfxMessageBox; CCmdUI::Enable; CComboBox::AddString; CComboBox::DeleteString; CComboBox::FindStringExact; CComboBox::ResetContent; CComboBox::SetCurSel; CDialog::DoModal; CDocument::OnNewDocument; CEdit::SetReadOnly; CFileDialog::DoModal; CFileDialog::GetFileName; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::GetActiveView; CFrameWnd::RecalcLayout; CFrameWnd::SetActiveView; CFrameWnd::rectDefault; CObject::AssertValid; CObject::Dump; CObject::GetRuntimeClass; CObject::IsKindOf; CView::GetDocument; CView::OnInitialUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::Create; CWnd::DoDataExchange; CWnd::GetDlgItem; CWnd::GetWindowText; CWnd::OnCreate; CWnd::SetDlgCtrlID; CWnd::ShowWindow; LoadBitmap


DAOTABLE: Uses MFC DAO Classes to Create Common Database Objects

Click to open or copy the DAOTABLE project files.

The DAOTABLE sample demonstrates using the MFC Data Access Objects (DAO) database classes to create common database objects: databases, tables, queries, fields, and indexes. This dialog-based application maps the properties of these objects to controls the user can set and/or view. The source code is organized so that most of the database interaction is isolated from the user-interface code. This makes it easy to identify examples of how one can use the MFC DAO database classes.

In addition to demonstrating the use of the MFC DAO classes, this sample can be a useful tool for creating simple Microsoft Access databases. You can create .mdb files from scratch, create and delete tables and queries, add and delete fields and indexes in the tables, and modify existing queries.

Running the Sample

DAOTABLE provides a detailed help facility to answer questions about the design, intent, and use of the program. Every dialog box has a help button that displays help for the controls on that dialog box. Additionally, there is a general information section accessible through the Help Contents button.

The MFC DAO classes are documented in Visual C++ ® Books Online. Simply search for the desired class (MFC DAO classes use the prefix "Cdao" as in CDaoTableDef), or the DAO property or method in which you are interested.

For additional documentation on DAO independent of the MFC classes, refer to the DAO Help available by installing the DAO Software Development Kit (SDK) from the Visual C++ CD-ROM disk.


DAOVIEW: Database Browser

Click to open or copy the DAOVIEW project files.

DAOVIEW illustrates the use of many new features in MFC 4.0 to implement a moderately sophisticated database browser. It relies heavily on the new DAO classes to communicate with the Microsoft Jet database engine. It allows the user to view the database schema and data. It can also be used to create or modify stored SQL queries.

DAOVIEW uses the new CTreeView and CListView classes to create the same look as the Windows® 95 Explorer. Drag and drop of tables and queries is also implemented using OLE.

Using DAOVIEW is relatively straightforward. Simply click Open on the File menu to select a database (.mdb file) to view. Note that you can also use drag and drop from File Manager to open a database. We provide a sample database, Sampdata.mdb, in the same directory as the DAOVIEW sample. This database is a Microsoft Access 7.0-compatible database modeled on the Northwind Traders example that ships with Access.

Once the database has been opened, DAOVIEW will show you the components (tables, relations, and queries) in the form of a tree-view. At this point, you can see more information about a particular item of interest by clicking one of the "+" symbols shown in the tree.

Context-sensitive menus have been implemented for table and query objects. These can be used by right-clicking the item and selecting the operation from the pop-up menu. It is also possible to copy objects via drag and drop. This works for both tables and queries. The drop destination can be the current database or a database being viewed in another instance of DAOVIEW.

Note about CTRLEXT.H, CTRLEXT.CPP, and CTRLEXT.INL

Of particular interest in the DAOVIEW sample are the above three files. These files contain the classes CTreeCtrlEx, CListCtrlEx, and CTreeCursor, which facilitate manipulation of the tree and list controls. The CTreeCtrlEx is identical to the MFC class CTreeCtrl except that where the MFC class returns an HTREEITEM, CTreeCtrlEx returns a CTreeCursor.

The class CTreeCursor wraps an HTREEITEM and a pointer to a CTreeCtrl. It implements the majority of functions in CTreeCtrl, which are specific to an HTREEITEM. It is, in effect, an iterator.

Also of interest is CListCtrlEx, which is virtually identical to the MFC CListCtrl class but has a couple of new member functions that make insertion into the list control easier.

This sample demonstrates the following keywords:

AddItem; AfxGetApp; AfxGetMainWnd; AfxMessageBox; AfxOleInit; CArchive::Close; CArchive::IsStoring; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDialog::OnInitDialog; CDocument::OnNewDocument; CDocument::OnOpenDocument; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::GetActiveDocument; CFrameWnd::OnCreateClient; CFrameWnd::SetActiveView; CMenu::GetSubMenu; CMenu::LoadMenu; CObject::AssertValid; CObject::Dump; CObject::Serialize; COleDataObject::GetGlobalData; COleDataObject::IsDataAvailable; COleDataSource::CacheGlobalData; COleDataSource::DoDragDrop; COleDropTarget::Register; CSplitterWnd::CreateStatic; CSplitterWnd::CreateView; CSplitterWnd::GetPane; CStatusBar::Create; CStatusBar::SetIndicators; CString::Find; CString::Format; CString::Left; CString::LoadString; CString::Mid; CToolBar::Create; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::GetDlgItem; CWnd::OnCreate; CWnd::PreCreateWindow; CWnd::SetFocus; CWnd::SetWindowText; CreateProcess; DeleteItem; DragAcceptFiles; GetCursorPos; GetDesktopWindow; GetParent; GetSysColor; GetVersion; MessageBox; RGB; RegisterClipboardFormat; ScreenToClient; SetBkColor; TrackPopupMenu; UpdateWindow; WinHelp; memset.


DBFETCH: Demonstrates Bulk Row Fetching in the MFC ODBC Database Classes

Click to open or copy the DBFETCH project files.

The DBFETCH sample shows how to use some of the new functionality that has been added to the MFC ODBC database classes. The CRecordset object now includes support for fetching records in bulk (retrieving more than one record at a time). The DBFETCH sample lets you randomly browse data using bulk row retrieval in a fashion similar to DAOVIEW or CATALOG2.

While CRecordset does not support updating a multirow row set, you can update a multirow set directly using the ODBC SQLSetPos API. DBFETCH extends the bulk row fetching code to include support for updating data, although updating is not supported through the sample's user interface. See the RowsetEdit, RowsetAdd, and RowsetDelete members of the CBulkRecordset class. These members are really just wrappers of the ODBC SQLSetPos API.

In addition to the helpers for updating, DBFETCH also includes helpers for handling multiple errors from ODBC. Currently the CDBException object handles multiple ODBC errors by appending all the SQL state and error string information into one string. This string can be unwieldy when using multirow fetching because multiple ODBC errors are more likely to occur.

Running the Sample

To run the sample, you should have an ODBC data source already defined. Once you have one or more ODBC data source names (DSNs) set up, you can build and run the sample yourself, or simply run the sample directly from the CD. You will be prompted by the standard ODBC Connect dialog box to select a data source. The sample displays a dialog from which you choose a data source, choose a table from the data source, and choose to get the data. The data is fetched and displayed in a second dialog. You can scroll through the records, selecting the first, last, next, and previous 25 records at a time.


DYNABIND: Illustrates Dynamic Binding of Database Columns to a Recordset

Click to open or copy the DYNABIND project files.

DYNABIND illustrates dynamic binding of database columns to a record set.

It is easier to bind columns to members of a record set, using ClassWizard, if you have access to the column information in an open database connectivity (ODBC) data source at the time you develop and compile the program. In some advanced database applications, however, not all of the columns are necessarily known at development and compile time.

For example, a vertical database application, such as for grocery store inventory, would have predefined tables and columns describing the details of grocery inventory. This application might also offer a customization feature that allows the end user (for example, the customer site database administrator) to define additional tables or columns. In this case, the application needs to be implemented in a more general table-driven fashion, to some extent like a general-purpose fourth-generation language (4GL) database system.

DYNABIND illustrates this by adding a customization feature to Step 3 of the database tutorial sample ENROLL. DYNABIND allows the user to add one or more text fields to the Section form. The fields may correspond to columns in the Section table of the Student Registration database that were not necessarily defined at the time that the CSectionSet class was originally created by ClassWizard.

DYNABIND has the same user interface as that of ENROLL Step 3, except for the addition of the customization feature. The Add Fields command in the Options menu lets you add fields to the bottom of the Section form. The Add Text Field dialog box lists all of the text columns (SQL_CHAR and SQL_VARCHAR) of the Section table of the Student Registration database that have not been previously dynamically added. From the list box, select the column you want to dynamically add to the form, and choose OK. DYNABIND will add an edit control to the bottom of the Section form. You then can enter data in this new form field, just as for any of the other prebound fields.

Note DYNABIND does not save the list of dynamically bound columns when you exit. DYNABIND only supports dynamic binding of the SQL_CHAR and SQL_VARCHAR data types. DYNABIND does not define new columns in the database. Use the existing columns already defined in the Section table, or use Microsoft Query or Microsoft Access to add columns to the Section table.

This sample demonstrates the following keywords:

AfxMessageBox; AfxThrowDBException; CComboBox::AddString; CComboBox::GetCurSel; CComboBox::GetLBText; CComboBox::ResetContent; CComboBox::SetCurSel; CDialog::DoModal; CDialog::OnInitDialog; CDocument::OnNewDocument; CEdit::Create; CEdit::SetReadOnly; CFieldExchange::SetFieldType; CListBox::AddString; CListBox::SetCurSel; CListBox::SetSel; CObList::AddTail; CObList::GetCount; CObList::IsEmpty; CObject::AssertValid; CObject::Dump; CRecordView::OnGetRecordset; CRecordView::OnMove; CRecordset::AddNew; CRecordset::Close; CRecordset::Delete; CRecordset::DoFieldExchange; CRecordset::GetDefaultConnect; CRecordset::GetDefaultSQL; CRecordset::GetTableName; CRecordset::IsBOF; CRecordset::IsEOF; CRecordset::IsOpen; CRecordset::Move; CRecordset::MoveFirst; CRecordset::MoveLast; CRecordset::MoveNext; CRecordset::OnSetOptions; CRecordset::Open; CRecordset::Requery; CRecordset::SetFieldNull; CRecordset::Update; CScrollView::GetTotalSize; CScrollView::ResizeParentToFit; CScrollView::SetScrollSizes; CStatic::Create; CStatusBar::Create; CStatusBar::SetIndicators; CString::Empty; CString::IsEmpty; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DoDataExchange; CWnd::GetFont; CWnd::GetParentFrame; CWnd::GetWindowRect; CWnd::OnCreate; CWnd::ScreenToClient; CWnd::SetFont; CWnd::UpdateData; afxTraceFlags


EXTBIND: Creating and Binding Databound Controls at Run Time

Click to open or copy the EXTBIND project files.

The EXTBIND sample shows how to bind data-aware controls across a dialog-box boundary. The data source can be initialized in one window, while the databound controls created in another window (for example, a modeless dialog box) can be bound to the data source at run time.

Run the sample to see information from the Employee table in the Pubs database. NorthWind DataSource is inactive in this dialog box until you press the NorthWind button to open the modeless dialog box. All controls in this dialog box are driven by NorthWind DataSource.

The main dialog template contains the control bound to the Pubs data source and several masked edit controls created at design time. The NorthWind dialog template contains only one Masked Edit control (see note below about Masked Edit controls). The rest of the controls (NorthWind DataSource, two DBGrids, Calendar) are created at run time.

All controls in the NorthWind dialog box are bound to the ODBC data source name (DSN) at run time, which is necessary because the data source control is in a separate dialog box. In addition, the NorthWind dialog box shows how to change the bound column of a simple control at run time. By clicking the Birth Date or Hire Date radio button, you change the calendar control binding (BirthDate or HireDate column, respectively). The same is possible for the Masked Edit control showing, in this case, First/Last name.

You must set up the following data source names (DSNs) to run the sample.

  • SQLServerPubs (the PUBS database that ships with SQL Server)

  • Northwind (the name of the Microsoft Access sample database, NORTHWIND.MDB)

Note The Masked Edit control does not automatically format its contents.

When the Masked Edit Controls Format property is set, it does not automatically format its contents upon losing focus. When embedded in a Visual Basic or Access form, the control automatically formats its contents when the control loses focus.

The Masked Edit Control uses a proprietary Visual Basic interface called IVBFormat. Control container applications written with Visual C++ do not support this interface. The absence of IVBFormat support in a control container prevents the Masked Edit Control from automatically updating its contents as specified by the Format property.

The Masked Edit Control can still be used in a Visual C++ control container application. However, the automatic formatting feature will be disabled. Other properties, like the Mask property and databinding properties function properly in the absence of the IVBFormat support.

This sample demonstrates the following keywords:

CWnd::Create; CWnd::BindDefaultProperty; CWnd::GetDSCCursor


MDIBIND: Databound Controls in CWnd-Derived Windows

Click to open or copy the MDIBIND project files.

The MDIBIND sample demonstrates that data binding can be done with any CWnd-derived windows, but only at run time. An AppWizard-generated MDI application is used for this sample. Data source and databound controls are created in CView-derived window client areas.

  • MDIBIND supports three document templates:

  • RDC – its view displays a Data Source control

  • Grid - its view displays a Grid control

  • Edit - its view displays a masked edit control (see note below about using Masked Edit controls in Visual C++)

Running the Sample

You can open/create the child windows based on these templates. With the Bind command from the Window menu, you can bind each control.

For the Grid control and Edit control, choose the data source from any available RDC window and specify the column if required. If the currently selected data source control is active, its results set is used to fill the Column Name box with appropriate column names.

For the Data Source control, you can specify the ODBC data source, user name, password, and SQL statement (just as you can specify these parameters in the resource editor at design time). Note that all bound controls change appropriately when you change the underlying data source name (DSN) by selecting another data source.

Note The Masked Edit control does not automatically format its contents.

When the Masked Edit Controls Format property is set, it does not automatically format its contents upon losing focus. When embedded in a Visual Basic or Access form, the control automatically formats its contents when the control loses focus.

The Masked Edit Control uses a proprietary Visual Basic interface called IVBFormat. Control container applications written with Visual C++ do not support this interface. The absence of IVBFormat support in a control container prevents the Masked Edit Control from automatically updating its contents as specified by the Format property.

The Masked Edit Control can still be used in a Visual C++ control container application. However, the automatic formatting feature will be disabled. Other properties, like the Mask property and databinding properties function properly in the absence of the IVBFormat support.

This sample demonstrates the following keywords:

CWnd::Create; CWnd::BindProperty; CWnd::BindDefaultProperty;CWnd::GetDSCCursor


MFCRows: MFC Record View Application That Uses OLE DB and Allows Updates

Click to open or copy the MFCROWS project files.

The MFCRows sample demonstrates how to use COleDBRecordView to scroll through a table in a database. It also demonstrates how to use multiple accessors so you can update a Microsoft Access table that contains an AutoNumber field to be retrieved.

Building and Running the Sample

To run the sample, you must first ensure that you have an ODBC data source name "OLE_DB_Nwind_Jet" set up that points to the Microsoft Access Northwind sample database.

This sample demonstrates the following keywords:

CDataSource::Open, CSession, CCommand::Open, CAccessor, CRowset::Open, COleDBRecordView, DDX_Text, CDBPropSet::AddProperty


ODBCINFO: Retrieves ODBC Driver Capabilities

Click to open or copy the ODBCINFO project files.

The ODBCINFO sample shows how to determine various ODBC driver capabilities at run time. ODBCINFO opens a selected ODBC data source and displays information about it in a set of property pages. The types of information displayed include:

  • Driver information such as names and conformance levels

  • Supported ODBC API and SQL functions

  • Supported SQL language, information on data types

  • Identifier information, including ODBC and driver-specific keywords

  • Various limits such as size or capacity

  • Miscellaneous information

ODBCINFO calls the SQLGetInfo function for every return type except handle values, then displays the results. Since SQLGetInfo is called repeatedly in the program, helper functions are defined that assist in calling SQLGetInfo and in formatting the returned data. These functions are static members of the CMyPage class, which is the common base class for all of the property page classes that are used to display data source information.

ODBCINFO also illustrates how to use property pages as the main window of an application.

Running the Sample

When you run ODBCINFO, select whether you want to load the ODBC cursor library using the Use Cursor Library check box. The ODBC cursor library provides static cursors for ODBC drivers that do not supply them. By checking or unchecking this check box, you can view the driver capabilities with or without the cursor library being present.

Select the Use Cursor Library check box if desired, click Data Source, and select an ODBC data source that you want to view. The property pages are populated with information from the selected data source.

Determining Data Types a Driver Supports

ODBCINFO uses a CRecordset-derived class called CGetTypeInfo that wraps the SQLGetTypeInfo ODBC API function to determine the data types that a particular driver supports. CGetTypeInfo is taken from the catalog recordsets (Catsets.cpp) in the CATALOG2 sample.

Using a Property Sheet as the Main Window of an Application

The main window of ODBCINFO is a property sheet. There are issues to be aware of when doing this. First, by default, you cannot minimize a property sheet. ODBCINFO allows this by modifying the window styles and system menu in the property sheet’s OnInitDialog function after calling the base class. Second, you should consider how to associate icons with the application. For Windows 95, this is accomplished by changing the PROPSHEETHEADER structure of the property sheet before calling DoModal. ODBCINFO does this in the application’s InitInstance function. To get the application to display as an icon when minimized on Windows NT, the application needs to draw the icon when it is minimized. This is done in ODBCINFO by overriding the property sheet’s OnPaint, OnEraseBkgnd, and OnQueryDragIcon message handlers.


STDREG: Dynamically Modifies Databases

Click to open or copy the STDREG project files.

STDREG is a tool for populating the Student Registration database, an open database connectivity (ODBC) data source used by the Enroll database tutorial. It illustrates how to dynamically create tables and columns in a database using direct structured query language (SQL), but works with any database format for which there is an ODBC driver.

Before running the sample, choose a database format and ODBC driver for the Student Registration database. To use Microsoft Foundation Class Library (MFC) database support for SQL Server, you must have the SQL Server product and the ODBC driver for SQL Server.

To use other database formats requires the database management system (DBMS), as well as the ODBC driver. To obtain 32-bit ODBC drivers for other databases, contact Microsoft or other ODBC driver vendors.

To use the Microsoft Access database format, use the Stdreg32.mdb file. For any other database format, you must create a new empty database schema for the Student Registration database using the database administration capability of your DBMS.

After you create the new empty database schema, you must then register the new database with ODBC. You can do this by either using the Control Panel ODBC tool or by running STDREG and choosing the Add Data Source option.

Creating New Tables

Once the database is registered with ODBC, choose the Initialize Data option of STDREG. You will be prompted with three dialog boxes titled Enter SQL Column Syntax. The STDREG tool sends CREATE TABLE SQL statements to create new tables in the Student Registration database. The syntax of the column-element portion of the CREATE TABLE statement is database-dependent. The dialog box implies what database-specific column types the database associates with the three ODBC-defined column types: SMALLINT, INTEGER, and VARCHAR. The STDREG tool determines these by calling SQLGetTypeInfo. Once these column types are determined, choose the appropriate column type based on your knowledge of the particular database.

The STDREG tool is designed to create tables in any arbitrary ODBC database. Therefore, it must determine how three ODBC data types used in the Student Registration application (SQL VARCHAR, SQL INTEGER, and SQL SMALLINT) are named internally by the DBMS. The STDREG tool queries the ODBC driver (using SQLGetTypeInfo) to find out what internal data types correspond to these SQL data types.

The ODBC driver may list more than one internal data type, or the driver may list data type creation parameters, such as "max length" for a VARCHAR. In these cases, it is difficult for STDREG, or any database-independent application, to choose the right internal data type, or to interpret the data type creation parameter. Therefore, STDREG displays the internal data types and asks you to use this information to specify the correct syntax for the internal data type.

Any given DBMS may define internal data types with names other than the standard data type names defined by ODBC. Normally, ODBC and MFC database applications do not need to refer to the data type names used internally by the DBMS; however, the SQL CREATE TABLE statement is an important exception. ODBC does not attempt to interpret the data types specified for the one or more table columns specified in the CREATE TABLE statement. The application sending the CREATE TABLE statement must know the data type names supported by the specific DBMS.

After you have supplied the three column types, STDREG creates six tables in the Student Registration database. Upon completion, choose Exit. You can then run any of the STEP versions of the ENROLL sample using your new database.

Note Although STDREG creates columns in each table of the Student Registration database, STDREG does not create referential integrity rules such as "the COURSE table is a foreign key of the course column of the SECTION (course section) table." Consequently, it is possible to use version STEP4 of the ENROLL sample to add incorrect data or delete a course even though one or more course sections are associated with it.

This sample demonstrates the following keywords:

AfxGetApp; AfxMessageBox; AfxThrowDBException; CCmdTarget::BeginWaitCursor; CCmdTarget::EndWaitCursor; CDC::DrawIcon; CDC::GetSafeHdc; CDC::SetMapMode; CDatabase::Close; CDatabase::ExecuteSQL; CDatabase::Open; CDialog::DoModal; CDialog::EndDialog; CDialog::OnInitDialog; CDialog::OnOK; CFieldExchange::SetFieldType; CListBox::AddString; CListBox::ResetContent; CMenu::AppendMenu; CObject::AssertValid; CObject::Dump; CRecordset::AddNew; CRecordset::Close; CRecordset::DoFieldExchange; CRecordset::GetDefaultConnect; CRecordset::GetDefaultSQL; CRecordset::IsEOF; CRecordset::IsOpen; CRecordset::MoveFirst; CRecordset::MoveNext; CRecordset::OnSetOptions; CRecordset::Open; CRecordset::Update; CString::Empty; CString::Format; CString::GetLength; CString::IsEmpty; CString::LoadString; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::CenterWindow; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::IsIconic; CWnd::OnPaint; CWnd::OnQueryDragIcon; CWnd::OnSysCommand; CWnd::SendMessage; CWnd::SetWindowText; CWnd::UpdateData; GetSystemMenu; GetSystemMetrics; LoadIcon; afxTraceFlags; exit


CLIPART: Common Resources

Click to open or copy the CLIPART project files.

The CLIPART directory consists of resource files that you can use to customize the appearance of your application. Among the resources included are the following:

  • Dialog resources for the common dialogs.

  • A bitmap containing a variety of toolbar buttons.

  • Cursor resources for splitting, moving, resizing, and other cursor operations.

  • Icon resources for books, clocks, cardfiles, disks, file cabinets, folders, mail, network connections, pencils, phones, traffic signs, and other images.

  • String table resources for common status bar prompts and indicators.

You are free to use these resource files as-is or with your own modifications.


CMNCTRL1: Demonstrates Common Control MFC Classes, Part 1

Click to open or copy the CMNCTRL1 project files.

CMNCTRL1 illustrates how to use the following common control MFC classes: CTreeCtrl, CToolBarCtrl, CAnimateCtrl, CDateTimeCtrl, and CMonthCalCtrl. It shows how the controls are created and how to change the controls using many of the different available styles. Some of the controls cover topics that often yield questions from the user; for example, the drag and drop implementation for CTreeCtrl.

CMNCTRL1 is the result of replacing the original CMNCTRLS sample with two smaller projects: CMNCTRL1 (tree, toolbar, date and time picker, month calendar, and animate controls) and CMNCTRL2 (progress, up/down, and slider controls). This was done to reduce the footprint of the sample code, making it easier to trace specific portions of the application. The list control, originally in the CMNCTRLS sample, can now be found in the LISTHDR sample.

When you run CMNCTRL1, select the tab for the control you wish to activate. Select the styles and views from the check boxes, radio buttons, and combo boxes available in the different property pages. You will see how each one of the options changes the behavior and/or appearance of the control being displayed. For CTreeCtrl, you will be able to see the different notification messages sent by the control as you experiment with it.

Note Because of a display bug in the Win32 API, the tree view control will not update the node labels when the TVS_HASLINES and TVS_LINESATROOT styles are dynamically applied. To restore the labels, open and close one of the child nodes.

This sample demonstrates the following keywords:

CBitmap::LoadBitmap; CEdit::Clear; CEdit::GetLineCount; CEdit::LineIndex; CEdit::LineLength; CEdit::ReplaceSel; CEdit::SetSel; CFileDialog::GetPathName; CGdiObject::DeleteObject; CImageList::DragShowNolock; CString::GetBufferSetLength; CString::GetLength; CString::Left; CString::LoadString; CString::ReleaseBuffer; CTreeCtrl::SelectDropTarget; CWnd::GetInvalidateRect; CWnd::GetClientRect; CWnd::GetWindowRect; CWnd::SetWindowPos; CWnd::SetWindowText; DeleteItem; GetCursorPos; GetDlgItem; GetParent; GetWindowLong; InvalidateRect; CWinApp::LoadIcon; MAKELONG; MessageBeep; ReleaseCapture; ScreenToClient; SetCapture; SetWindowLong; SetWindowPos; UpdateWindow; CWnd::WindowProc; mbstowcs; rand; srand; time; wsprintf


CMNCTRL2: Demonstrates Common Control MFC Classes, Part 2

Click to open or copy the CMNCTRL2 project files.

CMNCTRL2 illustrates how to use the following common control MFC classes: CProgressCtrl, CSliderCtrl, and CSpinButtonCtrl. It shows how the controls are created and how to change the controls using many of the different available styles.

CMNCTRL2 is the result of replacing the original CMNCTRLS sample with two smaller projects: CMNCTRL1 (tree, toolbar, date and time picker, month calendar, and animate controls) and CMNCTRL2 (progress, up/down, and slider controls). This was done to reduce the footprint of the sample code, making it easier to trace specific portions of the application. The list control, originally in the CMNCTRLS sample, can now be found in the LISTHDR sample.

When you run CMNCTRL2, select the tab for the control you wish to activate. Select the styles and views from the check boxes, radio buttons, and combo boxes available in the different property pages. You will see how each one of the options changes the behavior and/or appearance of the control being displayed.

This sample demonstrates the following keywords:

CBitmap::LoadBitmap; CEdit::Clear; CEdit::GetLineCount; CEdit::LineIndex; CEdit::LineLength; CEdit::ReplaceSel; CEdit::SetSel; CFileDialog::DoModal; CFileDialog::GetPathName; CGdiObject::DeleteObject; CSpinButtonCtrl::GetBuddy; CString::GetBufferSetLength; CString::GetLength; CString::Left; CString::LoadString; CString::ReleaseBuffer; CWinApp::LoadIcon; CWnd::GetClientRect; CWnd::GetWindowRect; CWnd::SetWindowPos; CWnd::SetWindowText; DeleteItem; CWnd::DestroyWindow; CWnd::EnableWindow; GetCursorPos; GetDlgItem; GetParent; GetWindowLong; GetWindowRect; InvalidateRect; LoadIcon; MAKELONG; MessageBeep; ReleaseCapture; ScreenToClient; SetCapture; SetWindowLong; SetWindowPos; UpdateWindow; WindowProc; mbstowcs; rand; srand; time; wsprintf


CTRLBARS: Illustrates Custom Control Bars

Click to open or copy the CTRLBARS project files.

The CTRLBARS sample illustrates a wide variety of customization options for control bars:

  • Multiple control bars in a frame window, selective hiding and showing of control bars, and dynamic rearrangement of controls along the border of the frame window. The control bars are allocated space in the frame window according to their Z-order, which initially is the order in which they are created (see CMainFrame::OnCreate). CTRLBARS changes the Z-order of the dialog bar with the CWnd::SetWindowPos function. It hides or shows a control bar using CWnd::ShowWindow. Whenever CTRLBARS changes the Z-order or hides or shows a control bar, it calls CFrameWnd::RecalcLayout afterward so that the window real estate is reallocated to the remaining visible control bars.

  • Custom toolbars, dynamic rearrangement of buttons in the toolbar, and adding controls (such as a combo box) to a toolbar. CTRLBARS demonstrates two ways of customizing a toolbar. The first toolbar, the Tool Bar, changes the arrangement of buttons between short (5 buttons) and long (10 buttons). CTRLBARS calls CToolBar::SetButtonInfo for each button to map it to a tile position in the toolbar's bitmap and to a command identification. The second toolbar, the Style Bar, illustrates replacing a toolbar button (or separator) with a control — a combo box in this example. CMainFrame::CreateStyleBar creates a 100-pixel-wide toolbar separator. It then creates the combo box (IDW_COMBO) as a child of the toolbar, and sets the position of the combo box to take the space it just allocated for the separator.

  • Custom status bar, custom indicators, and sending text to the message line. For status bars, the framework automatically updates a CAP LOCK, NUM LOCK, or SCROLL LOCK indicator if you specify, for example, ID_INDICATOR_CAPS as one of the identifications passed in the indicators[ ] array to CStatusBar::SetIndicators. CTRLBARS illustrates extending the standard status bar indicators with the overstrike (OVR) state, which the user toggles with the insert key. This requires a message handler for the ID_TOGGLE_INSERT command (mapped to the VK_INSERT key), and a resource string (ID_INDICATOR_OVR) for the text "OVR" to be displayed when the Overstrike mode is on. The resource identification ID_INDICATOR_OVR is a predefined Microsoft Foundation Class Library (MFC) constant.

  • Dialog bar, which is a control bar whose layout is defined by a dialog resource template. As with any control bar, notifications from controls in the dialog bar are routed to the owner of the dialog bar, namely the main frame window. For example, CMainFrame::OnSelChangePalette is the handler for the CBN_SELCHANGE notification from the combo box control in a dialog bar. CMainFrame also has handlers for two of the three Hide/Show check boxes (Styles and Palette). No handler needs to be written for the third check box, Hide/Show Toolbar, since the framework provides the standard handler for ID_VIEW_TOOLBAR.

  • Floating tool palette, which behaves like a toolbar but displays a two-dimensional array of tool buttons, and floats as a modeless window above the owner frame window. The floating tool palette is implemented in a reusable class, CPaletteBar, derived from CToolBar. The derivation from CToolBar provides CPaletteBar with toolbar button behavior. The palette-specific behavior implemented in CPaletteBar includes:
    • Floating (WS_POPUP) window style.

    • Two-dimensional arrangement of the tool buttons into rows and columns: creation, painting, and button hit-testing.

    • Thin (no text) title bar.

    • Movable palette using a tracking rectangle.
  • CTRLBARS also illustrates using ON_COMMAND_EX and ON_UPDATE_COMMAND_UI_RANGE. Many of the control bar customization options illustrated by CTRLBARS are discussed in Technical Note 31.

Running CTRLBARS

When you first run CTRLBARS, all the various controls are visible.

  • A toolbar with 5 buttons lies immediately below the menu bar. The first button (thick up-arrow) toggles the toolbar arrangement between "Short" (5 buttons) and "Long" (10 buttons). The buttons are always inactive except this first Short/Long button and the Help button, which opens the About box.

  • A second toolbar lies immediately below the first toolbar. This toolbar, called the Style Bar, is where you specify one of the following text alignment styles — Left, Centered, Right, or Justified. Selecting one of the styles has no effect other than to change the state of the Style Bar.

  • A status bar lies at the bottom of the window.

  • A floating palette, with a 3-by-4 array of tool buttons, lies on top of the window.

  • A dialog bar lies on the left border of the window. It is a dialog bar because the layout of this control bar is defined in a dialog template resource (IDD_VIEW_SELECT).

The View menu lets you hide or unhide (show) any of the first four of the above controls bars. The dialog bar is always visible. The hide/show state of the Tools, Styles, and Palette control bars is immediately reflected in the Hide/Show check boxes in the dialog bar. You can also hide or show one of the other control bars by toggling its check box.

With the Dlg Bar Top command on the View menu, you can rearrange the control bars so that the dialog bar is at the top of the Z-order of the control bars. When the dialog bar is at the top, it extends along the entire left border of the window except for the menu and title bars. The left ends of the two toolbars touch the dialog bar. When the dialog bar is returned to its original Z-order position (after all of the other control bars), the top of the dialog bar touches the lower edge of the second toolbar bar, and the bottom of the dialog bar touches the upper edge of the status bar. This reflects the basic algorithm that control bars are allocated window real estate on a first-come, first-serve basis.

The Style menu lets you select one of the four text alignment styles — Left, Centered, Right, or Justified. Any selection you make is immediately reflected in the Style Bar's combo box and in the corresponding button. Similarly, you can make a selection either by choosing one of the styles in the Style Bar combo box or by pressing one of the four buttons. The new selection is immediately reflected in the states of the other controls and in the Style menu.

The Palette menu lets you change the tool arrangement of the palette from 3-by-4 to 2-by-6.

When you select a tool from the Palette, the status bar message line shows "You have selected the <type> tool," in which <type> indicates which of the 12 tools you selected. This selection is reflected in the combo box in the dialog bar. You can also select a tool using this combo box.

The status bar, in addition to showing the most recently selected tool, also shows the status of three keys — ins, CAPS LOCK, and NUM LOCK.

This sample demonstrates the following keywords:

AfxFormatString1; AfxGetApp; AfxIsValidAddress; AfxRegisterWndClass; AfxThrowResourceException; BitBlt; CBrush::CreateSolidBrush; CCmdUI::ContinueRouting; CCmdUI::Enable; CCmdUI::SetCheck; CCmdUI::SetText; CComboBox::AddString; CComboBox::Create; CComboBox::GetCurSel; CComboBox::GetLBText; CComboBox::SetCurSel; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDC::Attach; CDC::Detach; CDC::PatBlt; CDC::RectVisible; CDialogBar::Create; CDumpContext::GetDepth; CFont::CreateFontIndirect; CFrameWnd::LoadFrame; CFrameWnd::RecalcLayout; CFrameWnd::SetMessageText; CGdiObject::Attach; CObject::AssertValid; CObject::Dump; CRect::Height; CRect::InflateRect; CRect::SetRectEmpty; CRect::Width; CStatusBar::Create; CStatusBar::GetPaneInfo; CStatusBar::SetIndicators; CStatusBar::SetPaneInfo; CString::LoadString; CToolBar::CToolBar; CToolBar::CommandToIndex; CToolBar::Create; CToolBar::GetButtonInfo; CToolBar::GetItemID; CToolBar::GetItemRect; CToolBar::LoadBitmap; CToolBar::SetButtonInfo; CToolBar::SetButtons; CToolBar::SetHeight; CToolBar::SetSizes; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::OnIdle; CWnd::ClientToScreen; CWnd::CreateEx; CWnd::GetCapture; CWnd::GetClientRect; CWnd::GetDC; CWnd::GetDlgItem; CWnd::GetOwner; CWnd::GetParentFrame; CWnd::GetSafeHwnd; CWnd::GetStyle; CWnd::GetWindowRect; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCancelMode; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseActivate; CWnd::OnMouseMove; CWnd::OnSysColorChange; CWnd::PreCreateWindow; CWnd::ReleaseDC; CWnd::SendMessage; CWnd::SetCapture; CWnd::SetFont; CWnd::SetWindowPos; CWnd::ShowWindow; CWnd::UpdateDialogControls; CWnd::UpdateWindow; CreateBitmap; CreateCompatibleBitmap; CreateCompatibleDC; CreateDIBitmap; CreatePatternBrush; CreatePen; CreateSolidBrush; DeleteDC; DeleteObject; FillRect; FindResource; FrameRect; FreeResource; GetActiveWindow; GetBValue; GetCapture; GetDC; GetDeviceCaps; GetGValue; GetNextWindow; GetObjectType; GetParent; GetRValue; GetStockObject; GetSysColor; GetSystemMetrics; GetVersion; GetWindow; HIBYTE; InvertRect; LOBYTE; LoadCursor; LoadIcon; LoadResource; LockResource; MAKEINTRESOURCE; OffsetRect; PatBlt; RGB; ReleaseCapture; ReleaseDC; SelectObject; SendMessage; SetActiveWindow; SetBkColor; SetCapture; SetROP2; SetRect; SetTextColor; StretchDIBits; UpdateWindow; free; lstrcpy; malloc; memcpy; memset


CTRLTEST: Implements Custom Controls

Click to open or copy the CTRLTEST project files.

CTRLTEST illustrates several techniques for implementing and using custom controls:

  • Implementing CParsedEdit, a specialized edit control deriving functionality from its library control class, and three methods of using custom controls.

  • Using the spin control. The spin control has small up-arrow and down-arrow buttons for incrementing or decrementing a value.

  • Bitmap button implementation of Custom menu commands using CBitmapButton.

  • Owner (parent window) drawing of menus and list boxes. Corresponding control classes deriving from the CMenu class and CListBox provide this feature in an object-oriented way.

  • Using resource files not maintainable by the Microsoft Visual C++ resource editors. This illustrates the benefits and drawbacks of using an .rc2 file in a dialog box that has a custom control with styles defined by constants in a header file.

All the illustrations in CTRLTEST are initiated through menu commands.

Example: Implementing and Using Custom Controls

You can implement a custom control from scratch by deriving from CWnd, but it is much easier if you can borrow functionality from one of the standard Windows controls by deriving from its control class in the library. CTRLTEST does this to implement a specialized edit control, CParsedEdit. This edit control accepts only specified sets of characters as user input: numeric, alphabetic, and/or noncontrol characters. CParsedEdit is derived from CEdit. It has an OnChar message handler to filter the characters.

The implementation of the commands in the Simple menu illustrates three methods of using a custom control. The methods are distinguished according to how the application associates instances of the control in the dialog box with the CParsedEdit class. Each Simple menu command displays a dialog box with four instances of the CParsedEdit control. Data entered in the dialog box is sent to the debug port as TRACE output. The three Simple menu commands are:

Test C++ Derived Class

The CParsedEdit controls are data members of the dialog class. The controls are explicitly created in the dialog's OnInitDialog function by calling CParsedEdit::CreateSet. See Dertest.cpp.

Test WNDCLASS Registered

The CParsedEdit controls are laid out in a dialog template resource (IDD_WNDCLASS_EDIT) as custom controls with a WNDCLASS identified as "paredit." It is instructive to examine the properties of these custom controls using the Visual C++ dialog editor.

  • Caption blank. This is the initial value shown in the CParsedEdit control.

  • Class:paredit. This is the WNDCLASS name which is registered by CParsedEdit::RegisterControlClass in PAREDIT2.CPP, before the dialog is called.

  • Visible:checked. The control is visible.

  • Tabstop:checked. The user can tab to this control.

  • Style:0x5081002, 0x5081001, 0x5081003, 0x5081ffff for the four parsed edit controls. The style 0x500000 is for WS_CHILD and WS_VISIBLE, and 0x1000 is for WS_TABSTOP. All custom controls have the WS_CHILD style. The WS_VISIBLE and WS_TABSTOP styles are automatically set by the dialog editor when you check the Visible and Tabstop styles. 0x80000 is for WS_BORDER. Since the dialog editor property page for a custom control does offer all of the window styles such as WS_BORDER, you must look up the constant in \Microsoft Visual Studio\VC98\Include\WINUSER.H. The styles 0x0001, 0x0002, 0x0004, and 0x0ffff are defined in PAREDIT.H as, respectively, PES_NUMBERS, PES_LETTERS, PER_OTHERCHARS, and PES_ALL.

  • The hexadecimal styles in the custom control property page are not self-documenting. If it is important to you to use the symbolic styles, such as PES_NUMBERS and PES_LETTERS, you can alternatively manually edit a separate resource file, such as RES\Ctrltest.rc2, that is included by the Resource Compiler at compile-time, but is not read by Visual C++ at editing time. For a discussion of the pros and cons of manually editing a custom control dialog in an .rc2 file, see Using resource files not maintainable by the Visual C++ resource editors.

Test Dynamic Subclassed

The controls are laid out in a dialog template resource (IDD_SUB_EDIT in Ctrltest.rc) as standard edit controls. The controls are declared as CParsedEdit data members in the dialog class. The dialog's OnInitDialog function calls CParsedEdit::SubClassEdit, which in turn calls CWnd::SubclassDlgItem, to associate each specific instance of the edit control with the CParsedEdit class. See Paredit.cpp.

Example: Spin Control

The CTRLTEST sample includes an implementation of a spin control. The spin control has a small up-arrow and a small down-arrow button for incrementing or decrementing a value.

The Spin Control command calls a dialog box that has four CParsedEdit controls, each associated with a spin control. Data entered in the CParsedEdit controls in this dialog box is filtered to accept only nonnegative integers. The user can enter numeric data by either typing the value into the CParsedEdit control or using the associated spin control.

Example: Bitmap Button

The implementation of the following Custom menu commands illustrates ways to use CBitmapButton:

  • Bitmap Button 1 - The dialog constructor explicitly loads the bitmap resources for each of the three states (up, down, and focus) of the button by calling CBitmapButton::LoadBitmaps.

  • Bitmap Button 2 - The dialog's OnInitDialog function calls CBitmapButton::Autoload to load the bitmap resources based on the following naming convention. The window text of the control serves as the base resource name, and the letters U, D, and F are appended to create the names of the resources for each of the three bitmap images for, respectively, up, down, and focus. For example, the three bitmap resources for the OK button are named OKU, OKD, and OKF.

  • Bitmap Button 3 - The dialog box is an extension of the second dialog box above, using a fourth possible button state, disabled. To use this dialog, click the left- or right-arrow bitmap button until the displayed number reaches 1, the lowest number, or 10, the highest number. When the limit is reached, the button is disabled and a fourth bitmap image is displayed. The naming convention for the bitmap resource for the disabled state is an X suffix, as is reflected in the resource names PREVX and NEXTX.

Example: Owner Drawing (Menu and List Box)

Various Windows controls and menus have an owner draw feature that lets the parent (or owner) window draw whatever it wants in the client area of the control instead of the standard control behavior. The corresponding control classes and CMenu class provide this feature in a more convenient, object-oriented way: The control or menu class handles the drawing. This is called "self drawing."

CTRLTEST illustrates the general technique of owner drawing in implementing the following commands in the Custom menu:

  • Custom Menu -This menu item calls a CColorMenu pop-up menu, derived from CMenu. Each submenu item displays one of eight colors using the self-drawing feature. A message box confirms the color you select from the submenu.

  • Custom List Box - This menu item calls a dialog box that displays a CColorListBox, derived from CListBox. The list box has eight entries, each drawn in one of eight colors using the self-drawing feature. TRACE output confirms your selection from the list box.

Example: Using Resource Files Not Maintainable by Visual C++ Resource Editors

The resource file CTRLTEST\RES\Ctrltest.rc2 is an example of a resource file not maintainable by the Visual C++ resource editors in a human-readable form. If you were to open Ctrltest.rc2 in Visual C++, and then save it, you would lose useful human-readable information, even though the Resource Compiler would still be able to compile the .rc2 file and produce an equivalent binary .res file. Thus, RES\Ctrltest.rc2 has been added as a #include in Ctrltest.rc with a Compile-Time Directive specified with the Resource File Set Includes command.

The following are three categories of human-readable information that are not maintainable by the Visual C++ resource editors. Two of these are demonstrated in Ctrltest.rc2:

  • Custom control styles symbols - For example, "msctls_updown32" is a style defined for the spin control. Although Visual C++ can interpret this symbol as it reads in the .rc2 file, Visual C++ would write it back out to the .rc2 file as a hexadecimal value.

  • Standard Windows WS_ or control style symbols used in a control from a standard Windows control-derived class - For example, ES_AUTOHSCROLL is defined for the spin control in the IDD_SPIN_EDIT dialog. Although Visual C++ can interpret these symbols as it reads in the .rc2 file, Visual C++ would write it back out to the .rc2 files as a hexadecimal value.

  • Arithmetic in the .rc file - Expressions such as "IDC_EDIT1+2" to identify controls in the IDD_SPIN_EDIT dialog would be written back out to the .rc2 file as a single hexadecimal value by Visual C++.

The CTRLTEST sample illustrates the pros and cons of using an .rc2 file in the case of a dialog that has a custom control with styles defined with constants in a header file. Both dialogs IDD_WNDCLASS_EDIT and IDD_SPIN_EDIT have custom controls with symbolically defined styles; but IDD_WNDCLASS is specified in a .rc file editable by the Visual C++ dialog editor, whereas IDD_SPIN_EDIT is specified in a .rc2 file that is only manually editable.

The differences between using the .rc file and the .rc2 file can be summarized as follows:

For the IDD_WNDCLASS_EDIT dialog, the resource script is defined in Ctrltest.rc. For the IDD_SPIN_EDIT dialog, the resource script is defined in RES\Ctrltest.rc2. For the IDD_WNDCLASS_EDIT dialog, the WNDCLASS custom control is "paredit", the style constants are defined in PAREDIT.H and an example style constant is PES_NUMBER. IDD_WNDCLASS_EDIT is editable by Visual C++ but cannot use #define styles. IDD_SPIN_EDIT is not editable by Visual C++ but can use #define styles.

The trade-off is that if you use the .rc2 file, you can use human-readable symbolic styles defined in the header file for the custom control, but you cannot edit the .rc2 file with the Visual C++ dialog editor. It is easier to lay out the dialog using Visual C++ than it is to manually write resource script; and writing resource script is more error prone. On the other hand, the styles are not self-documenting when displayed in hexadecimal in the custom control property page by the Visual C++ dialog editor.

This sample demonstrates the following keywords:

AfxGetInstanceHandle; AfxMessageBox; AfxThrowResourceException; CBitmapButton::AutoLoad; CDC::FillRect; CDC::FrameRect; CDialog::DoModal; CDialog::EndDialog; CDialog::OnInitDialog; CDialog::OnOK; CDialog::OnSetFont; CEdit::Create; CEdit::SetSel; CFrameWnd::Create; CListBox::AddString; CListBox::CompareItem; CListBox::DrawItem; CListBox::GetItemData; CListBox::MeasureItem; CMenu::AppendMenu; CMenu::CreateMenu; CMenu::Detach; CMenu::DrawItem; CMenu::EnableMenuItem; CMenu::FromHandle; CMenu::GetMenuString; CMenu::MeasureItem; CRect::Width; CStatic::Create; CString::Format; CString::LoadString; CWinApp::Enable3dControls; CWinApp::InitInstance; CWnd::Attach; CWnd::EnableWindow; CWnd::FromHandle; CWnd::GetDlgCtrlID; CWnd::GetDlgItem; CWnd::GetDlgItemInt; CWnd::GetMenu; CWnd::GetParent; CWnd::GetWindowRect; CWnd::GetWindowText; CWnd::IsWindowEnabled; CWnd::MessageBox; CWnd::OnChar; CWnd::OnCommand; CWnd::OnVScroll; CWnd::PostNcDestroy; CWnd::SendMessage; CWnd::SetDlgItemInt; CWnd::SetFocus; CWnd::SetFont; CWnd::SetWindowPos; CWnd::ShowWindow; CWnd::SubclassDlgItem; CallWindowProc; GetBValue; GetClassInfo; GetGValue; GetRValue; GetSystemMetrics; HIWORD; IsCharAlpha; IsCharAlphaNumeric; LOWORD; MAKEINTRESOURCE; MAKELONG; MessageBeep; ModifyMenu; RGB; RegisterClass; SetWindowLong


DBVLIST: Demonstrates CListView and CDaoRecordset

Click to open or copy the DBVLIST project files.

The DBVLIST sample uses MFC's CListView and CDaoRecordset classes to implement the virtual list view functionality that is available for the list view common control beginning with Microsoft Internet Explorer 4.0.

The sample demonstrates how virtual list views can be used to display very large lists of items as well as items that may not all be in memory at once. It displays a list of database items (employee records) filtered by division that is selectable by the user at run time.

Running the Sample

Initially, DBVLIST comes up blank. Simply select the division you want to view with the combo box in the upper pane, and then click the Fetch Results button. The results will appear in the list view in the pane in the lower half of the window. You can also change the sort order of the list by clicking the column header of the item you want to sort.

This sample demonstrates the following keywords:

CDaoRecordset::IsOpen; CDaoRecordset::Open; CDaoRecordset::Requery; CDaoRecordset::IsEOF; CDaoRecordset::MoveNext; CDaoRecordset::MoveFirst; CDaoRecordset::GetRecordCount; CListView::GetListCtrl; CListCtrl::InsertColumn; CListView::OnChildNotify


DIBLOOK: Illustrates the Use of DIBs and Color Palettes

Click to open or copy the DIBLOOK project files.

The DIBLOOK sample illustrates the use of device-independent bitmaps (DIBs) and the closely related use of color palettes.

DIBLOOK also illustrates a document that has an externally defined file format (in this case, the DIB file format). This is in contrast to an internally defined file format, which is otherwise implied when the framework automatically calls the document's Serialize function to store the contents of the document on disk. DIBLOOK further illustrates use of the Clipboard, CFile, and scroll views.

DIBLOOK is a Multiple Document Interface (MDI) application that lets you view multiple bitmaps at the same time. Use File Open to open an existing device-independent bitmap (.dib) file or device-dependent bitmap (.bmp) file. Alternatively, you can create a new bitmap document by copying a bitmap from another application, such as Paint, using the Clipboard, as follows:

  • From the other application, copy a bitmap to the Clipboard.

  • Use the DIBLOOK File New command to create a new bitmap document.

  • Use the Edit Paste command to copy the bitmap from the Clipboard into the new document.

Although you cannot edit the image in DIBLOOK, you can save the bitmap to another file by using the File Save As command. The bitmap is saved in device-independent bitmap format, even if its original format was device-dependent.

Externally Defined Document Format

DIBLOOK reads and stores bitmaps in the standard Windows device-independent bitmap format. While in memory, the bitmap is managed by Windows using an opaque HDIB handle. The internal format of the bitmap is visible to the application. Thus, DIBLOOK's document does not itself store the bitmap bits or the color table. Instead, CDibDoc simply holds a handle to the DIB (HDIB m_hDIB). DIBLOOK is an application whose document format is defined externally (typically some standard file format standard such as DIB), in contrast to an application whose document format is implicitly defined according to the sequence in which it serializes the document items in the CDocument::Serialize override.

DIBLOOK does not override CDocument::Serialize. Instead, DIBLOOK overrides CDocument::OnOpenDocument and OnSaveDocument. Both of these overrides use the pszPathName, passed in by the framework, to open a CFile object and to read or save the DIB. The actual code for reading and saving the DIB file is provided in Myfile.cpp; this code is reusable by any application that needs to read and save DIB files.

Using DIBs and Color Palettes

DIBLOOK illustrates how to display a DIB in a window and how to prepare the color palette for the window displaying the DIB.

After DIBLOOK reads the DIB from a file, it prepares a CPalette object based on the color table of the DIB and stores the palette as m_palhDIB in the CDibDoc object. When DIBLOOK displays the DIB in its CDibView::OnDraw, it calls a Windows ::PaintDIB routine implemented in DIBLOOK's Dibapi.cpp. PaintDIB in turn calls the Windows function ::SetDIBitsToDevice or ::StretchDIBits, using the color table of the DIB as the color palette. The DIB-displaying routines in Dibapi.cpp are reusable by any application that displays DIBs.

DIBLOOK selects a color palette that is optimal for the currently active window. DIBLOOK selects a color palette matching the color table of the DIB displayed in the currently active MDI child window. When an application is about to receive the input focus (shifting away from another application), its top-level window receives the WM_QUERYNEWPALETTE message. DIBLOOK's CMainFrame window handles this message by sending an application-defined message, WM_DOREALIZE, to each of the descendant windows. The list of descendant windows includes all the views of the possible multiple opened documents. In turn, each view selects into its display context as a foreground or background palette, depending on whether the view is the active one or not.

If another application changes the system palette, DIBLOOK receives the WM_PALETTECHANGED message. In this case, the CMainFrame window again sends the application-defined message, WM_DOREALIZE, to each of the views. Each of the views selects its palette into the display context as a background palette, however, yielding the foreground palette to the other application.

When the focus shifts within the application from one view to another, DIBLOOK selects and realizes the palette for the currently active view (see CDibView::OnActivateView). When the new palette is realized, Windows sends the WM_PALETTECHANGED message to all application top-level windows, including those of DIBLOOK. DIBLOOK handles the message by realizing as a background palette the color tables associated with the other DIBs in the other views.

This sample demonstrates the following keywords:

AfxGetApp; CCmdTarget::BeginWaitCursor; CCmdTarget::EndWaitCursor; CCmdUI::Enable; CDC::RealizePalette; CDC::SelectPalette; CDialog::DoModal; CDocument::DeleteContents; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::OnSaveDocument; CDocument::ReportSaveLoadException; CDocument::SetModifiedFlag; CDocument::SetPathName; CDocument::UpdateAllViews; CFile::Abort; CFile::Close; CFile::GetLength; CFile::Open; CFile::Read; CFile::ReadHuge; CFile::Write; CFile::WriteHuge; CFrameWnd::GetActiveView; CFrameWnd::LoadFrame; CMDIFrameWnd::MDIGetActive; CObject::AssertValid; CObject::Dump; CPalette::CreatePalette; CScrollView::SetScrollSizes; CStatusBar::Create; CStatusBar::SetIndicators; CString::LoadString; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::DoPreparePrinting; CView::GetDocument; CView::OnActivateView; CView::OnDraw; CView::OnInitialUpdate; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::OnPaletteChanged; CWnd::OnQueryNewPalette; CWnd::OpenClipboard; CWnd::SendMessage; CWnd::SendMessageToDescendants; CWnd::ShowWindow; CWnd::UpdateWindow; CloseClipboard; DragAcceptFiles; EmptyClipboard; GetClipboardData; GetDeviceCaps; GlobalAlloc; GlobalFree; GlobalLock; GlobalSize; GlobalUnlock; IsClipboardFormatAvailable; MessageBox; SelectPalette; SetClipboardData; SetDIBitsToDevice; SetStretchBltMode; StretchDIBits; memcpy


DLGCBR32: Demonstrates Adding a Status Bar and Toolbar to Dialog Boxes

Click to open or copy the DLGCBR32 project files.

In an MFC application, you can attach control bars such as status bars and toolbars to a frame window. However, for many applications a simple dialog box-based user interface is sufficient. MFC does not provide built-in support for adding control bars to dialog boxes.

DLGCBR32 is a sample application that demonstrates how to add a status bar and toolbar to a dialog box. In addition, it demonstrates a number of techniques related to using a modeless dialog box as the main window of an MFC application.

Running the Sample

To add a control bar to a dialog box, create the control bar as usual, then make room for the control bar within the client area of the dialog box. For the control bar to function properly, the dialog box must duplicate some of the functionality of a frame window. If you want ON_UPDATE_COMMAND_UI handlers to work for the control bars, you also need to derive new control bar classes and handle the WM_IDLEUPDATECMDUI message. If your dialog box is not the main window of your application, you will also need to modify its parent frame window to pass the WM_IDLEUPDATECMDUI message on to the dialog box's control bars.

To make room for a control bar within the client area of the dialog box, follow these steps in your dialog box's OnInitDialog function:

  1. Create the control bars. Figure out how much room the control bars will take by using the reposQuery option of RepositionBars.
    CRect rcClientStart;
    CRect rcClientNow;
    GetClientRect(rcClientStart);
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST,
                   AFX_IDW_CONTROLBAR_LAST,
                   0, reposQuery, rcClientNow);
  2. Move the controls in your dialog box to account for the space used by control bars at the top or left of the client area. If your dialog box contains a menu, you also need to account for the space used by the menu.
    CPoint ptOffset(rcClientNow.left - rcClientStart.left,
                    rcClientNow.top - rcClientStart.top);
    CRect rcChild;
    CWnd* pwndChild = GetWindow(GW_CHILD);
    while (pwndChild)
    {
       pwndChild->GetWindowRect(rcChild);
       ScreenToClient(rcChild);
       rcChild.OffsetRect(ptOffset);
       pwndChild->MoveWindow(rcChild, FALSE);
       pwndChild = pwndChild->GetNextWindow();
    }
  3. Increase the dialog box window dimensions by the amount of space used by the control bars.
    CRect rcWindow;
    GetWindowRect(rcWindow);
    rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
    rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();
    MoveWindow(rcWindow, FALSE);
  4. Position the control bars using RepositionBars.

To update the first pane of a status bar with menu item text, you must handle WM_MENUSELECT, WM_ENTERIDLE, WM_SETMESSAGESTRING, and WM_POPMESSAGESTRING in your dialog box class. You need to duplicate the functionality of the CFrameWnd handlers for these messages. See the CModelessMain class in the sample program for examples of these message handlers.

To display tooltips for the toolbar buttons, it is necessary to handle the TTN_NEEDTEXTW and TTN_NEEDTEXTA notifications.

To allow ON_UPDATE_COMMAND_UI handlers to work for other status bar panes and for toolbar buttons, you must derive new control bar classes and implement a message handler for WM_IDLEUPDATECMDUI. This is necessary because the default control bar implementations of OnUpdateCmdUI assume the parent window is a frame window. However, OnUpdateCmdUI does not do anything but pass the parent-window pointer to a function that requires only a CCmdTarget pointer. Therefore, you can temporarily tell OnUpdateCmdUI that the parent-window pointer you are giving it is a CFrameWnd pointer to meet the compiler requirements. Here's an example:

    LRESULT CDlgToolBar::OnIdleUpdateCmdUI(WPARAM wParam,
                                           LPARAM lParam)
    {
       if (IsWindowVisible())
       {
          CFrameWnd* pParent = (CFrameWnd*)GetParent();
          if (pParent)
             OnUpdateCmdUI(pParent, (BOOL)wParam);
       }
       return OL;
    }

To pass WM_IDLEUPDATECMDUI messages on to dialog boxes other than the main window, save dialog pointers in your frame window class and create a WM_IDLEUPDATECMDUI handler in that class. The handler should send the WM_IDLEUPDATECMDUI message on to the dialog child windows by using CWnd::SendMessageToDescendants. Then perform default processing for the message within the frame window.


DLGTEMPL: Creating Dialog Templates Dynamically

Click to open or copy the DLGTEMPL project files.

The DLGTEMPL sample shows how to create a dialog template dynamically and use the template with CDialog::InitModalIndirect. The sample displays a dialog box for selecting the height, width, and other attributes of a button, static text, and multiline edit control, then displays the resulting dialog box using templates in memory.

The bulk of the code for dynamically creating a dialog is found in the CMyDialogTemplate::DemoIt member function. DLGTEMPL does not prevent you from entering values that lay one control over another, nor does it prevent you from positioning a control beyond the boundary of the dialog. You can experiment with DLGTEMPL to see the effects of resizing and overlaying controls.

For more information on dialog templates, see the class CDialog and the Windows structures DLGTEMPLATE and DLGITEMTEMPLATE in the Win32 SDK.

Running the Sample

When you run DLGTEMPL, it displays a dialog box in which you select Button, Edit, or Text. Type the desired values for height, width, and X and Y coordinates for placement on the resulting dialog box, and a caption to be displayed. Click Show Dialog to display a dynamically created dialog box based on the values you enter.


DOCKTOOL: Demonstrates Dockable Toolbars

Click to open or copy the DOCKTOOL project files.

DOCKTOOL demonstrates dockable toolbar support. A dockable toolbar can be attached, or docked, to any side of its parent window, or it can be detached, or floated, in its own mini-frame window using CMiniFrameWnd. The following three steps are necessary to place a dockable toolbar in your application:

  1. Enable docking for the frame window or destination using the CFrameWnd::EnableDocking function. One DWORD parameter indicates which side of the frame window accepts docking. To dock control bars anywhere, pass CBRS_ALIGN_ANY to EnableDocking.

  2. Enable docking for the toolbar or source by calling CControlBar::EnableDocking for each toolbar. Specify the destination sides to which the toolbar should dock. If none of the sides specified match the sides enabled for docking in the frame window, the toolbar cannot dock — it will float. Once it has been floated, it remains a floating toolbar, unable to dock to the frame window.

  3. Dock the toolbar to the frame window by calling CFrameWnd::DockControlBar. Conversely, call CFrameWnd::FloatControlBar to detach a dockable toolbar from the frame window.

If you do not complete all three steps, your application will display a standard toolbar. The last two steps must be performed for each dockable toolbar in your application.

To retain the state of dockable toolbars (whether docked or floating) between invocations of your application, use the CControlBar::SetBarStyle and CControlBar::GetBarStyle functions to retrieve and restore the settings of any particular control bar. Normally, this information is stored in the application's .ini file using CFrameWnd::SaveBarState and retrieved using CFrameWnd::LoadBarState.

This sample demonstrates the following keywords:

AfxGetApp; CArchive::IsStoring; CComboBox::Create; CComboBox::DeleteString; CComboBox::GetCount; CComboBox::InsertString; CComboBox::SetCurSel; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::OnNewDocument; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadBarState; CFrameWnd::RecalcLayout; CFrameWnd::SaveBarState; CMenu::GetSubMenu; CMenu::LoadMenu; CMenu::TrackPopupMenu; CObject::AssertValid; CObject::Dump; CObject::Serialize; CRect::OffsetRect; CString::IsEmpty; CToolBar::Create; CToolBar::GetItemRect; CToolBar::LoadBitmap; CToolBar::SetButtonInfo; CToolBar::SetButtons; CView::GetDocument; CView::OnDraw; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::ClientToScreen; CWnd::DoDataExchange; CWnd::FromHandlePermanent; CWnd::GetParentFrame; CWnd::GetStyle; CWnd::GetWindowPlacement; CWnd::GetWindowRect; CWnd::GetWindowText; CWnd::Invalidate; CWnd::IsZoomed; CWnd::OnClose; CWnd::OnCreate; CWnd::PreTranslateMessage; CWnd::SendMessage; CWnd::SetWindowPlacement; CWnd::SetWindowPos; CWnd::SetWindowText; CWnd::ShowWindow; GetProfileInt; GetProfileString; GetStockObject; HIWORD; LOWORD; LoadBitmap; WriteProfileString; wsprintf


DYNAMENU: Dynamically Updates Menus

Click to open or copy the DYNAMENU project files.

DYNAMENU illustrates dynamic modification of menus and status bars regardless of whether handling commands are known at compile time. DYNAMENU illustrates the following capabilities:

  1. Dynamically updating the list of items in a menu.

  2. Implementing the equivalent of ON_COMMAND and ON_UPDATE_COMMAND_UI handlers for menu commands whose IDs are not known at compile time. This illustration can be applied to more complex cases, such as user-configurable menus.

  3. Updating the status bar command prompt for commands whose IDs are not known at compile time.

DYNAMENU initially displays a window with the text: "This text is displayed in the current color." You can change the color of the displayed text by selecting one of four items initially offered in the Color menu: Black, Red, Purple, or Blue.

To exercise the dynamic menu updating feature of DYNAMENU, click Change Options on the Color menu, which opens a Change Color Options dialog box. Four check boxes for Black, Red, Purple and Blue allow you to choose which colors are dynamically offered in the Color menu. For example, if you clear (uncheck) Red and Purple and return to the Color menu, only Black and Blue items will be offered in the menu.

Notice how the status bar displays, for example, "Set current color text to Black," when the focus is on the Black item in the Color menu.

Dynamically Updating the List of Items in a Menu

Class CDynaMDIChildWnd in Mdichild.cpp implements dynamic updating of items in the Color menu. When the list of available colors is updated, or when then MDI child window is activated, the CDynaMDIChildWnd::RefreshColorMenu function calls CMenu::DeleteMenu to delete each color item from the menu, and then adds the currently available colors to the menu using CMenu::AppendMenu.

Implementing Command Handlers for Dynamic Menu Items

DYNAMENU could have been implemented by reserving a fixed list of command IDs for the colors: ID_COLOR_BLACK, ID_COLOR_RED, etc. In such a case, ON_COMMAND and ON_UPDATE_COMMAND_UI handlers could have been implemented for the color commands as usual. This would be the most straightforward way to implement DYNAMENU.

However, for sake of illustration, DYNAMENU does not use fixed command IDs. Instead, DYNAMENU dynamically assigns command IDs not known or associated with the menu items at compile time. This illustration can be applied to more complex cases, such as user-configurable menus.

The equivalent of ON_COMMAND and ON_UPDATE_COMMAND message map handling is implemented in the document's override of CCmdTarget::OnCmdMsg. If the OnCmdMsg function is called with a NULL pointer for the AFX_CMDHANDLERINFO* parameter, this means that no message map entry has been found for the command. In this case, the override of OnCmdMsg checks whether the command ID, passed as the first parameter, is one of the dynamically assigned command IDs for the color menu items. If so, the override calls either a command handler (DoSelectColor) or command user interface handler (DoUpdateSelectColor), depending on whether the second parameter passed to OnCmdMsg is the MFC-defined CN_COMMAND or CN_UPDATE_COMMAND_UI.

Updating Status Bar Command Prompt for Dynamic Menu Items

In DYNAMENU, the MDI child window (CDynaMDIChildWnd) owns the status bar. The default implementation of CFrameWnd::GetMessageString uses the currently shown command ID (for the item that currently has the focus in the menu) to get the corresponding string resource for the command and display it in the first pane of the status bar. DYNAMENU overrides GetMessageString to display a command prompt for the dynamically defined commands.

This sample demonstrates the following keywords:

AfxFormatString1; AfxGetMainWnd; CCmdTarget::OnCmdMsg; CDialog::DoModal; CDialog::OnInitDialog; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnNewDocument; CDocument::UpdateAllViews; CFrameWnd::Create; CFrameWnd::GetActiveDocument; CFrameWnd::GetMessageString; CFrameWnd::LoadFrame; CMenu::AppendMenu; CMenu::DeleteMenu; CMenu::GetMenuItemCount; CMenu::GetMenuItemID; CMenu::GetSubMenu; CObject::AssertValid; CObject::Dump; CObject::Serialize; CString::LoadString; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWinApp::SetDialogBkColor; CWnd::CenterWindow; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetDlgItem; CWnd::GetMenu; CWnd::GetParentFrame; CWnd::OnCreate; CWnd::SetWindowText; CWnd::ShowWindow; CWnd::UpdateWindow; DragAcceptFiles; DrawText; LoadBitmap; RGB; SetBkMode; SetTextColor


HELLO: Demonstrates a Simple Application with a Frame Window

Click to open or copy the HELLO project files.

The HELLO sample is the classic "Hello, World" application. HELLO illustrates a single application window with a menu and About box. The sample does not make use of the framework's document/view architecture. HELLO also illustrates using string resource names rather than numeric IDs. Given that Microsoft Visual C++ makes it easy to use more efficient numeric IDs and symbols, HELLO's approach of using string names is not recommended.

When you run HELLO, it displays "Hello, Windows!" centered in the application window. Use the Help About command, or f1, to see the About box.

Like any application written using MFC, HELLO has a CWinApp-derived class. This application class provides a minimal implementation of InitInstance, which is to construct a frame window object (of the application-specific CMainWindow class), and then call the window's ShowWindow and UpdateWindow functions. HELLO displays "Hello, Windows!" in response to the WM_PAINT message by specifying a message map entry, ON_WM_PAINT, for CMainWindow and by implementing the OnPaint handler.

This sample demonstrates the following keywords:

CDC::SetBkMode; CDC::SetTextAlign; CDC::SetTextColor; CDC::TextOut; CDialog::DoModal; CFrameWnd::LoadFrame; CString::LoadString; CWnd::GetClientRect; CWnd::OnPaint; GetSysColor; ShowWindow; UpdateWindow


HELLOAPP: Demonstrates Minimal 'Hello World' Application

Click to open or copy the HELLOAPP project files.

HELLOAPP is the minimal Microsoft Foundation Class Library (MFC) sample, and illustrates how few lines of code are required simply to get a window to appear on the screen. HELLOAPP is even simpler than the HELLO sample: HELLOAPP does not paint anything in the main window's client area, nor does it even have a message map for the main window. HELLOAPP is nevertheless instructive in that it demonstrates the minimal overhead required for a content-less application, as opposed to, for example, a WinMain type of application developed using the Microsoft Windows Software Development Kit.

When you run HELLOAPP, it displays "Hello World!" in the title bar of an empty application window.

Like any application written using MFC, HELLOAPP has a CWinApp-derived class. This application class provides a minimal implementation of InitInstance, which is to construct a frame window object (of the application-specific class CMainWindow), and then call the window's ShowWindow and UpdateWindow functions.

This sample demonstrates the following keywords:

CFrameWnd::Create; CFrameWnd::rectDefault; CWinApp::InitInstance; ShowWindow; UpdateWindow


LISTHDR: Demonstrates the List View and Header Common Controls

Click to open or copy the LISTHDR project files.

LISTHDR demonstrates how to use the following common control MFC classes: CListCtrl and CHeaderCtrl. It shows how the controls are created and how to change the controls using many of the different available styles. Taken from the old CMNCTRLS sample, the LISTHDR sample has been updated to take advantage of several features implemented in Internet Explorer 4.0.

When you run LISTHDR, select the styles and views from the check boxes, radio buttons, and combo boxes available. You will see how each one of the options changes the behavior and/or appearance of the control being displayed. Some options include dynamically switching between different views, displaying the list view items in four separate working areas, and modifying various other styles. In addition to manipulating the list view control, you can change the appearance of the embedded header control. Some examples include the reordering the header items by dragging and dropping and displaying images in each header item from a separate image list.

There are dependencies between attributes (such as Report view and LVS_NOSORTHEADER). This causes some controls to be disabled or enabled, depending on the current state of the list view control.

This sample demonstrates the following keywords:

::SetWindowLong, CHeaderCtrl::GetItem, CImageList::Create, CImageList::Add, CListCtrl::SetExtendedStyle, CListCtrl::InsertColumn, CListCtrl::InsertItem, CListCtrl::SetItem, CListCtrl::GetHeaderCtrl, CListCtrl::SetWorkAreas, CListCtrl::ApproximateViewRect, CListCtrl::SetItemPosition, CListCtrl::CreateDragImage, CListCtrl::BeginDrag, CListCtrl::DragEnter, CListCtrl::DragMove, CWnd::ModifyStyleEx, CWnd::ModifyStyle, CWnd::GetDlgItem


MDI: Demonstrates the MFC MDI Interface

Click to open or copy the MDI project files.

The MDI sample uses the framework's multiple-document interface (MDI) support without using the document/view architecture.

For an additional MDI sample, see MDIDOCVW.

MDI also illustrates the Microsoft Windows timer, CColorDialog, CBitmap, and changing the default cursor of a window.

The MDI sample application provides a parent window with two distinct types of MDI child windows: a Bounce window, in which a ball bounces around; and a Hello window, which simply displays the text "Hello, World!" You can create multiple instances of each type of window.

Click New Bounce or New Hello on the File menu to create a new MDI child window. Both MDI child windows determine what menus are shown when they are active. Both windows have a Color menu. When you choose a color from this menu, the color of the bouncing ball or of the Hello text is updated. Choose the Custom item to call a color dialog box, from which you can select a special color.

The Bounce window also has a Speed menu, from which you can select the speed at which the ball moves around the screen.

If you minimize the Bounce window, notice that there isn't a static icon. Rather, a small ball bounces around in the icon. In contrast, the Hello window has a normal icon.

MDI Without Documents and Views

Unlike an MDI application produced by AppWizard, this sample application does not use the framework's support for documents and views. Thus, it does not use document templates; the application's InitInstance does not call AddDocTemplate.

This application nevertheless takes full advantage of the framework's MDI support. CMainFrame is derived from CMDIFrameWnd. CBounceWnd and CHelloWnd are derived from CMDIChildWnd. Commands on the Window menu, such as Tile, are handled by the framework's default implementation in CMDIFrameWnd.

Although CBounceWnd and CHelloWnd both override Create, the override is not necessary to take advantage of the framework's MDI support. The override of Create illustrates how to change the default cursor and icon of a window. Changing the default cursor or icon of a window requires registering a new WNDCLASS by calling AFXRegisterWndClass and passing the name of the WNDCLASS in the call to Create.

This sample demonstrates the following keywords:

AfxGetInstanceHandle; AfxRegisterWndClass; CBitmap::CreateCompatibleBitmap; CCmdUI::SetCheck; CColorDialog::DoModal; CColorDialog::GetColor; CDC::BitBlt; CDC::CreateCompatibleDC; CDC::DeleteDC; CDC::DrawText; CDC::Ellipse; CDC::FillRect; CDC::GetDeviceCaps; CDC::SelectObject; CDC::SetBkColor; CDC::SetTextColor; CFrameWnd::LoadFrame; CFrameWnd::rectDefault; CGdiObject::DeleteObject; CMDIChildWnd::Create; CMenu::LoadMenu; CWinApp::Enable3dControls; CWinApp::InitInstance; CWnd::DestroyWindow; CWnd::GetClientRect; CWnd::GetCurrentMessage; CWnd::GetDC; CWnd::Invalidate; CWnd::KillTimer; CWnd::MessageBox; CWnd::OnCreate; CWnd::OnPaint; CWnd::OnSize; CWnd::OnTimer; CWnd::ReleaseDC; CWnd::SetTimer; CWnd::ShowWindow; CWnd::UpdateWindow; GetSysColor; LOWORD; LoadCursor; LoadIcon; MAKEINTRESOURCE; RGB; max; min


MDIDOCVW: Demonstrates the MFC Multiple Document Interface

Click to open or copy the MDIDOCVW project files.

The MDIDOCVW sample uses the framework's multiple-document interface (MDI) support and the document/view architecture. The sample contains two document types: Hello (which prints out a string in a view) and Bounce (which displays a bouncing ball of color in a view). MDIDOCVW also illustrates the Microsoft Windows timer, CColorDialog, CBitmap, and changing the default cursor of a window.

The MDIDOCVW sample provides a parent window with two distinct types of MDI child windows: a Bounce window, in which a ball bounces around; and a Hello window, which simply displays the text "Hello, World!"

Running the Sample

Click New Bounce or New Hello on the File menu to create a new MDI child window. Both types of MDI child windows determine what menus are shown when they are active. Both types of windows have a Color menu. When you choose a color from this menu, the color of the bouncing ball or of the Hello text is updated. Click Custom to call a Color dialog box, from which you can select a custom color.

The Bounce window also has a Speed menu, from which you can select the speed the ball moves around the screen.

Although CBounceView and CHelloView both override Create, the override is not necessary to take advantage of the framework's MDI support. The override of Create, found in the CBounceView class, illustrates how to change the default cursor. Changing the default cursor of a window requires registering a new WNDCLASS by calling AfxRegisterWndClass and passing the name of the WNDCLASS in the call to Create.

The MDIDOCVW sample uses the document/view architecture. The application has two document types, Hello and Bounce, that demonstrate various MDI concepts.

A toolbar implements most of the menu commands. The toolbar also implements check-box buttons for the five basic colors.

This sample demonstrates the following keywords:

AfxRegisterWndClass; CBitmap::CreateCompatibleBitmap; CCmdUI::SetCheck; CColorDialog::DoModal; CColorDialog::GetColor; CDC::BitBlt; CDC::CreateCompatibleDC; CDC::DeleteDC; CDC::DrawText; CDC::Ellipse; CDC::FillRect; CDC::GetDeviceCaps; CDC::SelectObject; CDC::SetBkColor; CDC::SetTextColor; CFrameWnd::LoadFrame; CFrameWnd::rectDefault; CGdiObject::DeleteObject; CMDIChildWnd::Create; CWinApp::InitInstance; CWnd::DestroyWindow; CWnd::GetClientRect; CWnd::GetCurrentMessage; CWnd::GetDC; CWnd::KillTimer; CWnd::MessageBox; CWnd::OnCreate; CWnd::OnSize; CWnd::OnTimer; CWnd::ReleaseDC; CWnd::SetTimer; CWnd::ShowWindow; CWnd::UpdateWindow; GetSysColor; LOWORD; RGB; max; min


MODELESS: Uses a CDialog Object as a Modeless Dialog

Click to open or copy the MODELESS project files.

MODELESS is a Microsoft Foundation Class Library (MFC) sample that demonstrates the use of an MFC CDialog object as a modeless dialog. MODELESS is a very simple dialog-based application that manages a list box in its main dialog while providing a modeless dialog that allows you to add strings to the list box in the main window.

When the sample starts, it presents an empty list box. You can open the modeless dialog box by clicking Add. Even while the Modeless Adder dialog box is open, you can bring focus back to the main dialog. The Add button on the main dialog is disabled when the modeless dialog box is open so that the user cannot create more than one instance of the modeless box.

The main dialog's CMainDlg class manages a pointer to the modeless dialog box. It does this just for convenience; once created, the modeless dialog box requires no further management. In your application, you might choose to offer the modeless box information — that pointer would provide access to the C++ object managing the dialog and therefore would be a great place to start.

The code for the Add button in the main dialog creates the modeless dialog box using the Create function, instead of calling DoModal. This is what makes the box modeless — Windows treats messages for the box differently. When the box is destroyed, EndDialog is not used; instead, DestroyWindow is called. Since the normal OnOk and OnCancel member functions of a CDialog object would call EndDialog, you need to make sure your modeless dialog doesn't call those functions and instead overrides them to call DestroyWindow.

Usually, when you create a modal dialog box, you destroy it manually after DoModal returns. Since you can't wait for Create to return while displaying your modeless dialog box, you'll need to have some other mechanism for destroying the C++ object associated with the window. This sample uses a very simple mechanism: It performs delete this in the handler for OnPostNcDestroy — a function that is called after the client area of the box has been destroyed.

Note that the modeless dialog communicates with its parent dialog in two different ways. First, when the user presses OK, the string in the edit control in the modeless dialog is added to the content of the list box in the modal dialog box. Second, when the user destroys the window by whatever means, the modeless box calls the BoxDone function in the modal window. This function simply resets the pointer to the modal dialog and re-enables the Add button.

This sample demonstrates the following keywords:

AfxGetApp; CDC::DrawIcon; CDC::GetSafeHdc; CDialog::Create; CDialog::DoModal; CDialog::OnCancel; CDialog::OnOK; CListBox::AddString; CMenu::AppendMenu; CMenu::ModifyMenu; CRect::Height; CRect::Width; CString::IsEmpty; CString::LoadString; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DestroyWindow; CWnd::DoDataExchange; CWnd::EnableWindow; CWnd::GetClientRect; CWnd::GetDlgItem; CWnd::GetWindowText; CWnd::IsIconic; CWnd::OnPaint; CWnd::OnQueryDragIcon; CWnd::OnSysCommand; CWnd::PostNcDestroy; CWnd::SendMessage; CWnd::SetActiveWindow; GetSystemMenu; GetSystemMetrics; LoadIcon


MULTIPAD: Edits Files Simultaneously

Click to open or copy the MULTIPAD project files.

MULTIPAD is a simple text editor with a standard user interface. Essentially a multiple document interface (MDI) version of the Microsoft Windows Notepad application, MULTIPAD lets the user open and edit multiple text files at one time. The user interface is standard for text editors.

Earlier versions of the Microsoft Foundation Class Library (MFC) adapted and simplified the Windows Software Development Kit (SDK) MULTIPAD sample, taking advantage of MDI support in the library, and further simplified MULTIPAD by taking advantage of several new framework features including toolbar, status bar, printing, and the CEditView class. See DLLHUSK for a simple illustration of deriving from CEditView, and SUPERPAD for an advanced illustration.

The CEditView class uses a Windows edit control to hold the entire text document in memory while the user edits the document's contents. CEditView significantly extends the functionality of the edit control by handling the Edit menu Cut, Copy, Paste, Clear, Select All, Find, Replace, Repeat, and Undo commands and the File menu Print command. MULTIPAD does not need a CMDIChildWnd-derived class for the frame window, nor does it need to derive from CEditView. Serialization of the text file consists of one line of code: The document class object delegates serialization of the text file to the CEditView object.

This sample demonstrates the following keywords:

CFrameWnd::Create; CObject::Serialize; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::OnCreate; DragAcceptFiles; LoadBitmap; ShowWindow


NPP: Demonstrates the Windows Messaging API (MAPI)

Click to open or copy the NPP project files.

NPP is an SDI application similar to Notepad that allows you to edit text messages and send them to other users or other systems via the Windows messaging API, or MAPI.

Before running NPP, make sure you have MAPI installed on your machine. If you are running Windows NT, MAPI is installed if you have installed the Schedule+ and/or Microsoft Mail applications. If you are running Windows 95, MAPI is installed if you have installed Schedule+ and/or Microsoft Exchange.

To run NPP, just build the sample and run the resulting application. Note that the File menu has a Send command, which can attach the content of the edit window to a MAPI message. Note that selecting Send will prompt you for a user name and password to start your MAPI session if you are not already logged on.

The two important lines of code that enable this feature (aside from adding the menu choice itself to the resource file) are entries in the message map for the CNotepadDoc instance, which the application maintains. The entries are:

ON_COMMAND(ID_FILE_SEND_MAIL, OnFileSendMail)
ON_UPDATE_COMMAND_UI(ID_FILE_SEND_MAIL, OnUpdateFileSendMail)

CDocument::OnFileSendMail and CDocument::OnUpdateFileSendMail are built into MFC; nothing extra is needed to gain this level of MAPI support in your applications.

This sample demonstrates the following keywords:

AfxGetMainWnd; AfxMessageBox; CComboBox::Copy; CComboBox::Create; CComboBox::GetDroppedState; CComboBox::Paste; CComboBox::SetEditSel; CComboBox::ShowDropDown; CDC::GetTextExtent; CDC::GetTextMetrics; CDC::SelectObject; CDialog::DoModal; CDialog::OnCancel; CDialog::OnInitDialog; CDocument::OnNewDocument; CEdit::GetLineCount; CEdit::LineFromChar; CEdit::LineIndex; CEdit::LineScroll; CEdit::SetSel; CEditView::GetEditCtrl; CEditView::GetSelectedText; CEditView::OnFindNext; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::GetActiveView; CFrameWnd::RecalcLayout; CObject::AssertValid; CObject::Dump; CObject::Serialize; CRect::Height; CStatusBar::CommandToIndex; CStatusBar::SetPaneText; CString::Format; CString::GetLength; CString::LoadString; CToolBar::GetItemRect; CToolBar::SetButtonInfo; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWinApp::OnIdle; CWinApp::OpenDocumentFile; CWnd::Create; CWnd::DoDataExchange; CWnd::FromHandle; CWnd::GetDescendantWindow; CWnd::GetDlgItem; CWnd::GetFocus; CWnd::GetStyle; CWnd::GetWindowRect; CWnd::GetWindowText; CWnd::GetWindowTextLength; CWnd::KillTimer; CWnd::OnClose; CWnd::OnCreate; CWnd::PostMessage; CWnd::PreTranslateMessage; CWnd::ScreenToClient; CWnd::SendMessage; CWnd::SetFocus; CWnd::SetFont; CWnd::SetTimer; CWnd::SetWindowPos; CWnd::SetWindowText; CWnd::ShowWindow; CreateFontIndirect; DragAcceptFiles; EndDialog; EnumFontFamilies; GetDlgItem; GetKeyState; GetLocalTime; GetStockObject; LoadBitmap; MessageBeep; SendMessage; SetWindowText; memcpy


PROPDLG: Demonstrates Property Sheet Support

Click to open or copy the PROPDLG project files.

PROPDLG illustrates Microsoft Foundation Class Library (MFC) support for property sheets or tabbed dialog boxes. PROPDLG also illustrates a modeless mini-frame window.

PROPDLG is a simple object drawing program that uses property sheets for entering the shape and color attributes of a currently selected object. For an example of a more fully featured object drawing program, see the DRAWCLI sample.

Click anywhere in the view to add a new shape, which is initially a fixed-size rectangle. Click elsewhere to add more shapes. To select a shape, click that shape. The Object menu offers three types of property sheets for updating the attributes of the currently selected object. A real application would typically only offer one of these types of property sheets:

  • Simple Property Sheet — A pop-up dialog box with tabs for Style and Shape. Click OK to apply the properties to the currently selected object and exit the dialog box. Click Cancel to exit the dialog box without applying the properties. The Apply Now and Help buttons are always disabled in these illustrations.

  • Property Sheet with Preview — Also a pop-up dialog box with two tabs. This dialog box also has a preview child window. The preview window shows you what the object would look like if the current values in the property sheet were applied. This illustrates how you can customize the layout of a property sheet. This example also implements the Apply Now button, which is enabled whenever you change any property.

  • Mini-Frame Property Sheet — A modeless property sheet dialog box within a mini-frame window. The properties in this modeless dialog box always reflect the currently selected object. Changes to values in the property sheet are applied immediately to the currently selected object.

This sample demonstrates the following keywords:

AfxGetMainWnd; CCmdUI::Enable; CDC::GetClipBox; CDialog::DoModal; CDocument::OnNewDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::Create; CFrameWnd::GetActiveFrame; CFrameWnd::GetActiveView; CFrameWnd::LoadFrame; CMDIFrameWnd::MDIGetActive; CObject::AssertValid; CObject::Dump; CObject::Serialize; CPen::CreatePen; CRect::Height; CRect::IntersectRect; CRect::IsRectNull; CRect::PtInRect; CRect::Width; CStatusBar::Create; CStatusBar::SetIndicators; CString::LoadString; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWinApp::SetDialogBkColor; CWnd::CenterWindow; CWnd::Create; CWnd::DoDataExchange; CWnd::FromHandle; CWnd::GetClientRect; CWnd::GetParent; CWnd::InvalidateRect; CWnd::IsWindowVisible; CWnd::OnCreate; CWnd::OnEraseBkgnd; CWnd::OnKeyDown; CWnd::OnLButtonDblClk; CWnd::OnLButtonDown; CWnd::OnPaint; CWnd::SendMessage; CWnd::ShowWindow; CWnd::UpdateWindow; DragAcceptFiles; Ellipse; FillRect; GetParent; GetWindowRect; RGB; Rectangle; RoundRect; SelectObject; SendMessage; SetFocus; SetWindowPos; UpdateWindow


ROWLIST: Selecting Full Rows in List Views

Click to open or copy the ROWLIST project files.

The ROWLIST sample illustrates selecting full rows in a report mode of the CListView MFC common control class. The sample implements a reusable class, CListViewEx, that provides full row selection as an additional view mode of a list view control. CListViewEx uses the owner-draw mode to do all of the painting for the control. You can use the class in your own projects, either directly or as a base class. ROWLIST also demonstrates how to use state and overlay images with a list view control.

Running the Sample

When you run ROWLIST, it presents an SDI application whose view is a CListView-derived class. The view has items representing different colors, with additional data about them. The list view control comes up initially in the report mode, with full row selection enabled. The View menu and the toolbar allow you to select other view modes.

State images are initially set to an empty square on the left side of each item. If you click a state image, the item's image becomes an icon displayed on the caption bar (Windows 95 only). If state images are not displayed, you can double-click an item to change its state.

The CListViewEx Class

The class CListViewEx, derived from CListView, is a reusable class that implements the full row selection mode. The class provides complete support for the owner-draw mode of a list view control, and provides full row selection by implementing painting code for all images and labels. CListViewEx displays a control's images and labels exactly as in the report mode, with the addition of the full row selection. The class has only two additional member functions (as compared to CListView): SetFullRowSel and GetFullRowSel. These functions are used to set or query for the full row selection mode.

You can reuse the class in your own projects, either by deriving a class from it, or by using it directly. The simplest way to use the class is to use AppWizard to create an application that has a CListView-derived class, and then to change its base class to CListViewEx.

Using State and Overlay Images with a CListView

ROWLIST demonstrates use of state and overlay images. State images are initially set to an empty square on the left side of each item. If you click a state image, the item’s image becomes an icon displayed on the caption bar. In response, the item's state icon changes to a square with a check mark. CRowListView::OnLButtonDown contains the code that inserts the check mark if a state icon is selected, and that changes a state icon for an item.

If state images are not displayed, then the image currently in use will be marked with an overlay image on top of it (a gray square with a check mark). You can use a double-click to change the state of an item, which also toggles an overlay image on or off. The implementation code for the double-click is found in CRowListView::OnLButtonDblClk.


SAVER: Screen Saver

Click to open or copy the SAVER project files.

SAVER demonstrates how to write a simple screen saver using the Microsoft Foundation Class Library (MFC). The screen saver draws large characters on the screen, psuedo-morphing the text "MFC" to the text "C++". You can add SAVER to your system as a screen saver. You can also run it and configure its parameters, such as pen width, pen style, and speed of drawing, from the command line.

SAVER demonstrates the following techniques.

  • Getting the size of the screen

  • Making a full-screen window

  • Hiding the mouse cursor

  • Dynamic Data Exchange (DDX) in a dialog box.

To run SAVER from the command line, type SAVER -s. To configure the screen saver parameters, type SAVER -c on the command line. The SAVER configuration dialog box is then displayed.

To add the screen saver to your system, you need to copy it to your windows system directory after building it. The details differ slightly, depending on whether you are running Windows® NT or Windows® 95.

  • In Windows NT, copy Saver.scr to C:\Windows\System32\Saver.scr. Start the Desktop applet in Control Panel. In the Screen Saver dialog box, click MFC Screen Saver.

  • In Windows 95, copy Saver.scr to C:\Windows\System\Saver.scr. On the Start menu, click Settings and then Control Panel. Click the Display icon and switch to the Screen Saver page. In the dialog box, click Saver.

Saver does not use the library Scrnsave.lib that is provided by the SDK, as that library does not fit the MFC architecture. Much of what Scrnsave.lib does has to be duplicated in Saver.

Saver's CSaverApp::InitInstance routine looks at the command line. If "-c" is specified, the routine creates a dialog box, calls DoModal( ), and returns FALSE from InitInstance (which causes the application to exit). If the user presses the OK button, the user's settings are stored in the registry.

If "-s" is specified, CSaverApp::InitInstance creates a CSaverWnd object and returns TRUE from InitInstance. CSaverWnd derives from CDrawWnd, which does the basic drawing of the screen saver image and is used by the configuration dialog itself to provide a preview of what the screen saver is going to do. CSaverWnd adds handlers for events such as WM_MOUSEMOVE and WM_LBUTTONDOWN. When these events occur, the screen saver shuts down.

This sample demonstrates the following keywords:

AfxGetApp; AfxGetResourceHandle; AfxRegisterWndClass; BeginPath; CColorDialog::DoModal; CColorDialog::GetColor; CComboBox::GetCurSel; CDC::DrawIcon; CDC::FillRect; CDC::GetSafeHdc; CDialog::DoModal; CDialog::OnInitDialog; CGdiObject::Attach; CGdiObject::DeleteObject; CGdiObject::Detach; CMenu::AppendMenu; CRect::Height; CRect::Width; CRgn::CombineRgn; CRgn::CreateFromPath; CRgn::CreateRectRgn; CScrollBar::GetScrollPos; CScrollBar::SetScrollPos; CString::IsEmpty; CString::LoadString; CWinApp::Enable3dControls; CWinApp::GetProfileInt; CWinApp::InitInstance; CWinApp::SetRegistryKey; CWinApp::WriteProfileInt; CWnd::CenterWindow; CWnd::Create; CWnd::CreateEx; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetDlgItemInt; CWnd::GetSafeHwnd; CWnd::Invalidate; CWnd::IsIconic; CWnd::KillTimer; CWnd::OnActivate; CWnd::OnActivateApp; CWnd::OnCreate; CWnd::OnDestroy; CWnd::OnHScroll; CWnd::OnKeyDown; CWnd::OnLButtonDown; CWnd::OnMButtonDown; CWnd::OnMouseMove; CWnd::OnNcActivate; CWnd::OnPaint; CWnd::OnQueryDragIcon; CWnd::OnRButtonDown; CWnd::OnSetCursor; CWnd::OnSize; CWnd::OnSysCommand; CWnd::OnSysKeyDown; CWnd::OnTimer; CWnd::PostMessage; CWnd::PostNcDestroy; CWnd::SendMessage; CWnd::SetTimer; CWnd::UpdateWindow; EndPath; FillRgn; GetBValue; GetDlgItem; GetGValue; GetProfileInt; GetRValue; GetSystemMenu; GetSystemMetrics; GetWindowRect; LineTo; LoadCursor; LoadIcon; MAKEINTRESOURCE; MoveTo; PostQuitMessage; RGB; ScreenToClient; SelectObject; SetCursor; SetPolyFillMode; SetScrollPos; SetScrollRange; WidenPath; atol; lstrcmpi


SNAPVW: Using Property Pages in a Form View Application

Click to open or copy the SNAPVW project files.

The SNAPVW sample demonstrates how to use property pages in a form view. The frame of the MDI child window is used in place of a property sheet that might otherwise contain the OK, Cancel, and Apply buttons.

Running the Sample

When you run SNAPVW, a set of property pages is displayed within the MDI child frame. CSnapView::OnSize overrides the CFormView base class implementation and calculates the size of the frame window so that it "snaps" to the size of the property pages. CSnapView::Create sets up the window, adds the property pages, and sets the appropriate styles. The Minimize and Maximize buttons have been removed from the child frame window so that the frame remains closely aligned with the edges of the property pages. You can navigate between the pages by clicking on the individual pages and choosing the menu items, or by using the mnemonics and arrow keys.

This sample demonstrates the following keywords:

CCmdUI::Enable; CDocument::OnNewDocument; CFormView::Create; CFormView::OnEraseBkgnd; CFormView::OnSize; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CObject::GetRuntimeClass; CObject::IsKindOf; CPropertyPage::Create; CPropertySheet::AddPage; CScrollView::SetScrollSizes; ,CWinApp::AddDocTemplate; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::Create; CWnd::DoDataExchange; CWnd::GetDlgItem; CWnd::GetWindowText; CWnd::OnCreate; CWnd::PreCreateWindow; CWnd::SetDlgCtrlID; CWnd::SetWindowPos; CWnd::ShowWindow


TRACKER: Illustrates Various CRectTracker Styles and Options

Click to open or copy the TRACKER project files.

The TRACKER sample is a test application that provides an exhaustive illustration of CRectTracker member functions, styles, and options. For a real-world example that uses CRectTracker, see DRAWCLI, the object-oriented drawing sample application.

TRACKER initially displays a square with four colored and numbered quadrants. The quadrants are displayed to help you see when the square is inverted horizontally and/or vertically. Initially, the square has no CRectTracker adornments. Try the various toolbar commands, or Edit menu commands, to turn on and off CRectTracker styles, including dotted or solid lines; hatched border, inside or outside the rectangle; and resize handles, inside or outside the rectangle.

Notice how the cursor changes shape over parts of the rectangle to indicate what happens if you drag the mouse. Try moving and resizing the rectangle.

This sample demonstrates the following keywords:

CBrush::CreateSolidBrush; CDialog::DoModal; CDocument::OnNewDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::Create; CFrameWnd::LoadFrame; CGdiObject::DeleteObject; CObject::AssertValid; CObject::Dump; CObject::Serialize; CRect::Height; CRect::IntersectRect; CRect::Width; CRectTracker::Draw; CRectTracker::GetTrueRect; CRectTracker::HitTest; CRectTracker::SetCursor; CRectTracker::Track; CRectTracker::TrackRubberBand; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DoDataExchange; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnSetCursor; CWnd::ShowWindow; CWnd::UpdateWindow; ExtTextOut; GetTextMetrics; LoadBitmap; MessageBeep; PatBlt; RGB; SelectObject; SetBkMode; SetTextAlign; abs


VCTERM: Uses the Microsoft Communications ActiveX Control

Click to open or copy the VCTERM project files.

The VCTERM sample is a simple terminal emulation program illustrating the use of the Mscomm32.ocx ActiveX Control. It illustrates how to use the Communications control with a serial port. The Communications control allows you to open a serial port, change its settings, send and receive data through the port, and monitor and set many of the different data lines. This particular sample is a direct spin-off of the VBTERM sample application that ships with Visual Basic, and mirrors its functionality closely.

This sample does not use the document/view architecture of the Microsoft Foundation Classes. The initial application was generated with the AppWizard as an MFC SDI-type application, but the document and view classes were then removed because they are not needed.

The Mscomm32.ocx ActiveX Control is created dynamically at runtime as a data member of the CMainFrame class. The creation code is located in the CMainFrame::OnCreate function.

An edit control is parented off of the CMainFrame window and is the interface for displaying the text that is sent and received via the Mscomm32.ocx control. The edit control is resized by overriding CMainFrame::RecalcLayout.

This sample also illustrates how to create a modeless status dialog capable of canceling an operation. The CCancelDlg class is a modeless dialog class, and simply signals the CMainFrame to stop transmitting data. The interesting code is in the CMainFrame::OnFileTransmit function. Note the calls to the DoEvents function, which processes all pending messages in the applications message queue.

Running the Sample

You will need to have either a modem attached to your computer's serial port, or have two computers connected via a null-modem cable. Some of the modem commands that are hard-coded into this sample might not work with some modems. There are notes in the source code to point out where modem commands might need to be modified to work with a particular modem. Please consult the documentation included with your modem to determine the appropriate command strings to send to your modem.

After you have connected a null-modem cable to your computers, simply build and run the sample. Select the desired port settings (settings should be identical across both machines) and open the port. At this point, text typed into the edit window of the VCTERM application should appear in the Edit window of the VCTERM application running on the other machine.

Note This sample does not support the downloading of files. It also does not support the transmitting of binary files. VCTERM supports transmitting ASCII text only.


VIEWEX: Demonstrates Multiple Views, Scroll Views, and Splitter Windows

Click to open or copy the VIEWEX project files.

The VIEWEX sample illustrates the following.

  • A static splitter window in which the order and number of panes never change and the panes are usually of different view classes.

  • A form view (CFormView) that stays synchronized with other views on the same document.

  • Dialog data exchange (DDX), specifically of radio group button data.

The document in VIEWEX is simple. Its data consists of a string and its color.

When you first run VIEWEX, it presents a New dialog box in which you select the type of document window to be illustrated:

  • Simple Text displays the string, using the current color, centered in the window.

  • Input Form View provides a form (a CFormView) in which you can change the string in an edit control, and change the color by selecting from a radio button group.

  • Splitter Frame with both Simple Text and Input Form displays in two side-by-side panes of a splitter window. When you change the string (character by character) or color in the Input Form, the Simple Text view automatically reflects the change.

  • Three-way Splitter Frame displays the Input Form view in one splitter window pane. The other pane is divided into two subpanes by a splitter bar: The upper subpane displays a Simple Text view; the lower subpane displays a Color view. The Color view simply paints itself entirely in the current color.

You can change the string by using the edit control in the Input Form, and by clicking Change Data on the Edit menu.

You can also view multiple documents at a time. For the sake of simplicity, however, you cannot save or reopen documents, nor can you view the same document in more than one of the above windows.

Static Splitter Window

In VIEWEX, the MDI child window creates a 1-by-2 splitter window within its client area by overriding OnCreateClient. In the case of the three-way splitter, VIEWEX embeds a second 2-by-1 splitter window within the right-side pane of the 1-by-2 splitter window.

VIEWEX calls CSplitterWnd::CreateStatic instead of CSplitterWnd::Create to create static splitter windows instead of dynamic splitter windows. Each pane of VIEWEX's splitter window has a different view class. VIEWEX calls CSplitterWnd::CreateView to specify the CView derived class for each pane. In the case of the first pane, VIEWEX uses the view class specific in the document template object, which is passed to OnCreateClient in the m_pNewViewClass member of the CCreateContext. In the case of other panes, VIEWEX specifies the RUNTIME_CLASS of the view.

Form View

CInputView illustrates synchronizing a form view with other views, so when the user enters data in one of the fields, the change is immediately reflected in other views. CInputView accomplishes this by mapping ON_EN_CHANGE and ON_BN_CLICKED for all of its controls to a central OnDataChange message handler. OnDataChange calls CView::UpdateData to transfer data from the screen to the member variables of CInputView and then calls the document's UpdateAllViews to inform the other views about the change.

Dialog Data Exchange (DDX)

VIEWEX's CInputView illustrates dialog data exchange (DDX) of radio group button data. If you use ClassWizard to view the member variables of CInputView or if you look at the CInputView::DoDataExchange written by ClassWizard in Iputvw.h, you will notice that only the first button in the radio group is mapped to the member variable m_iColor. This m_iColor is a zero-based ordinal value (int) representing which radio button is selected.

This sample demonstrates the following keywords:

CDC::FillRect; CDialog::DoModal; CDocument::OnNewDocument; CDocument::UpdateAllViews; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CFrameWnd::SetActiveView; CObject::Serialize; CRect::Height; CRect::Width; CSplitterWnd::CreateStatic; CSplitterWnd::CreateView; CSplitterWnd::GetPane; CSplitterWnd::IdFromRowCol; CString::GetLength; CView::GetDocument; CView::OnActivateView; CView::OnDraw; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::OnFileNew; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::OnMouseActivate; CWnd::ShowWindow; CWnd::UpdateData; CWnd::UpdateWindow; RGB; SetBkMode; SetTextAlign; SetTextColor; TextOut; max


WIZARD97: Demonstrates CPropertyPageEx and CPropertySheetEx

Click to open or copy the Wizard97 project files.

The WIZARD97 sample uses MFC's CPropertyPageEx and CPropertySheetEx classes to implement a wizard with the new look as used by Windows 98 and Windows NT 5.0. You must be using Windows 98 or Windows NT 5.0 for this sample to work properly.

Most of the code necessary to implement the User Interface (UI) is internal to MFC, so this sample is almost identical to implementing a wizard with the old UI, except that the new classes are used and the PSH_WIZARD97 flag must be used.

Running the Sample

WIZARD97 displays a simple wizard with four pages, displaying the UI format. To move between pages, simply use the NEXT or BACK buttons.

This sample demonstrates the following keywords:

CPropertySheetEx::CPropertySheetEx; CPropertySheetEx::AddPage; CPropertySheetEx::SetWizardButtons; CPropertySheetEx::DoModal; CPropertyPageEx::OnSetActive


COUNTER: MFC Internet Server Extension DLL

Click to open or copy the COUNTER project files.

The COUNTER sample illustrates the development of an Internet server extension using MFC. This extension demonstrates how to use an Internet Server Application Programming Interface (ISAPI) DLL to send image data (rather than HTML data) back to a Web browser.

The COUNTER sample can be built to use MFC in a shared DLL or to link statically to MFC.

This sample requires a Web server that supports the ISAPI. For details, see "Installing the Sample" below.

Installing the Sample

After you build the sample, copy the DLL file that was created into a directory on your Web server. Make sure the directory offers users of your server EXECUTE privileges, and that you have installed the correct MFC DLLs on the server’s \<Windows>\SYSTEM directory.

Once the file has been installed, you can create HTML pages that will access the DLL as if it were an image file. The following HTML file demonstrates three ways of calling the counter. The example assumes that COUNTER has been installed into the /SCRIPTS virtual directory on your server.

<HTML>
<HEAD>
<TITLE>Counter Demonstration</TITLE>
</HEAD>
<BODY>
The current system time is:
<IMG SRC="/scripts/counter.dll?clock"><P>
Visits to the page referred to by /mydir/mypage.htm:
<IMG SRC="/scripts/counter.dll/mydir/mypage.htm"><P>
Visits to this page:
<IMG SRC="/scripts/counter.dll"><P>
</BODY>
</HTML>

If you have both READ and EXECUTE privileges on your /SCRIPTS directory, change the following lines as shown:

...
Visits to the page referred to by /mydir/mypage.htm:
<IMG SRC="/scripts/counter.dll/mydir/mypage.htm?"><P>
Visits to this page:
<IMG SRC="/scripts/counter.dll?"><P>
...

Running the Sample

To send back data from an ISAPI server in a format other than HTML, you will need to make a few minor changes. First, the StartContent and WriteTitle functions should not be called, since these output header information that only applies to HTML files. Second, AddHeader should be called with the proper content type string (see the beginning of Counter.cpp for an example). Finally, EndContent should not be called, since this function also only applies to HTML format output.

This sample sends back image data in XBM (x-bitmap) format. This format was chosen because the output is strictly text and, thus, the format is easy to implement. The XBM data is generated in the function OutputXBM from the image bits stored in Charset.h. The XBM format requires that the image bits be sent in reverse order. Therefore, the bits in Charset.h are reversed. For example, the digit "3" looks like the following:

0x3E 00111110
0x63 00110011
0x60 01100000
0x60 01100000
0x3C 00111101
0x60 01100000
0x60 01100000
0x60 01100000
0x63 01100011
0x3E 00111110

The XBM is a monochrome format. If you want color output, you will need to implement a different format, such as the GIF format, which is a binary format. To send back binary data, such as a GIF format image as output, you will need to complete some alternative steps. Since the CHtmlStream class does not allow streaming of individual bytes, you need to create a class derived from CHtmlStream, then use that class to send output to the client. Here is an example class:

class CBinaryHtmlStream : public CHtmlStream
{
public:
   // we have a special overload of << to allow for a single byte
   CBinaryHtmlStream& operator<<(BYTE b)
   {
      Write(&b, 1);
      return *this;
   }
}

To send data using this stream, replace the OutputXBM function with the following skeleton code:

static const TCHAR szContentType[] = _T("Content-Type: image/gif\r\n");

void CCounterExtension::OutputXBM(CHttpServerContext* pCtxt, CString& szDigits)
{
   // some code here which takes szDigits and creates a new image
   // which has the GIF representation of those digits. This
   // image will be stored in memory at m_ImageByteArray[].
   // The number of bytes in the image is stored in m_nNumberBytes.

   // Start by writing the proper content type to the client
   AddHeader(pCtxt, szContentType);

   CString strLength;
   strLength.Format("Content-Length: %d\r\n", m_nNumberBytes);
   AddHeader(pCtxt, (LPCTSTR)strLength);

   CBinaryHtmlStream* pStream = new CBinaryHtmlStream;
   ISAPIVERIFY(pStream != NULL);

   int nCount;
   for (nCount = 0; nCount<m_nNumberBytes; nCount++)
      *pStream << m_ImageByteArray[nCount];

   *pCtxt << *pStream;

   delete pStream;

   // ... more code here ...
}

This sample demonstrates the following keywords:

CHttpServer::GetExtensionVersion; ISAPIVERIFY; CHttpServer::AddHeader; CArchive; CCriticalSection


FTPTREE: Displays the Structure and Content of an FTP Site

Click to open or copy the FTPTREE project files.

The FTPTREE sample application illustrates the following MFC Internet client (WinInet) features:

  • Using the CInternetSession and CFtpConnection classes to achieve Internet or intranet connectivity with the least amount of custom code.

  • Using the CFtpFileFind class in conjunction with CFtpConnection to navigate the directory structure of an FTP site.

  • Building the contents of a tree control dynamically.

FTPTREE is a simple dialog application that has one edit box (for the name of the server and optionally a path to an object on that server) and a standard tree control object. The tree control belongs to the dialog box, and displays either an error message or the contents (up to 128 items) of an FTP site specified in the ftp:// edit box.

The CInternetSession object encapsulates the connection to the Internet (or intranet). This object persists while the FTPTREE dialog exists in memory, though it could just as easily be opened only when needed (and closed immediately after) with little overhead.

If an Internet session object cannot be initialized based on the configuration specified in the registry entry HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings, an error is displayed and the application shuts down.

Running the Sample

FTPTREE opens an Internet session based on the configuration specified in the registry. Valid inputs for the ftp:// edit box are the following.

  • myserver — Only the name of the intranet FTP server.

  • www.myserver.com — Only the name of the Internet FTP server.

  • myserver/dir/ — The name of an FTP server and a path. The path will be expanded in the tree control.

  • myserver/dir/file — The name of an FTP server and a path to a specific object. The object will be selected if found; if the object is not available, the tree will be expanded as much as possible.

You can add the protocol prefix ftp:// to any of the above entries.

TIS Proxy May Be Needed for Connection

The FTPTREE sample, and Wininet.dll in general, require either a direct connection to an FTP server or a connection to an FTP server via a TIS proxy. FTPTREE, CFtpConnection, and direct WININET API calls will not work correctly with CERN FTP proxies.

The FTPTREE sample uses proxy information specified in the registry. If you get messages such as "The connection with the server was reset" indicating FTPTREE is unable to connect with an Internet site, your may need to change your preconfigured registry settings to specify a TIS proxy for FTP services. These settings are easily changed from Internet Explorer on the Connection tab of the Options property sheet. The corresponding registry entries are:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"
"ProxyServer"
"ProxyOverride"

This sample demonstrates the following keywords:

CFtpConnection::CFtpConnection; CFtpConnection::SetCurrentDirectory; CFtpConnection::GetCurrentDirectory; CFtpConnection::Close; CFtpFileFind::CFtpFileFind; CFtpFileFind::FindFile, CFtpFileFind::FindNextFile; CFileFind::IsDirectory; CInternetSession::CInternetSession; CInternetSession::GetFtpConnection; CInternetSession::Close;


HTTPSVR: Demonstrates World Wide Web HTTP Server

Click to open or copy the HTTPSVR project files.

HTTPSVR is an MFC sample that demonstrates the use of MFC and its Windows Sockets (WinSock) classes in implementing a simple World Wide Web HTTP server. HTTPSVR turns any computer connected to a network into a publishing platform viewable from any of a number of web browsers available on the market today, such as Microsoft's Internet Explorer.

HTTPSVR also minimally supports the Common Gateway Interface (CGI). You can create forms and execute CGI-compatible server-side applications using the standard hypertext markup language (HTML) tags.

To increase performance, HTTPSVR checks a file's last modified date and compares it to the date sent by the browser in the HTTP If-Modified-Since field. Most browsers will send this field if they already have a copy of the file in their cache. If the file has not been modified since the date of the cached copy, it will send the browser a Not Modified status code instead of downloading the entire file again.

Running the Sample

When the sample starts, it presents an empty common control list view and begins listening for HTTP requests from the network. The root folder of the server defaults to WebPages on the same drive as the executable the first time you run it. If the root folder does not exist, HTTPSVR asks if you want to create it. If you don't like the default name, you can change it using the edit control provided. HTTPSVR gets and saves its settings from a special configuration file with an HSC extension. It is recommended that you save changes you make to the default configuration by clicking Save on the Server menu, then use the resulting HSC file to start HTTPSVR after that.

Once HTTPSVR is started, all files and folders under the root folder will be visible to anyone on the network with a web browser, unless the file's Hidden attribute is set. If someone requests to view a folder under your root, HTTPSVR will first check to see if it contains a default file. Default filenames are Default.html, Default.htm, index.html, and index.htm. You can make other names default filenames by modifying the string resource, IDS_DEFAULTDOC. If a file with one of the default names is in the folder requested by the browser, HTTPSVR will redirect the browser to that file. Otherwise, HTTPSVR will create an FTP-like directory listing of all the files in the folder. Unless you want everyone to be able to view the contents of your folders in this manner, it is recommended that every folder contain an HTML file with one of the default names.

You should place your HTML documents in logical subfolders for easy retrieval and maintenance. One subfolder you should have under your root is SvrAdmin. The HTTPSVR sample contains a SvrAdmin subfolder. Copy all the .gif files from HTTPSVR's SvrAdmin to the SvrAdmin subfolder under your root. When the server needs to create a directory listing (see previous paragraph), it will try to use the icons from the SvrAdmin subfolder if the Display Icons option is set. The SvrAdmin subfolder is not necessary. If it does not exist, HTTPSVR will not attempt to put the icons in any listings.

The main window will list all documents, folders, and returned status codes that are accessed by someone browsing the web. When the view is in Details mode, it will display the total number of times each file has been downloaded and some additional information related to the last time the file was accessed: the time, the server that referred it, and by what Uniform Resource Locator (URL) it was accessed.

HTPSVR is an SDI application, and multiple instances of it can be running at one time provided they are all operating on different ports. Only one server can be running on a single port at one time. You set the port of your server on the Server Name page of the server's property sheet. The default is 80, and it can be any number between 1 and 63535. To access a web server with any port other than 80, use the colon syntax for the server's name: http://www.cochin.com:1008 would refer to a server listening on port 1008. HTTPSVR's title bar will reflect the correct syntax needed to access the server.


MFCIE: Demonstrates the MFC CHtmlView and CReBar Classes

Click to open or copy the MFCIE project files.

The MFCIE sample uses MFC's CHtmlView and CReBar classes to implement a subset of the functionality provided by the Microsoft Internet Explorer. Microsoft Internet Explorer 4.0 is required to run this sample.

The MFCIE sample provides a view very much like Microsoft Internet Explorer. You can browse to any location on the Web, enter data in forms, print Web pages, download files, or open files on your local hard drive. New addresses can be entered manually in the "Address" bar of the CReBar control, or hypertext links can be clicked on in the main view.

The sample demonstrates the ease in which a Web browsing capability can be inserted into any application. Most of the functionality of CHtmlView is trivial to implement (for example GoHome or GoBack), although some of the less obvious features such as printing and font sizing have been implemented for your convenience. The MFCIE sample also demonstrates the proper method of retrieving and reading the Favorites selections and displays them in their own menu.

One thing to note is that the web browser control used by CHtmlView does its own printing internally, so MFC's printing and Print Preview methods are bypassed entirely.

Running the Sample

MFCIE assumes that you are already connected to the Internet. When it first starts, it will open your home page and you can browse from there just as you would with Microsoft Internet Explorer, either by using the Address bar, the Favorites menu, or by following links on the current page.

This sample demonstrates the following keywords:

CToolBarCtrl::SetButtonWidth; CToolBarCtrl::SetHotImageList; CToolBarCtrl::SetImageList; CReToolBar::SetButtons; CReToolBar::SetButtonInfo; CReToolBar::SetButtonText; CReBar::AddBar; CHtmlView::Navigate2; CAnimateCtrl::Play; CAnimateCtrl::Stop; CAnimateCtrl::Seek; CComboBoxEx::InsertItem; CHtmlView::GoHome; CHtmlView::GoBack; CHtmlView::GoForward; CHtmlView::GoSearch; CHtmlView::Stop; CHtmlView::Refresh; CHtmlView::ExecWB


MFCUCASE: Demonstrates Internet Server Filter DLLs

Click to open or copy the MFCUCASE project files.

The MFCUCASE sample demonstrates the use of MFC's support for Internet Server filter DLLs. MFCUCASE can be built as a project that uses MFC or one that doesn't use MFC, by choosing from the dropdown list of release types. When the project is built, the result is a filter DLL. You need Microsoft Internet Information Server (IIS) to run the sample. IIS is bundled with the Windows NT Server or can be purchased separately. For more information on Internet Server Filters, check the Microsoft Internet Information Server documentation. For more information on debugging Internet extension DLLs, see Technical Note 63.

The MFCUCASE filter watches for Uniform Resource Locators (URLs) that contain the directory name "/UC/". If the filter sees this character sequence in a URL, it maps the URL so that it no longer contains the "/UC/" string, and converts data from the URL site to uppercase before returning the data to the client. For example, if your server is named THUMPER and you have a file on it named Hockey.html, you might request "http://thumper/hockey.html" using your Web client software. With MFCUCASE installed, you could also request "http://thumper/uc/hockey.html" to get the file HOCKEY.HTML, with all strings displayed in the file converted to uppercase. You cannot request http://thumper/uc/ because MFCUCASE will not convert default pages to uppercase. MFCUCASE only converts files with an explicit filename in the URL path. You can enhance MFCUCASE by adding your own code to check whether a default file exists and supplying the filename "default.html" to MFCUCASE if it does.

Note that MFCUCASE converts all strings in the file to uppercase. This means that targets of jumps are converted to uppercase, which may break the jump.

Also note that the OnMapUrl and OnSendRawData functions always return SF_STATUS_REQ_NEXT_NOTIFICATION because their design never encounters the possibility for a fatal error. Handler functions should only return SF_STATUS_REQ_ERROR if they run into a situation that they can never recover from. Since the OnMapUrl and OnSendRawData samples in MFCUCASE can process a URL or a character string and decide the filter isn't needed when data is returned to the user, they don't ever return an error code. If the functions fail while loading resources or allocating memory, then they should be coded to return error codes.

Running the Sample

You'll need to add the MFCUCASE filter to your registry so the Internet Information Server loads it when you begin running the server. Add the full path and filename of your built MFCUCASE.DLL file to the registry key at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Filter DLLs. If the key already has a filter listed, add a comma and your path to the end of the string. You'll need to restart the service (either by stopping the service and restarting it, or by rebooting your computer) for the service to load your filter DLL.


PINBALL: Internet Server Extension That Provides Graphics and Redirection

Click to open or copy the PINBALL project files.

The PINBALL sample demonstrates several challenging techniques in the development of an Internet Server Extension that uses MFC. PINBALL provides a simple form that allows users to select the names of their favorite pinball machines. If the user selects one of the listed machines, an image of that machine's backglass artwork is displayed. Users who indicate that they don't see the name of a favorite machine are redirected to a popular Internet site to search for information about the machine.

Installing and Running the Sample

Install the application on your Web server by copying the Pinball.dll executable file to any directory in your published Web space. Also, copy Tz.gif, Mars.jpg, Cv.gif, and Taf.gif to the directory that contains Pinball.dll.

Once the sample is installed, invoke the sample by executing it from your Web client. If the sample is in the root directory of the Web space on a server named MOOSEBOY, for example, use the following URL to execute the sample:

http://mooseboy/pinball.dll

The sample will respond with the main form from the extension, which is stored as a resource in the extension's image and sent from the Default member function in CPinballExtension.

If you select a pinball game and click Show Me to submit the form, the server will provide a graphic file depicting the artwork on the game's backglass. All of the artwork files show games made by Williams Industries in Chicago.

How the Sample Works

The extension uses CHttpServerContext::TransmitFile to send the file to the client as fast as possible. TransmitFile instructs Windows NT to transmit the file directly from the disk, without performing any double-buffering. On a very high-volume server, this technique can improve response time and scalability significantly. CHttpServerContext::TransmitFile calls CHttpServerContext::ServerSupportFunction with the HSE_REQ_TRANSMIT_FILE command, which actually performs the work. Using HSE_REQ_TRANSMIT_FILE requires some extra work, and TransmitFile does that work.

You will notice that the CPinballExtension::GetImage command handler is responsible for responding to the form. If any error occurs, the function makes an HTTP response by using the StartContent, WriteTitle, and EndContent members of CHttpServer, like most normal HTML-based extensions.

If the user requests a graphics file that is successfully found and properly transmitted, the command handler function does not make calls to send anything else. Because TransmitFile takes care of sending the headers and the data, no further communication is necessary. The SendJPGFile and SendGIFFile functions prepare a part of the header and call SendAFile to do the rest of the work.

If the user's response indicates no favorite machines are on the form, the extension will redirect the user to the Internet Pinball Database, a popular Internet site for pinball aficionados. The redirection operation isn't complicated: the server simply sends a plain HTML response with a <META> tag that performs the redirection.

This sample demonstrates the following keywords:

CHttpServer::TerminateExtension, CHttpServer::GetExtensionVersion, CHttpServer::StartContent, CHttpServer::WriteTitle, CHttpServer::EndContent, CHttpServerContext::ServerSupportFunction, BEGIN_PARSE_MAP, ON_PARSE_COMMAND, DEFAULT_PARSE_COMMAND, ON_PARSE_COMMAND, ON_PARSE_COMMAND_PARAMS, END_PARSE_MAP


StockTicker: Displays Web Information in an ATL Control

Click to open or copy the STOCKTICKER project files.

StockTicker downloads stock information from the Web and displays it in an ATL control that scrolls the data from right to left. The control updates the data at set intervals, which the user sets.

StockTicker contains 4 parts:

  • Shared ATL component (stockquotes).

  • ATL control (stocktickeratl).

  • ISAPI Extension DLL (stocksourcemfc).

  • MFC container app (containermfc). You can rename this .exe file.

Installing and Running the Sample

To use StockTicker, first build all of the components and then use regsvr32 to register two DLLs: stockquotes.dll and stocktickeratl.dll. You may need to register ATL.dll, also.

The ISAPI Extension DLL mimics a stock data source. It should be installed on a computer where Web server software (such as Microsoft Internet Information Server (IIS)) has been installed. You must tell StockTicker where this DLL is located. For instructions on how to use the ISAPI Extension DLL, see below.

How to Use the Sample

Run containermfc.exe. Right-click in the client area of the application to display a popup menu. Use this menu to change the following behavior and properties of StockTicker:

Stocks

Displays a dialog box through which you can add or remove the stock symbols to monitor. The dialog box is initialized with the current list of stock symbols.

Update Now

Updates the stock information from the Web.

Properties

The Properties dialog box has 3 property pages: color, font, and custom. If the stock color and font property pages do not display in the Properties dialog box, make sure you have registered msstkprp.dll.

You can change the following properties.

  • Ticker Speed: Move the slider to increase or decrease the rate at which the stock information scrolls from right to left.

  • Update Interval: Time in minutes between updates.

  • ISAPI Extension DLL URL: Enter the full URL to the ISAPI Extension DLL. Append the following text to the end of the URL: ?QueryForStocks?Symbol=.

    When specifying the URL for the ISAPI Extension DLL, you need to include the component that is responsible for returning the HTML that contains the stock information.

About Stock Ticker

Opens the About dialog box.

Stay On Top

StockTicker will stay on top of all other applications; otherwise, it can be hidden by other applications.

Features Used by StockTicker

  • ATL COM object

  • ATL Dialog object

  • ATL control

  • MFC Internet (WinInet) classes

  • MFC ISAPI Extension DLL

  • Connection points

  • Persistence

  • Custom enumerators

  • Standard C++ Library

StockTicker Components

This section provides more detail on the StockTicker components.

Stock Quotes Component

The shared component, the ATL object, is created with the ATL COM AppWizard. It uses MFC WinInet support and other utility classes. Stock Quotes keeps track of the stocks to be monitored and updates the stock information from the Web. An application can use this component for either synchronous or asynchronous updates. If the StartUpdating method is called, a child thread is created and the function returns immediately. The child thread creates a timer and waits until the update interval has elapsed. Then it requests an update from the Stock Quotes component. Subsequent calls to Update post a thread message to the child thread indicating that an update should occur, and Update returns immediately. In synchronous mode, Update blocks until the download is complete.

The Stock Quotes component keeps track of stock data source objects that represent the Web sites from which the stock information is downloaded. When StockTicker updates the stock information, the Stock Quotes component goes through the list of stock data sources and attempts to download the information. If the attempt fails, the component tries to download stock data from the next source. If all of the stock data sources fail to download the information, <NA> will appear in the ticker window after the stock symbol.

Stock data comes from the Web site in HTML form. The data must be parsed to find the current price and the price change since the last update. The Stock Quotes component handles this parsing by searching for 2 keywords: for example, Current: or Change:. The component reads the data following the keywords if that data is either a fractional or decimal number (fractional or decimal).

Because stock Web sites may change the way they deliver data, you may have to change the algorithm that Stock Quotes uses to get the stock information.

See below for instructions on how to add your own stock data sources.

ISAPI Extension DLL

The default stock data source is the local ISAPI Extension DLL. The ISAPI Extension DLL does not return real stock data. Instead, when you request data for a stock, the DLL checks whether the stock symbol is in its list of known stocks. If the stock symbol is on the list, the DLL retrieves the data and randomly adjusts the current stock price up or down. If the stock symbol is new, it is added to the list and an initial stock price is set.

Stock Ticker Control

This control was created with the ATL Object Wizard. It uses MFC to make some things easier.

You can use this control outside of StockTicker.

The Stock Ticker control uses the Stock Quotes component to handle the stock information and updates. When it comes time to save itself to a stream, the control will also ask the Stock Quotes component to save itself.

On startup, the Stock Ticker control creates the Stock Quotes component and asks it to start updating stock information. The control then starts a timer that it uses for the draw/render loop. When stock data has been updated, the Stock Quotes component notifies the control (through a connection point). The control then gets all the stock information from the Stock Quotes component and creates a string out of it. This string is drawn in the control and scrolls from right to left.

Stock Ticker Container

The Stock Ticker container is an MFC Active Control container, created with the MFC AppWizard. It saves its size and position upon quitting, and it restores its previous state when it is restarted.

The container also handles the StockTicker menus.

How to Add Stock Source Web Sites

Follow these steps to add your own stock source Web site.

  1. Edit stockquotes\stockquotes_.h. Examine the CSQSISAPIDll class. You can use the class as an example for creating new stock quote classes.

  2. Create a new class, derived from CStockQuoteSource.

  3. In the new class constructor, set m_strURL to the full URL of the Web site from where to retrieve data. Be sure to include the command to retrieve the stock data.

  4. The format of the HTML returned from the Web site may require that you override SetStockInfo and/or ParseStockInfo.

  5. Rebuild the component and register it.

If your selected site returns data resembling CONAME: <NA>, where CONAME is the stock symbol, either the site could not be accessed, or the source class you created could not find the stock information from the HTML.

Note The format, either decimal or fractional, of the stock data may differ among the stocks you choose to monitor. StockTicker makes no attempt to alter the data to make it consistent.

This sample demonstrates the following keywords:

IEnumXXX, CWinThread, std::vector, IConnectionPointContainer, CInternetSession, CInternetException, AfxParseURL, CHttpConnection, CHttpFile, COleClientItem, COleDocument, COleDispatchDriver, CreateILockBytesOnHGlobal, StgCreateDocfileOnILockBytes, OleSave, StgIsStorageILockBytes, GetHGlobalFromILockBytes, COleFont, std::basic_istream, std::basic_ostream, CHttpServer, CComPtr, CDialogImpl, std::list, IPersistStreamInit, IFontDisp, IViewObjectEx, CComControl, IOleControl, IPropertyPageImpl, CBitmap, CDC, IPersistStreamInit_Load, IPersistStreamInit_Save, IConnectionPointImpl


TEAR: "Tearing" HTML Pages Off the Internet

Click to open or copy the TEAR project files.

The TEAR sample shows how to write an MFC console application that uses WININET.DLL to communicate with the Internet. The sample shows how to form an HTTP request using CHttpFile against CHttpConnection and CInternetSession objects.

Running the Sample

You must pass TEAR a URL referencing an HTTP server with a Web page that you would like to retrieve. To run the sample, open a command prompt window, type TEAR and the URL at the command line, and press ENTER. The program will log onto the Internet and retrieve the page and copy the raw HTML for the page to stdout. For example:

TEAR http://www.microsoft.com/ie/support/default.htm

The sample TEAR accepts several command-line options. To display the TEAR command-line options, open a command prompt window, type TEAR at the command line, and press ENTER. The program displays a list of command-line options.

You can use the /D option to force the program to use the preconfigured Internet access parameters that you have set up on your computer via Control Panel or the Internet Access Setup Wizard. If your local area network is directly connected to the Internet, use the /L option. If you need to reach the Internet through a gateway, use the /G option. The program responds to these options by changing the session flags passed to the CInternetSession constructor.

The /S option strips HTML formatting tags from the retrieved text, while the /P option causes the application to use CInternetSession::EnableStatusCallback to get information on the progress of the connection.

Redirection to a Different Server

Redirection in the TEAR sample deserves special attention. TEAR uses the INTERNET_FLAG_NO_AUTO_REDIRECT when it sends its request. This means that WININET doesn't automatically handle redirection errors by redirecting to another server. Instead, WININET reports redirection errors back to TEAR as errors.

There is a substanital amount of extra code in the sample to detect and react to these errors, and most applications won't need that code. Normally, applications won't specify the INTERNET_FLAG_NO_AUTO_REDIRECT flag when making HTTP requests. This lets WININET handle redirection transparently. Since TEAR is a sample, however, it provides a good vehicle for demonstrating the use of the CHttpFile::QueryInfo and CHttpFile::QueryInfoStatusCode member functions.

When TEAR detects a redirection error, it reacts by using QueryInfo to return all of the headers passed in the response header. It parses the response header to find the new location--that is, the target of the server's redirection, and handles the error appropriately. It is possible to ask TEAR to connect to a site that issues a redirection to another URL that in turn issues yet another redirection. In this situation, TEAR fails the request and print an error message.

You can learn more about the redirection status codes and the HTTP protocol in general by reading the specifications available at http://www.w3.org.


WWWQUOTE: Demonstrates Development of an Internet Server Extension Using MFC

Click to open or copy the WWWQUOTE project files.

The WWWQUOTE sample illustrates the development of an Internet Server Extension using MFC. This extension makes use of ODBC to retrieve information from a database and provide it to the user via his/her HTTP connection to the server. The example shows proper use of the parse map macros, the CHttpServer class, and thread-safe programming techniques.

The WWWQUOTE sample can be built to use MFC in a shared DLL or to link statically to MFC.

This sample requires a Web server that supports the Internet Server Application Programming Interface (ISAPI), and should be run in an environment where a server-class database is available. For details, see "Installing the Sample" below.

Several issues, such as multithreading, require thoughtful handling when accessing a database from an ISAPI extension DLL. For a discussion of these issues, see Technical Note 67.

Installing the Sample

The WWWQUOTE sample is designed to demonstrate information retrieval in a high-throughput application. You need to use the sample with SQL Server and run the sample under Windows NT, Server Edition — the sample cannot be used with user-oriented database systems like Microsoft Access because they cannot provide the throughput necessary for a server application. You can configure the data source to work with another SQL database server, such as Oracle Server, but the instructions here discuss the use of SQL Server.

The sample files include a script that you can use in ISQL/W, the interactive SQL Server utility. ISQL/W allows you to create the tables and indexes, and insert data the sample uses. The script file is called Quotes.sql, and you can open it in ISQL/W and run it to create the tables. Before you run the script file, you should make sure you have attached ISQL/W to the correct database and you have set up the privileges. The script will create tables named CUSIP and PRICES. You can run the script in an existing database as long as your target database does not already contain objects with these names.

Once the database is installed, you'll need to create an ODBC system data source on the server as follows:

  1. Start the Windows NT Server Control Panel on the server and open the ODBC32 applet.

  2. In the ODBC32 applet, click System DSN.

  3. When the System Data Sources dialog box appears, click Add.

  4. In the Add Data Source dialog box, select the ODBC driver appropriate for your database server.

  5. In the Setup dialog box for your driver, specify a Data Source Name of "Stock Quotes". You can use whatever values you need for the other options. You will probably want to provide a default database name that matches the database you used when you ran the Quotes.sql script.

Once you have set up the database, copy the DLL file created when you built the server into a directory on your Web server. Make sure the file is stored in a directory that offers users of your server execution privileges.

Once the files have been installed, you can connect to the server from a client machine with your favorite Web browser. The quote program dynamically produces forms. You can respond to the forms and have the server generate stock quotes for you. There are only a few issues of stock with a few months of market activity in the sample database, but you can use the forms provided by the server in your own applications to request valid quote information.

To get started, use your browser to request that the server execute the Wwwquote.dll file. If your server is named www.mooseboy.com, you can use this URL to activate the program:

     http://www.mooseboy.com/scripts/wwwquote.dll?

You must provide the trailing question mark. Note that this example assumes your server has the WWWQUOTE sample DLL installed in a directory called scripts.


ACDUAL: Adds Dual Interfaces to an Automation Application

Click to open or copy the ACDUAL project files.

ACDUAL demonstrates how to add dual-interface support to an MFC-based Automation (formerly OLE Automation) application. The sample consists of the following subdirectories:

  • MFCCTRL, which contains a version of the AUTODRIV sample that lets you select whether to control the server application using the dispatch interface or using vtable binding.

  • SERVER, which contains a version of the AUTOCLIK sample with dual-interface support.

  • VBCTRL, which contains a Visual Basic 4.0 program that controls the server application.

The ACDUAL server uses AUTOCLIK, Step 3 as a starting point. New GUIDs (globally unique identifiers) were generated to prevent confusion with the original AUTOCLIK sample, and some resources strings were changed to clarify whether the ACDUAL server is running. All other changes to the sources are marked with comment blocks like this:

      // DUAL_SUPPORT_START
      ... modified code goes here
      // DUAL_SUPPORT_END

For more information about dual interfaces, object description language (ODL) scripts, and Automation error interfaces, see Technical Note 65.

Running the Sample

You must run ACDUAL as a stand-alone application once to register its ActiveX type with the system. After this is done, you are ready to run either the VB or MFC version of AUTODRIV. Both versions of AUTODRIV launch ACDUAL and create a Document object, which you can then manipulate using Automation via the AUTODRIV user interface. The MFC version of AUTODRIV contains an additional check box that lets you select whether to use VTBL binding to communicate with the ACDUAL Document object.

Dual Interfaces

A dual interface allows you to implement an IDispatch interface or a VTBL interface. A dual interface is strongly recommended for all exposed Automation objects. Issues to consider when implementing a dual interface are discussed in Technical Note 65 and include:

  • Implementing dual-interface support for CCmdTarget-based classes

  • Passing dual-interface pointers

  • Enabling typesafe binding, including:
    • Registering the application's library type

    • Modifying project build settings to accommodate type library changes

    • Specifying the correct object class name in a type library
  • Handling exceptions and the automation error interface

See also the ActiveX topics Overview of Automation, Dual Interfaces, Type Description Interfaces, and the ODL reference entry on the dual attribute.


BINDSCRB: Illustrates an MFC Binder-Compatible Server

Click to open or copy the BINDSCRB project files.

The BINDSCRB sample illustrates the use of new Active™ interfaces for components used to build Active documents. An application that is an Active document server can be contained in any Active document object container. The sample is so named because the Microsoft® Office Binder, included in Microsoft® Office 95, was the first tool to support containment of these objects. The Binder acts as a client, while the documents are served by Active document servers.

BINDSCRB behaves like the SCRIBBLE sample, but shares the user interface of its container if its container supports Active documents. If the container does not support Active documents, BINDSCRB behaves like a normal Active component. Active document containers include the Microsoft Office Binder and Microsoft® Internet Explorer 3.0. The Active interfaces provided by an Active document container differ slightly from normal Active interfaces so that the Binder can provide a specialized user environment.

Running the Sample

You need to run BINDSCRB once as a standalone application so it can register itself with the system. When you run BINDSCRB, you will notice that it does not look much different from the SCRIBBLE sample. After you close BINDSCRB, you can start the Office Binder, Microsoft Internet Explorer 3.0, or any other Active document container application. Use the command appropriate for that application to insert the BINDSCRB object into the container. If you use the Office Binder, for example, you should click Add on the Section menu to reach the Add Section dialog box. The Add Section dialog box has an entry in the As a Blank Section list box that corresponds to the BINDSCRB sample. Select this entry and click OK in the dialog box to add a new BINDSCRB document to the binder.

Since BINDSCRB implements all the necessary binder interfaces for persistence, you can load and save the content of the binder in a Binder file, including any changes you make to the sample. Similarly, you can open a Binder file and expect to see a BINDSCRB document with your changes.

BINDSCRB works by adding implementations of the binder-specific Active interfaces to the interfaces that MFC classes enabled for Active documents, like COleServerDocument, already support. It does this by registering itself with MFC as an Active document server application. MFC contains code to support these new interfaces. For further information, see CDocObjectServer and CDocObjectServerItem in the MFC Class Library Reference and Internet First Steps: Active Documents and Active Documents in the Visual C++ Programmer's Guide.

Note that a sample with this same name was provided in the MFC 4.1 package. This sample has been significantly revised, and can only be built using MFC 4.2 or later because it relies on Active document support available MFC 4.2.

This sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; CArchive::IsStoring; CCmdUI::Enable; CCmdUI::SetCheck; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDC::DPtoLP; CDC::GetDeviceCaps; CDC::GetTextMetrics; CDC::LPtoDP; CDC::LPtoHIMETRIC; CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CDC::SetMapMode; CDC::SetTextAlign; CDC::SetViewportExt; CDC::SetWindowExt; CDC::SetWindowOrg; CDC::TextOut; CDialog::DoModal; CDocTemplate::SetServerInfo; CDocument::DeleteContents; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFont::CreateFontIndirect; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CObList::GetHeadPosition; CObList::GetNext; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; COleDocIPFrameWnd; COleDocument::EnableCompoundFile; COleIPFrameWnd::OnCreateControlBars; COleServerDoc::GetEmbeddedItem; COleServerDoc::GetZoomFactor; COleServerDoc::NotifyChanged; COleServerDoc::OnGetEmbeddedItem; COleServerDoc::OnSetItemRects; COleServerItem::CopyToClipboard; COleServerItem::GetDocument; COleServerItem::IsLinkedItem; COleServerItem::OnDraw; COleServerItem::OnGetExtent; COleTemplateServer::ConnectTemplate; COleTemplateServer::UpdateRegistry; CPen::CreatePen; CRect::InflateRect; CRect::IntersectRect; CRect::SetRectEmpty; CScrollView::SetScrollSizes; CSplitterWnd::Create; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPrepareDC; CView::OnPreparePrinting; CView::OnPrint; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::OnSize; CWnd::PreCreateWindow; CWnd::SetCapture; CWnd::SetOwner; CWnd::ShowWindow; CWnd::UpdateWindow; CreatePen; DeleteObject; DragAcceptFiles; GetClipBox; LPtoDP; RGB; ReleaseCapture; SetRectEmpty; max; memset; min


CALCDRIV: Demonstrates an Automation Client Application

Click to open or copy the CALCDRIV project files.

CALCDRIV is a simple Automation (formerly OLE Automation) client application. CALCDRIV drives the MFCCALC sample application, which is an Automation server that provides basic calculator functions and is one of the OLE Software Development Kit samples. MFCCALC has a simple calculator interface that looks like the Calculator application that comes with Microsoft Windows. MFCCALC can also demonstrate the use of ClassWizard's Automation Client option and a ClassWizard-created dispatch class.

Before you run CALCDRIV, first build the MFCCALC sample, then register it with Windows. If you run MFCCALC once, MFCCALC, like other MFC server applications, will automatically enter itself into the system registry. If you do not follow this procedure, you get an "Unable to create 'MFCCALC.Application' object" message.

When you run CALCDRIV, the Microsoft Foundation Class Library (MFC) Calc Driver dialog box appears and the MFCCALC application is launched. You can use MFCCALC's calculator user interface directly at this point, or you can drive MFCCALC from CALCDRIV as follows:

  1. In the Expression field, type two or more numbers separated by the operator +, -, *, or /. Note that MFCCALC does not interpret parentheses and does not implement operator precedence.

  2. Click Go to have MFCCALC evaluate the expression in one step.

  3. Click Single Step to step through the expression one number/operator at a time.

  4. Click Refresh to request state information for MFCCALC (Last Accum and Last Operand).

ClassWizard Automation Client Option

The CRemoteCalcDlg class of CALCDRIV represents the dispatch interface of MFCCALC. Class CRemoteCalcDlg is derived from CCmdTarget, which has a few automation-specific member functions, such as CreateDispatch.

It is easy to implement a dispatch class such as MFCCALC with ClassWizard if the automation server application has a type library (.tlb) file. To implement the header and implementation files, Calctype.h and Calctype.cpp:

  1. Select the Automation tab in ClassWizard.

  2. Click Read Type Library, which opens the Read Type Library dialog box.

  3. Select Mfccalc.tlb from the MFCCALC sample files as the type library file.

  4. In the Confirm Classes dialog box, change the Class Name from ICalcDlg to CRemoteCalcDlg.

  5. Change the header filename from Mfccalc.h to Calctype.h.

  6. Change the implementation filename from Mfccalc.cpp to Calctype.cpp.

You do not need to make any changes to the Calctype.h and Calctype.cpp files created by ClassWizard.

Using a ClassWizard-Created Dispatch Class

CALCDRIV uses the CRemoteCalcDlg class created by ClassWizard as follows:

  • CDriverDlg embeds a CRemoteCalcDlg object, m_calc. The CRemoteCalcDlg object, like the CDriverDlg object in which it is embedded, is alive for most of the duration of CALCDRIV. The CRemoteCalcDlg is constructed when the dialog object is constructed.

  • CDriverDlg::OnInitDialog calls CCmdTarget::CreateDispatch for the CRemoteCalcDlg object. CreateDispatch requires the dispatch name as the first parameter. Typically, the developer of an automation server application provides documentation describing the names of the dispatch interfaces and the properties and methods of the interfaces. Another way to find the names of the dispatch interfaces of an automation server application is to look at the server's Windows registration, using REGEDIT /v (the verbose option).

  • CDriverDlg implements CALCDRIV's expression evaluator by calling the Button method of MFCCALC, which is an emulator for the various buttons in the calculator's dialog box.

  • CDriverDlg implements CALCDRIV's Refresh function by calling the GetOpnd and GetAccum methods of MFCCALC.

  • The CDriverDlg destructor calls the Quit method exposed by MFCCALC to shut down MFCCALC when CALCDRIV closes.

This sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; CDialog::DoModal; CDialog::EndDialog; CDialog::OnInitDialog; CEdit::GetSel; CEdit::SetSel; COleDispatchDriver::AttachDispatch; COleDispatchDriver::CreateDispatch; COleDispatchDriver::GetProperty; COleDispatchDriver::InvokeHelper; COleDispatchDriver::SetProperty; CString::GetLength; CWinApp::Enable3dControls; CWinApp::InitInstance; CWnd::DoDataExchange; CWnd::GetWindowText; CWnd::SetWindowText; GetWindowText; afxMemDF; min; wsprintf


DRAWCLI: Illustrates Windows 95 Logo Compliance

Click to open or copy the DRAWCLI project files.

DRAWCLI is an object-oriented drawing application with Visual Editing container support. Among the Microsoft Foundation Class Library (MFC) Active™ container samples — CONTAINER, OCLIENT, and DRAWCLI — this sample provides the best illustration of integrating Active container support with application-specific features (in this case, drawing features). In addition, DRAWCLI demonstrates effective use of C++ polymorphism in the design of its "shape" and "drawing tool" classes (CDrawObj and CDrawTool).

DRAWCLI also illustrates Windows 95 logo compliance. All MFC applications meet some of the requirements for the Windows 95 logo: a Win32 executable, support for long filenames, support for UNC pathnames, use of system colors and metrics, and compatibility with Windows NT. DRAWCLI meets the remaining requirements for the Windows 95 logo by including the following features.

  • ActiveX support. DRAWCLI is an Active container that stores its files in the compound file format, supports in-place activation, and acts as a drop target for drag-and-drop operations.

  • MAPI support. DRAWCLI provides a "Send as Mail" message on its File menu, allowing the user to send a document as a mail attachment.

  • Compliance with shell guidelines, including registration of large and small icons, use of the system registry instead of an .ini file, and having a setup and an uninstall program. For the latter, DRAWCLI includes a script compatible with InstallSHIELD, Stirling Software's toolkit for creating setup and uninstall programs.

DRAWCLI also meets the following recommendations for Windows 95 applications.

  • Uses tabbed property pages.

  • Uses Windows 95 common controls.

  • Displays a shortcut menu in response to a right-button mouse click.

  • Stores Summary Information with its documents.

DRAWCLI's user interface is similar to those of other object-oriented drawing programs.

Integrating Active Container Support with Application-Specific Features

The DRAWCLI sample was originally a stand-alone drawing application developed using the MFC classes. The stand-alone version of DRAWCLI was then integrated with a second skeleton version of DRAWCLI created using AppWizard's ActiveX Container feature. This process is similar to how the ActiveX Visual Editing server tutorial adds server support to create the Step 7 version of SCRIBBLE.

The design of an MFC ActiveX container application should look essentially the same, regardless of whether you're adding ActiveX functionality to an existing stand-alone MFC (doc/view) application, or whether you're starting with an AppWizard-generated ActiveX container application. The following is a brief description of how DRAWCLI is separated into application-specific code and ActiveX container-specific code.

Class CDrawObj, implemented in Drawobj.cpp, is a base class for derived "shape" classes. This base class handles hit testing of shapes, moving of shapes, and resizing of shapes. Through the use of polymorphism, DRAWCLI can interact with objects of different classes through CDrawObj's interface.

Classes CDrawRect and CDrawPoly are derived from CDrawObj. CDrawRect is used to draw rectangles, rounded rectangles, ellipses, and lines. CDrawPoly is used to draw polygons. These two classes are independent of DRAWCLI's ActiveX container functionality.

Class CDrawOleObj is also derived from CDrawObj, and is used to represent embedded objects. CDrawOleObj delegates any ActiveX-specific operation to a contained CDrawItem object (described below). For generic shape operations, embedded objects are treated like other shape objects in DRAWCLI because CDrawOleObj is derived from CDrawObj.

Class CDrawItem, derived from COleClientItem, handles all the ActiveX-specific behavior for the embedded object. The implementation of CDrawItem is similar to the implementation of the COleClientItem-derived classes in the CONTAINER and OCLIENT samples.

Class CDrawDoc is derived from COleDocument. The COleDocument object maintains a CObList of CDrawObj objects. CDrawDoc delegates several ActiveX container-specific menu commands, such as Edit Paste, Paste Link, and Links, to the base class COleDocument.

Class CDrawView is derived from CScrollView. The ActiveX-specific implementation of CDrawView is similar to the implementation of the view classes in the CONTAIN and OCLIENT samples. The bulk of DRAWCLI's drawing-specific user interface is also implemented in CDrawView.

This sample demonstrates the following keywords:

AfxGetApp; AfxGetMainWnd; AfxMessageBox; AfxOleInit; AfxRegisterWndClass; AfxThrowMemoryException; CArchive::Close; CArchive::IsStoring; CBitmap::CreateCompatibleBitmap; CBrush::CreateBrushIndirect; CBrush::CreateSolidBrush; CCmdTarget::BeginWaitCursor; CCmdTarget::EndWaitCursor; CCmdUI::Enable; CCmdUI::SetCheck; CCmdUI::SetRadio; CColorDialog::DoModal; CColorDialog::GetColor; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDC::Attach; CDC::BitBlt; CDC::CreateCompatibleDC; CDC::DPtoLP; CDC::DrawFocusRect; CDC::FillRect; CDC::GetClipBox; CDC::GetDeviceCaps; CDC::HIMETRICtoDP; CDC::IntersectClipRect; CDC::IsPrinting; CDC::LPtoDP; CDC::LineTo; CDC::MoveTo; CDC::OffsetViewportOrg; CDC::OffsetWindowOrg; CDC::PatBlt; CDC::SelectObject; CDC::SetBkColor; CDC::SetBrushOrg; CDC::SetMapMode; CDC::SetViewportExt; CDC::SetViewportOrg; CDC::SetWindowExt; CDC::SetWindowOrg; CDialog::DoModal; CDocTemplate::SetContainerInfo; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::GetTitle; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::OnSaveDocument; CDocument::SetModifiedFlag; CDocument::SetTitle; CDocument::UpdateAllViews; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CGdiObject::UnrealizeObject; CMDIChildWnd::Create; CMenu::GetSubMenu; CMenu::LoadMenu; CMenu::TrackPopupMenu; CObList::AddTail; CObList::GetCount; CObList::GetHeadPosition; CObList::GetNext; CObList::IsEmpty; CObList::RemoveAll; CObList::RemoveAt; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; COleClientItem::Close; COleClientItem::CreateCloneFrom; COleClientItem::CreateFromData; COleClientItem::CreateStaticFromData; COleClientItem::Deactivate; COleClientItem::Delete; COleClientItem::DoVerb; COleClientItem::Draw; COleClientItem::GetActiveView; COleClientItem::GetClipboardData; COleClientItem::GetDocument; COleClientItem::GetExtent; COleClientItem::GetInPlaceWindow; COleClientItem::GetItemState; COleClientItem::GetType; COleClientItem::IsInPlaceActive; COleClientItem::OnChange; COleClientItem::OnChangeItemPosition; COleClientItem::OnGetItemPosition; COleClientItem::Release; COleClientItem::SetItemRects; COleClientItem::UpdateLink; COleDataObject::AttachClipboard; COleDataObject::GetFileData; COleDataObject::IsDataAvailable; COleDataSource::CacheGlobalData; COleDataSource::SetClipboard; COleInsertDialog::CreateItem; COleInsertDialog::DoModal; COleInsertDialog::GetSelectionType; CPen::CreatePen; CPen::CreatePenIndirect; CPrintDialog::CreatePrinterDC; CRect::BottomRight; CRect::Height; CRect::InflateRect; CRect::IntersectRect; CRect::IsRectEmpty; CRect::NormalizeRect; CRect::OffsetRect; CRect::SetRect; CRect::TopLeft; CRect::Width; CRectTracker::Draw; CRgn::CreateEllipticRgnIndirect; CRgn::CreatePolygonRgn; CRgn::CreateRoundRectRgn; CRgn::RectInRegion; CScrollView::GetDeviceScrollPosition; CScrollView::SetScrollSizes; CStatusBar::Create; CStatusBar::SetIndicators; CString::MakeLower; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::IsSelected; CView::OnActivateView; CView::OnBeginPrinting; CView::OnDragEnter; CView::OnDragLeave; CView::OnDragOver; CView::OnDraw; CView::OnDrop; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPrepareDC; CView::OnPreparePrinting; CView::OnPrint; CView::OnScrollBy; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWinApp::SetRegistryKey; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::GetParentFrame; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnDestroy; CWnd::OnEraseBkgnd; CWnd::OnLButtonDblClk; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::OnSetFocus; CWnd::OnSize; CWnd::PreCreateWindow; CWnd::ScreenToClient; CWnd::SetCapture; CWnd::SetFocus; CWnd::ShowWindow; CWnd::UpdateWindow; DragAcceptFiles; Ellipse; GetACP; GetKeyState; GetMapMode; GetVersion; GlobalFree; GlobalLock; GlobalUnlock; LOWORD; LineTo; LoadCursor; MAKELONG; MoveTo; MulDiv; Polygon; RGB; Rectangle; RegisterClipboardFormat; ReleaseCapture; RoundRect; SelectObject; SetCursor; free; malloc; memcpy; min; realloc; wcstombs


HIERSVR: Demonstrates a Server Application with OLE Drag and Drop

Click to open or copy the HIERSVR project files.

HIERSVR is an example of a Visual Editing server application that supports linked objects as well as in-place edited objects. In addition, as a "full" server, this application also can directly open and save files. The HIERSVR object is a multiple-level hierarchy diagram, where each node in the hierarchy consists of text surrounded by a rectangle or other shapes. In addition to illustrating server functionality, HIERSVR also illustrates OLE drag and drop, and copying to the Clipboard.

You must run HIERSVR as a stand-alone application once to register its ActiveX™ type with the system.

The type of document or object HIERSVR edits and displays is a single inheritance hierarchy diagram. Each node in the diagram, except the root node, has only one parent node. Each parent may have multiple children. A company's organization chart is an example of a hierarchy diagram. So is the list of the Microsoft Foundation Class Library (MFC) classes, since they do not use C++ multiple inheritance. In fact, Mfcclass.hie is included as an example HIERSVR document.

Every node in the hierarchy has a minimal set of attributes.

  • Description — text consisting of up to 30 characters.

  • Shape — style of rectangle that surrounds the text rectangle, rounded rectangle, or oval rectangle.

  • Item Key Link (optional) — name used to refer to a linked item. If not specified, the item key link defaults to the description string. This name is visible when you view the link using the Edit Links command in the client application.

Creating a HIERSVR Diagram

A new HIERSVR diagram begins as a single node with the text "Root node." To add a node, first select its parent node by clicking it. Then click Add Node on the Edit menu. In the Add Node dialog box, specify the three attributes described above. To change the attributes of a node, select it with a mouse click, and then click Change Node. To move a node, click it and drag to the new location.

HIERSVR will import hierarchy information from a text file formatted as follows: The text in each line (delimited by a line feed) is the node's Description. The number of tab characters preceding the text determines the level of the node in the hierarchy. In the HIERSVR sample directory, Mfcclass.txt is the text import file for Mfcclass.hie, the native HIERSVR file.

To link a hierarchy diagram to a client document, you must first save the file in HIERSVR. Then select the node you want to copy using Edit Copy. This will copy the link to the Clipboard. The text of the selected node will also be copied to the Clipboard in the CF_TEXT format, and the entire hierarchy of nodes will be copied in a HIERSVR-native clipboard format. Saving the document is required because the link format requires a document name. Finally, in the client application, click Edit Paste Link (or click Paste Link on the Edit Paste Special menu). The link will be displayed in the client document as the node that you selected before clicking Edit Copy. The rectangle will also be displayed.

To embed a hierarchy diagram in a client document, you can either use a clipboard procedure similar to that above for linking the object, or click Insert New Object in the client application. If you choose the clipboard procedure, use Edit Paste rather than Edit Paste Link in the client application. Only the subhierarchy starting at the selected node will be embedded in the client document.

Whether you link or embed the diagram, only the top selected node will be displayed in the client application window. To see the rest of the diagram, you will need to launch HIERSVR from the client application by double-clicking the item.

Visual Editing Server

HIERSVR illustrates the class derivations necessary to implement a fully functional Visual Editing server application, and also illustrates some of the most common client application user interfaces that require additional code.

The three framework classes used to implement a Visual Editing server application are illustrated by the following.

  • A COleTemplateServer object, stored as member variable m_server in HIERSVR's application class.

  • HIERSVR's own CServerDoc class, derived from COleServerDoc.

  • HIERSVR's own CServerItem class, derived from COleServerItem.

  • HIERSVR's own CInPlaceFrame class, derived from COleIPFrameWnd, originally created by AppWizard.

See Help: Compiling and Testing Your Help File for information on how to compile your help file.

This sample demonstrates the following keywords:

AfxGetMainWnd; AfxMessageBox; AfxOleInit; AfxThrowMemoryException; AfxThrowNotSupportedException; AfxThrowResourceException; CArchive::Close; CCmdTarget::BeginWaitCursor; CCmdTarget::EndWaitCursor; CCmdUI::Enable; CCmdUI::SetCheck; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDC::GetDeviceCaps; CDC::LPtoDP; CDC::LPtoHIMETRIC; CDC::SelectObject; CDC::SetMapMode; CDC::SetViewportExt; CDC::SetWindowExt; CDialog::DoModal; CDialog::OnInitDialog; CDocTemplate::SetServerInfo; CDocument::DeleteContents; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnNewDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFile::Open; CFileDialog::DoModal; CFileDialog::GetPathName; CFontDialog::DoModal; CFontDialog::GetColor; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CMenu::GetSubMenu; CMenu::LoadMenu; CMenu::TrackPopupMenu; CObList::AddHead; CObList::AddTail; CObList::GetCount; CObList::GetHeadPosition; CObList::GetNext; CObList::GetTail; CObList::RemoveAll; CObList::RemoveAt; CObject::AssertValid; CObject::Dump; CObject::Serialize; COleDataObject::AttachClipboard; COleDataObject::GetFileData; COleDataObject::IsDataAvailable; COleIPFrameWnd::OnCreateControlBars; COleLinkingDoc::OnGetLinkedItem; COleServerDoc::GetItemPosition; COleServerDoc::IsInPlaceActive; COleServerDoc::OnDeactivateUI; COleServerDoc::OnGetEmbeddedItem; COleServerDoc::OnSetItemRects; COleServerDoc::RequestPositionChange; COleServerDoc::UpdateAllItems; COleServerItem::CopyToClipboard; COleServerItem::DoDragDrop; COleServerItem::GetClipboardData; COleServerItem::GetDataSource; COleServerItem::GetDocument; COleServerItem::GetItemName; COleServerItem::IsLinkedItem; COleServerItem::OnDraw; COleServerItem::OnGetClipboardData; COleServerItem::OnGetExtent; COleServerItem::OnOpen; COleServerItem::OnRenderFileData; COleServerItem::SetItemName; COleTemplateServer::ConnectTemplate; COleTemplateServer::UpdateRegistry; CPen::CreatePen; CRect::BottomRight; CRect::Height; CRect::InflateRect; CRect::IntersectRect; CRect::OffsetRect; CRect::PtInRect; CRect::Size; CRect::TopLeft; CScrollView::GetDeviceScrollPosition; CScrollView::ScrollToPosition; CScrollView::SetScrollSizes; CString::Empty; CString::GetLength; CString::IsEmpty; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::GetDocument; CView::OnDragEnter; CView::OnDragLeave; CView::OnDragOver; CView::OnDraw; CView::OnDrop; CView::OnInitialUpdate; CView::OnPrepareDC; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::ExitInstance; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::ClientToScreen; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetParentFrame; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnKeyDown; CWnd::OnLButtonDblClk; CWnd::OnLButtonDown; CWnd::OnRButtonDown; CWnd::OnSize; CWnd::SetOwner; CWnd::ShowWindow; CWnd::UpdateWindow; CreateFontIndirect; DragAcceptFiles; EnableWindow; ExtTextOut; GetDeviceCaps; GetSysColor; GetTextExtent; GetWindowTextLength; IsChild; LPtoDP; LineTo; LoadBitmap; MoveTo; MulDiv; RGB; RectVisible; Rectangle; RegisterClipboardFormat; RoundRect; SelectObject; SetTextColor; SetViewportExt; SetWindowExt; SetWindowOrg; _alloca; afxMemDF; lstrcpy; memset; min; strlen; wcstombs


INPROC: Demonstrates an In-Process Automation Server Application

Click to open or copy the INPROC project files.

INPROC is an in-process Automation (formerly OLE Automation) server. Unlike the other automation server samples provided, INPROC can be loaded as a dynamic-link library (DLL) in the client's address space. In-process servers are usually more efficient than servers implemented as separate EXEs because a remote procedure call (RPC) is not necessary to invoke methods on the objects implemented by the server. The DLL version of INPROC cannot be run directly; DLLs cannot be run as EXEs can. To test INPROC, you must "drive" it from a client application. INPROC can be driven from Visual Basic® or from Visual C++®. See the IPDRIVE sample for an example of driving INPROC from Visual C++.

You can build an EXE version of INPROC (EXE variants are one of the targets you can choose in the sample's project file). These EXE versions do nothing more than register themselves in the Windows registry.

To register the DLL version of INPROC, use the .REG file provided (run regedit INPROC.REG) or use REGSVR from the CONTROLS sample. If you use REGEDIT, be sure that Inproc.dll is on the system path (you could also modify the .reg file to refer to the path of Inproc.dll explicitly).

The CVariantMap class implements a VARIANT to VARIANT map. This allows any VARIANT to be mapped to any other VARIANT. Although this is probably not useful to Visual C++ programmers (who would probably use CMap directly), it does bring the power of MFC's collection classes to Visual Basic users. The CVariantMap class is accessed by the name mfc.inproc.varmap. This is how the object is registered in the Windows registry. CVariantMap implements the "standard" collection methods and properties as well as the _NewEnum method.

The CStringCollect class implements an array of strings. Its implementation is simpler than the CVariantMap class, even though it implements many of the same automation features as CVariantMap. The CStringCollect object is accessed by the name mfc.inproc.strcoll. It implements most of the "standard" collection methods and properties and is a good example for how to implement your own collections. Of particular interest is its implementation of the _NewEnum method, which allows Visual Basic users to use the "For Each... In" syntax when enumerating the contents of a collection. CStringCollect uses CEnumVariant to implement this functionality (it implements IEnumVARIANT using MFC's interface maps). You may find CEnumVariant useful in your own applications.

Finally, the sample implements a few "dummy properties," which are used simply to compare the performance of in-process servers and LocalServer servers. These are the properties tested by IPDRIVE's Test1 and Test2 buttons.

This sample demonstrates the following keywords:

AfxIsValidAddress; AfxMessageBox; AfxOleInit; AfxOleLockApp; AfxOleUnlockApp; AfxThrowMemoryException; AfxThrowOleException; CCmdTarget::EnableAutomation; CCmdTarget::GetIDispatch; CCmdTarget::OnFinalRelease; CString::AllocSysString; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::RunAutomated; CWinApp::RunEmbedded; DllCanUnloadNow; DllGetClassObject; min


IPDRIVE: Demonstrates an Automation Client Application

Click to open or copy the IPDRIVE project files.

IPDRIVE is a simple Automation (formerly OLE Automation) client application that drives the INPROC sample application. It tests the functionality provided by INPROC, an Automation in-process server. IPDRIVE can drive both the in-process version and the out-of-process or local server version of INPROC, demonstrating the performance advantages of in-process components. See the INPROC sample for more information.

To run IPDRIVE, you must first build and register the INPROC sample. Then, when you run IPDRIVE, it will load the INPROC sample and create a variant map object that you can manipulate using IPDRIVE's interface.

A variant map object is much like MFC's CMap collection. It is used to map one arbitrary value to another arbitrary value. Each value is a VARIANT, which consists of a type and a value. IPDRIVE's user interface allows you to access both the type and the value. Any type/value pair can be mapped to any other type/value pair.

IPDRIVE also provides two buttons, Test1 and Test2, which can be used to test the performance of the INPROC server application. For the most part, these functions test the function call overhead of automation. Function call overhead is expected to be much greater with the local server versions of INPROC than with the in-process versions of INPROC. A local server runs in its own address space as a separate executable. As such, it requires a remote procedure call (RPC) to access the methods and properties of its objects. An in-process server, however, loads as a DLL in the client's address space and does not require an RPC. Both the Test1 and Test2 buttons execute for exactly five seconds, then display the number of calls. The more calls, the better the performance.

INPROC also contains a simpler collection (a string array), which is not exercised by IPDRIVE.

This sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; AfxThrowUserException; CArchive::IsStoring; CComboBox::GetCurSel; CComboBox::SetCurSel; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::OnNewDocument; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CObject::Serialize; COleDispatchDriver::GetProperty; COleDispatchDriver::InvokeHelper; COleDispatchDriver::SetProperty; CScrollView::ResizeParentToFit; CStatusBar::Create; CStatusBar::SetIndicators; CString::AllocSysString; CString::Format; CString::GetBuffer; CString::LoadString; CString::ReleaseBuffer; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::GetDocument; CView::OnInitialUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWinApp::SetDialogBkColor; CWnd::DoDataExchange; CWnd::GetDlgItem; CWnd::GetParentFrame; CWnd::GetWindowText; CWnd::OnCreate; CWnd::SetDlgItemText; CWnd::SetWindowText; DragAcceptFiles; GetKeyState; GetTickCount; max; wsprintf


MFCBIND: Active Document Container

Click to open or copy the MFCBIND project files.

The MFC Binder sample shows how to create an Active document (formerly known as a DocObject) container using the Active document container support classes in MFC. The MFC Binder sample is an SDI application that uses the COleDocObjectItem class to represent an embedded Active document in an MFC document. MFCBIND works much like the Office Binder application, which ships with Microsoft Office.

To use MFC Binder, start the application and click the Add menu item from the Section menu to add as many sections as you want to the binder. Examples of sections are Word and Excel documents. When a section is added to the binder, you can edit it directly from within the MFC Binder application as though you were working in the section's native application. When you finish editing the sections in the binder, click the Save command from the File menu to save the binder. The Save command saves the sections in the binder to a single file. When you re-open the binder later, the sections will be available in their previously saved state.

In MFC, Active documents are handled much the same way regular in-place editable embeddings are handled. The COleDocument-derived class still maintains a list of the currently embedded items. The COleClientItem object, which is replaced by the COleClientItem-derived COleDocObjectItem class, represents the embedded item in the COleDocument. It is these COleDocObjectItem-derived items that are maintained in a list by the COleDocument-derived class. Active documents, however, take up the entire client area of the view when they are in-place active. An Active document container also has full control of the Help menu, unlike the older in-place embeddings. The Help menu contains menu items for both the Active document container and server. Because the Active document container owns the Help menu, it is responsible for forwarding messages for the server's part of the Help menu to the server. The help menu merging and message forwarding functionality is completely handled by the MFC framework.

This sample demonstrates the following keywords:

COleClientItem::FinishCreate, COleClientItem::GetIconFromRegistry, IOleObject::GetUserClassID, COleClientItem::OnChange, COleClientItem::OnChangeItemPosition, COleClientItem::OnGetItemPosition, COleClientItem::OnActivate, COleDocument::GetInPlaceActiveItem, COleClientItem::Deactivate, COleClientItem::CreateNewItem, COleClientItem::DoVerb, COleDocObjectItem::COleDocObjectItem, COleClientItem::CreateFromFile, COleClientItem::Activate, COleDocObjectItem::OnPreparePrintin, COleDocObjectItem::OnPrint, SystemParametersInfo, MeasureItem, DrawItem, GetSystemMetrics, SelectObject


MFCCALC: Demonstrates an Automation Server Application

Click to open or copy the MFCCALC project files.

MFCCALC is an Automation (formerly OLE Automation) server. It implements a simple calculator similar to the CALC application in Windows. It can be driven via Automation with the CALCDRIV sample or run stand-alone.

In prior versions of Visual C++, this functionality was provided by the OLE2 sample DSPCALC2. MFCCALC is simply an MFC version of DSPCALC2 and provides much the same functionality.

For more information, see the CALCDRIV sample.

This sample demonstrates the following keywords:

AfxGetApp; AfxGetInstanceHandle; AfxGetThread; AfxMessageBox; AfxOleInit; CCmdTarget::EnableAutomation; CDC::DrawIcon; CDC::GetSafeHdc; CDialog::Create; CDialog::DoModal; CDialog::OnCancel; CDialog::OnInitDialog; CDialog::OnOK; CMenu::AppendMenu; CMenu::ModifyMenu; CMenu::RemoveMenu; CRect::Height; CRect::Width; CString::Format; CString::IsEmpty; CString::LoadString; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::RunAutomated; CWinApp::RunEmbedded; CWnd::DestroyWindow; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetDlgItem; CWnd::GetSafeHwnd; CWnd::GetStyle; CWnd::IsIconic; CWnd::OnPaint; CWnd::OnQueryDragIcon; CWnd::OnSysCommand; CWnd::PostNcDestroy; CWnd::PreTranslateMessage; CWnd::SendMessage; CWnd::SetFocus; CWnd::SetWindowText; CWnd::ShowWindow; GetSystemMenu; GetSystemMetrics; LoadAccelerators; LoadIcon; MAKEINTRESOURCE; SetFocus; TranslateAccelerator


OCLIENT: Illustrates a Visual Editing Container Application

Click to open or copy the OCLIENT project files.

OCLIENT is an example of a visual editing container application. It is essentially an extended version of the CONTAINER tutorial sample, although it is not strictly a derivation of CONTAINER. OCLIENT illustrates these additional features:

  • Drag and drop to and from another application.

  • Cloning (duplication) of objects via Control-Drag within the same application window.

  • Automatic scrolling of window during a drag-and-drop operation.

  • Edit Paste of a native format object.

  • Edit Paste Link.

See Help: Compiling and Testing Your Help File.

Refer to the CONTAINER tutorial in Tutorials for an introduction to Microsoft Foundation Class Library (MFC) support for visual editing container applications. Refer to the OCLIENT sources for techniques for implementing the above features.

Running OCLIENT

OCLIENT, like CONTAINER, is a simple object-drawing program. The only type of object it draws is a linked or embedded OLE item. You can add a new object to the OCLIENT drawing in either of the following ways:

  • Click Insert New Object on the Edit menu. In the Insert New Object dialog box, select the type of OLE item you want to add. A new object will appear in OCLIENT's window, and OCLIENT's menu and toolbar will be updated with pop-up menus and toolbar buttons supplied by the server application.

  • While running an Automation server, copy an OLE item to the Clipboard. Then, on the Edit menu in OCLIENT, click Paste to embed the OLE item, or click Paste Link to link the OLE item.

The newly added OLE item is always placed in the top-left corner of the OCLIENT drawing. The new OLE item might partially or completely cover an older item. You can select one OLE item at a time using the mouse. A selected linked item is indicated with a dotted rectangle, and an embedded item is indicated with a solid rectangle. You can move an OLE item by dragging it; you can resize a selected OLE item by using the resize handles.

To delete an OLE item, select it with a mouse click, then click delete or use the Edit Clear menu command.

To edit the contents of an OLE item, double-click it or select it with the mouse and then click Edit <type> Object on the Edit menu. To complete the editing of an in-place editing item, click somewhere outside the rectangle of the item in OCLIENT's window. To complete the editing of an item that has been fully opened in the server application, use the server's File Update command.

This sample demonstrates the following keywords:

AfxGetMainWnd; AfxMessageBox; AfxOleInit; AfxThrowArchiveException; AfxThrowFileException; AfxThrowMemoryException; CArchive::Close; CArchive::IsStoring; CCmdTarget::BeginWaitCursor; CCmdTarget::EndWaitCursor; CCmdUI::Enable; CCmdUI::SetCheck; CControlBar::EnableDocking; CDC::DPtoLP; CDC::DrawFocusRect; CDC::GetDeviceCaps; CDC::HIMETRICtoDP; CDC::LPtoDP; CDC::RealizePalette; CDC::SelectPalette; CDocTemplate::SetContainerInfo; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CGdiObject::UnrealizeObject; CMDIChildWnd::Create; CMenu::GetSubMenu; CMenu::LoadMenu; CMenu::TrackPopupMenu; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; COleClientItem::Close; COleClientItem::CreateCloneFrom; COleClientItem::Deactivate; COleClientItem::Delete; COleClientItem::DoDragDrop; COleClientItem::DoVerb; COleClientItem::Draw; COleClientItem::GetActiveView; COleClientItem::GetClipboardData; COleClientItem::GetDocument; COleClientItem::GetDrawAspect; COleClientItem::GetInPlaceWindow; COleClientItem::GetItemState; COleClientItem::GetType; COleClientItem::IsInPlaceActive; COleClientItem::OnActivate; COleClientItem::OnChange; COleClientItem::OnChangeItemPosition; COleClientItem::OnDeactivateUI; COleClientItem::OnGetClipboardData; COleClientItem::OnGetItemPosition; COleClientItem::SetDrawAspect; COleClientItem::SetItemRects; COleClientItem::UpdateLink; COleDataObject::Attach; COleDataObject::AttachClipboard; COleDataObject::IsDataAvailable; COleDataSource::CacheGlobalData; COleDocument::EnableCompoundFile; COleDocument::GetNextItem; COleDocument::GetStartPosition; COleDocument::HasBlankItems; COleDocument::OnShowViews; COleInsertDialog::CreateItem; COleInsertDialog::DoModal; COleInsertDialog::GetSelectionType; COlePasteSpecialDialog::AddFormat; COlePasteSpecialDialog::AddStandardFormats; COlePasteSpecialDialog::CreateItem; COlePasteSpecialDialog::DoModal; COlePasteSpecialDialog::GetSelectionType; COleTemplateServer::ConnectTemplate; COleTemplateServer::UpdateRegistry; COleUpdateDialog::DoModal; CPalette::CreateHalftonePalette; CRect::InflateRect; CRect::IntersectRect; CRect::IsRectEmpty; CRect::OffsetRect; CRect::Size; CRect::TopLeft; CRectTracker::Draw; CRectTracker::HitTest; CRectTracker::SetCursor; CRectTracker::Track; CScrollView::GetDeviceScrollPosition; CScrollView::SetScrollSizes; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::DoPreparePrinting; CView::GetDocument; CView::IsSelected; CView::OnDragEnter; CView::OnDragLeave; CView::OnDragOver; CView::OnDraw; CView::OnDrop; CView::OnInitialUpdate; CView::OnPrepareDC; CView::OnPreparePrinting; CView::OnScrollBy; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWinApp::RunEmbedded; CWnd::ClientToScreen; CWnd::GetClientRect; CWnd::GetDC; CWnd::GetParentFrame; CWnd::InvalidateRect; CWnd::OnChar; CWnd::OnCreate; CWnd::OnDestroy; CWnd::OnLButtonDblClk; CWnd::OnLButtonDown; CWnd::OnPaletteChanged; CWnd::OnQueryNewPalette; CWnd::OnRButtonDown; CWnd::OnSetCursor; CWnd::OnSetFocus; CWnd::OnSize; CWnd::ReleaseDC; CWnd::SetFocus; CWnd::ShowWindow; CWnd::UpdateWindow; CreateHatchBrush; DeleteItem; DragAcceptFiles; FORMATETC; FillRect; GetDeviceCaps; GetKeyState; GetSysColor; GlobalFree; GlobalLock; GlobalUnlock; LPtoDP; MessageBeep; MulDiv; RGB; RectVisible; RegisterClipboardFormat; ReleaseStgMedium; STGMEDIUM; SelectPalette; SetBkColor; SetBrushOrg; SetMapMode; SetRect; SetTextColor; SetViewportExt; SetWindowExt; abs; afxMemDF; max; memset; min


OLEVIEW: ActiveX Object Viewer

Click to open or copy the OLEVIEW project files.

The OLEVIEW sample illustrates how to implement ActiveX™ Object viewers through custom ActiveX interfaces. These custom interfaces are implemented in Iviewers.dll.

This sample includes two projects that you need to build: Iviewers.mak and Oleview.mak. To run OLEVIEW, make sure that Iviewers.dll is in the same directory as Oleview.exe or in a directory in your path.

The application has an SDI interface with two panes. The left pane allows you to browse the registry by means of a tree control. Once you select a node, the right pane will display the pertinent information.

If you select a type library in the tree control and double-click it, the type library viewer will be called.

This sample demonstrates the following keywords:

AfxGetInstanceHandle; AfxMessageBox; AfxOleInit; AfxThrowMemoryException; AfxThrowOleException; BitBlt; CBitmap::CreateBitmap; CBitmap::LoadBitmap; CBrush::CreateSolidBrush; CCmdTarget::BeginWaitCursor; CCmdTarget::EndWaitCursor; CDC::Attach; CDC::BitBlt; CDC::CreateCompatibleDC; CDC::DeleteDC; CDC::Detach; CDC::GetPixel; CDC::GetTextMetrics; CDC::SelectObject; CDialog::DoModal; CDialog::OnInitDialog; CDocument::OnCloseDocument; CDocument::OnNewDocument; CDocument::UpdateAllViews; CFileDialog::DoModal; CFileDialog::GetPathName; CFont::CreateFontIndirect; CFrameWnd::Create; CFrameWnd::GetActiveDocument; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CFrameWnd::SetActiveView; CGdiObject::DeleteObject; CListBox::SetCurSel; CObject::AssertValid; CObject::Dump; CRect::Height; CRect::Width; CScrollView::SetScrollSizes; CSplitterWnd::CreateStatic; CSplitterWnd::CreateView; CSplitterWnd::GetColumnInfo; CSplitterWnd::GetPane; CSplitterWnd::SetColumnInfo; CStatic::SetIcon; CString::Format; CString::GetBuffer; CString::IsEmpty; CString::LoadString; CString::ReleaseBuffer; CView::GetDocument; CView::OnDragEnter; CView::OnDragLeave; CView::OnDragOver; CView::OnDrop; CView::OnInitialUpdate; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::ExitInstance; CWinApp::InitInstance; CWinApp::OnFileNew; CWinApp::SetRegistryKey; CWnd::DoDataExchange; CWnd::DragAcceptFiles; CWnd::GetParent; CWnd::GetSafeHwnd; CWnd::GetStyle; CWnd::GetWindowPlacement; CWnd::GetWindowRect; CWnd::OnCreate; CWnd::OnDestroy; CWnd::OnSize; CWnd::OnSysColorChange; CWnd::ScreenToClient; CWnd::SetFocus; CWnd::SetFont; CWnd::SetRedraw; CWnd::SetWindowPlacement; CWnd::SetWindowPos; CWnd::SetWindowText; CWnd::ShowWindow; ClientToScreen; CoCreateInstance; CoFreeUnusedLibraries; CoGetClassObject; CoGetMalloc; CreateSolidBrush; DeleteItem; DeleteObject; EnumFontFamilies; ExtTextOut; ExtractIcon; FormatMessage; FreeLibrary; FreeProcInstance; GetBkColor; GetClientRect; GetDC; GetDeviceCaps; GetNearestColor; GetObject; GetParent; GetProcAddress; GetProfileInt; GetProfileString; GetStockObject; GetSysColor; GetSystemMetrics; GetTextExtentPoint; GetTextMetrics; GetUserDefaultLCID; GetVersionEx; GetWindowLong; GetWindowRect; IClassFactory::CreateInstance; IMalloc::Free; IUnknown::QueryInterface; IUnknown::Release; IsWindow; LoadBitmap; LoadIcon; LoadLibrary; LoadLibraryEx; LocalFree; MAKEINTRESOURCE; MakeProcInstance; MulDiv; OffsetRect; Polygon; RGB; RectVisible; RegCloseKey; RegEnumKey; RegOpenKey; RegQueryValue; ReleaseDC; SelectObject; SetBkColor; SetTextColor; SetWindowPos; TabbedTextOut; WinExec; WinHelp; WriteProfileString; _fstrnicmp; atoi; isdigit; isspace; isxdigit; lstrcat; lstrcmpi; lstrcpy; lstrlen; max; strrchr; toupper; wsprintf


SUPERPAD: Demonstrates a Visual Editing Server That Edits Text Using CEditView

Click to open or copy the SUPERPAD project files.

The SUPERPAD sample illustrates how to use the CEditView class in conjunction with Visual Editing server support.

The MULTIPAD sample provides a simple illustration of how to use CEditView. In contrast, SUPERPAD illustrates advanced uses of CEditView through class derivation, including toggling the word wrap state of the edit control and changing the screen and printer font.

SUPERPAD also illustrates a wide variety of Microsoft Foundation Class Library (MFC) programming techniques.

  • About dialog box showing system resource usage.

  • Splash window that is displayed when the application first starts.

  • Persistent window placement by storing window position information in a private .ini file.

  • Idle loop processing.

  • Using a wait cursor.

  • Subclassing a window.

  • Adding page headers and footers during printing.

  • Page breaking during printing.

  • Starting print preview at the current selection in the document.

  • Returning from print preview to the same position in the document as last previewed.

  • Standard font dialog box (CFontDialog).

To use SUPERPAD as a Visual Editing server, run it once as a stand-alone application so that it registers itself with Microsoft Windows®.

When you first run SUPERPAD, it displays a splash window that looks like an About dialog box. It stays on the screen briefly and then vanishes after a time-out. To close the splash window, press any key or click the mouse.

SUPERPAD remembers its window position from the last time you ran it. It also remembers whether the document window was maximized in the MDI frame window.

SUPERPAD Menus

The File menu offers standard commands — New, Open, Close, Save, Save As, Print, Print Preview, Print Setup, the most recently used (MRU) file list, and Exit.

The File menu also offers a Page Setup option you can use to specify a per-page header and/or footer. Leave the header or footer blank if you want none. You can specify any text in the header and footer. You can also specify any of the following formatting codes.

  • &f for the file name.

  • &p for the page number.

  • Any of the formatting codes defined for the C run-time strftime function. For example, %a for the abbreviated weekday name, %B for the full month name, %d for the day of the month, and %Y for the year with century can be specified. These formatting options are not available if you link SUPERPAD to the DLL version of MFC because strftime is not available in a DLL.

Like the simple MULTIPAD sample, SUPERPAD offers the following Edit menu commands, which are handled by default by CEditView: Cut, Copy, Page, Delete, Find. Find Next, Replace, Select All, and Undo. The Edit menu also offers a Word Wrap command to turn word wrapping on or off.

The View menu offers the following commands, which exercise various features of CEditView:

  • Set Tab Stops — enter a single integer in the dialog box for equally spaced tab stops.

  • Set Font — specify the font to be used when displaying the file on the screen.

  • Set Printer Font — specify the font to be used when printing.

  • Mirror Display Font — turn this toggle state on if you want to temporarily deselect the currently specified printer font and instead use a printer font that most closely matches the screen font.

SUPERPAD Classes

SUPERPAD derives its view class CPadView from CEditView. CPadView accesses the attributes and operations of CEditView to add to the functionality of CEditView, as described here.

CPadView calls CEditView::SetFont and SetPrinterFont to initialize and change the screen and printer fonts.

To implement the Edit Word Wrap command, CPadView toggles the state of word wrapping by creating a new edit control (whose WNDCLASS is the standard Windows "edit" control). It toggles the ES_AUTOHSCROLL and WS_HSCROLL styles of the control, which together determine whether an edit control does word wrapping. CPadView saves the buffer of the old edit control and moves it into the new edit control. Finally, it destroys the old edit control and then associates the hWnd of the new edit control with the CPadView class by calling CWnd::SubclassWindow.

CPadView overrides OnPrint to add page headers and footers. It overrides OnBeginPrinting to set the current time, which is optionally displayed in the header, in the footer, or in both. It starts print preview at the current selection in the edit control.

CPadView overrides CView::OnScrollTo to scroll the view to the same position as last viewed during print preview.

This sample demonstrates the following keywords:

AfxGetApp; AfxGetInstanceHandle; AfxMessageBox; AfxOleInit; CArchive::Flush; CArchive::GetFile; CArchive::IsStoring; CBitmap::CreateCompatibleBitmap; CButton::DrawItem; CCmdUI::SetCheck; CDC::Attach; CDC::CreateCompatibleDC; CDC::Detach; CDC::DrawIcon; CDC::FillRect; CDC::GetDeviceCaps; CDC::GetTextMetrics; CDC::IntersectClipRect; CDC::LPtoHIMETRIC; CDC::LineTo; CDC::MoveTo; CDC::Rectangle; CDC::RestoreDC; CDC::SaveDC; CDC::SelectObject; CDC::SetBkMode; CDC::SetWindowExt; CDC::SetWindowOrg; CDC::StretchBlt; CDC::TextOut; CDialog::Create; CDialog::DoModal; CDialog::OnInitDialog; CDocTemplate::SetServerInfo; CDocument::DeleteContents; CDocument::GetFirstViewPosition; CDocument::GetNextView; CEditView::GetEditCtrl; CEditView::GetPrinterFont; CEditView::PrintInsideRect; CEditView::SerializeRaw; CEditView::SetPrinterFont; CEditView::SetTabStops; CEditView::dwStyleDefault; CFile::Write; CFont::CreateFontIndirect; CFontDialog::DoModal; CFrameWnd::ActivateFrame; CFrameWnd::Create; CFrameWnd::LoadFrame; CGdiObject::CreateStockObject; CGdiObject::DeleteObject; CGdiObject::GetObject; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; COleIPFrameWnd::OnCreateControlBars; COleLinkingDoc::OnGetLinkedItem; COleResizeBar::Create; COleServerDoc::IsInPlaceActive; COleServerDoc::OnDeactivateUI; COleServerDoc::OnGetEmbeddedItem; COleServerDoc::UpdateAllItems; COleServerItem::CopyToClipboard; COleServerItem::GetDataSource; COleServerItem::GetDocument; COleServerItem::OnDraw; COleServerItem::OnGetExtent; COleServerItem::OnRenderFileData; COleServerItem::OnShow; COleServerItem::SetItemName; COleTemplateServer::ConnectTemplate; COleTemplateServer::UpdateRegistry; CPrintDialog::CreatePrinterDC; CPrintInfo::SetMaxPage; CRect::Height; CRect::InflateRect; CRect::IsRectEmpty; CRect::SetRect; CRect::Size; CRect::Width; CStatusBar::Create; CStatusBar::SetIndicators; CString::Find; CString::GetBuffer; CString::GetLength; CString::IsEmpty; CString::Left; CString::LoadString; CString::Mid; CString::ReleaseBuffer; CTime::Format; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::GetDocument; CView::OnBeginPrinting; CView::OnPrepareDC; CView::OnPrint; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::ExitInstance; CWinApp::GetProfileInt; CWinApp::GetProfileString; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnIdle; CWinApp::PreTranslateMessage; CWinApp::RegisterShellFileTypes; CWinApp::WriteProfileInt; CWinApp::WriteProfileString; CWnd::BringWindowToTop; CWnd::CenterWindow; CWnd::DestroyWindow; CWnd::Detach; CWnd::DoDataExchange; CWnd::FromHandle; CWnd::GetClientRect; CWnd::GetDC; CWnd::GetDlgCtrlID; CWnd::GetFocus; CWnd::GetFont; CWnd::GetParent; CWnd::GetParentFrame; CWnd::GetStyle; CWnd::GetSuperWndProcAddr; CWnd::GetWindowPlacement; CWnd::GetWindowRect; CWnd::GetWindowText; CWnd::GetWindowTextLength; CWnd::IsZoomed; CWnd::KillTimer; CWnd::OnClose; CWnd::OnCreate; CWnd::OnEraseBkgnd; CWnd::OnRButtonDown; CWnd::OnSize; CWnd::OnTimer; CWnd::PreCreateWindow; CWnd::ReleaseDC; CWnd::ScreenToClient; CWnd::SendMessage; CWnd::SetDlgCtrlID; CWnd::SetDlgItemText; CWnd::SetFocus; CWnd::SetFont; CWnd::SetOwner; CWnd::SetTimer; CWnd::SetWindowPlacement; CWnd::SetWindowPos; CWnd::SetWindowText; CWnd::ShowWindow; CWnd::SubclassDlgItem; CWnd::SubclassWindow; CWnd::UpdateWindow; CreateWindow; DragAcceptFiles; GetCurrentTime; GetObject; GetProfileInt; GetProfileString; GetStockObject; GetSystemMetrics; GlobalMemoryStatus; IsIconic; IsWindowVisible; LOWORD; LoadIcon; MulDiv; SetWindowLong; SetWindowPos; UpdateWindow; WideCharToMultiByte; WriteProfileString; _alloca; _getdrive; lstrcpyn; lstrlen; min; wcstombs; wsprintf


TSTCON: ActiveX Control Test Container

Click to open or copy the TSTCON project files.

The TSTCON sample implements an ActiveX control container using MFC's support for OLE embedding. You can use TSTCON to test ActiveX controls, change their properties, and invoke their methods. You can write scripts using the VBScript language to automate the testing of the controls. TSTCON can keep a log of the events and property change notifications fired by a control.

TSTCON also demonstrates several MFC programming topics, including the following.

  • CCheckListBox: A list box with a check box next for each item.

  • CDragListBox: A list box in which you can drag the items to rearrange their order.

  • Implementing an Active Scripting Engine host (VBScript).

  • Implementing context-sensitive help for dialog boxes.

Running the Sample

To launch a control in the container

  1. From the Tools menu, click ActiveX Control Test Container.

  2. In Test Container, from the Edit menu, click Insert New Control.

  3. From the list box, select Calendar Control 8.0, and click OK. The Microsoft Calendar Control appears in the upper half of the splitter window.

  4. Manipulate the calendar by changing month, year, and date. In the lower pane, observe how the logs, events, and property change notifications are fired by the control as you manipulate it.

To change the control's properties

  1. Select the calendar control by clicking the calendar's border.

  2. From the Edit menu, click Properties. Test Container displays the Properties dialog box for the control.

  3. Using this dialog box, you can edit the properties of the control. Change the control's properties and observe the changes.

  4. Close the Properties dialog box.

To invoke methods on the control

  1. From the Control menu, click Invoke Methods. The Invoke Method dialog box appears.

  2. In the Method Name combo box, select BackColor (PropPut).

  3. From the Parameter Type combo box, select VT_COLOR.

  4. Click Choose Color, choose a color from the color palette, and click OK.

  5. In the Invoke Method dialog box, click Invoke. The background color of the calendar control changes to the color you selected in the color palette.

For more information on how to use the Test Container, from the Help menu, click Help Topics.


WORDPAD: The Windows 95 Application

Click to open or copy the WORDPAD project files.

WORDPAD is the word processing application included with Windows 95. It is an example of a full-fledged word processing application written using the Microsoft Foundation Class Library (MFC).

The SUPERPAD sample illustrates a basic word processor based on the CEditView class. In contrast, WORDPAD is based on the CRichEditView, CRichEditDoc, and CRichEditCntrItem classes, and — besides supporting the features that SUPERPAD supports — also demonstrates the following features.

  • The ability to read, write, and convert between multiple file formats, including the Word for Windows 6.0 file format, .rtf (Rich Text Format), and ASCII text.

  • Text formatting, including the use of fonts, character formatting (bold, italics, underlining), color, and point sizes. These attributes are available in a formatting toolbar.

  • Per-paragraph formatting, including alignment (left, center, or right), tabs, margins, and first-line indentation. These attributes are also available in a ruler toolbar.

  • Undo support.

  • ActiveX™ component support, both container and server.

WORDPAD comes with a help file describing its user interface.

This sample demonstrates the following keywords:

AfxBeginThread; AfxFormatString1; AfxFormatString2; AfxGetApp; AfxGetAppName; AfxGetInstanceHandle; AfxGetMainWnd; AfxMessageBox; AfxOleGetMessageFilter; AfxOleInit; AfxOleSetUserCtrl; AfxRegisterClass; AfxRegisterWndClass; AfxThrowFileException; AfxThrowNotSupportedException; AfxThrowResourceException; BitBlt; CArchive::Close; CArchive::Read; CArchive::Write; CBrush::CreateSolidBrush; CButton::DrawItem; CComboBox::AddString; CComboBox::CompareItem; CComboBox::Create; CComboBox::DrawItem; CComboBox::FindString; CComboBox::FindStringExact; CComboBox::GetCount; CComboBox::GetCurSel; CComboBox::GetDroppedState; CComboBox::GetItemData; CComboBox::GetItemHeight; CComboBox::GetLBText; CComboBox::InsertString; CComboBox::LimitText; CComboBox::MeasureItem; CComboBox::ResetContent; CComboBox::SetCurSel; CComboBox::SetItemData; CComboBox::SetItemHeight; CComboBox::ShowDropDown; CControlBar::EnableDocking; CDC::Attach; CDC::BitBlt; CDC::CreateCompatibleDC; CDC::CreateIC; CDC::Detach; CDC::DrawFocusRect; CDC::DrawText; CDC::ExtTextOut; CDC::FillRect; CDC::GetBkColor; CDC::GetDeviceCaps; CDC::GetTextColor; CDC::GetTextExtent; CDC::GetTextMetrics; CDC::LineTo; CDC::MoveTo; CDC::Rectangle; CDC::RestoreDC; CDC::SaveDC; CDC::SelectObject; CDC::SetBkMode; CDC::SetTextColor; CDC::SetViewportOrg; CDC::TextOut; CDialog::Create; CDialog::DoModal; CDialog::EndDialog; CDialog::GetDefID; CDialog::InitModalIndirect; CDialog::OnInitDialog; CDialog::OnOK; CDialog::SetDefID; CDocTemplate::GetDocString; CDocument::GetFirstViewPosition; CDocument::GetNextView; CFile::Abort; CFile::Close; CFile::Flush; CFile::GetLength; CFile::GetPosition; CFile::GetStatus; CFile::LockRange; CFile::Open; CFile::Read; CFile::Seek; CFile::SeekToBegin; CFile::SetLength; CFile::UnlockRange; CFile::Write; CFileDialog::DoModal; CFont::CreateFontIndirect; CFrameWnd::ActivateFrame; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::GetActiveDocument; CFrameWnd::GetActiveView; CFrameWnd::RecalcLayout; CFrameWnd::SetMessageText; CGdiObject::Attach; CGdiObject::CreateStockObject; CListBox::AddString; CListBox::GetCurSel; CListBox::SetCurSel; CMenu::AppendMenu; CMenu::CreatePopupMenu; CMenu::DeleteMenu; CMenu::Detach; CMenu::DrawItem; CMenu::FromHandle; CMenu::GetMenuItemCount; CMenu::GetSubMenu; CMenu::LoadMenu; CMenu::MeasureItem; CMenu::RemoveMenu; CMenu::TrackPopupMenu; CObject::AssertValid; CObject::Dump; CObject::Serialize; COleDataObject::Attach; COleDataObject::IsDataAvailable; COleDataSource::CacheData; COleDropTarget::Register; COleIPFrameWnd::OnCreateControlBars; COleIPFrameWnd::RepositionFrame; COleMessageFilter::EnableBusyDialog; COleResizeBar::Create; COleServerItem::GetClipboardData; COleServerItem::GetDocument; COleServerItem::OnDraw; COleServerItem::OnDrawEx; COleServerItem::OnGetExtent; COleStreamFile::OpenStream; COleTemplateServer::ConnectTemplate; CPalette::GetPaletteEntries; CPoint::Offset; CRect::BottomRight; CRect::CopyRect; CRect::Height; CRect::IntersectRect; CRect::OffsetRect; CRect::PtInRect; CRect::SetRect; CRect::SetRectEmpty; CRect::Size; CRect::TopLeft; CRect::Width; CStatusBar::Create; CStatusBar::SetIndicators; CString::Collate; CString::Empty; CString::FindOneOf; CString::GetBuffer; CString::GetBufferSetLength; CString::GetLength; CString::IsEmpty; CString::LoadString; CString::MakeUpper; CString::ReleaseBuffer; CString::Right; CToolBar::CommandToIndex; CToolBar::Create; CToolBar::GetItemRect; CToolBar::LoadBitmap; CToolBar::SetButtonInfo; CToolBar::SetButtons; CToolBar::SetSizes; CWinApp::Enable3dControls; CWinApp::ExitInstance; CWinApp::GetProfileInt; CWinApp::InitInstance; CWinApp::LoadIcon; CWinApp::LoadStdProfileSettings; CWinApp::OnDDECommand; CWinApp::OnFileNew; CWinApp::OnFileOpen; CWinApp::OpenDocumentFile; CWinApp::PreTranslateMessage; CWinApp::SetRegistryKey; CWinApp::WinHelp; CWinApp::WriteProfileInt; CWnd::BringWindowToTop; CWnd::CalcWindowRect; CWnd::CenterWindow; CWnd::ClientToScreen; CWnd::Create; CWnd::DestroyWindow; CWnd::DoDataExchange; CWnd::EnableWindow; CWnd::FromHandle; CWnd::GetCapture; CWnd::GetClientRect; CWnd::GetDlgCtrlID; CWnd::GetDlgItem; CWnd::GetFocus; CWnd::GetNextDlgTabItem; CWnd::GetOwner; CWnd::GetParent; CWnd::GetParentFrame; CWnd::GetSafeHwnd; CWnd::GetScrollPos; CWnd::GetStyle; CWnd::GetWindowPlacement; CWnd::GetWindowRect; CWnd::GetWindowTextLength; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::IsChild; CWnd::IsWindowEnabled; CWnd::MoveWindow; CWnd::OnCommand; CWnd::OnCreate; CWnd::OnDestroy; CWnd::OnDevModeChange; CWnd::OnDropFiles; CWnd::OnEnable; CWnd::OnEraseBkgnd; CWnd::OnFontChange; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::OnMove; CWnd::OnPaletteChanged; CWnd::OnQueryNewPalette; CWnd::OnShowWindow; CWnd::OnSize; CWnd::OnSysColorChange; CWnd::OnWindowPosChanged; CWnd::OnWindowPosChanging; CWnd::PreCreateWindow; CWnd::PreTranslateMessage; CWnd::ScreenToClient; CWnd::SendMessage; CWnd::SetCapture; CWnd::SetDlgItemText; CWnd::SetFocus; CWnd::SetOwner; CWnd::SetWindowPos; CWnd::SetWindowText; CWnd::ShowWindow; CWnd::SubclassDlgItem; CWnd::UpdateWindow; CloseHandle; CommDlgExtendedError; CreateEvent; CreateFontIndirect; CreateILockBytesOnHGlobal; CreatePen; CreateSolidBrush; DeleteAtom; DeleteObject; DragAcceptFiles; DragFinish; DragQueryFile; EnumDateFormats; EnumFontFamilies; EnumTimeFormats; EnumWindows; FORMATETC; FindResource; FindWindow; FormatMessage; FreeLibrary; GetClassInfo; GetClassName; GetClientRect; GetClipboardData; GetDC; GetDateFormat; GetDeviceCaps; GetDlgItem; GetKeyState; GetLocalTime; GetLocaleInfo; GetModuleFileName; GetModuleHandle; GetObject; GetProcAddress; GetProfileInt; GetShortPathName; GetStockObject; GetSysColor; GetSystemMetrics; GetTextMetrics; GetTimeFormat; GetUserDefaultLCID; GetVersion; GetWindow; GetWindowText; GlobalAddAtom; GlobalAlloc; GlobalFree; GlobalGetAtomName; GlobalLock; GlobalSize; GlobalUnlock; HIWORD; InvalidateRect; KillTimer; LOWORD; LineTo; LoadBitmap; LoadCursor; LoadIcon; LoadLibrary; LoadString; MAKEINTRESOURCE; MAKELPARAM; MessageBeep; MoveTo; MsgWaitForMultipleObjects; MulDiv; OleInitialize; OleUninitialize; OpenFile; PeekMessage; PtInRect; RGB; ReadClassStg; RegCloseKey; RegCreateKey; RegOpenKey; RegQueryValueEx; RegSetValueEx; RegisterClipboardFormat; ReleaseCapture; ReleaseDC; ReleaseStgMedium; ResetEvent; RestoreDC; RoundRect; STGMEDIUM; SaveDC; SelectObject; SendMessage; SendMessageTimeout; SetEvent; SetFocus; SetForegroundWindow; SetROP2; SetRect; SetTimer; SetWindowPos; SetWindowText; ShellAbout; ShowWindow; StgCreateDocfileOnILockBytes; StgOpenStorage; WinHelp; div; isspace; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; max; memcmp; memcpy; memmove; memset; min; strcpy; wsprintf


AUTOCLIK: Automation Server Application

Click to open or copy STEP1

Click to open or copy STEP2

Click to open or copy STEP3

AUTOCLIK is a simple Automation (formerly OLE Automation) server application. The AUTOCLIK sample has three subdirectories, AUTOCLIK\STEP1, STEP2, and STEP3, that correspond to steps in the Automation Server Tutorial. AUTOCLIK illustrates the following.

  • Automation starter code created by AppWizard.

  • ClassWizard options for creating automation-enabled CCmdTarget-derived classes and for adding automation properties and methods.

  • Exposing existing class members and functions to other applications using Automation.

  • Multiple dispatch interfaces in a single Microsoft Foundation Class Library (MFC) application.

  • Accessing this automation object via Visual Basic (Step 3).

The STEP1 sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; AfxOleLockApp; AfxOleUnlockApp; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::OnNewDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CObject::AssertValid; CObject::Dump; CObject::Serialize; COleTemplateServer::ConnectTemplate; COleTemplateServer::UpdateRegistry; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::PreCreateWindow; CWnd::ShowWindow; CWnd::UpdateWindow; DragAcceptFiles; TextOut

The STEP2 sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; AfxOleLockApp; AfxOleUnlockApp; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnNewDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::ActivateFrame; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CObject::AssertValid; CObject::Dump; CObject::Serialize; COleTemplateServer::ConnectTemplate; COleTemplateServer::UpdateRegistry; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::GetParentFrame; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::PreCreateWindow; CWnd::ShowWindow; CWnd::UpdateWindow; DragAcceptFiles; ShowWindow; TextOut

The STEP3 sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; AfxOleLockApp; AfxOleUnlockApp; CCmdTarget::EnableAutomation; CCmdTarget::FromIDispatch; CCmdTarget::GetIDispatch; CCmdTarget::OnFinalRelease; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnNewDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::ActivateFrame; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; COleTemplateServer::ConnectTemplate; COleTemplateServer::UpdateRegistry; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::GetParentFrame; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::PreCreateWindow; CWnd::ShowWindow; CWnd::UpdateWindow; DragAcceptFiles; ShowWindow; TextOut


AUTODRIV: Automation Client Application

Click to open or copy the AUTODRIV project files.

AUTODRIV is a simple Automation (formerly OLE Automation) client application that drives the AUTOCLIK tutorial sample. The AUTODRIV sample can be used to test AUTOCLIK. AUTODRIV is also a good demonstration of how to write an automation driver application.

To run AUTODRIV, you must first build and register the AUTOCLIK sample. AUTODRIV will launch the AUTOCLIK sample and create a document that you can manipulate using the interface provided by AUTODRIV.

See the Automation Server Tutorial for more information on the AUTODRIV user interface. This AUTODRIV sample is discussed in the AUTOCLIK tutorial.

This sample demonstrates the following keywords:

AfxGetApp; AfxMessageBox; AfxOleInit; CDC::DrawIcon; CDC::GetSafeHdc; CDialog::DoModal; CDialog::EndDialog; COleDispatchDriver::AttachDispatch; COleDispatchDriver::GetProperty; COleDispatchDriver::InvokeHelper; COleDispatchDriver::SetProperty; CRect::Height; CRect::Width; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::IsIconic; CWnd::OnClose; CWnd::OnCreate; CWnd::OnPaint; CWnd::OnQueryDragIcon; CWnd::SendMessage; CWnd::ShowWindow; CWnd::UpdateData; GetSystemMetrics; LoadIcon; ShowWindow


CIRC: ActiveX Control

Click to open or copy the CIRC1 project files.

CIRC1: The Circle control just after it is created with ControlWizard.

Click to open or copy the CIRC2 project files.

CIRC2: The Circle control after several properties and events have been added.

Click to open or copy the CIRC3 project files.

CIRC3: The completed Circle control. Demonstrates ActiveX control basics, including control painting, stock and custom properties, stock and custom events, use of colors and fonts, the stock Font property page, the default property page, and versioning.

CIRC is a simple example of an ActiveX Control. The CIRC sample has three subdirectories, CIRC1, CIRC2 and CIRC3, that correspond to steps in the Circle Application Tutorial. CIRC illustrates the following.

  • Change the painting behavior of an ActiveX control

  • Adding stock properties

  • Adding custom properties

  • Responding to mouse events

  • Adding custom events

  • Using text and fonts

  • Implementing ActiveX control property pages

  • Using simple data binding for control properties

The CIRC1 sample demonstrates the following keywords:

AfxGetInstanceHandle; CDialog::DoModal; Ellipse; FillRect; GetStockObject; MAKELONG

The CIRC2 sample demonstrates the following keywords:

AfxGetInstanceHandle; CDC::Ellipse; CDC::SelectObject; CDC::SelectStockObject; CDialog::DoModal; Ellipse; FillRect; GetClientRect; GetDC; MAKELONG; RGB; ReleaseDC; SelectObject

The CIRC3 sample demonstrates the following keywords:

AfxGetInstanceHandle; CDC::Ellipse; CDC::SelectObject; CDC::SelectStockObject; CDialog::DoModal; CString::AllocSysString; CString::GetLength; Ellipse; ExtTextOut; FillRect; GetClientRect; GetDC; GetVersion; MAKELONG; RGB; ReleaseDC; SelectObject; SetBkMode; SetTextAlign; SetTextColor


CONTAINER: Visual Editing Container Application

Click to open or copy STEP1

Click to open or copy STEP2

CONTAINER is a simple example of a Visual Editing container application. The CONTAINER sample has two subdirectories, CONTAIN\STEP1 and STEP2, that correspond to steps in the Container Application Tutorial. CONTAINER illustrates the following.

  • Container starter code created by AppWizard.

  • The application-specific classes CContainerItem and CContainerView and the MFC classes COleClientItem and COleDocument.

  • Selection and hit detection of embedded objects.

  • Activation of embedded objects.

  • Tracker rectangles using the CRectTracker class.

For examples of more advanced Visual Editing container features, see the DRAWCLI and OCLIENT sample applications.

The STEP1 sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; AfxThrowMemoryException; CCmdTarget::BeginWaitCursor; CCmdTarget::EndWaitCursor; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocTemplate::SetContainerInfo; CDocument::OnNewDocument; CDocument::UpdateAllViews; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CObject::AssertValid; CObject::Dump; CObject::Serialize; COleClientItem::Close; COleClientItem::Deactivate; COleClientItem::Delete; COleClientItem::DoVerb; COleClientItem::Draw; COleClientItem::GetActiveView; COleClientItem::GetDocument; COleClientItem::GetInPlaceWindow; COleClientItem::GetItemState; COleClientItem::OnChange; COleClientItem::OnChangeItemPosition; COleClientItem::OnDeactivateUI; COleClientItem::OnGetItemPosition; COleClientItem::SetItemRects; COleDocument::EnableCompoundFile; COleDocument::GetNextItem; COleDocument::GetStartPosition; COleInsertDialog::CreateItem; COleInsertDialog::DoModal; COleInsertDialog::GetSelectionType; CRect::PtInRect; CRectTracker::Draw; CRectTracker::SetCursor; CRectTracker::Track; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::IsSelected; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::Invalidate; CWnd::OnCreate; CWnd::OnLButtonDblClk; CWnd::OnLButtonDown; CWnd::OnSetCursor; CWnd::OnSetFocus; CWnd::OnSize; CWnd::PreCreateWindow; CWnd::SetFocus; CWnd::ShowWindow; CWnd::UpdateWindow; DragAcceptFiles; GetKeyState; SetRect

The STEP2 sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; AfxThrowMemoryException; CArchive::IsStoring; CCmdTarget::BeginWaitCursor; CCmdTarget::EndWaitCursor; CDC::HIMETRICtoDP; CDialog::DoModal; CDocTemplate::SetContainerInfo; CDocument::OnNewDocument; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CObject::AssertValid; CObject::Dump; CObject::Serialize; COleClientItem::Close; COleClientItem::CreateFromClipboard; COleClientItem::Deactivate; COleClientItem::Delete; COleClientItem::DoVerb; COleClientItem::Draw; COleClientItem::GetActiveView; COleClientItem::GetDocument; COleClientItem::GetInPlaceWindow; COleClientItem::GetItemState; COleClientItem::IsInPlaceActive; COleClientItem::OnChange; COleClientItem::OnChangeItemPosition; COleClientItem::OnDeactivateUI; COleClientItem::OnGetItemPosition; COleClientItem::SetItemRects; COleClientItem::UpdateLink; COleDocument::EnableCompoundFile; COleDocument::GetNextItem; COleDocument::GetStartPosition; COleInsertDialog::CreateItem; COleInsertDialog::DoModal; COleInsertDialog::GetSelectionType; CRect::PtInRect; CRect::SetRect; CRect::Size; CRectTracker::Draw; CRectTracker::GetTrueRect; CRectTracker::SetCursor; CRectTracker::Track; CView::DoPreparePrinting; CView::GetDocument; CView::IsSelected; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnLButtonDblClk; CWnd::OnLButtonDown; CWnd::OnSetCursor; CWnd::OnSetFocus; CWnd::OnSize; CWnd::PreCreateWindow; CWnd::SetFocus; CWnd::ShowWindow; CWnd::UpdateWindow; DragAcceptFiles; GetKeyState


ENROLL: A Sample MFC Database Application

Click to open or copy STEP1

Click to open or copy STEP2

Click to open or copy STEP3

Click to open or copy STEP4

ENROLL is an example of a Microsoft Foundation Class Library (MFC) database application. The ENROLL sample has four subdirectories, named STEP1, STEP2, STEP3 and STEP4. The first three subdirectories correspond to steps in the Database Tutorial. STEP4, which adds more advanced features to the ENROLL database application, is not discussed in the tutorial but is discussed below.

The first three steps of ENROLL illustrate the following.

  • Code created by the AppWizard database option.

  • CRecordset and CRecordView classes.

  • Using MFC database classes in conjunction with the framework's document/view architecture.

  • Adding, updating, and deleting database records.

  • Handling database exceptions.

STEP4 of ENROLL illustrates the following.

  • Using multiple CRecordView-derived classes.

  • Switching views in a frame window.

  • Using update hints and CDocument::UpdateAllViews to coordinate multiple record views.

ENROLL STEP4 has the same user interface as ENROLL STEP3, with the addition of a new Form menu and a Course form. The Form menu lets you toggle between the Sections form and the Course form. When you add or delete a course in the Course form, the change is automatically reflected in the list of courses displayed in the dialog box in the Section form.

Note To run the ENROLL application, you must first set up the Student Registration Database and register it with ODBC. For information about how to do this, see Setting Up the Student Registration Data Source.

The STEP1 sample demonstrates the following keywords:

CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::OnNewDocument; CFieldExchange::SetFieldType; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CRecordView::OnGetRecordset; CRecordset::DoFieldExchange; CRecordset::GetDefaultConnect; CRecordset::GetDefaultSQL; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::PreCreateWindow

The STEP2 sample demonstrates the following keywords:

CComboBox::AddString; CComboBox::GetCurSel; CComboBox::GetLBText; CComboBox::ResetContent; CComboBox::SetCurSel; CDialog::DoModal; CDocument::OnNewDocument; CFieldExchange::SetFieldType; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CRecordView::OnGetRecordset; CRecordset::DoFieldExchange; CRecordset::GetDefaultConnect; CRecordset::GetDefaultSQL; CRecordset::IsEOF; CRecordset::IsOpen; CRecordset::MoveNext; CRecordset::Open; CRecordset::Requery; CRecordset::SetFieldNull; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::PreCreateWindow; CWnd::UpdateData

The STEP3 sample demonstrates the following keywords:

AfxMessageBox; CComboBox::AddString; CComboBox::ResetContent; CComboBox::SetCurSel; CDialog::DoModal; CDocument::OnNewDocument; CEdit::SetReadOnly; CFieldExchange::SetFieldType; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CRecordView::OnGetRecordset; CRecordView::OnMove; CRecordset::AddNew; CRecordset::Delete; CRecordset::DoFieldExchange; CRecordset::GetDefaultConnect; CRecordset::GetDefaultSQL; CRecordset::IsBOF; CRecordset::IsEOF; CRecordset::IsOpen; CRecordset::Move; CRecordset::MoveLast; CRecordset::MoveNext; CRecordset::Open; CRecordset::SetFieldNull; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::PreCreateWindow; CWnd::UpdateData

The STEP4 sample demonstrates the following keywords:

AfxMessageBox; CComboBox::AddString; CComboBox::DeleteString; CComboBox::FindStringExact; CComboBox::GetCurSel; CComboBox::GetLBText; CComboBox::ResetContent; CComboBox::SetCurSel; CDatabase::IsOpen; CDialog::DoModal; CDocument::OnNewDocument; CEdit::SetReadOnly; CFieldExchange::SetFieldType; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::GetActiveView; CFrameWnd::RecalcLayout; CFrameWnd::SetActiveView; CFrameWnd::rectDefault; CObject::AssertValid; CObject::Dump; CObject::GetRuntimeClass; CObject::IsKindOf; CRecordView::OnGetRecordset; CRecordView::OnMove; CRecordset::AddNew; CRecordset::Delete; CRecordset::DoFieldExchange; CRecordset::GetDefaultSQL; CRecordset::IsBOF; CRecordset::IsEOF; CRecordset::IsOpen; CRecordset::MoveLast; CRecordset::MoveNext; CRecordset::Open; CRecordset::Requery; CRecordset::SetFieldNull; CRecordset::Update; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::Create; CWnd::DoDataExchange; CWnd::GetDlgItem; CWnd::GetWindowText; CWnd::OnCreate; CWnd::PreCreateWindow; CWnd::SetDlgCtrlID; CWnd::ShowWindow; CWnd::UpdateData


SCRIBBLE: Illustrates Use of Foundation Class Libraries

Click to open or copy STEP1

Click to open or copy STEP2

Click to open or copy STEP3

Click to open or copy STEP4

Click to open or copy STEP5

Click to open or copy STEP6

Click to open or copy STEP7

SCRIBBLE is the tutorial sample application discussed in Visual C++® Tutorials. The SCRIBBLE sample directory has seven subdirectories that correspond to different steps in the tutorial. Each subdirectory contains the complete sources for a given step.

SCRIBBLE provides simple illustrations of a wide breadth of MFC features. Step 1 through Step 6 of the Scribble Tutorial give the best introduction to the following framework features.

  • Application objects

  • Documents, views, and document templates

  • Commands, message maps, and command user interface updating

  • MDI (multiple document interface) frame and child windows

  • Toolbars and status bars

  • Update hints from documents to views

  • Dialogs, data exchange, and validation

  • Scroll view

  • Splitter window

  • Printing and print preview

  • Context-sensitive Help

Refer to other samples for illustrations of advanced use of the above features, and for illustrations of many other features not covered in the tutorial.

Step 7, Creating an OLE Server, of the Scribble Tutorial adds another step to the development of the SCRIBBLE application by introducing OLE Visual Editing server functionality.

The STEP1 sample demonstrates the following keywords:

CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CDialog::DoModal; CDocument::DeleteContents; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetModifiedFlag; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CObList::GetHeadPosition; CObList::GetNext; CObject::AssertValid; CObject::Dump; CObject::Serialize; CPen::CreatePen; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::PreCreateWindow; CWnd::SetCapture; CWnd::ShowWindow; CWnd::UpdateWindow; CreatePen; DragAcceptFiles; LineTo; MoveTo; RGB; ReleaseCapture; SelectObject

The STEP2 sample demonstrates the following keywords:

CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CDialog::DoModal; CDocument::DeleteContents; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CObList::GetHeadPosition; CObList::GetNext; CObject::AssertValid; CObject::Dump; CObject::Serialize; CPen::CreatePen; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::PreCreateWindow; CWnd::SetCapture; CWnd::ShowWindow; CWnd::UpdateWindow; CreatePen; DeleteObject; DragAcceptFiles; LineTo; MoveTo; RGB; ReleaseCapture; SelectObject

The STEP3 sample demonstrates the following keywords:

CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CDialog::DoModal; CDocument::DeleteContents; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CObList::GetHeadPosition; CObList::GetNext; CObject::AssertValid; CObject::Dump; CObject::Serialize; CPen::CreatePen; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::PreCreateWindow; CWnd::SetCapture; CWnd::ShowWindow; CWnd::UpdateWindow; CreatePen; DeleteObject; DragAcceptFiles; LineTo; MoveTo; RGB; ReleaseCapture; SelectObject

The STEP4 sample demonstrates the following keywords:

CArchive::IsStoring; CCmdUI::Enable; CCmdUI::SetCheck; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDC::DPtoLP; CDC::GetClipBox; CDC::LPtoDP; CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CDialog::DoModal; CDocument::DeleteContents; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CMDIChildWnd::Create; CObList::GetHeadPosition; CObList::GetNext; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; CPen::CreatePen; CRect::InflateRect; CRect::IntersectRect; CRect::SetRectEmpty; CScrollView::SetScrollSizes; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPrepareDC; CView::OnPreparePrinting; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::PreCreateWindow; CWnd::SetCapture; CWnd::ShowWindow; CWnd::UpdateWindow; CreatePen; DeleteObject; DragAcceptFiles; RGB; ReleaseCapture; SetRectEmpty; max; min

The STEP5 sample demonstrates the following keywords:

CDC::DPtoLP; CDC::GetTextMetrics; CDC::LPtoDP; CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CDC::SetTextAlign; CDC::SetWindowOrg; CDC::TextOut; CDialog::DoModal; CDocument::DeleteContents; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFont::CreateFontIndirect; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CObList::GetHeadPosition; CObList::GetNext; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; CPen::CreatePen; CRect::InflateRect; CRect::IntersectRect; CScrollView::SetScrollSizes; CSplitterWnd::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPrepareDC; CView::OnPreparePrinting; CView::OnPrint; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::PreCreateWindow; CWnd::SetCapture; CWnd::ShowWindow; CWnd::UpdateWindow; CreatePen; DeleteObject; DragAcceptFiles; GetClipBox; LPtoDP; LineTo; MoveTo; RGB; ReleaseCapture; SelectObject; SetRectEmpty; max; memset; min

The STEP6 sample demonstrates the following keywords:

CArchive::IsStoring; CCmdUI::Enable; CCmdUI::SetCheck; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDC::DPtoLP; CDC::GetClipBox; CDC::LPtoDP; CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CDialog::DoModal; CDocument::DeleteContents; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFont::CreateFontIndirect; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CMDIChildWnd::Create; CObList::GetHeadPosition; CObList::GetNext; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; CPen::CreatePen; CPrintInfo::SetMaxPage; CRect::InflateRect; CRect::IntersectRect; CRect::SetRectEmpty; CScrollView::SetScrollSizes; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPrepareDC; CView::OnPreparePrinting; CView::OnPrint; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::PreCreateWindow; CWnd::SetCapture; CWnd::ShowWindow; CWnd::UpdateWindow; CreatePen; DeleteObject; DragAcceptFiles; GetTextMetrics; LineTo; MoveTo; RGB; ReleaseCapture; SelectObject; SetRectEmpty; SetTextAlign; SetWindowOrg; TextOut; max; memset; min

The STEP7 sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; CArchive::IsStoring; CCmdUI::Enable; CCmdUI::SetCheck; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDC::DPtoLP; CDC::GetDeviceCaps; CDC::GetTextMetrics; CDC::LPtoDP; CDC::LPtoHIMETRIC; CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CDC::SetMapMode; CDC::SetTextAlign; CDC::SetViewportExt; CDC::SetWindowExt; CDC::SetWindowOrg; CDC::TextOut; CDialog::DoModal; CDocTemplate::SetServerInfo; CDocument::DeleteContents; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFont::CreateFontIndirect; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CObList::GetHeadPosition; CObList::GetNext; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; COleDocument::EnableCompoundFile; COleIPFrameWnd::OnCreateControlBars; COleServerDoc::GetEmbeddedItem; COleServerDoc::GetZoomFactor; COleServerDoc::NotifyChanged; COleServerDoc::OnGetEmbeddedItem; COleServerDoc::OnSetItemRects; COleServerItem::CopyToClipboard; COleServerItem::GetDocument; COleServerItem::IsLinkedItem; COleServerItem::OnDraw; COleServerItem::OnGetExtent; COleTemplateServer::ConnectTemplate; COleTemplateServer::UpdateRegistry; CPen::CreatePen; CRect::InflateRect; CRect::IntersectRect; CRect::SetRectEmpty; CScrollView::SetScrollSizes; CSplitterWnd::Create; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPrepareDC; CView::OnPreparePrinting; CView::OnPrint; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::OnSize; CWnd::PreCreateWindow; CWnd::SetCapture; CWnd::SetOwner; CWnd::ShowWindow; CWnd::UpdateWindow; CreatePen; DeleteObject; DragAcceptFiles; GetClipBox; LPtoDP; RGB; ReleaseCapture; SetRectEmpty; max; memset; min

The STEP8 sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDC::DPtoLP; CDC::GetClipBox; CDC::GetDeviceCaps; CDC::LPtoDP; CDC::LPtoHIMETRIC; CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CDC::SetMapMode; CDC::SetViewportExt; CDC::SetWindowExt; CDialog::DoModal; CDocTemplate::SetServerInfo; CDocument::DeleteContents; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFont::CreateFontIndirect; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CMDIChildWnd::Create; CObList::GetHeadPosition; CObList::GetNext; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; COleDocument::EnableCompoundFile; COleDropTarget::Register; COleIPFrameWnd::OnCreateControlBars; COleResizeBar::Create; COleServerDoc::GetEmbeddedItem; COleServerDoc::GetZoomFactor; COleServerDoc::NotifyChanged; COleServerDoc::OnGetEmbeddedItem; COleServerDoc::OnSetItemRects; COleServerItem::CopyToClipboard; COleServerItem::GetDocument; COleServerItem::IsLinkedItem; COleServerItem::OnDraw; COleServerItem::OnGetExtent; COleTemplateServer::ConnectTemplate; COleTemplateServer::UpdateRegistry; CPen::CreatePen; CPrintInfo::SetMaxPage; CRect::InflateRect; CRect::IntersectRect; CScrollView::SetScrollSizes; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPrepareDC; CView::OnPreparePrinting; CView::OnPrint; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::OnSize; CWnd::PreCreateWindow; CWnd::SetCapture; CWnd::SetOwner; CWnd::ShowWindow; CWnd::UpdateWindow; CreatePen; DeleteObject; DragAcceptFiles; GetDeviceCaps; GetTextMetrics; LineTo; MoveTo; RGB; ReleaseCapture; SelectObject; SetMapMode; SetRectEmpty; SetTextAlign; SetViewportExt; SetWindowExt; SetWindowOrg; TextOut; max; memset; min


GUIDGEN: Generates Globally Unique Identifiers (GUIDs)

Click to open or copy the GUIDGEN project files.

The GUIDGEN sample is a simple dialog-based Microsoft Foundation Class Library (MFC) application that can help you as you code ActiveX™ applications. GUIDGEN can be used to generate globally unique identifiers, or GUIDs, that identify classes, objects, and interfaces. GUIDGEN can be used in place of the Class ID Generator, which is a part of the OLE SDK.

To run GUIDGEN, just build the sample and run the application. The application will present a dialog box, which serves as its complete user interface.

The radio buttons in the "GUID Format" group box determine the format of the GUID the program will generate. The first format is designed to be used in invocations of MFC's IMPLEMENT_OLECREATE macro.

The second format generates a reference to the DEFINE_GUID macro.

The remaining formats are appropriate for statically allocated GUIDs and GUIDs included in registry entries or registry editor scripts.

Once you've selected the format for your GUID, you can copy it to the Clipboard with the Copy button. You can return to your editor and paste the GUID code into your application's source. When you need to generate a new GUID, press the New Guid button.

Aside from being a dialog-box based application, GUIDGEN also shows how MFC applications can paste text data to the Clipboard. The CGuidGenDlg::OnOK function in the GUIDGDLG.CPP file shows how OpenClipboard and SetClipboardData can be called to accomplish this task. The application also demonstrates calling the CoCreateGuid API to request a new GUID from the operating system. Look for this code in CGuidGenDlg::OnNewguid, which is also in the GUIDGDLG.CPP file.

This sample demonstrates the following keywords:

AfxGetApp; AfxMessageBox; CDC::DrawIcon; CDC::GetSafeHdc; CDialog::DoModal; CDialog::EndDialog; CDialog::OnInitDialog; CDialog::OnOK; CMenu::AppendMenu; CRect::Height; CRect::Width; CString::Format; CString::GetLength; CString::IsEmpty; CString::LoadString; CWinApp::Enable3dControls; CWinApp::ExitInstance; CWinApp::InitInstance; CWinApp::SetRegistryKey; CWnd::CenterWindow; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetParent; CWnd::GetSystemMenu; CWnd::IsIconic; CWnd::OnPaint; CWnd::OnQueryDragIcon; CWnd::OnSysCommand; CWnd::OpenClipboard; CWnd::SendMessage; CWnd::SetDlgItemText; CWnd::UpdateData; CloseClipboard; CoInitialize; CoUninitialize; EmptyClipboard; GetForegroundWindow; GetProfileInt; GetSystemMetrics; GlobalAlloc; GlobalLock; GlobalUnlock; LoadIcon; SetClipboardData; memcpy


MAKEHM: Utility for Associating Resources with Help Contexts

Click to open or copy the MAKEHM project files.

MAKEHM is a console application that produces a mapping between resource identifications and Help contexts. The sources are provided for MAKEHM to serve as an illustration of a console application that uses the Microsoft Foundation Class Library (MFC), and to enable you to modify the tool.

A console application such as MAKEHM is linked with the same variant of the MFC library as GUI (graphical user interface) applications.

Normally, you do not need to run MAKEHM directly. Custom build rules on the resource.h file will determine when it is run. For Visual C++ 6, a MAKEHELP.BAT will be provided for backward compatibility with projects from older versions.

The command line syntax to run MAKEHM directly is:

makehm <from>,<to>,<add> [<from>, <to>,<add> [...]] <resource.h> >> [output.hm]

<from>

Specifies the symbol prefix to be read, such as a command ID.

<to>

Specifies the symbol prefix of the Help context identification to be produced in the .hm file.

<add>

The Help ID base number to be added to the value of the <from> identification to produce the Help context number.

You can specify one or more sets of <from>,<to>,<add> in the command line.

<resource.h>

The header file that provides #define definitions for the symbols to be read.

<output.hm>

The .hm file to be produced by MAKEHM.

Look at the custom build rules for the resource.h file (or a Makehelp.bat file produced by AppWizard) to learn what command line values to use.

This sample demonstrates the following keywords:

AfxThrowMemoryException; CFile::Close; CFile::GetPosition; CFile::Open; CFile::Seek; CStdioFile::ReadString; CStdioFile::WriteString; CString::GetBuffer; CString::GetLength; CString::IsEmpty; CString::ReleaseBuffer; CString::Right; __iscsym; __iscsymf; _strdup; exit; fprintf; free; isdigit; isxdigit; sprintf; strchr; strcmp; strlen; strncmp; strstr; strtok


TEMPLDEF: Tool That Expands C++ Templates

Click to open or copy the TEMPLDEF project files.

The TEMPLDEF tool is a C++ template expander that has been used to create the simple Microsoft Foundation Class (MFC) collection classes that are not based on C++ templates. The nontemplate collection classes have been provided by MFC beginning with MFC 1.0. MFC now provides collection classes implemented using C++ templates, namely: CList, CArray, CMap, CTypedPtrList, CTypedPtrArray, and CTypedPtrMap. If you write new type-safe collection classes for your own data types, you should use the newer template-based classes.

MFC still includes the simple collection classes such as CByteArray and CStringList. The TEMPLDEF tool expands C++ template-like source files, such as Array.ctt in the TEMPLDEF sample directory, to create CByteArray. A console application such as TEMPLDEF is linked with the same variant of the MFC library as GUI (graphical user interface) applications.

TEMPLDEF uses a syntax similar to the ANSI C++ language syntax. The TEMPLDEF tool expands a template file into sources for a user-specified class_name, which can then be used as an alternative to:

template_class<type_specifier> class_name

In addition to being a useful tool, the source code provided for TEMPLDEF serves as an example of a console application using the Microsoft Foundation Class Library (MFC).

You can model your template classes after the source files for four collection types provided in the TEMPLDEF sample directory — arrays, lists, maps from keys to values, and maps from strings to values.

To get a quick look at how the TEMPLDEF tool works, build the Templdef.exe and run Mkcoll.bat from the TEMPLDEF sample directory.

Mkcoll.bat reproduces the sources for all of the Foundation collection classes, whose sources and headers are included in the \Microsoft Visual Studio\VC98\MFC\SRC and MFC\Include directories. For example, one of the source files produced by Mkcoll.bat is Array_b.cpp, which is the implementation for the CByteArray class. This file is exactly the same as the Array_b.cpp file in MFC\SRC.

The TEMPLDEF command lines in Mkcoll.bat provide a model for how to run TEMPLDEF to produce additional type-specific collection classes, as explained in the next section. The collection template source files (Array.ctt, List.ctt, Map.ctt, and Map_s.ctt) provide models for how to develop your own template classes.

Producing Additional Type-Specific Collection Classes

The TEMPLDEF sample directory provides sources for four types of collections:

  • Array.ctt is the template for the array collection shape.

  • List.ctt is the template for the list collection shape.

  • Map.ctt is the template for the collection shape that maps keys of a specified type to values of a specified type.

  • Map_s.ctt is the template for the collection shape that maps keys of a specific CString type to values of some specified type.

The command-line syntax for running TEMPLDEF to produce a type-specific collection is illustrated by the following example from Mkcoll.bat:

templdef "CArray<BYTE,BYTE,1,0> CByteArray" array.ctt temp.h temp.inl array_b.cpp
  • "CArray" is the template name, as would be specified in the C++ syntax for the template class.

  • The first template argument, BYTE, is the data type, such as that used for the return type of CByteArray::GetAt.

    BYTE GetAt(int nIndex) const;

  • The second template argument, BYTE, is the data type, when referred to as an argument to a member function of the template class.

    void SetAt(int nIndex, BYTE newElement);

  • The third template argument, 1, sets the value for IS_SERIAL, which determines whether the template class is declared with the DECLARE_SERIAL macro and has a Serialize member function.

  • The fourth template argument, 0, sets the value for HAS_CREATE, which determines whether the template class has additional ConstructElement and DestructElement member functions that are optimized for a particular element type. The library provides such optimization only for the CString type. You should set this argument to 1 only if the element type is CString.

  • "CByteArray" is the name of the expanded template class produced by TEMPLDEF.

  • "Array.ctt" is the source file for the class template.

  • "Temp.h" is the header file produced for the expanded template class.

  • "Temp.inl" is the inline file produced for the template class.

  • "Array_b.cpp" is the implementation file produced for the expanded template class.

Note Mkcoll.bat concatenates the header and inline files for all of the Foundation collection classes. The resulting Newcoll.h and Newcoll.inl files are the same as the Afxcoll.h and Afxcoll.inl files in MFC\Include. It is neither necessary nor advised to append your own additional collection classes to Afxcoll.h and Afxcoll.inl.

This sample demonstrates the following keywords:

CFile::Open; ConstructElements; CStdioFile::ReadString; CStdioFile::WriteString; CString::GetLength; DestructElements; exit; fprintf; fputc; isalnum; isalpha; isdigit; isspace; strncpy


TRACER: Views and Sets Diagnostic Trace Options

Click to open or copy the TRACER project files.

TRACER is a Microsoft Windows–hosted tool that lets you set the trace flags in Afx.ini. These trace flags determine what category of messages are sent from the debug version of an application to the debugging window or console. For an explanation of the trace options, see Technical Note 7: Debugging Trace Options. It is not necessary to build the Tracer.exe because it is already provided in \Microsoft Visual Studio\VC98\bin.

In addition to serving as a useful debugging tool, TRACER's sources show how to implement dialog data exchange, and a Windows-based application whose user interface is simply a dialog box.

The TRACER dialog box offers six trace options. The first option, Enable Tracing, turns tracing on or off. The other five options let you select which types of trace messages will be sent to the debugging window or console.

This sample demonstrates the following keywords:

AfxGetApp; AfxMessageBox; CDC::DrawIcon; CDC::GetSafeHdc; CDialog::DoModal; CDialog::OnInitDialog; CMenu::ModifyMenu; CRect::Height; CRect::Width; CString::LoadString; CWinApp::Enable3dControls; CWinApp::InitInstance; CWnd::DoDataExchange; CWnd::EnableWindow; CWnd::GetClientRect; CWnd::GetDlgItem; CWnd::GetSystemMenu; CWnd::IsIconic; CWnd::OnPaint; CWnd::OnSysCommand; CWnd::SendMessage; GetProfileInt; GetSystemMetrics; LOWORD; LoadIcon; PostQuitMessage


OLE DB Templates Samples Index

The OLE DB Templates samples are as follows.

Sample | Description
ATLAgent | Demonstrates using CCommand and CAccessor to read information from a database, and demonstrates using the compiler COM support to control the Microsoft Agent control.
ATLMTO | Provider that dynamically acquires its column definitions.
CatDB | Displays the schema information, such as tables and columns, of OLE DB providers.
ComplexDB | Uses the OLE DB consumer template classes to create a control that uses complex data binding to show data in a list box.
DBViewer | Demonstrates a mid-level application that relies on the CManualAccessor class.
MultiRead | Reads through a table in a database using multiple threads.
MyProv | A simple read-only provider that reads a set of two strings from a file.
Provider | Demonstrates a provider that has more than one result set type.


ATLAgent: Demonstrates Using CCommand and CAccessor to Read Information from a Database

Click to open or copy the ATLAgent project files.

This control reads instructions from a database using the OLE DB Consumer Template classes. These instructions are used to command the Microsoft Agent control. The sample demonstrates how to use the CCommand and CAccessor classes to read information from a database and how to use the compiler COM support to control the Microsoft Agent.

To install the Microsoft Agent control

  1. Download the Microsoft Agent control from http://www.microsoft.com/workshop/prog/agent. Select Downloads from the left pane.

  2. Optionally, download the text-to-speech engine available from the same page to allow the agent to speak.

  3. Choose the link to download the Microsoft Agent character animation files and download one or more of the character .acs files. By default the ATLAgent control uses the Merlin-with-sound-effects character (merlinsfx.acs). Save the files to the directory where you have installed Microsoft Agent — typically, C:\Program Files\Microsoft Agent\.

To use the control

  1. Select the ODBC icon in Control Panel and set up a Microsoft Access data source called Agent. Point the data source to the Agent.mdb file contained in the sample’s directory.

  2. Modify the directory locations at the beginning of AgentCtl.h if you have installed Microsoft Agent into a different directory.

  3. Build the control.

  4. Open ATLAgent.htm from the sample and click the Play button. The Agent should appear and should follow the instructions contained in the Instructions table in the Agent.mdb database.


ATLMTO: Dynamically Acquires Column Definitions

Click to open or copy the ATLMTO project files.

The ATLMTO sample demonstrates a provider that dynamically acquires its column definitions (meta data). Its purpose is to enable two-tier clients to operate in a three-tier environment. The provider does so by delegating its work to a COM object that either resides on the local machine or at a location accessible by DCOM. The provider then receives a special cookie from the COM object (third-tier) that contains connection information and column meta data. Once the provider acquires the meta data, it calls through a dual interface to acquire a BSTR representation of the rowset data. With the stream (BSTR) of data and the column meta data, the provider is capable of carrying on a two-tier OLE DB conversation with an OLE DB template consumer or with an ADO client.

This provider will override the following: GetColumnInfo of its user record (CRemoteRecord), and the ArrayType parameter of IRowsetImpl. Further, it demonstrates the process of holding column data in a CSimpleArray<ATLCOLUMNINFO> to enable dynamic determination of the column meta data.

The provider can only work with COM objects that support a special "hidden" BSTR on their callable methods and that expose the IMTOData interface. A sample consumer called TestMTO, a COM object that supports the needed interface and parameter, is included as subproject of the ATLMTO sample.

Building and Running the Sample

  • The sample is set up so that when you build TestMTO, it builds both TestMTO and ATLMTO in the correct order.

  • A small database (Accounts.mdb) is included with the sample. To use the database with the sample, you need to register it as an ODBC data source. Use the MS Access 97 Database driver and Accounts as the data source name and point it to Accounts.mdb. You can do this from the 32bit ODBC icon in Control Panel.

  • After building the sample, run Qurydemo.exe and choose the "MtoProv OLE DB Provider" entry in the Initialize dialog box to get a new command. (Qurydemo.exe is installed when you install the OLE DB SDK. There is also an SDK sample called Qurydemo, which has the source code for Qurydemo.exe.)

  • In the command window, type the following.
    call GetAccounts (50)

    and press the Play button. You will get a result set that includes all accounts with more than $50 in them.


CatDB: Data Source Schema Browser

Click to open or copy the CatDB project files.

CatDB is ported from the MFC ODBC Catalog application. The application displays the schema information, such as tables and columns, of OLE DB providers. It is easy for you to track the differences between this sample and the MFC ODBC Catalog sample, because all of the changes from the MFC sample are surgical. This sample makes use of the CEnumerator, CDataSource, CSession, and schema rowset classes.

The code to enumerate the providers, connect to a data source, and create a session is in the CCatDBDoc::OnOpenDocument function. The code to open the schema rowsets is in CCatDBDoc::FetchTableInfo and CCatDBDoc::FetchColumnInfo. Both FetchTableInfo and FetchColumnInfo use the OLE DB Template schema rowset classes, CTables and CColumns. The code to display the schema information is in CCatDBView::OnUpdate. The OnUpdate function moves through the records in the database, and accesses the CTables and CColumns classes for data.

This sample demonstrates how to enumerate the OLE DB providers. CEnumSourcesDlg provides support to recursively display and connect to the data sources. The dialog box uses the OLE DB Template CEnumerator class. To connect to the data source, CEnumSourcesDlg returns an LPMONIKER value for the selected data source. CDataSource::Open then takes this LPMONIKER value and performs the connection.

You can use this sample with the ODBC provider and with the Microsoft Access 97 and Microsoft SQL Server 6.5 databases. If you have the OLE DB SDK installed, to run this sample you must set up the OLE_DB_NWind_Jet and OLE_DB_NWind_SQL data services using the ODBC icon in the control panel.


ComplexDB: Demonstrates Complex Data Binding Using OLE DB Consumer Templates

Click to open or copy the ComplexDB project files.

This sample uses the OLE DB consumer template classes to create an ATL control that uses complex data binding to show data in a list box. A complex data-bound control uses the OLE DB data-binding interfaces (IDataSource and IRowPosition) to gain access to a rowset (see Creating a Complex Control).

To build the sample, make sure that the ActiveX Control Writer's SDK for OLE DB is installed and that you have added the relevant include and lib directories to your paths.

Once built, you can test the control by performing the following steps, or by building and running the MFCBind project that is part of this sample:

  1. Run the MFC AppWizard to create a dialog-based application (ensure you include the support for ActiveX controls).

  2. Once the project is generated by the wizard, right-click the dialog, select Insert ActiveX Control, and insert the control named "Microsoft ADO Data Control, version 6.0."

  3. Open the properties for that control and set the relevant properties to connect to a data source and run a command. For example:
    ConnectionString = DSN=OLE_DB_NWind_Jet
RecordSource = select * from products
  4. Right-click the dialog and select Insert ActiveX Control, but this time insert the control named "ComplexCtl class" (this is the ComplexDB control you just built).

  5. Open the properties for that control and set the datasource property to the data source control you inserted in step 2. This is typically IDC_ADODC1.

  6. Set the FieldName to the field you want to display from the query.

  7. Build and run the application.

The value of the specified field for each record in the query should be displayed in the list box. You can also use the controls on the ADO data control to move forward and backward through the records.


DBViewer: Database Browser

Click to open or copy the DBViewer project files.

The DBViewer sample is an enhancement of the MFC DAOVIEW sample. It demonstrates a mid-level application that relies on the OLE DB Template CManualAccessor class. This sample illustrates how to take full control of the bindings and use them for your applications.

Once you are connected to a data source via the enumerator support, you can manipulate the data, call the stored procedures, and view the schema information. The tree view on the left side of the application window displays the tables and the stored procedures. To view or modify data, right click a table or a stored procedure, and a shortcut menu will appear with additional operations.

This sample contains a lot of code to support stored procedures. However, you will find that not all stored procedures will run under this sample. This is because the underlying ODBC Drivers do not provide support for some OLE DB methods. DBViewer does support multiple-result sets. If you click the list view where the data is located, you may see the multiple result sets button highlighted on the toolbar. You can click it and obtain the next result set.

DBViewer demonstrates how to use the error information in your application. The CErrorsDialog handles the IErrorRecords interface and displays the error information returned from a particular call.

You can use DBViewer with the ODBC provider, and with the Microsoft Access97 and Microsoft SQL Server 6.5 databases; however, DBViewer cannot handle SQL Server stored procedures with integer parameters, or with names consisting of more than one word, for example, 'My stored procedure'. You will get errors in these cases.


MultiRead: Reads Database Table Using Multiple Threads

Click to open or copy the MultiRead project files.

This sample demonstrates how to use the OLE DB consumer template classes to read through a table in a database using multiple threads. The sample contains the CMultiDlg class, which is used to show a dialog. With this dialog, the user enters the number of threads to use to read through the table. When the user clicks the Run button, ReadRecords in dbtest.h is called to open the database, the session, and the table, and to create the necessary number of threads. As it opens the table, the function sets the DBPROP_CANHOLDROWS property to true so that the provider allows the user to retrieve new rows without releasing the previously-retrieved rows. This capability is required, because multiple threads retrieves new rows as other threads are still processing their current threads.

The sample also shows how to extend the standard CRowset class by creating a new CMyRowset class, which derives from CRowset, and adds the MoveAndProcess member function. The start routine of each thread is the ReadTable function and the table class is passed to this function. The function calls the routine MoveAndProcess to read through each record. Note that the accessor class CProduct is defined so that the data will not be retrieved automatically on the MoveNext call. Consequently, we don’t have to worry about buffer conflicts with the other threads, and we don’t need to protect MoveNext with a critical section. The MoveAndProcess function calls MoveNext, and then calls GetDataHere to place the data directly into a local variable of that function. ProcessRecord is called for each record retrieved and the function simply traces out the values of the record by default.

Each thread counts the number of records it reads, and those are traced out at the end, along with a total and time taken, which is displayed on the dialog.

The sample demonstrates the following classes:

CAccessor, CDataSource, CDBPropSet, CRowset, CSession, CTable

the following macros:

BEGIN_ACCESSOR_MAP, BEGIN_ACCESSOR, COLUMN_ENTRY, END_ACCESSOR, END_ACCESSOR_MAP, DEFINE_COMMAND

and the following functions:

CreateThread, GetCurrentThreadId, GetExitCodeThread, WaitForMultipleObjects


MyProv: A Simple Read-Only Provider

Click to open or copy the MyProv project files.

The MyProv sample demonstrates how to create an OLE DB provider that that reads a set of two strings from a file. The default OLE DB Template row-fetching mechanism is enhanced by adding the IRowsetLocate interface to CMyProviderRowset. The implementation of this interface demonstrates:

  • How to add an interface to a provider

  • How to dynamically determine the columns returned to the consumer

  • How to add bookmark support to a provider

For a complete description of this sample, see Implementing an OLE DB Template Provider in the OLE DB Template articles.

To run this read-only provider, you need to have an appropriate OLE DB consumer application. For this purpose, you can use the accompanying test consumer, which is described in Implementing an OLE DB Template Consumer.


PROVIDER: OLE DB Provider Templates Sample

Click to open or copy the PROVIDER project files.

PROVIDER demonstrates an OLE DB provider that has more than one result set type. The OLE DB Provider wizard generates a provider that has a single result set based on a Win32 directory entry. This sample demonstrates how to enhance this functionality to include a Win32 registry entry.

The important classes in the sample are CDirRowset, CWindowsFile, CRegRowset, and CWinRegKey. Both CDirRowset and CRegRowset have a method Execute.\ that populates the result set. The result set acquires its shape from the data class. The data classes in this example (CWindowsFile and CWinRegKey) both contain PROVIDER_COLUMN_MAPs that determines what data will be returned to the user when the user requests a rowset. The file Rowset.cpp has an implementation for ICommand::Execute. The implementation of this function determines if a particular command text is prefixed by REG:. If it has such a prefix, it uses CRowsetImpl::CreateRowset to create a rowset that contains registry key information (CRegRowset); otherwise, it creates the standard wizard generated (CDirRowset).

For more information, see Using the OLE DB Provider Templates.


SDK Samples Index

See Building SDK Samples for information on how to compile and run an SDK sample.

The SDK samples are comprised of code samples that demonstrate various APIs and coding techniques:

  • Begin samples are for the beginning SDK programmer.

  • COM samples show how to use the Component Object Model, including DCOM, ActiveX controls, Automation, and the samples from Kraig Brockschmidt's Inside OLE, Second edition.

  • DbMsg samples show how to use database or message technologies such as ADO, ODBC, OLE DB, SQL Server, Exchange, and MAPI.

  • Graphics samples show how to use such audio and video technologies as Musical Instrument Digital Interface (MIDI), Broadcast Architecture, DirectAnimation, DirectX, GDI, ICM, and AVI.

  • Internet samples show how to write applications using Internet and intranet technologies.

  • NetDS samples show how to develop programs that communicate over a network.

  • SDK Tools samples contain source code for various tools.

  • SysMgmt samples show how to write system components.

  • WinBase samples show how to write Windows-based services.

  • WinUI samples show how to write Windows shell services.


Building SDK Samples

This topic discusses how you can:

Open an SDK Sample Within Visual C++

Build an SDK Sample from the Command Line

Fix an SDK Sample that Fails to Build

Open an SDK Sample Within Visual C++

There are two ways you can open an SDK sample project in Visual C++: by using the .dsp file or by using the MAKEFILE. If an SDK sample does not have a .sdp file, then it will have a MAKEFILE.

Note Some SDK samples contain version 5.0 Visual C++ .dsp and .dsw files. These project and workspace files can be used in Visual C++ 6.0. However, when you open the file, you will be prompted to confirm its conversion to the Visual C++ 6.0 format. Also note that some samples will generate warnings when you build the project.

To open a sample in the development environment using the .dsp file

  1. Select Open Workspace from the File menu.

  2. Make sure the Files of type list box is set to Projects (.dsp).

  3. Locate and open the .dsp for the sample.

When you open a .dsp file for a sample that also has a .dsw file, Visual C++ will attempt to open the .dsw file.

To open a sample in the development environment using MAKEFILE

  1. From the File menu, click Open Workspace.

  2. Locate and open the MAKEFILE you want to build.

  3. Click Yes to the message that asks if you want to proceed.

  4. Select the platforms supported in the MAKEFILE.

  5. From the Project menu, click Settings.

  6. Type the name of the sample's executable name in the Output file name box of the General tab and, for debug builds, type the sample's executable name in the Executable for debug session box in the Debug tab. If you do not know the sample's executable name, you can either look in the MAKEFILE and search for the -out string or you can click Build Makefile.exe from the Build menu and then inspect the sample directory to see which executable has been created. Be aware that not all samples output a .EXE; for example, a sample might output a .dll.

  7. From the Build menu, click Execute Makefile.exe.

For more information on NMAKE and the commands in a MAKEFILE, see the NMAKE Reference.

Build an SDK Sample from the Command Line

Each SDK sample comes with a MAKEFILE. MAKEFILEs are designed to run at the command prompt. See Open an SDK Sample Within Visual C++ for information on how to build a project's MAKEFILE from the development environment.

To build a sample from a command line in a command prompt window

  1. Run the Vcvars32.bat file that Visual C++ installs at Microsoft Visual Studio/VC98/bin.

  2. Change to the subdirectory that contains the MAKEFILE.

  3. Make sure all existing files that the MAKEFILE will write to are writeable. Use attrib -r *.* to make all files writeable.

  4. Issue the nmake command. NMAKE will look in the current directory and execute the MAKEFILE.

Fix an SDK Sample that Fails to Build

If you encounter an error when you build an SDK sample at the command line or from with Visual C++, a possible cause is that all the files necessary for building the sample are not present. Inspect the sample's MAKEFILE for any file dependencies and then check your drive to ensure that all the required files and subdirectories are present. For example, if there are more than one download link in a sample abstract, you must not change the download path, which displays when you click a download link, beginning with the sdk subdirectory.

If you determine that one or more files or directories are not on your local machine, you will need to copy the files from the MSDN CD that holds the Visual C++ samples.


Beginning Samples

Click to open or copy the files for the Begin samples.

Building SDK Samples


dll: A Simple DLL

Click to open or copy the DLL project files.

This sample shows you how to create a very simple DLL.

Building SDK Samples

This sample uses the following keywords:

checkmenuitem; clearselection; createwindow; defwindowproc; demoinit; demowndproc; dialogbox; dispatchmessage; dllmain; enddialog; endselection; freeprocinstance; getdc; getmenu; getmessage; getstockobject; lineto; loadcursor; loadicon; loadstring; localalloc; localfree; locallock; localunlock; loword; makempoint; makeprocinstance; messagebox; movetoex; mpoint2point; patblt; point2mpoint; postquitmessage; registerclass; releasecapture; releasedc; setcapture; setrectempty; setrop2; showwindow; startselection; translatemessage; unreferenced_parameter; updateselection; updatewindow; winmain


Generic: Win32-Based Application

Click to open or copy the Generic project files.

The Generic sample is a generic Win32-based application with a menu and an About box, but without any real functionality. The sample demonstrates the basic steps that are used to create the application.

Building SDK Samples

This sample uses the following keywords:

initapplication; initinstance; winhelp; centerwindow; clienttoscreen; createfont; createwindow; defwindowproc; dialogbox; dispatchmessage; enddialog; getdlgitem; getdlgitemtext; getfileversioninfo; getfileversioninfosize; getfocus; getlasterror; getmessage; getstringres; getsystemmetrics; getuserdefaultlangid; getversion; globalalloc; globalfree; globallock; globalunlock; initapplication; initinstance; isiconic; loadcursor; loadicon; lobyte; loword; lstrcat; lstrcpy; lstrlen; messagebeep; myregisterclass; postquitmessage; primarylangid; registerclass; registerclassex; sendmessage; setdlgitemtext; showwindow; systemparametersinfo; translatemessage; updatewindow; verqueryvalue; windproc; winmain; wndproc


Simple: Minimum Console Application

Click to open or copy the Simple project files.

Simple is a minimum console application; a Win32 version of the classic “Hello, World” C program.


Winhelp: Creating a .HLP File

Click to open or copy the Winhelp project files.

The Winhelp sample shows the components of a working help system based on the Help Workshop (HCW.EXE) and provides a quick introduction to creating Windows Help files.


COM SDK Samples

Click to open or copy the files for the COM samples.

In addition to the sample directories, the files available with this link, which create an sdk\com subdirectory on your computer, have a few individual files for the COM Applications Samples, including a Help file for OLE User Interface Library, a Readme file with brief descriptions of the COM Applications Samples, and an OLE GID file.


Active Document Samples

Click to open or copy the files for the Active Document samples.


Dfv: View OLE Documents

Click to open or copy the Dfv project files.

Click to open or copy the Winhlprs project files (required).

Dfv demonstrates basic read/write/enumerate operations using OLE documents. Dfv lets you view the structure of a disk-based OLE document. The streams and storages contained in the file are displayed in a Microsoft Windows® File Manager-type expandable list box. To use this utility, from the File menu choose the Open command and choose an OLE document to view. The Outline series of samples use OLE documents as their native file format, so Dfv will read any of the files generated by these samples. To create a sample OLE document that you can load into Dfv and view, choose Create Test Storage File Test.dfl from the File menu.

Dfv also demonstrates basic read/write/enumerate operations using OLE documents.

Building SDK Samples

This sample demonstrates the following keywords:

bitblt; closehandle; cobuildversion; cogetmalloc; coinitialize; collapse; couninitialize; create; create; createbitmap; createcompatibledc; createfile; createfontindirect; createsolidbrush; createstorageelement; createstreamelement; createwindow; ddbchangecolor; defwindowproc; delete; deletedc; deleteelement; deleteobject; destroywindow; dialogproc; dispatchmessage; dlgabout.showdialog; domenu; enddialog; enumelements; exists; exists; expand; expandall; exttextout; exttextoutw; failed; getclientrect; getdc; getdevicecaps; gethwnd; gethwnd; getmessage; getmodulefilename; getobject; getopenfilename; getstockobject; getsyscolor; gettextextentpoint32; gettextextentpoint32w; gettextmetrics; hiword; initapplication; initapplication; initinstance; initinstance; initinstance; invalidaterect; loadaccelerators; loadandstretch; loadbitmap; loadbitmaps; loadbitmaps; loadcursor; loadicon; loadstring; loadstring; loword; lstrcpy; lstrlen; makeintresource; mbstowcs; memset; messagebox; olestr; openfile; openfile; openstorage; openstream; postquitmessage; read; registerclass; releasedc; return; rgb; seek; selectobject; sendmessage; setbkcolor; setfocus; setstretchbltmode; settextcolor; setwindowpos; showwindow; stat; stgopenstorage; stretchblt; strncpy; succeeded; text; toggle; translateaccelerator; translatemessage; updatewindow; va_start; wcscpy; wcslen; windowproc; winhelp; winmain


DOServer: Active Document Server

Click to open or copy the DOServer project files.

DOServer is a very simple example of an Active Document server. It implements the minimum number of interfaces required to have an object be an Active Document.

If the application is executed without the /EMBEDDING switch, a dialog box is displayed that has options for registering the server and creating a working file. When you select Register Server, the application makes all of the required entries into the registry to register the application as an Active Document server. You must do this at least once before attempting to load a working file into a container.

If the Create File option is selected, the user can create a new file that can be loaded into an Active Document container (such as Internet Explorer, Microsoft Office Binder or the Framer sample in this SDK).

This Active Document only implements a color feature. After the file is loaded into the container, the color can be selected from the Color menu that the server adds to the container menu.

Building SDK Samples

This sample demonstrates the following keywords:

activateinplace; activateme; activateui; addref; advise; applyviewstate; arraysize; beginpaint; bringwindowtotop; cclassfactory; cdataobject; centerwindow; cenumformatetc; checkmenuradioitem; checkradiobutton; close; closeview; cocreateinstance; cogetmalloc; coinitialize; coledocument; coledocumentview; coleinplaceactiveobject; coleinplaceobject; coleobject; colorhookproc; contextsensitivehelp; coregisterclassobject; corevokeclassobject; couninitialize; cpersistfile; cpersiststorage; createdataadviseholder; createdocwindow; createfile; createinstance; createmenu; createoleadviseholder; createsolidbrush; createstream; createstreams; createview; createviewwindow; createwindowex; dadvise; deactivateinplace; deactivateui; debugbreak; define_guid; defwindowproc; deleteobject; destroymenu; dialogbox; dispatchmessage; doverb; dunadvise; enablemodeless; enablewindow; enddialog; endpaint; enumadvise; enumdadvise; enumformatetc; enumverbs; enumviews; failed; fillrect; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getcanonicalformatetc; getclassid; getclassinfo; getclientrect; getclientsite; getclipboarddata; getcurfile; getdata; getdatahere; getdesktopwindow; getdlgitem; getdocmiscstatus; getdocument; getextent; getinplacesite; getlasterror; getmenustring; getmessage; getmiscstatus; getmodulefilename; getmoniker; getoleobjectdatahere; getrect; getrunningobjecttable; getsavefilename; getsubmenu; getsystemmetrics; getuserclassid; getusertype; getwindow; getwindowcontext; getwindowlong; getwindowrect; getword; handsoffstorage; initapp; initfromdata; initnew; inplacedeactivate; insertmenu; insertmenus; invalidaterect; isdirty; isdlgbuttonchecked; isequaliid; isspace; isuptodate; load; loadcursor; loadmenu; lockserver; lstrcat; lstrcmp; lstrcmpi; lstrcmpiw; lstrcpy; lstrcpyw; lstrlen; lstrlenw; maindlgproc; makeintresource; mergemenus; movewindow; multibytetowidechar; next; olecreatemenudescriptor; oledestroymenudescriptor; olesave; olestr; oncommand; oncreate; ondocwindowactivate; onframewindowactivate; oninplaceactivate; oninplacedeactivate; onpaint; onuiactivate; onuideactivate; open; openstream; openstreams; outputdebugstring; parsecommandline; postquitmessage; querygetdata; queryinterface; reactivateandundo; readclassstg; regclosekey; regcreatekeyex; register; registerclass; registerclassimplcategories; registerclipboardformat; registerserver; registerwindowmessage; regsetvalueex; release; releasestreamsandstorage; removemenu; removemenus; reset; resizeborder; resultfromscode; revoke; rgb; save; savecompleted; saveviewstate; seek; sendonrename; sendonsave; setactiveobject; setclientsite; setcolorscheme; setdata; setextent; setfocus; sethostnames; setinplacesite; setmenu; setmoniker; setobjectrects; setparent; setrect; setrectcomplex; setsize; setwindowlong; show; showwindow; skip; skip; stdapi_; stdmethodimp_; stgcreatedocfile; stgopenstorage; stringfromiid; succeeded; switch; text; translateaccelerator; translatemessage; uiactivate; uideactivate; unadvise; update; updatemenu; updatewindow; viewwndproc; widechartomultibyte; winmain; write; writeclassstg; wsprintf; zeromemory


Framer: Active Document Objects Hosting as a Container

Click to open or copy the Framer project files.

Framer is intended to demonstrate simple Active Document Objects hosting as a container. That is, Framer demonstrates the basic support necessary to host Active Documents. It is implemented according to the guidelines in the "Active Documents Specification" document and has been tested against Microsoft Word and Microsoft Excel, as well as a few other OLE-enabled applications that do not support Active Documents.

Building SDK Samples

This sample demonstrates the following keywords:

aboutproc; accelerators; activate; activateme; addref; advise; beginpaint; caninplaceactivate; chourglass; cimpiadvisesink; cimpioleclientsite; cimpioledocumentsite; cimpioleinplacesite; clientwndproc; close; commdlgextendederror; commit; contextsensitivehelp; create; createobject; createstorage; createstream; createstreamonhglobal; createview; createwindow; csite; deactivateandundo; defwindowproc; deleteinterfaceimp; destroy; destroyelement; destroymenu; destroywindow; dialogbox; discardundostate; dispatchmessage; doverb; drawmenubar; enablemenuitem; enablemodeless; enddialog; endpaint; exec; failed; framewndproc; getborder; getclientrect; getcontainer; getmenu; getmenuitemcount; getmessage; getmoniker; getopenfilename; getsubmenu; getsyscolor; getwindow; getwindowcontext; init; inplacedeactivate; insertmenu; insertmenus; instance; invalidaterect; loadaccelerators; loadcursor; loadicon; loadmenu; loword; lstrlen; makeintresource; makelong; memset; messageloop; messageloop; multibytetowidechar; objectinitialize; olecreatefromfile; oleinitialize; olerun; olesave; olesetmenudescriptor; oleuninitialize; onclose; oncommand; ondatachange; onframewindowactivate; oninplaceactivate; oninplacedeactivate; onposrectchange; onrename; onsave; onshowwindow; onuiactivate; onuideactivate; onviewchange; opendialog; postmessage; postquitmessage; queryinterface; querystatus; registerallclasses; registerclass; release; releasecapture; releaseinterface; removemenu; removemenus; requestborderspace; requestnewobjectlayout; resizeborder; resizeclientwindow; resultfromscode; savecompleted; saveobject; scroll; sendmessage; setactiveobject; setbkcolor; setborderspace; setcapture; setclientsite; setcursor; setfocus; setinplacesite; setmenu; setrect; setstatustext; setwindowlong; setwindowpos; show; showobject; showwindow; stdmethodimp_; stgcreatedocfile; succeeded; text; textout; translateaccelerator; translatemessage; uiactivate; update; updateobjectrects; updatewindow; window


Range: Demonstrate Http Read Range

Click to open or copy the Range project files.

This sample is intended primarily to demonstrate http read range, but can also be used for simple GET requests without ranges. Application writers may be interested in plugging into the interface defined in Range.h, using one C call to initiate the request and one C callback to receive status and data.

Other interesting aspects of this sample include the following:

Urlmon

  • Using urlmon from a console app (not required)

  • Correctly using IStream::Read return values

  • Implementing IHttpNegotiate to add request headers

  • Using IWininetHttpInfo to parse response headers

Wininet

  • Passing INTERNET_FLAG_OFFLINE to InternetOpen

  • Calling InternetSetFilePointer in offline mode

  • Calling InternetTimeFromSystemTime

Building SDK Samples

This sample demonstrates the following keywords:

abort; addref; bindtostorage; bufalloc; bufbeg; bufreset; bufshift; bufsize; bufspace; casemsg; coinitialize; couninitialize; createasyncbindctx; createurlmoniker; curlmoncallback; failed; getbindinfo; getclientsite; getcontainer; getcurrentthreadid; getpriority; grokint; grokstr; isdigit; isequalguid; min; multibytetowidechar; ondataavailable; onlowresource; onobjectavailable; onprogress; onstartbinding; onstopbinding; parsemultipartheader; queryinterface; recvbuf; release; stdmethodimp_; succeeded; switch; upcase;


Alternative ActiveX Control Development Framework Samples

Click to open or copy the files for the ActiveX Control samples.


BaseCtl: ActiveX Control Development Framework

Click to open or copy the Basectl project files.

The Basectl framework targets a slightly more advanced programmer than does the Visual C++ Microsoft Foundation Classes (MFC). Specifically, you must understand the following:

  • Some of the fundamentals of OLE automation and dual interfaces.

  • What an .ODL file is and how to modify it.

  • How to work with OLE persistence interfaces, most notably IStream, IPersistPropertyBag and IPersistStream.

However, you do not need to have much knowledge of OLE embedding interfaces.

Programmers who do not have specific performance requirements, those not familiar with many of the pertinent OLE technologies, or those who work primarily with MFC will find MFC more suited to their needs.

It is necessary to build FrameWrk before building ToDoSvr or WebImage. Running nmake from the samples\basectl directory will build all of the sample code in the correct order.


Card: Windowless ActiveX Control

Click to open or copy the Card project files.

Click to open or copy the Include project files (required).

This sample ActiveX Control implements a standard playing card, with the ability to show the standard 52 card deck, 2 jokers, and 13 different card backs. This control is a Windowless control, which uses transparency to create the missing card corner effect.

Building SDK Samples

This sample demonstrates the following keywords:

addref; bitblt; cardborder; cardcachemem; ccardcontrol; ccarddraw; ccardgeneralpage; centerborder; check_pointer; checkdlgbutton; checklicensekey; cocreateinstance; colecontrol; controlobject; cpropertypage; createcompatiblebitmap; createcompatibledc; createcomponentcategory; createdibcard; createdibsection; createrectrgn; createsolidbrush; declare_standard_dispatch; declare_standard_supporterrorinfo; declare_standard_unknown; define_guid; define_propertypageobject; define_windowlesscontrolobject; deletecriticalsection; deletedc; deleteobject; dialogproc; do_guids_match; drawback; drawcardback; drawme; entercriticalsection; failed; fillrect; fireevent; firstcontrol; freedc; get_cardalignment; get_invert; get_number; get_suite; getambientproperty; getdlgitem; getdlgitemtext; getlicensekey; getresourcehandle; getstockobject; hiword; hiword; initializecriticalsection; internalqueryinterface; invalidatecontrol; isdlgbuttonchecked; leavecriticalsection; load; loadbinarystate; loadbitmap; loadcursor; loadtextstate; loword; lparam; lptodp; makedirty; makeintresource; makelcid; makepoints; memcpy; memset; messagebox; modaldialog; nextcontrol; ocxdefwindowproc; ocxgetwindowrect; ocxinvalidaterect; oletranslatecolor; ondraw; polyline; privateunknown; propertychanged; propertypage; proppageexception; put_cardalignment; put_invert; put_number; put_suite; queryinterface; registercategories; registerclass; registerclassdata; registerclassimplcategories; registerclsidincategory; registerdata; release; restoredc; return_on_failure; rgb; savebinarystate; savedc; savetextstate; selectcliprgn; selectobject; sendmessage; setcontrolsize; setdropdown; setmapmode; setpixelv; settextcolor; setviewportorgex; setwindoworgex; simpleatoi; stdmethod; stdmethod_; stretchblt; succeeded; switch; symbitblt; symbitbltbottom; symbitbltbottomnotransx; symbitblttop; unregisterclassimplcategories; unregisterclsidincategory; validatecardalignment; validatenumber; validatesuite; variantclear; variantinit; warning; wcslen; wcsncpy; windowless; windowproc; wndclassnameofcontrol


FrameWrk: Build Library for Framework

Click to open or copy the FrameWrk project files.

Click to open or copy the Include project files (required).

Click to open or copy the Lib project files (required).

The FrameWrk sample is part of the BaseCtl sample. From the command line, run nmake to build a debug build or nmake nodebug=1 to build a nodebug (retail) build of the framework library.

After building the FrameWrk libraries you can build the other BaseCtl samples.

Building SDK Samples

This sample demonstrates the following keywords:

_createoledc; _idmsgbox; _makepath; _specialkeystate; abort; activationpolicyofcontrol; addref; addref_object; addsink; addslot; advise; aftercreatewindow; allocslot; ambientpropertychanged; ansinext; assert; beforecreatewindow; beforedestroywindow; beginpaint; binding; bindtostorage; bitmapidofcontrol; callwindowproc; caninplaceactivate; canwindowlessactivate; cautomationobject; cclassfactory; ccustomverbsofcontrol; cdownloadsink; cexpandoobject; check_pointer; checkforlicense; checklicensekey; cleanup_on_error; cleanup_on_failure; cleanupreflection; clearhashtable; cloneproperties; clsidofobject; clsidofobject; colecontrol; comparename; controlfromhwnd; copyandaddrefobject; copymemory; copyoleverb; cotaskmemalloc; cotaskmemalloc; cotaskmemfree; cproppagesofcontrol; createbindctx; createdc; createdialog; createerrorinfo; createfnofobject; createinplacewindow; createinstance; createinstancelic; createmoniker; createoleadviseholder; createoleobjectfromindex; createrectrgnindirect; createreflectwindow; createstream; createurlmoniker; createwindow; createwindowex; cstandardenum; ctlwndclassregistered; ctypeinfoofobject; cunknownobject; customverbsofcontrol; debugbreak; define_guid; defwindowproc; delete; deletecriticalsection; deletedc; deletekeyandsubkeys; deleteobject; destroywindow; dialogproc; disablethreadlibrarycalls; dispid; do_guids_match; docstringidofproppage; docustomverb; dosuperclasspaint; doverb; enablemodeless; endpaint; entercriticalsection; enumadvise; equalrect; eventiidofcontrol; externaladdref; externalqueryinterface; externalrelease; fail; failed; fatalappexit; fcontrolisopaque; fcontroliswindowless; fireevent; fireprogress; firereadystatechange; freeallslots; g_pfnthreadproc; getactivewindow; getambientproperty; getamoniker; getbindhost; getbindinfo; getcapture; getclassid; getclientrect; getdc; getdevicecaps; getextent; getfocus; gethashtablehead; getidofname; getidsofnames; getidsofnamesex; getinplacesite; getkeystate; getlasterror; getlicensekey; getlicinfo; getlocaleid; getlocaleinfo; getmodulefilename; getnextdispid; getnextdispid; getouterwindow; getparent; getparkingwindow; getpriority; getpriority; getprocessheap; getreftypeinfo; getreftypeofimpltype; getresourcehandle; getscreenmetrics; getslot; getsystemmetrics; gettypeinfo; gettypeinfocount; gettypeinfoofguid; getversion; getwindow; getwindowcontext; getwindowlong; getwindowrect; gtr_free; gtr_malloc; heapalloc; heapfree; heaprealloc; helpcontextofproppage; helpfileofobject; helpfileofproppage; himetric_per_inch; himetrictopixel; hresult_from_win32; iindex; indexofoleobject; init; initializecriticalsection; initializelibrary; initializenewstate; initnew; inplaceactivate; inplacedeactivate; insert; interfaceofobject; interlockeddecrement; interlockedincrement; internalqueryinterface; intersectrect; invalidaterect; invoke; isdialogmessage; isemptyobject; isequalguid; iswindowvisible; langidfromlcid; leavecriticalsection; lhashvalofname; load; loadbinarystate; loadlibrary; loadregtypelib; loadstandardstate; loadstring; loadtextstate; loadtypelib; lockserver; lparam; lpclsid; lpdevmodew; lpolestr; lpsizel; lptodp; lstrcat; lstrcpy; lstrlen; lstrlenw; m_cbelementsize; m_celements; m_cpevents; m_cpevents.advise; m_cpevents.doinvoke; m_cppropnotify; m_cppropnotify.addsink; m_ensureloaded; m_icurrent; m_iid; m_iindex; m_objecttype; m_pfncopyelement; m_pmainunknown; m_polecontrol; m_releaseallobjects; m_rgelements; m_savetostream; make_ansiptr_fromwide; make_wideptr_fromansi; makelangid; makelcid; makewidestrfromansi; map_loghim_to_pix; map_pix_to_loghim; mapwindowpoints; memcpy; memset; messagebox; mkparsedisplaynameex; modaldialog; move; multibytetowidechar; name; nameofobject; new; next; nextcontrol; objectiscreatable; ocxdefwindowproc; offsetof; offsetrect; olecreatepropertyframe; olemiscflagsofcontrol; olestrfromansi; olestrfromresid; onchanged; ondata; ondataavailable; ondatachanged; ondefwindowmessage; ondraw; onfocus; ongetpalette; ongetrect; oninplaceactivate; oninplaceactivateex; oninplacedeactivate; onlowresource; onobjectavailable; onposrectchange; onprogress; onquickactivate; onrequestedit; onsetextent; onsetobjectrectschangingwindowpos; onspecialkey; onstartbinding; onstatuschange; onstopbinding; onuiactivate; onuideactivate; onverb; onviewchange; openstream; optimize; outputdebugstring; pixeltohimetric; pointer; postmessagefilter; pproppagesofcontrol; pptypeinfoofobject; premessagefilter; primarylangid; ptinrect; ptypeinfoofobject; qi_inherits; queryinterface; quick_release; read; regclosekey; regcreatekeyex; regdeletekey; regenumkeyex; registerallobjects; registerautomationobject; registerbindstatuscallback; registerclass; registerclassdata; registercontrolobject; registerdata; registertypelib; registerunknownobject; regopenkeyex; regsetvalueex; release; release_object; releasedc; requestlickey; return_on_failure; return_on_nullalloc; savebinarystate; saveobject; savestandardstate; savetextstate; scrollrect; scrollwindowex; sendmessage; sendonsave; setactiveobject; setadvise; setborderspace; setcapture; setclientsite; setdescription; seterrorinfo; setextent; setfocus; setguid; setguifocus; sethelpcontext; sethelpfile; setinplaceparent; setinplacevisible; setlibrarythreadproc; setmapmode; setobjectrects; setobjects; setparent; setslot; setsource; setupdownload; setviewportextex; setviewportorgex; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; setwindowrgn; showobject; showpropertyframe; showwindow; stdmethod; stdmethod_; stdmethodimp_; stringfromguida; subclasswndprocofcontrol; subclasswndprocofcontrol; subclasswndprocofcontrol; succeeded; succeeded; sysallocstring; sysallocstring; sysallocstringlen; templatenameofproppage; titleidofproppage; translateaccelerator; uideactivate; unadvise; uninitializelibrary; unregisterallobjects; unregisterautomationobject; unregisterclass; unregistercontrolobject; unregisterdata; unregistertypelibrary; unregisterunknownobject; ushort)versionofobject; v_cy; v_i2; v_i4; va_arg; va_end; va_start; variantchangetype; variantclear; variantinit; versionofobject; viewchanged; warning; widechartomultibyte; windowless; windowproc; winhelp; wndclassnameofcontrol; write; wsprintf; zeromemory


ToDoSvr: Build the ToDoSvr Control

Click to open or copy the ToDoServer project files.

Click to open or copy the Include project files (required).

ToDoSvr is a simple example of a combination OLE Control and Document Object server based on the OLE Controls Framework sample code. Generic extensions to the framework, which would apply to any Document Object server, are contained in the class CDocumentObject, which is defined in cdocobj.h. Any code that is specific to making ToDoSvr act as a Document Object is marked with a comment containing the word DOCOBJ.

ToDoSvr depends on the FrameWrk sample, which you must build first. To build a debug version of the framework library, use the command line nmake from the FrameWrk directory. To build a retail version of the framework, use the command line nmake nodebug=1 from the FrameWrk directory. Libraries are placed in the ..\Lib directory.

In its current state, ToDoSvr shows nothing more than the minimal amount of code required to act as a Document Object from within Office Binder. It does not manage any data and it doesn't display anything.

In its completed form, ToDoSvr is a simple to-do list manager that can act as a Document Object within any Document Object container. ToDoSvr exposes a simple object model which lets you manage to-do information via OLE automation. In addition to providing hyperlinks to documents you are working on, ToDoSvr objects act as hyperlink targets, so that you can easily jump to particular tasks.

Building SDK Samples

This sample demonstrates the following keywords:

_purecall; activateasdocobject; activateme; addref; addref_object; applyviewstate; assert; baseclass; callwindowproc; caninplaceactivate; cdocumentobject; checkforlicense; checklicensekey; cleanup_on_error; clone; closeview; clsidofobject; cpropertypage; create; createinplacewindow; createview; ctodocontrol; ctodogeneralpage; declare_standard_unknown; defaultextidofdocobject; define_docobject; define_guid; define_propertypageobject; dialogproc; do_guids_match; docobject; dosuperclasspaint; doverb; enumviews; fail; failed; filedescriptionidofdocobject; firstcontrol; getclassinfo; getdocmiscstatus; getdocument; getinplacesite; getlicensekey; getrect; getresourcehandle; getwindow; getwindowcontext; initializelibrary; inplacedeactivate; internalqueryinterface; load; loadstring; lparam; lstrcat; lstrcpy; lstrlen; makelcid; memset; messagebox; miscflagsofdocobject; modaldialog; nameofobject; nextcontrol; onapplyviewstate; oninplaceactivate; onsaveviewstate; onuiactivate; open; outputdebugstring; printofdocobject; privateunknown; propertypage; proppageexception; queryinterface; quick_release; regclosekey; regcreatekeyex; registerclass; registerclassdata; registerdata; registerdocobject; regopenkeyex; regsetvalueex; release; release_object; saveviewstate; setactiveobject; setborderspace; setclientsite; setextent; setfocus; setinplacesite; setinplacevisible; setobjectrects; setrect; setrectcomplex; setwindowpos; show; stdmethod; stringfromguida; subclasswndprocofcontrol; succeeded; sysallocstring; trace; uiactivate; uideactivate; unadvise; uninitializelibrary; unregisterdata; warning; wndclassnameofcontrol; wsprintf;


WebImage: Build the WebImage Control

Click to open or copy the WebImage project files.

Click to open or copy the Include project files (required).

This sample illustrates embedding a locally installed OLE Control (Wimg.ocx) into a page. This control displays a 24-bit bitmap on the page.

Building SDK Samples

This sample demonstrates the following keywords:

_purecall; addref; aftercreatewindow; assert; base; beforecreatewindow; bitblt; bstrfromansi; calcimagesize; cdibfile; cdibsection; check_pointer; checklicensekey; cinternetcontrol; cocreateinstance; controlobject; cpropertypage; create; createcompatibledc; createcomponentcategory; createdibsection; createhalftonepalette; cwebimagecontrol; cwebimagegeneralpage; define_guid; define_propertypageobject; deletedc; deleteobject; dialogproc; do_guids_match; fail; failed; fireprogress; firstcontrol; get_image; getdc; getdlgitemtext; getfileheader; getinfoheader; getlicensekey; getobject; getresourcehandle; getsize; handle; hbrush; headersize; hiword; imagesize; internalqueryinterface; invalidatecontrol; load; loadcursor; loword; lparam; lstrcmp; lstrcpy; lstrlen; make_ansiptr_fromwide; makedirty; makelcid; memset; messagebox; modaldialog; nextcontrol; ocxdefwindowproc; olestrfromansi; paintto; privateunknown; propertychanged; propertypage; proppageexception; put_image; queryinterface; read; readfrom; realizepalette; registercategories; registerclass; registerclassdata; registerclassimplcategories; registerclsidincategory; registerdata; release; return_on_failure; return_on_nullalloc; scramble; selectobject; selectpalette; setbmppath; setcontrolsize; setdlgitemtext; setmapmode; setup; setupdownload; stretchdibits; succeeded; switch; sysallocstring; sysfreestring; unregisterclassimplcategories; unregisterclsidincategory; updateimage; variantclear; variantinit; warning; wcslen; wcsncpy; widthbytes; wndclassnameofcontrol; write


COM Applications Samples

Click to open or copy the files for the COM Applications samples.

The main COM samples directory above this directory (Download all COM SDK Samples) has a few individual files intended for this directory: a .hlp file for OLE User Interface Library, a readme file with brief descriptions of the COM Applications Samples, and an OLE .gid file.


Bttncur: Buttons and Cursors

Click to open or copy the Bttncur project files.

Click to open or copy the files for the Bin directory (required).

Click to open or copy the files for the Include directory (required).

Click to open or copy the files for the Lib directory (required).

This sample contains public functions to generate different states of toolbar buttons from a single bitmap. States are Normal, Pressed, Checked, and Disabled.

Building SDK Samples

This sample uses the following keywords:

bitblt; bool; createbitmap; createcompatiblebitmap; createcompatibledc; createdibitmap; createpatternbrush; createsolidbrush; cursorscache; cursorsfree; deletedc; deleteobject; drawblankbutton; exttextout; getbvalue; getdc; getdevicecaps; getgvalue; getrvalue; getsyscolor; getversion; hbrushdithercreate; isbadwriteptr; libmain; loadbitmap; loadcursor; makeintresource; maskcreate; outputdebugstring; patb; patblt; releasedc; restoredc; rgb; savedc; selectobject; setbkcolor; setrect; settextcolor; toolbuttonfree; toolbuttoninit; uicursorload; uitoolbuttondraw; uitoolbuttondrawtdd; uitoolconfigurefordisplay; unlockdata; unreferenced_parameter; wep; xxxlibmain


Cmallspy: IMallocSpy Interface

Click to open or copy the Cmallspy project files.

The Cmallspy sample demonstrates a simple implementation of the IMallocSpy interface. When the capability for replaceable memory allocators was removed from 32-bit OLE, the ability for applications to provide their own debug allocators for OLE was also removed. OLE disallows caller-provided allocators for multithread safety and general robustness. To provide a way for applications to monitor memory allocation, detect memory leaks, and simulate memory failure, OLE now provides support for a simple wrapper for the IMalloc interface called the IMallocSpy interface.

Building SDK Samples

This sample uses the following keywords:

addref; alloc; cmallocspy; cogetmalloc; coinitialize; coregistermallocspy; corevokemallocspy; couninitialize; free; isequaliid; main; postalloc; postdidalloc; postfree; postgetsize; postheapminimize; postrealloc; prealloc; predidalloc; prefree; pregetsize; preheapminimize; prerealloc; printf; queryinterface; release; stdmethod; stdmethod_


Common Directory for COM Application Samples

Click to open or copy the Common project files.

Click to open or copy the files for the Lib directory (required).

Altassrt.cxx contains assertion routines for the SDK. The function PopUpAssert displays assertion information; it's called when an assertion is hit. The function PopUpError displays a dialog box using provided text, and presents the user with the option to continue or cancel; has these arguments: The string to display in the main body of the dialog, the line number of the file in error, and the filename of the file in error.

Stablize.cxx contains a stabilization class (CSafeRefCount) used to stabilize objects during re-entrant calls, by tracking the reference count.

Building SDK Samples

This sample uses the following keywords:

assert; csaferefcount; debugbreak; decrementnestcount; getcurrentprocessid; getcurrentthreadid; getmodulefilenamea; incrementnestcount; messageboxa; popupassert; popuperror; safeaddref; saferelease; sprintf; strrchr


Decode: Error Code Decoder Tool

Click to open or copy the Decode project files.

Decode is a decoder of 32-bit OLE error codes (HRESULTs) and Windows error codes. Enter OLE error codes in hexadecimal and Windows error codes in decimal.

This tool might not be able to decode errors added after the shipping of the Win32 SDK in which it is included.

Building SDK Samples

This sample uses the following keywords:

case_code; case_facility; case_hresult; checkdlgbutton; decodehresult; dialogbox; enddialog; facility_itf; facilty_control; formatmessage; getdlgitem; getdlgitemtext; hbrush; hresult_code; hresult_facility; hresultdialogfunc; isdlgbuttonchecked; loadcursor; loadicon; loword; lstrcpy; make_hresult; makeintresource; makelangid; registerclass; setwindowtext; sscanf; switch; text; wsprintf


Gizmobar: Generates Gizmobar.dll and Gizmobar.lib

Click to open or copy the Gizmobar project files.

Click to open or copy the files for the Bin directory (required).

Click to open or copy the files for the Include directory (required).

Click to open or copy the files for the Lib directory (required).

This sample contains the main window procedure of the Gizmobar control, which handles mouse logic and Windows messages.

Building SDK Samples

This sample uses the following keywords:

beginpaint; bitposition; bool; callwindowproc; commandparams; createpen; createsolidbrush; createwindowa; defwindowproc; deletefile; deleteobject; destroywindow; dllmain; dword; enablewindow; endpaint; fenumchangefont; fenumenable; fenumhittest; fenumpaintgizmos; fillrect; free; fregistercontrol; genericsubproc; getclientrect; getdc; getdlgitem; getdlgitemint; getdlgitemtexta; getdlgitemtextw; getkeystate; getnextdlgtabitem; getparent; getprop; getstockobject; getsyscolor; getsystemmetrics; getwindowid; getwindowinstance; getwindowlong; getwindowword; hbrush; hiword; hlocal; intersectrect; invalidaterect; iswindow; libmain; loadcursor; localalloc; localfree; long; loword; lstrcpy; makelong; makewparam; malloc; mdirefreshmenu; menuselectparams; min; multibytetowidechar; openfile; pgizmo; pgizmobar; pgizmofromhwndid; pointfromlparam; positionbit; ptinrect; rectangle; rectstorect; recttorects; registerclass; releasecapture; releasedc; removeprop; scrollthumbposition; selectobject; sendcommand; sendmenuselect; sendmessage; sendscrollposition; setactivewindow; setbkcolor; setcapture; setdlgitemint; setdlgitemtexta; setdlgitemtextw; setfocus; setforegroundwindow; setprop; setrect; settextcolor; setwindowlong; setwindowpos; short; showwindow; strlen; text; uint; uitoolbuttondrawtdd; uitoolconfigurefordisplay; unicodetoansi; unlockdata; unreferenced_parameter; updatewindow; wcslen; wcstombs; widechartomultibyte


MFract Samples: COM Custom Interfaces

Click to open or copy the files for the MFract samples.

The MFract sample uses OLE2's Component Object Model (COM) to provide a mechanism for implementing modular fractal engines.

Each of MFract's fractal engines are implemented as inproc servers that provide a custom interface called IFractalEngine. This allows new fractal engines to be created for MFract without having to modify or recompile the application. In fact, creating a new fractal engine doesn't require that the programmer know anything about Mfract beyond the custom interfaces that it uses.


App: Build Mfract.exe

Click to open or copy the App project files.

Click to open or copy the Idl project files (required).

Click to open or copy the Bin project files (required).

Click to open or copy the Winhlprs project files (required).

It is recommended that you simply download everything from COM MFract Samples: Custom Interfaces, rather than from this level.

App is the master application that manages and presents the modular fractal engines for the MFract sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; _strdup; _wcsdup; abs; addref; animatepalette; beginpaint; bitblt; bitmapfromdib; cchangedim; cenginelist; cfractalwindow; changefractalengines; char; checkbuttons; checkmenuitem; checkradiobutton; clienttoscreen; clipline; closehandle; clsidfromstring; cocreateinstance; commit; create; createbipalette; createcompatibledc; createdibitmap; createdibpalette; createdibsection; createevent; createfile; createpalette; createpopupmenu; createsolidbrush; createstream; cyclestop; defwindowproc; delete; deletecriticalsection; deletedc; deleteobject; destroymenu; dialogproc; dibblt; dibfrombitmap; dibinfo; dibnumcolors; dispatchmessage; dlgabout.showdialog; dlgchangedim; dlgchangedim.showdialog; domenu; donedrawinggraph; double; drawbitmap; drawrect; enablemenuitem; enddialog; endpaint; endwait; entercriticalsection; eraserect; exists; failed; faster; findentry; framerect; getclassid; getclipbox; getdc; getdevicecaps; getdibits; getdlgitemint; getentry; getextent; getfocus; getgraphsize; gethwnd; getmenu; getmenustring; getmessage; getmodulefilename; getobject; getopenfilename; getpoint; getsavefilename; getstockobject; getsystemmetrics; getsystempaletteentries; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalrealloc; globalunlock; hiword; init; initapplication; initializecriticalsection; initinstance; insertmenu; invalidaterect; isdib; isequalguid; iszoomed; killtimer; leavecriticalsection; line; loadaccelerators; loadcursor; loadfile; loadicon; loadpalette; loadstring; localalloc; localfree; loword; lpvoid; lread; lstrcpy; lwrite; makeintresource; mbstowcs; memcpy; memset; messagebeep; messagebox; modifymenu; movewindow; muldiv; newwindowsize; offsetrect; olebuildversion; oleinitialize; oleloadfromstream; olesavetostream; olestr; oleuninitialize; oncreate; onstart; onstop; opendib; openfile; openstream; paletteentry; palettesize; patblt; point; postmessage; postquitmessage; queryinterface; read; readdibbitmapinfo; readdibbitmapinfofromstream; readfile; realizepalette; rect; regclosekey; regcreatekeyex; regenumvalue; registerclass; regqueryinfokey; regsetvalueex; release; releasecapture; releasedc; resetevent; rgcommandlist; savebitmap; savefile; savepalette; seek; selectobject; selectpalette; sendmessage; setcapture; setcursor; setcursorpos; setdefaultcolors; setdefaults; setdibcolortable; setdibitstodevice; setdlgitemint; setevent; setextent; setgraphsize; setproperties; setrect; setrectempty; setscrollpos; setscrollrange; settimer; setupcolortable; setwindowlong; setwindowpos; showcursor; showwindow; sprintf; sscanf; start; startwait; stdmethod; stdmethod_; stdmethodimp_; stgcreatedocfile; stgopenstorage; stop; stretchblt; stretchdibblt; stretchdibits; stringfromguid2; strlen; succeeded; switch; text; toggletitle; translateaccelerator; translatemessage; unionrect; unrealizeobject; updatewindow; waitforsingleobject; wash; wcslen; wcstombs; widthbytes; windowproc; winhelp; winmain; write; writedib; writefile


Julia: Julia Set Fractal Engine

Click to open or copy the Julia project files.

Click to open or copy the Idl project files (required).

Click to open or copy the Bin project files (required).

Click to open or copy the Winhlprs project files (required).

It is recommended that you simply download everything from COM MFract Samples: Custom Interfaces, rather than from this level.

This sample is a Julia Set fractal engine to demonstrate custom interfaces for COM. It produces Julia.dll.

Building SDK Samples

This sample uses the following keywords:

addref; checkdlgbutton; cjulia; cjuliacf; cocreateinstance; computepoint; createinstance; delete; dialogproc; dllcanunloadnow; dllgetclassobject; dllmain; donedrawinggraph; enddialog; failed; getclassid; getdlgitemtexta; getextent; getsizemax; init; initialize; isdirty; isdlgbuttonchecked; isequalguid; load; loadstring; lockserver; loword; makeintresource; memcpy; messagebox; queryinterface; read; readdouble; release; reset; save; setdefaults; setdlgitemtexta; setextent; setgraphsize; setproperties; showdialog; sizedouble; sprintf; sscanf; start; stop; useboundingboxes; write; writedouble


Mandel: Mandelbrot Fractal Engine

Click to open or copy the Mandel project files.

Click to open or copy the Idl project files (required).

Click to open or copy the Bin project files (required).

Click to open or copy the Winhlprs project files (required).

It is recommended that you simply download everything from COM MFract Samples: Custom Interfaces, rather than from this level.

This sample is a Mandelbrot Fractal engine to demonstrate custom interfaces for COM. It produces Mandel.dll.

Building SDK Samples

This sample uses the following keywords:

addref; checkdlgbutton; cmandelbrot; cmandelbrotcf; cocreateinstance; computepoint; createinstance; delete; dialogproc; dllcanunloadnow; dllgetclassobject; dllmain; donedrawinggraph; enddialog; failed; getclassid; getdlgitemtexta; getextent; getsizemax; init; initialize; isdirty; isdlgbuttonchecked; isequalguid; load; loadstring; lockserver; loword; makeintresource; memcpy; messagebox; queryinterface; read; readdouble; release; reset; save; setdefaults; setdlgitemtexta; setextent; setgraphsize; setproperties; showdialog; sizedouble; sprintf; sscanf; start; stop; useboundingboxes; write; writedouble


Plasma: Plasma Fractal Engine

Click to open or copy the Plasma project files.

Click to open or copy the Idl project files (required).

Click to open or copy the Bin project files (required).

Click to open or copy the Winhlprs project files (required).

It is recommended that you simply download everything from COM MFract Samples: Custom Interfaces, rather than from this level.

This sample is a Plasma Fractal engine to demonstrate custom interfaces for COM. Produces Plasma.dll.

Building SDK Samples

This sample uses the following keywords:

addref; closehandle; cplasma; cplasmacf; createevent; createinstance; createthread; delete; dialogproc; dllcanunloadnow; dllgetclassobject; dllmain; donedrawinggraph; enddialog; failed; float; getclassid; getdlgitemtexta; getextent; getpoint; getsizemax; gettickcount; graphicsthread; init; initialize; isdirty; isequalguid; load; loadstring; lockserver; loword; makeintresource; memcpy; messagebox; normalize; point; queryinterface; rand; readdouble; rect; release; resetevent; save; setdefaults; setdlgitemtexta; setevent; setextent; setgraphsize; setproperties; showdialog; sizedouble; sprintf; sqrt; srand; sscanf; start; startgraphicsthread; stop; subdivide; terminatethread; unsigned; waitforsingleobject; writedouble


Quad: Quadrant Engine

Click to open or copy the Quad project files.

Click to open or copy the Idl project files (required).

Click to open or copy the Bin project files (required).

Click to open or copy the Winhlprs project files (required).

It is recommended that you simply download everything from COM MFract Samples: Custom Interfaces, rather than from this level.

Sources for the Quadrant Fractal engine. Produces Quad.dll.

This component is used by fractal engines such as the Mandelbrot and Julia Set objects to simplify the amount of code that they have to write. Using this component allows the Mandelbrot and Julia Sets to get away with providing only a property dialog implementation, persistence, and a simple point-to-color mapping function. The Quadrant engine takes care of iterating across the graph, drawing the points, and optimizing areas where possible.

Building SDK Samples

This sample uses the following keywords:

addref; closehandle; computepoint; cquadrantengine; cquadrantenginecf; createevent; createinstance; createthread; delete; dllcanunloadnow; dllgetclassobject; dllmain; donedrawinggraph; failed; getpoint; graphicsthread; init; initialize; isequalguid; lockserver; paletteindex; plotareaslowly; point; queryinterface; rect; release; reset; resetevent; setevent; setgraphsize; start; startgraphicsthread; stop; subdivide; terminatethread; useboundingboxes; waitforsingleobject


Rgen: Recursive Generator Fractal Engine

Click to open or copy the Rgen project files.

Click to open or copy the Idl project files (required).

Click to open or copy the Bin project files (required).

Click to open or copy the Winhlprs project files (required).

It is recommended that you simply download everything from COM MFract Samples: Custom Interfaces, rather than from this level.

This sample is a Recursive Generator engine to demonstrate custom interfaces for COM. It produces Rgen.dll.

Building SDK Samples

This sample uses the following keywords:

acos; addref; beginpaint; cartesianfrompolar; closehandle; convertx; converty; cos; create; createevent; createinstance; createpen; createthread; crgen; crgencf; defwindowproc; delete; deleteobject; dialogproc; dllcanunloadnow; dllgetclassobject; dllmain; donedrawinggraph; double; ellipse; enddialog; endpaint; failed; getclassid; getclipbox; getdlgitemint; getextent; getsizemax; getstockobject; graphicsthread; hiword; init; initialize; initializepoints; invalidaterect; isdirty; isequalguid; line; lineto; load; loadcursor; loadstring; lockserver; long; loword; makeintresource; mapdialogrect; memcpy; messagebox; movetoex; polarfromcartesian; polyline; queryinterface; read; readdouble; rect; recurse; redraw; registerclass; release; releasecapture; resetevent; retrievepoints; save; selectobject; setcapture; setdefaults; setdefaultsegmentlist; setdlgitemint; setevent; setextent; setgraphsize; setproperties; showdialog; sin; sizedouble; sqrt; start; startgraphicsthread; stop; terminatethread; text; waitforsingleobject; windowproc; write; writedouble


Idl: Build FGUIDS.LIB Library

Click to open or copy the Idl project files.

It is recommended that you simply download everything from COM MFract Samples: Custom Interfaces, rather than from this level.

This sample contains the custom interfaces used by MFract and its fractal engines. It produces a set of .h files and a library called Fguids.lib which contains all the IIDs for the interfaces. Run build -nmake clean in this directory to delete midl-generated files.


Object Samples

Click to open or copy the files for the Object samples.


Ohello: Object Sample Illustrating a Custom Interface

Click to open or copy the Ohello project files.

The Ohello program demonstrates OLE custom interfaces and proper reference counting and shutdown behavior for a multiple-use local server. The program also shows how to use the Win32® registry functions to install a local server and a proxy DLL in the registry.

Building SDK Samples

This sample uses the following keywords:

addref; cocreateinstance; coinitialize; coregisterclassobject; corevokeclassobject; couninitialize; createinstance; decrementlockcount; dispatchmessage; failed; formatmessage; freelibrary; getlasterror; getmessage; getmodulefilenamea; getprocaddress; helloproc; hresult_from_win32; incrementlockcount; interlockeddecrement; interlockedexchange; interlockedincrement; isequalguid; loadlibrarya; localfree; lockserver; main; makelangid; objectcreated; objectdestroyed; postquitmessage; printerrormessage; printf; queryinterface; regclosekey; regcreatekeyexa; regdeletekeya; regflushkey; registerclassfactory; registerlocalserver; registerproxydll; regopenkeyexa; regsetvalueexa; release; revokeclassfactory; sleep; sprintf; stricmp; strlen; succeeded; translatemessage; unregisterlocalserver; unregisterproxydll


OLEapt: OLE Apartment Model Threading

Click to open or copy the OLEapt project files.

The OLEapt sample demonstrates OLE apartment model threading. The term "apartment" describes a thread with a message queue that supports OLE/COM objects. Objects within an apartment are re-entrant in only the traditional Windows sense, similar to single-threaded OLE. Therefore, operations that yield to the message queue can cause further messages to be sent to any objects within the apartment. Apartment model threading allows there to be more than one "apartment" where previously there was only one: the main application thread.

Building SDK Samples

This sample uses the following keywords:

addref; beginpaint; cclassfactory; cobject; cocreateinstance; coinitialize; comarshalinterface; coregisterclassobject; corevokeclassobject; couninitialize; counmarshalinterface; createevent; createinstance; createstreamonhglobal; createthread; createwindow; define_guid; defwindowproc; dispatchmessage; endpaint; failed; fautoregister; getcurrentthreadid; getlasterror; getmessage; getmodulefilename; hbrush; invalidaterect; loadcursor; loadicon; lockserver; lstrcpy; lstrlen; mainwndproc; memset; messagebeep; messagebox; msgwaitformultipleobjects; peekmessage; postquitmessage; queryinterface; regclosekey; regcreatekey; registerclass; regsetvalue; release; resumethread; seek; serverthreadproc; setevent; showwindow; stdmethodimp_; strcmpi; strtok; text; textout; translatemessage; waitforsingleobject; winmain; wsprintf


OLEStd: OLE Standard Utility Library

Click to open or copy the OLEStd project files.

The OLEStd sample creates a library of utility functions that you may find useful as a model for writing your own code.

Most of this code was once part of the OLE UI sample library that used to be included in the OLE samples. Since OLEDLG.DLL was added to the set of system-supported OLE libraries, much of the old OLE UI code has become obsolete. This library contains most of the remaining functionality from that DLL.

Note: This library is not an official part of the OLE specification. It is intended only to demonstrate techniques and methods; not to be used as a professional development library. Microsoft cannot guarantee that all of this code is completely correct or fully operational. You may feel free to incorporate some of this code in your applications but please be aware that it has undergone limited testing and may not be entirely free of bugs.

Building SDK Samples

This sample uses the following keywords:

_dos_findfirst; _fmemset; addref; advise; alloc; ansitooem; cache; closemetafile; clsidfromprogid; codosdatetimetofiletime; cofiletimenow; cogetmalloc; coisole1class; commit; copymetafile; cotreatasclass; createbindctx; createfilemoniker; createilockbytesonhglobal; createmetafile; createstorage; createstreamonhglobal; defined; destroyelement; didalloc; draw; enum; enumcache; enumelements; enumformatetc; findclose; findfirstfile; free; getclassfile; getdata; getdisplayname; getextent; getfiletimes; getmiscstatus; getmoniker; getrunningobjecttable; getsize; getsourcedisplayname; getuserclassid; getusertype; globalalloc; globalfree; globallock; globalunlock; isbadreadptr; iscloseformatetc; isequalclsid; isequalformatetc; isrunning; issystemmoniker; loadstring; lpolestr; lstrcpy; lstrcpyn; lstrlen; messagebox; mkparsedisplayname; next; notechangetime; oledbg_begin2; oledbgassert; oledbgassertsz; oledbgout; oledbgout1; oledbgout2; oledbgout4; oledbgouthresult; oleduplicatedata; olequerycreatefromdata; olequerylinkfromdata; olesave; olesavetostream; olesetcontainedobject; olesetcontainedobject; olestdcheckvtbl; olestdcommitstorage; olestdcopymetafilepict; olestdcopystring; olestdcreatechildstorage; olestdcreaterootstorage; olestdcreatestorageonhglobal; olestdcreatetempfilemoniker; olestdcreatetempstorage; olestddestroyallelements; olestddoconvert; olestddotreatasclass; olestdfillobjectdescriptorfromdata; olestdfree; olestdfreestring; olestdgetdata; olestdgetdefaultfileformatofclass; olestdgetdropeffect; olestdgetfirstmoniker; olestdgetitemtoken; olestdgetlenfileprefixofmoniker; olestdgetlinksourcedata; olestdgetmetafilepictfromoleobject; olestdgetobjectdescriptordata; olestdgetobjectdescriptordatafromoleobject; olestdgetoleobjectdata; olestdgetpriorityclipboardformat; olestdgetsize; olestdgettreatasfmtusertype; olestdgetusertypeofclass; olestdinitvtbl; olestdisduplicateformat; olestdisolelink; olestdmalloc; olestdmarkpasteentrylist; olestdmkparsedisplayname; olestdnotefilechangetime; olestdnoteobjectchangetime; olestdnullmethod; olestdopenchildstorage; olestdopenorcreaterootstorage; olestdopenrootstorage; olestdqueryformatmedium; olestdqueryinterface; olestdquerylinksourcedata; olestdqueryobjectdescriptordata; olestdqueryoleobjectdata; olestdrealloc; olestdregisterasrunning; olestdrelease; olestdrevokeasrunning; olestdseticonincache; olestdsetupadvises; olestdswitchdisplayaspect; olestdverifyrelease; olestr; olestrcpy; olestrlen; openstorage; progidfromclsid; queryinterface; readclassstg; readfmtusertypestg; realloc; regclosekey; register; regopenkey; regqueryvalue; regsetvalue; release; releasestgmedium; revoke; savecompleted; setadvise; setconvertstg; setdata; sethostnames; setwindowextex; setwindoworgex; stdapi_; stgcreatedocfile; stgcreatedocfileonilockbytes; stgopenstorage; stringfromclsid; succeeded; uncache; writeclassstg; writeclassstm; writefmtusertypestg; wsprintf


Outline: Extending an Application

Click to open or copy the Outline project files.

Click to open or copy the files for the Lib directory (required).

The Outline sample application set demonstrates taking a base application (in this case Outline.exe) and extending it into an OLE container and server (Cntroul and Svroutl, respectively), and into an OLE in-place container and server.

"In-place" is also known as "visual editing". The container and server are Icntrotl and Isvrotl, respectively.

These applications attempt to implement the complete OLE functionality and recommended user model. For example, these applications implement all of the OLE user interface dialog boxes. As such, this is not a trivial sample application set.

All Outline sample applications support loading and saving files; they all use docfiles for storage.

Building SDK Samples

This sample uses the following keywords:

_assert; _fmemcpy; _fmemset; aboutdlgproc; addeditdlgproc; addref; advise; appwndproc; assignpopupmessage; caninplaceactivate; codisconnectobject; createbindctx; createdataadviseholder; creategenericcomposite; createhatchwindow; createitemmoniker; createmenu; createoleadviseholder; createsolidbrush; createstatuswindow; createstream; createwindow; defined; definenamedlgproc; defwindowproc; delete; deletemenu; deleteobject; destroymenu; destroystatuswindow; destroywindow; docwndproc; drawfocusrect; drawmenubar; enumadvise; exttextout; failed; fillrect; fnassert; getaccelitemcount; getclientrect; getcontrolmessage; getconvertstg; getdc; getdisplayname; geticonofclass; getitemmessage; getmenu; getmoniker; getpopupmessage; getrandom; getstockobject; getsyscolor; getsysmenumessage; gettextextentpoint; gettextmetrics; getwindow; getwindowcontext; getwindowrect; gotonamedlgproc; hiword; init_interfaceimpl; inputtextdlg; insertmenu; insertmenus; int; int)sendmessage; intersectrect; invalidaterect; invertrect; is_filename_delim; isequalclsid; isequaliid; iswindowvisible; linelistwndproc; liset32; loadcursor; loword; lparam; lplinelist)&; lpoledoc; lstrcpy; lstrlen; makelparam; max; modifymenu; mytranslateaccelerator; new; offsetrect; olecreatemenudescriptor; oledbgaddrefmethod; oledbgassert; oledbgassertsz; oledbgout; oledbgout2; oledbgout3; oledbgout4; oledbgouthresult; oledbgoutnoprefix3; oledbgoutrect3; oledbgoutrefcnt4; oledbgqueryinterfacemethod; oledbgreleasemethod; oleregenumformatetc; oleregenumverbs; olereggetmiscstatus; olereggetusertype; olestdfreestring; olestdgettreatasfmtusertype; olestdmsgfilter_setparentwindow; olestdnoteobjectchangetime; olestdqueryformatmedium; olestdrelease; olestdverifyrelease; olestr; olestrcmp; olestrcpy; oleuishowobject; oninplaceactivate; oninplacedeactivate; onposrectchange; onuiactivate; onuideactivate; openstream; pack; postmessage; printdlgproc; querygetdata; rand; read; registerclass; registerstatusclass; release; releasedc; removemenu; removemenus; resetorigdc; save; screentoclient; seek; selectobject; sendmessage; sendonclose; sendondatachange; sendonrename; sendonsave; setactiveobject; setbkmode; setborderspace; setconvertstg; setdctoanisotropic; setdebuglevelcommand; setfocus; sethatchwindowsize; setlineheightdlgproc; setmapmode; setmenu; setparent; setstatustext; settextcolor; setviewportextex; setwindowextex; showwindow; stdmethodimp_; succeeded; switch; tracedebug; uint; unadvise; updatewindow; winmain; write; writefmtusertypestg; wsprintf; xformheightinhimetrictopixels; xformsizeinhimetrictopixels; xformwidthinhimetrictopixels


Cntroutl: OLE Container

Click to open or copy the Cntroutl project files.

This sample requires that the Outline sample be installed.


Icntrotl: In-Place Container

Click to open or copy the Icntrotl project files.

This sample requires that the Outline sample be installed.


Isvrotl: In-Place Server

Click to open or copy the Isvrotl project files.

This sample requires that the Outline sample be installed.


Outline: Base Application

Click to open or copy the Outline project files.

This sample requires that the Outline sample be installed.


SvrOutl: OLE Server

Click to open or copy the SvrOutl project files.

This sample requires that the Outline sample be installed.


SimpCntr: Simple OLE Container

Click to open or copy the SimpCntr project files.

The Simpcntr sample is the simplest OLE container that can be written that supports the visual editing feature. The sample has no native file format, and can only support one OLE object at a time. Use the Insert Object command to create an object.

Building SDK Samples

This sample uses the following keywords:

about; addframeleveltools; addframelevelui; addref; appendmenu; assert; beginpaint; bool; bringwindowtotop; cadvisesink; close; closeoleobject; cogetmalloc; coleclientsite; coleinplaceframe; coleinplacesite; contextsensitivehelp; copyrect; create; createpalette; createstandardpalette; createstorage; createwindow; csimpleapp; csimpledoc; csimplesite; defined; defwindowproc; deleteobject; destroydocs; destroymenu; destroywindow; dialogbox; disableinsertobject; dispatchmessage; docwndproc; doverb; enablemenuitem; enddialog; endpaint; failed; finitapplication; finitinstance; free; getclientrect; getcolorset; getcontainer; getdc; getdevicecaps; getextent; getmenu; getmenuitemcount; getmessage; getmoniker; getobjrect; getstockobject; getsubmenu; getsystempaletteentries; getwindow; handleaccelerators; hiword; initapplication; initinstance; initobject; inplacedeactivate; insertobject; invalidaterect; laddverbs; lcommandhandler; lcreatedoc; loadcursor; loadicon; loword; lresizedoc; lsizehandler; mainwndproc; memset; movewindow; muldiv; olebuildversion; oledraw; olefree; oleinitialize; olesave; olesetcontainedobject; olesetmenudescriptor; olestr; oleuiinsertobject; oleuninitialize; onclose; onframewindowactivate; onshowwindow; outputdebugstring; paintapp; paintdoc; paintobj; postquitmessage; ptinrect; queryinterface; querynewpalette; realizepalette; registerclass; release; releasedc; removemenu; requestnewobjectlayout; resizeborder; revert; rgb; safeaddref; saferelease; savecompleted; saveobject; selectobject; selectpalette; sendmessage; setadvise; setfocus; sethostnames; setmessagequeue; setobjectrects; setrectempty; setrop2; showobject; showwindow; stabilize; stdmethodimp_; style; succeeded; translateaccelerator; translatemessage; uideactivate; unloadoleobject; updatewindow; warning; winmain; wselectpalette; xformheightinhimetrictopixels; xformwidthinhimetrictopixels


SimpDND: Simple OLE Drag and Drop

Click to open or copy the SimpDND project files.

The Simpdnd sample provides a simple implementation of OLE drag and drop.

Building SDK Samples

This sample uses the following keywords:

_fmemset; about; addref; assert; beginpaint; bool; bringwindowtotop; cadvisesink; cdataxferobj; cdropsource; cdroptarget; close; closeoleobject; coleclientsite; copyobjecttoclip; copyto; create; createpalette; createpen; createstorage; createwindow; csimpleapp; csimpledoc; csimplesite; defined; defwindowproc; deleteobject; destroydocs; destroymenu; destroywindow; dialogbox; disableinsertobject; dispatchmessage; docwndproc; dodragdrop; dodragscroll; doverb; drawdragfeedback; enablemenuitem; enddialog; endpaint; enumformatetc; finitapplication; finitinstance; getclientrect; getcolorset; getcontainer; getcurrenttime; getdata; getdc; getextent; getmenu; getmenuitemcount; getmessage; getmoniker; getobjrect; getprofileint; getstockobject; getsubmenu; getsyscolor; globalunlock; handleaccelerators; highlightrect; hiword; initapplication; initdragfeedback; initinstance; initobject; insertobject; int; invalidaterect; killtimer; laddverbs; lcommandhandler; lcreatedoc; loadcursor; loadicon; loword; lresizedoc; lsizehandler; mainwndproc; messagebox; movewindow; offsetpoint; offsetrect; olebuildversion; oledbgout; oledbgsetdbglevel; oledraw; oleflushclipboard; oleinitialize; oleload; olequerycreatefromdata; olesave; olesetclipboard; olesetcontainedobject; olestdfree; olestdgetdropeffect; olestdgetmetafilepictfromoleobject; olestdgetobjectdescriptordatafromoleobject; olestdgetoleobjectdata; olestdinitialize; olestduninitialize; olestr; oleuiinitialize; oleuiinsertobject; oleuiuninitialize; oleuninitialize; onclose; onshowwindow; outputdebugstring; paintapp; paintdoc; paintobj; postquitmessage; querydrag; querydrop; queryinterface; realizepalette; rectangle; registerclass; registerclipboardformat; registerdragdrop; release; releasecapture; releasedc; releasestgmedium; removemenu; requestnewobjectlayout; resultfromscode; revert; revokedragdrop; rgb; safeaddref; saferelease; savecompleted; saveobject; screentoclient; scroll; selectobject; selectpalette; sendmessage; setadvise; setbottomright; setcapture; setfocus; sethostnames; setmessagequeue; setrop2; settimer; settopleft; showobject; showwindow; stabilize; stdmethodimp_; stgcreatedocfile; style; succeeded; translatemessage; undrawdragfeedback; unloadoleobject; updatewindow; warning; winmain; xformheightinhimetrictopixels; xformsizeinhimetrictopixels; xformwidthinhimetrictopixels


SimpSvr: Simple Visual Editing

Click to open or copy the SimpSvr project files.

The Simpsvr sample implements the simplest OLE object that supports visual editing. The object is a colored square with a black border.

Building SDK Samples

This sample uses the following keywords:

addframelevelui; addref; advise; assemblemenus; beginpaint; caninplaceactivate; cclassfactory; cdataobject; cexternalconnection; cleardataadviseholder; cleardoc; clearobj; clearoleadviseholder; clearoleclientsite; close; closemetafile; codisconnectobject; cofiletimenow; coleinplaceactiveobject; coleinplaceobject; coleobject; colockobjectexternal; copyrect; coregisterclassobject; corevokeclassobject; cpersiststorage; create; createbrushindirect; createdataadviseholder; createhatchwindow; createmenu; createmetafile; createobject; createoleadviseholder; createpen; createstreams; createwindow; csimpsvrapp; csimpsvrdoc; csimpsvrobj; deactivateui; define_guid; defined; defwindowproc; deleteobject; destroymenu; destroywindow; dialogbox; disassemblemenus; dispatchmessage; docwndproc; doinplaceactivate; doinplacehide; draw; enddialog; endpaint; enumadvise; finitapplication; finitinstance; float; getapp; getclientrect; getcolormenu; getdataadviseholder; getdataobject; getdoc; getframeinfo; gethappwnd; gethdocwnd; gethelpmenu; gethhatchwnd; gethinst; getinplaceframe; getinplacesite; getmainmenu; getmenu; getmessage; getmetafilepict; getobj; getoleadviseholder; getoleclientsite; getoleinplaceactiveobject; getoleinplaceobject; getoleobject; getparent; getpersiststorage; getposrect; getregisterclass; getrotregister; getrunningobjecttable; getsize; getstockobject; getstorage; getsubmenu; getuiwindow; getwindow; globallock; globalunlock; hideappwnd; hidedocwnd; hidehatchwnd; hiword; initapplication; initinstance; inplacedeactivate; insertmenu; intersectrect; invalidaterect; isdirty; isinitialized; isinplaceactive; isinplacevisible; isstartedbyole; isuiactive; isuptodate; laddverbs; lbuttondown; lcommandhandler; lcreatedoc; load; loadcursor; loadfromstorage; loadicon; loword; lresizedoc; lsizehandler; mainwndproc; movewindow; notechangetime; offsetrect; olebuildversion; olecreatemenudescriptor; oledbgdata_main; oledbgout; oledestroymenudescriptor; oleinitialize; olestdinitialize; olestduninitialize; olestr; oleuiinitialize; oleuiuninitialize; oleuninitialize; oninplaceactivate; oninplacedeactivate; onshowwindow; onuiactivate; onuideactivate; openedit; openstreams; outputdebugstring; paintapp; paintdoc; paintobj; parsecmdline; postmessage; postquitmessage; querygetdata; queryinterface; read; register; registerclass; registerhatchwindowclass; release; releasestreamsandstorage; removemenu; removemenus; revoke; rgb; rotatecolor; safeaddref; saferelease; saveobject; seek; selectobject; sendmessage; sendonclose; sendondatachange; sendonrename; sendonsave; setactiveobject; setborderspace; setfocus; sethatchwindowsize; setmapmode; setmenu; setmessagequeue; setrectempty; setsize; setstatustext; setviewportextex; setwindowextex; setwindoworgex; showappwnd; showdocwnd; showhatchwnd; showobject; showwindow; stabilize; stdmethodimp_; style; translatemessage; uideactivate; unadvise; update; updatewindow; winmain; write; wsprintf; xformheightinpixelstohimetric; xformwidthinpixelstohimetric


WinHlprs: Windows Helper Functions

Click to open or copy the WinHlprs project files.

This sample includes the following functions.

dialog.cxx

Class or Function | Description
CHlprDialog::ShowDialog | Creates the dialog so that its DialogProc member function can be invoked. Similar to Windows' DialogBox function.
DialogProc | A common DialogProc used by all CHlprDialog class objects. This procedure is the DialogProc registered for all dialogs created with the CHlprDialog class.

cwindow.cxx

Implementation for a window class.

Class or Function | Description
CHlprWindow::Create | A special version of CreateWindow. ::WindowProc forwards all messages on to the CHlprWindow::WindowProc method, allowing the window to directly access class members, giving the WindowProc access to the "this" pointer.
WindowProc | A standard WindowProc that forwards Windows messages on to the CHlprWindow::WindowProc method.

strmhelp.cxx

Contains routines for writing variables to a stream in an architecture-independent manner.

Function | Description
SizeDouble | Returns the maximum number of bytes that WriteDouble will take to write a double to an IStream.
WriteDouble | Writes a double to an OLE stream in a machine-independent manner.
ReadDouble | Reads a double from an OLE stream in a machine-independent manner.

Building SDK Samples

This sample uses the following keywords:

chlprwindow; create; createwindow; defwindowproc; dialogboxparam; dialogproc; gethwnd; getwindowlong; read; readdouble; setwindowlong; showdialog; sizedouble; sprintf; sscanf; strlen; succeeded; windowproc; write; writedouble


Distributed COM (DCOM) Samples

Click to open or copy the files for the DCOM samples.

The DCOM samples demonstrate the use of distributed COM, also known as DCOM.


COMperf: COM Performance Sample

Click to open or copy the COMperf project files.

This is the reference performance sample for COM/DCOM run on local and remote machines. This program is both a client and a server. It launches as a client by default, registering its executable as a server with COM and creating other instances of itself on remote and local machines to be servers. A single command-line argument is allowed for a remote server name. Performance numbers in calls/sec are output in tabular form. The sample tests COM and IDispatch method calls with two security levels: default/min and full. It uses DCOMCNFG to set default security to Authn Lvl to NONE for best comparison. Parameter sizes are varied to see the effect on security levels(~4/50/4k bytes). The sample uses Psperf.dll, which contains a MIDL-generated proxy/stub implementation.

Note Put Psperf.dll in the same directory as this exe on all machines. Run the exe on each machine to automatically register the class code and proxy/stub dll. You can then run on either machine and pass a remote machine name (DNS or IP address) as a single command-line parameter.

Building SDK Samples

This sample uses the following keywords:

_tprintf; aptfreeautotest; aptfreecomtest; cclassfactory; clientthreadproc; cogetclassobject; coinitializeex; comarshalinterface; coregisterclassobject; corevokeclassobject; couninitialize; counmarshalinterface; createdisptypeinfo; createevent; createinstance; createstreamonhglobal; createthread; ctestcomperformance; ctimer; define_guid; dispatchmessage; dotests; exit; failed; fautoregister; formatmessage; fprintresults; freefreeautotest; freefreecomtest; freelibrary; getcurrentthreadid; getidsofnames; getlasterror; getmodulefilename; getprocaddress; gettypeinfo; gettypeinfocount; hresult_code; hresult_facility; invoke; levels; loadlibrary; localfree; lockserver; lstrcmpw; lstrcpy; lstrlen; makelangid; memset; message; messagebeep; msgwaitformultipleobjects; msgwaitformultipleobjectsex; multibytetowidechar; outputtime; peekmessage; queryblanket; queryinterface; queryperformancecounter; queryperformancefrequency; regclosekey; regcreatekey; regsetvalue; release; resumethread; seek; serverthreadproc; setblanket; setevent; sleep; start; stdmethodimp_; stop; succeeded; sysallocstring; sysallocstringbytelen; sysfreestring; text; usage; waitforsingleobject; wsprintf


DCOMperm: Permissions for a COM Server

Click to open or copy the DCOMperm project files.

The Dcomperm sample provides source code and several wrapper functions to simplify the process of manipulating the access and launch permissions for a COM server. Additionally, this sample provides code that demonstrates how to set and retrieve the RunAs password for a COM server.

Building SDK Samples

This sample uses the following keywords:

_getch; getcurrentprocess; getlasterror; listdefaultaccessacl; listdefaultlaunchacl; makelangid; str2uni; text; uni2str


Secure: Secure Network OLE

Click to open or copy the Secure project files.

The Secure sample consists of a client portion and a server portion. Its purpose is to demonstrate client-side and server-side security in a network OLE application.

Note DCOM is implemented only on Windows NT 4.0 and later versions. This sample will not work correctly on Windows 95 or on earlier versions of Windows NT.

The server application, Secsvr.exe, demonstrates the packaging options available to server writers and the call-security capabilities. It implements the following server capabilities:

  • A free-threaded server implemented as a service. The application implements the class "LocalService" (CLSID_SecureObjectService).

  • A free-threaded server implemented as a standard executable. The application implements the class "LocalServer32" (CLSID_SecureObject).

  • An apartment-threaded server implemented as a standard executable. The application implements the class "LocalServer32" (CLSID_SecureObject).

The client application, Secclnt.exe, allows you to select security settings for the client application's connections to the server application.

This sample also includes Psmyprop.dll, which supplies the proxies and stubs needed for a remote custom interface used between the client and the server.

Building SDK Samples

This sample uses the following keywords:

accesscheck; addref; changeserviceconfig; choosecolor; clientdialogproc; closehandle; closeservicehandle; cogetclassobject; coinitialize; coinitializeex; coinitializesecurity; coqueryproxyblanket; coregisterclassobject; corevokeclassobject; cosetproxyblanket; couninitialize; createevent; createinstance; createservice; createsolidbrush; csecureobject; debugbreak; deletecriticalsection; deleteobject; dialogbox; drawfocusrect; enablewindow; enddialog; entercriticalsection; entry; errormessage; failed; fautoregister; fillrect; formatmessage; framerect; getcolor; getdesktopwindow; getdlgitem; getfield; getlasterror; getmodulefilename; getstockobject; getsystemmetrics; getusername; getwindowrect; getwindowtextw; hresult_code; hresult_facility; hresult_from_win32; initializecriticalsection; interlockeddecrement; interlockedincrement; invalidaterect; invertrect; leavecriticalsection; localfree; lockserver; lstrcmpiw; lstrcpynw; lstrcpyw; lstrlen; lstrlenw; makeintresource; makelangid; makelong; memset; messagebox; movewindow; myservicehandler; myservicemain; offsetrect; openscmanager; openservice; outputdebugstring; postmessage; putcolor; putusername; queryinterface; regclosekey; regcreatekey; registerservicectrlhandler; regopenkey; regsetvalue; regsetvalueex; release; rgsizeof; selectentry; sendmessage; serverdialogproc; setevent; setservicestatus; setwindowtext; setwindowtextw; startservicectrldispatcher; stdmethodimp_; strcmpi; strtok; text; updatepropertyfields; updatesecurityfields; waitforsingleobject; winmain; wsprintf


Simple: Simple Network OLE Sample

Click to open or copy the Simple project files.

The Simple sample demonstrates the minimum requirements to use a COM object, whether it is on the same machine or on a different machine. This sample consists of a client and a server portion.

Note DCOM is implemented only on Windows NT 4.0 and later versions. This sample will not work correctly on Windows 95 or on earlier versions of Windows NT.

The server application, Sserver.exe, implements the CLSID_SimpleObject class as a LocalServer. Instances of the class support a limited form of the IStream interface. Calls to Read and Write succeed, but they do nothing. Calls to other methods fail with E_NOTIMPL.

The client application, Sclient.exe, uses the CLSID_SimpleObject class implemented by the server.

Building SDK Samples

This sample uses the following keywords:

addref; atol; clone; closehandle; cocreateinstanceex; coinitializeex; commit; copyto; coregisterclassobject; cotaskmemalloc; couninitialize; createevent; createinstance; csimpleobject; define_guid; exit; failed; formatmessage; getlasterror; hresult_code; hresult_facility; hresult_from_win32; interlockeddecrement; interlockedincrement; localfree; lockregion; makelangid; memset; message; multibytetowidechar; outputtime; queryinterface; queryperformancecounter; queryperformancefrequency; release; revert; seek; setevent; setsize; stat; stdmethodimp_; text; unlockregion; waitforsingleobject; wprintf


Samples for Inside OLE, 2nd Edition

Click to open or copy the files for the Inside OLE samples.

If you download all samples with this link, you will get all the samples and several additional files that you might want to use (MAK, DOC, BAT, TXT, and WRI).

Required files for all Inside OLE, 2nd Edition Samples

In order to build any sample from Kraig Brockschmidt’s Inside OLE, 2nd editon, you will need the makefiles, library and include subdirectories that you can download with the following links:

Click to open or copy the required makefiles.

Click to open or copy the required library files.

Click to open or copy the required include files.

You will only need to copy these files once; you will then be able to download and build any of the Brockschmidt samples.


Chapter 1

Click to open or copy the files for the Inside OLE Chapter 1 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 1 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Cosmo (Chapter 1)

Click to open or copy the Cosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; activedocument; adjustwindowrect; beginpaint; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cframe; check; checklineselection; checkmenuitem; choosecolor; clear; clip; closeclipboard; closemetafile; colorget; colorset; commandparams; cpolyline; cpolylineadvisesink; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createlinemenu; createmetafile; createpen; createsolidbrush; createtoolbar; createwindowex; cwindow; dataget; datagetmem; dataset; datasetmem; defwindowproc; deletedc; deletemetafile; deleteobject; dptolp; draw; emptyclipboard; enable; enablemenuitem; endpaint; errormessage; fdirtyset; fmessagehook; fquerypaste; getclassinfo; getclientrect; getclipboarddata; getdc; getdevicecaps; getmapmode; getmenu; getparent; getstockobject; getsubmenu; getsyscolor; gettextmetrics; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; inflaterect; invalidaterect; isclipboardformatavailable; iswindow; linestyleget; linestyleset; lineto; load; loadcursor; makelong; makepoints; memset; messagebeep; messagebox; messageloop; modifymenu; movetoex; muldiv; newdocument; offsetrect; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onsizechange; openclipboard; openfile; openfilew; paste; patblt; pointscale; polylinewndproc; preshowinit; readfromfile; rectangle; rectconvertmappings; rectget; rectset; rectstorect; recttorects; registerallclasses; registerclass; releasedc; rename; renderbitmap; renderformat; rendermetafile; rendermetafilepict; save; saveopendialog; screentoclient; selectobject; setbkcolor; setclipboarddata; setmapmode; setpixel; setrect; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; sizeget; sizeset; text; undo; unicodetoansi; unregisterclass; updatemenus; updatetoolbar; updatewindow; window; writetofile; wsprintf


Patron (Chapter 1)

Click to open or copy the Patron sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

abortdoc; abortproc; activedocument; activepage; beginpaint; cclient; cdocument; cframe; clear; commandparams; configurefordevice; cpage; cpages; cpatronclient; cpatrondoc; cpatronframe; createcclient; createcdocument; createdialog; createfont; createic; createpen; createsolidbrush; createtoolbar; createwindow; createwindowex; curpageget; curpageset; cwindow; defwindowproc; deletedc; deleteobject; deletepage; destroywindow; devmodeget; devmodeset; dispatchmessage; dptolp; draw; enable; enablemenuitem; enablewindow; enddoc; endpage; endpaint; escape; exttextout; fdirtyset; firstpage; fmessagehook; frameget; getclientrect; getdc; getdevicecaps; getdlgitem; getdlgitemtext; getid; getparent; getscrollpos; getscrollrange; getstockobject; getsyscolor; getsystemmenu; getsystemmetrics; gettextextentpoint; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalsize; globalunlock; invalidaterect; ipage; isdialogmessage; lastpage; lineto; load; loadcursor; lptodp; lstrcpy; makeintresource; max; memset; messagebox; messageloop; min; movetoex; muldiv; newpage; nextpage; numpagesget; oncommand; pageadd; pagedelete; pageget; pageinsert; pageswndproc; peekmessage; previouspage; print; printdlg; printdlghook; printdlgproc; printersetup; rectangle; rectconvertmappings; rectget; rectset; registerallclasses; registerclass; releasedc; remove; rename; screentoclient; scrollthumbposition; scrollwindow; selectobject; sendmessage; setabortproc; setbkcolor; setdlgitemtext; setfocus; setmapmode; setrect; setscrollpos; setscrollrange; settextcolor; setwindowlong; setwindowpos; showwindow; sizeget; sizeset; startdoc; startpage; text; textout; translatemessage; updatemenus; updatescrollranges; updatetoolbar; updatewindow; window; wsprintf


Chapter 2

Click to open or copy the files for the Inside OLE Chapter 2 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 2 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Enumrect (Chapter 2)

Click to open or copy the Enumrect sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; capp; cenumrect; clone; commandparams; createrectenumeratorc; createrectenumeratorcpp; createwindow; defwindowproc; dispatchmessage; enumwndproc; exttextout; free; getclientrect; getdc; getmessage; getsyscolor; getwindowlong; isequaliid; loadcursor; loadicon; lstrlen; makeintresource; malloc; message; next; postmessage; postquitmessage; queryinterface; rectenum_addref; rectenum_clone; rectenum_constructor; rectenum_destructor; rectenum_next; rectenum_queryinterface; rectenum_release; rectenum_reset; rectenum_skip; registerclass; release; releasedc; reset; resultfromscode; setbkcolor; setrect; settextcolor; setwindowlong; showwindow; skip; stdmethod; stdmethod_; stdmethodimp_; succeeded; text; translatemessage; updatewindow; winmain


Malloc1 (Chapter 2)

Click to open or copy the Malloc1 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

alloc; app_create; app_destroy; app_doallocations; app_freeallocations; app_getallocator; app_haveallocations; app_haveallocator; app_init; app_message; cobuildversion; cogetmalloc; coinitialize; couninitialize; createwindow; defwindowproc; dispatchmessage; exttextout; failed; free; getclientrect; getdc; getmessage; getsyscolor; getwindowlong; loadcursor; loadicon; lstrlen; makeintresource; malloc; mallocwndproc; postmessage; postquitmessage; realloc; registerclass; release; releasedc; setbkcolor; settextcolor; setwindowlong; showwindow; succeeded; text; translatemessage; updatewindow; winmain; wsprintf


Malloc2 (Chapter 2)

Click to open or copy the Malloc2 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

alloc; capp; cobuildversion; cogetmalloc; coinitialize; couninitialize; createwindow; defwindowproc; didalloc; dispatchmessage; doallocations; exttextout; failed; free; freeallocations; getallocator; getclientrect; getdc; getmessage; getsize; getsyscolor; getwindowlong; haveallocations; haveallocator; heapminimize; loadcursor; loadicon; lstrlen; makeintresource; mallocwndproc; message; postmessage; postquitmessage; realloc; registerclass; release; releasedc; setbkcolor; settextcolor; setwindowlong; showwindow; succeeded; text; translatemessage; updatewindow; winmain; wsprintf


Query (Chapter 2)

Click to open or copy the Query sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; capp; cimpisampleone; cimpisampletwo; cobject1; cobject2; cobject3; commandparams; createobject1; createobject2; createobject3; createwindow; declare_interface_; defwindowproc; deleteinterfaceimp; dispatchmessage; exttextout; failed; getclientrect; getdc; getmessage; getstring; getsyscolor; getwindowlong; loadcursor; loadicon; lstrcpy; lstrlen; makeintresource; message; postmessage; postquitmessage; queryinterface; querywndproc; registerclass; release; releasedc; releaseinterface; resultfromscode; setbkcolor; settextcolor; setwindowlong; showwindow; stdmethod; stdmethod_; stdmethodimp_; succeeded; text; translatemessage; updatewindow; winmain


Reuse (Chapter 2)

Click to open or copy the Reuse sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; canimal; capp; cimpianimal_a; cimpianimal_k; cimpikoala_a; cimpikoala_c; ckoalaa; ckoalac; climbeucalyptustrees; commandparams; createanimal; createkoalaaggregation; createkoalacontainment; createwindow; declare_interface_; defwindowproc; deleteinterfaceimp; dispatchmessage; eat; exttextout; failed; getclientrect; getdc; getinterface; getmessage; getsyscolor; getwindowlong; loadcursor; loadicon; lstrlen; makeintresource; message; ods; postmessage; postquitmessage; pouchopensdown; procreate; queryinterface; registerclass; release; releasedc; releaseinterface; resultfromscode; reusewndproc; setbkcolor; settextcolor; setwindowlong; showwindow; sleep; sleepforhoursaftereating; stdmethod; stdmethod_; stdmethodimp_; succeeded; text; translatemessage; updatewindow; winmain


Chapter 3

There are no samples for this chapter.


Chapter 4

Click to open or copy the files for the Inside OLE Chapter 4 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 4 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Connect (Chapter 4)

Click to open or copy the Connect sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; advise; capp; cconnectionpoint; cconnobject; cduckevents; cenumconnectionpoints; cenumconnections; clone; commandparams; connect; connectwndproc; createwindow; declare_interface_; defwindowproc; disconnect; dispatchmessage; enumconnectionpoints; enumconnections; exttextout; failed; findconnectionpoint; flap; getclientrect; getconnectioninterface; getconnectionpoint; getdc; getmessage; getsyscolor; getwindowlong; loadcursor; loadicon; lstrlen; makeintresource; message; next; paddle; playsound; postmessage; postquitmessage; quack; queryinterface; registerclass; release; releasedc; releaseinterface; reset; resultfromscode; setbkcolor; settextcolor; setwindowlong; showwindow; skip; stdmethod; stdmethod_; stdmethodimp_; succeeded; text; translatemessage; triggerevent; unadvise; updatewindow; winmain; wsprintf


Chapter 5

Click to open or copy the files for the Chapter 5 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 5 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Cocosmo (Chapter 5)

Click to open or copy the Cocosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

activedocument; addref; adjustwindowrect; advise; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cframe; check; checklineselection; checkmenuitem; choosecolor; clear; clip; closeclipboard; cocreateinstance; cofreeunusedlibraries; coinitialize; colorget; colorset; commandparams; couninitialize; cpolylineadvisesink; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createlinemenu; createpen; createtoolbar; datagetmem; dataset; deletedc; deleteobject; emptyclipboard; enable; enablemenuitem; errormessage; failed; fdirtyset; fmessagehook; fquerypaste; getclassinfo; getclientrect; getclipboarddata; getdc; getmenu; getscode; getsubmenu; gettextmetrics; getwindowlong; getwindowrect; globallock; globalunlock; inflaterect; isclipboardformatavailable; linestyleget; linestyleset; lineto; load; memset; messagebox; messageloop; modifymenu; movetoex; newdocument; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onsizechange; openclipboard; paste; patblt; preshowinit; queryinterface; readfromfile; rectset; registerallclasses; registerclass; release; releasedc; releaseinterface; rename; renderbitmap; renderformat; rendermetafilepict; resultfromscode; save; saveopendialog; selectobject; setclipboarddata; setrect; setwindowpos; stdmethodimp_; succeeded; unadvise; undo; unregisterclass; updatemenus; updatetoolbar; window; writetofile


Dkoala1 (Chapter 5)

Click to open or copy the Dkoala1 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; ckoala; ckoalaclassfactory; createinstance; dllcanunloadnow; dllgetclassobject; failed; libmain; libmain32; lockserver; objectdestroyed; queryinterface; release; resultfromscode; stdmethodimp_; unlockdata


Dkoala2 (Chapter 5)

Click to open or copy the Dkoala2 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; ckoala; ckoalaclassfactory; createinstance; dllcanunloadnow; dllgetclassobject; dllregisterserver; dllunregisterserver; failed; getmodulefilename; libmain; libmain32; lockserver; lstrcat; lstrcpy; lstrlen; objectdestroyed; queryinterface; regclosekey; regcreatekeyex; regdeletekey; regsetvalueex; release; resultfromscode; setkeyandvalue; stdmethodimp_; stringfromguid2; text; unlockdata; wsprintf


Dkoala3 (Chapter 5)

Click to open or copy the Dkoala3 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_tcsrchr; addref; checkforlicensefile; ckoala; ckoalaclassfactory; closehandle; createanobject; createfile; createinstance; createinstancelic; dllcanunloadnow; dllgetclassobject; failed; free; getlicinfo; getmodulefilename; libmain; libmain32; lockserver; lstrcpy; lstrlen; lstrlena; malloc; mbstowcs; memcmp; objectdestroyed; openfile; queryinterface; readfile; release; requestlickey; resultfromscode; stdmethodimp_; sysallocstring; sysfreestring; text; unlockdata; widechartomultibyte


Ekoala1 (Chapter 5)

Click to open or copy the Ekoala1 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; capp; ckoala; ckoalaclassfactory; cobuildversion; coinitialize; coregisterclassobject; corevokeclassobject; couninitialize; createinstance; createwindow; defwindowproc; dispatchmessage; failed; getmessage; getwindowlong; iswindow; koalawndproc; lockserver; lstrcmpia; objectdestroyed; postmessage; postquitmessage; queryinterface; registerclass; release; resultfromscode; setwindowlong; stdmethodimp_; text; translatemessage; winmain


Ekoala2 (Chapter 5)

Click to open or copy the Ekoala2 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; capp; ckoala; ckoalaclassfactory; cobuildversion; coinitialize; coregisterclassobject; corevokeclassobject; couninitialize; createinstance; createwindow; defwindowproc; dispatchmessage; failed; getmessage; getmodulefilename; getwindowlong; iswindow; koalawndproc; lockserver; lstrcat; lstrcmpia; lstrcpy; lstrlen; objectdestroyed; postmessage; postquitmessage; queryinterface; regclosekey; regcreatekeyex; regdeletekey; registerclass; registerserver; regsetvalueex; release; resultfromscode; setkeyandvalue; setwindowlong; stdmethodimp_; stringfromguid2; text; translatemessage; unregisterserver; winmain; wsprintf


Licuser (Chapter 5)

Click to open or copy the Licuser sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

capp; checkmenuitem; cofreeunusedlibraries; cogetclassobject; coinitialize; couninitialize; createinstance; createinstancelic; createobject; createwindow; defwindowproc; destroywindow; dispatchmessage; drawmenubar; enablemenuitem; exttextout; failed; getclientrect; getdc; getmenu; getmessage; getscode; getsyscolor; getwindowlong; iswindow; licenseduserwndproc; loadcursor; loadicon; lockserver; lstrlen; makeintresource; message; obtainclassfactory; postmessage; postquitmessage; registerclass; release; releaseclassfactory; releasedc; requestlickey; setbkcolor; settextcolor; setwindowlong; showwindow; succeeded; sysfreestring; text; translatemessage; updatewindow; winmain


Objuser (Chapter 5)

Click to open or copy the Objuser sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; capp; checkmenuitem; cocreateinstance; cofreeunusedlibraries; cogetclassobject; coinitialize; couninitialize; createinstance; createwindow; defwindowproc; destroywindow; dispatchmessage; exttextout; failed; getclientrect; getdc; getmenu; getmessage; getsyscolor; getwindowlong; iswindow; loadcursor; loadicon; lstrlen; makeintresource; message; objectuserwndproc; postmessage; postquitmessage; registerclass; release; releasedc; releaseinterface; setbkcolor; settextcolor; setwindowlong; showwindow; succeeded; text; translatemessage; updatewindow; winmain; wsprintf


Polyline (Chapter 5)

Click to open or copy the Polyline sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _lread; _lwrite; addref; advise; beginpaint; cconnectionpoint; cimpiconnptcont; cimpipolyline; closemetafile; colorget; colorset; cpolyline; cpolylineclassfactory; createcompatiblebitmap; createcompatibledc; createinstance; createmetafile; createpen; createsolidbrush; createwindowex; dataget; datagetmem; dataset; datasetmem; defwindowproc; deletedc; deleteinterfaceimp; deletemetafile; deleteobject; dllcanunloadnow; dllgetclassobject; dptolp; draw; endpaint; enumconnectionpoints; enumconnections; failed; findconnectionpoint; getclassinfo; getclientrect; getconnectioninterface; getdc; getdevicecaps; getmapmode; getparent; getstockobject; getsyscolor; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; invalidaterect; libmain; libmain32; linestyleget; linestyleset; lineto; loadcursor; lockserver; lptodp; makepoints; messagebeep; movetoex; muldiv; objectdestroyed; offsetrect; oncolorchange; ondatachange; onlinestylechange; onpointchange; onsizechange; openfile; pointscale; polylinewndproc; queryinterface; readfromfile; rectangle; rectconvertmappings; rectget; rectset; rectstorect; recttorects; registerclass; release; releasedc; releaseinterface; renderbitmap; rendermetafile; rendermetafilepict; resultfromscode; screentoclient; selectobject; setbkcolor; setmapmode; setpixel; setrect; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; sizeget; sizeset; stdmethodimp_; text; unadvise; undo; unicodetoansi; unlockdata; updatewindow; window; writetofile


Selfreg (Chapter 5)

Click to open or copy the Selfreg sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

cofreelibrary; coinitialize; couninitialize; failed; getprocaddress; loadlibrarya; messageboxa; pszwhitespacescan; succeeded; winexec; winmain; wsprintfa


Chapter 6

Click to open or copy the files for the Chapter 6 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 6 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Ekoala3 (Chapter 6)

Click to open or copy the Ekoala3 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addconnection; addref; capp; checkmenuitem; cimpiexternalconnection; cimpipersist; ckoala; ckoalaclassfactory; cmessagefilter; cobuildversion; coinitialize; colockobjectexternal; coregisterclassobject; coregistermessagefilter; corevokeclassobject; couninitialize; createinstance; createwindow; defwindowproc; deleteinterfaceimp; dispatchmessage; failed; getclassid; getmenu; getmessage; getwindowlong; handleincomingcall; iswindow; koalawndproc; lockserver; lstrcmpia; makeintresource; messagebox; messagepending; objectdestroyed; ods; postmessage; postquitmessage; queryinterface; registerclass; release; releaseconnection; releaseinterface; resultfromscode; retryrejectedcall; setwindowlong; showwindow; stdmethodimp_; text; translatemessage; updatewindow; winmain; wsprintf


Ekoala4 (Chapter 6)

Click to open or copy the Ekoala4 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_tcsncpy; addref; capp; cimpianimal; cimpikoala; ckoala; ckoalaclassfactory; climbeucalyptustree; cobuildversion; coinitialize; coregisterclassobject; corevokeclassobject; couninitialize; createinstance; createwindow; defwindowproc; deleteinterfaceimp; dispatchmessage; eat; failed; getmessage; gettickcount; getwindowlong; iswindow; koalawndproc; lockserver; lstrcmpia; lstrcpyn; objectdestroyed; postmessage; postquitmessage; pouchopensdown; procreate; queryinterface; registerclass; release; resultfromscode; setwindowlong; sleep; sleepaftereating; stdmethodimp_; text; translatemessage; whatkindofanimal; winmain


Ekoala5 (Chapter 6)

Click to open or copy the Ekoala5 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; capp; ckoala; ckoalaclassfactory; cobuildversion; coinitialize; coregisterclassobject; corevokeclassobject; couninitialize; createinstance; createwindow; defwindowproc; destroywindow; disconnectobject; dispatchmessage; failed; getmarshalsizemax; getmessage; gettickcount; getunmarshalclass; getwindowlong; handlecall; iswindow; koalawndproc; lockserver; lstrcmpia; marshalinterface; objectdestroyed; objectwndproc; postmessage; postquitmessage; queryinterface; registerclass; release; releasemarshaldata; resultfromscode; setwindowlong; stdmethodimp_; text; translatemessage; unmarshalinterface; winmain


Ianimal (Chapter 6)

Click to open or copy the Ianimal sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; defined; dlldata_routines; eat; extern_proxy_file; ianimal_addref; ianimal_eat; ianimal_eat_proxy; ianimal_eat_stub; ianimal_procreate; ianimal_procreate_proxy; ianimal_procreate_stub; ianimal_queryinterface; ianimal_release; ianimal_sleep; ianimal_sleep_proxy; ianimal_sleep_stub; ianimal_whatkindofanimal; ianimal_whatkindofanimal_proxy; ianimal_whatkindofanimal_stub; libmain; libmain32; midl_file_heading; midl_user_allocate; midl_user_free; procreate; queryinterface; reference_proxy_file; release; sleep; whatkindofanimal


Ikoala (Chapter 6)

Click to open or copy the Ikoala sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; climbeucalyptustree; defined; dlldata_routines; extern_proxy_file; ikoala_addref; ikoala_climbeucalyptustree; ikoala_climbeucalyptustree_proxy; ikoala_climbeucalyptustree_stub; ikoala_pouchopensdown; ikoala_pouchopensdown_proxy; ikoala_pouchopensdown_stub; ikoala_queryinterface; ikoala_release; ikoala_sleepaftereating; ikoala_sleepaftereating_proxy; ikoala_sleepaftereating_stub; libmain; libmain32; midl_file_heading; midl_user_allocate; midl_user_free; pouchopensdown; queryinterface; reference_proxy_file; release; sleepaftereating


Koalaprx (Chapter 6)

Click to open or copy the Koalaprx sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_tcsncpy; addref; calllocal; cimpianimal; cimpikoala; cimpimarshal; ckoala; ckoalaproxyfactory; climbeucalyptustree; createinstance; deleteinterfaceimp; disconnectobject; dllcanunloadnow; dllgetclassobject; eat; failed; getmarshalsizemax; getunmarshalclass; libmain; libmain32; lockserver; marshalinterface; objectdestroyed; postmessage; pouchopensdown; procreate; queryinterface; release; releasemarshaldata; resultfromscode; sendmessage; sleep; sleepaftereating; stdmethodimp_; text; unlockdata; unmarshalinterface; whatkindofanimal


Objuser2 (Chapter 6)

Click to open or copy the Objuser2 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; capp; cmessagefilter; cocreateinstance; coinitialize; coregistermessagefilter; couninitialize; createwindow; defwindowproc; destroywindow; dispatchmessage; displaybusydialog; exttextout; failed; getclassid; getclientrect; getdc; getmessage; getsyscolor; getwindowlong; handleincomingcall; iswindow; loadcursor; loadicon; lstrlen; makeintresource; memset; message; messagepending; objectuserwndproc; oleuibusy; postmessage; postquitmessage; queryinterface; registerclass; release; releasedc; releaseinterface; resultfromscode; retryrejectedcall; setbkcolor; settextcolor; setwindowlong; showwindow; stdmethodimp_; succeeded; text; translatemessage; updatewindow; winmain; wsprintf


Objuser3 (Chapter 6)

Click to open or copy the Objuser3 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

capp; climbeucalyptustree; cocreateinstance; cofreeunusedlibraries; coinitialize; couninitialize; createwindow; defwindowproc; destroywindow; dispatchmessage; eat; exttextout; failed; getclientrect; getdc; getmessage; getsyscolor; getwindowlong; iswindow; loadcursor; loadicon; lstrlen; makeintresource; message; objectuserwndproc; postmessage; postquitmessage; pouchopensdown; procreate; queryinterface; registerclass; release; releasedc; releaseinterface; setbkcolor; settextcolor; setwindowlong; showwindow; sleep; sleepaftereating; stringfromguid2; succeeded; text; translatemessage; updatewindow; whatkindofanimal; winmain; wsprintf


Chapter 7

Click to open or copy the files for the Chapter 7 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 7 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Cosmo (Chapter 7)

Click to open or copy the Cosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; activedocument; adjustwindowrect; beginpaint; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cframe; check; checklineselection; checkmenuitem; choosecolor; clear; clip; closeclipboard; closemetafile; coinitialize; colorget; colorset; commandparams; couninitialize; cpolyline; cpolylineadvisesink; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createlinemenu; createmetafile; createpen; createsolidbrush; createstream; createtoolbar; createwindowex; cwindow; dataget; datagetmem; dataset; datasetmem; defwindowproc; deletedc; deletemetafile; deleteobject; dptolp; draw; emptyclipboard; enable; enablemenuitem; endpaint; errormessage; failed; fdirtyset; fmessagehook; fquerypaste; getclassinfo; getclientrect; getclipboarddata; getdc; getdevicecaps; getmapmode; getmenu; getparent; getscode; getstockobject; getsubmenu; getsyscolor; gettextmetrics; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; inflaterect; invalidaterect; isclipboardformatavailable; iswindow; linestyleget; linestyleset; lineto; liset32; load; loadcursor; makelong; makepoints; memset; messagebeep; messagebox; messageloop; modifymenu; movetoex; muldiv; newdocument; offsetrect; oletext; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onsizechange; openclipboard; openfile; openfilew; openstream; paste; patblt; pointscale; polylinewndproc; preshowinit; readfromfile; readfromstorage; rectangle; rectconvertmappings; rectget; rectset; rectstorect; recttorects; registerallclasses; registerclass; release; releasedc; rename; renderbitmap; renderformat; rendermetafile; rendermetafilepict; save; saveopendialog; screentoclient; seek; selectobject; setbkcolor; setclipboarddata; setmapmode; setpixel; setrect; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; sizeget; sizeset; stgcreatedocfile; stgisstoragefile; stgopenstorage; text; undo; unicodetoansi; unregisterclass; updatemenus; updatetoolbar; updatewindow; window; writeclassstg; writefmtusertypestg; writetofile; writetostorage; wsprintf


Fragment (Chapter 7)

Click to open or copy the Fragment sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _lcreat; _llseek; _lopen; _lread; _lwrite; alloc; allocchararrays; cfragment; cogetmalloc; coinitialize; copyto; couninitialize; createfragmentedfile; createstream; defragmentfile; deletefile; destroyelement; failed; free; freespaceinfile; loadcursor; lstrcpy; makeintresource; message; messagebox; movefile; multibytetowidechar; mymovefile; oletext; openfile; release; setcursor; stat; stgcreatedocfile; stgopenstorage; streamcreate; succeeded; text; widechartomultibyte; winmain; wsprintf


Patron (Chapter 7)

Click to open or copy the Patron sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

abortdoc; abortproc; activedocument; activepage; addref; alloc; beginpaint; cbdevmode; cclient; cdocument; cframe; clear; cogetmalloc; commandparams; commit; configurefordevice; copyto; cpage; cpages; cpatronclient; cpatrondoc; cpatronframe; createcclient; createcdocument; createdialog; createfont; createic; createpen; createsolidbrush; createstorage; createstream; createtoolbar; createwindow; createwindowex; curpageget; curpageset; cwindow; defwindowproc; deletedc; deletefile; deleteobject; deletepage; destroy; destroyelement; destroywindow; devmodeget; devmodeset; dispatchmessage; dptolp; draw; enable; enablemenuitem; enablewindow; enddoc; endpage; endpaint; escape; exttextout; failed; fdirtyset; firstpage; fmessagehook; frameget; free; getclientrect; getdc; getdevicecaps; getdlgitem; getdlgitemtext; getid; getparent; getscode; getscrollpos; getscrollrange; getstockobject; getstoragename; getsyscolor; getsystemmenu; getsystemmetrics; gettextextentpoint; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalsize; globalunlock; invalidaterect; ipage; isdialogmessage; lastpage; lineto; load; loadcursor; lptodp; lstrcmpi; lstrcpy; makeintresource; max; memcpy; memset; messagebox; messageloop; min; movetoex; muldiv; multibytetowidechar; newpage; nextpage; numpagesget; oleinitialize; oletext; oleuninitialize; oncommand; open; openstorage; openstream; pageadd; pagedelete; pageget; pageinsert; pageswndproc; peekmessage; previouspage; print; printdlg; printdlghook; printdlgproc; printersetup; readclassstg; rectangle; rectconvertmappings; rectget; rectset; registerallclasses; registerclass; release; releasedc; releaseinterface; remove; rename; save; screentoclient; scrollthumbposition; scrollwindow; seek; selectobject; sendmessage; setabortproc; setbkcolor; setdlgitemtext; setfocus; setmapmode; setpoint; setrect; setscrollpos; setscrollrange; settextcolor; setwindowlong; setwindowpos; showwindow; sizeget; sizeset; startdoc; startpage; stgcreatedocfile; stgopenstorage; storageset; storageupdate; succeeded; switchtofile; text; textout; translatemessage; update; updatemenus; updatescrollranges; updatetoolbar; updatewindow; window; writeclassstg; writefmtusertypestg; wsprintf


Chapter 8

Click to open or copy the files for the Chapter 8 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 8 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Cocosmo (Chapter 8)

Click to open or copy the Cocosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

activedocument; addref; adjustwindowrect; advise; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cframe; check; checklineselection; checkmenuitem; choosecolor; clear; clip; closeclipboard; cocreateinstance; cofreeunusedlibraries; coinitialize; colorget; colorset; commandparams; couninitialize; cpolylineadvisesink; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createlinemenu; createpen; createstream; createtoolbar; datagetmem; dataset; deletedc; deleteobject; emptyclipboard; enable; enablemenuitem; errormessage; failed; fdirtyset; fmessagehook; fquerypaste; getclassinfo; getclientrect; getclipboarddata; getdc; getmenu; getsubmenu; gettextmetrics; getwindowlong; getwindowrect; globallock; globalunlock; inflaterect; initnew; isclipboardformatavailable; linestyleget; linestyleset; lineto; load; lstrcmpi; memset; messagebox; messageloop; modifymenu; movetoex; newdocument; oletext; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onsizechange; openclipboard; openstream; paste; patblt; preshowinit; queryinterface; rectset; registerallclasses; registerclass; release; releasedc; releaseinterface; rename; renderbitmap; renderformat; rendermetafilepict; resultfromscode; save; savecompleted; saveopendialog; selectobject; setclipboarddata; setrect; setwindowpos; stdmethodimp_; stgcreatedocfile; stgopenstorage; succeeded; unadvise; undo; unregisterclass; updatemenus; updatetoolbar; window


Polyline (Chapter 8)

Click to open or copy the Polyline sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; advise; beginpaint; cconnectionpoint; cimpiconnptcont; cimpipersiststorage; cimpipersiststreaminit; cimpipolyline; closemetafile; colorget; colorset; cpolyline; cpolylineclassfactory; createcompatiblebitmap; createcompatibledc; createinstance; createmetafile; createpen; createsolidbrush; createstream; createwindowex; cstringtable; dataget; datagetmem; dataset; datasetmem; defwindowproc; deletedc; deleteinterfaceimp; deletemetafile; deleteobject; dllcanunloadnow; dllgetclassobject; dptolp; draw; endpaint; enumconnectionpoints; enumconnections; failed; findconnectionpoint; getclassid; getclassinfo; getclientrect; getconnectioninterface; getdc; getdevicecaps; getmapmode; getparent; getsizemax; getstockobject; getsyscolor; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; handsoffstorage; initnew; invalidaterect; isdirty; libmain; libmain32; linestyleget; linestyleset; lineto; liset32; load; loadcursor; lockserver; lptodp; makepoints; messagebeep; movetoex; muldiv; objectdestroyed; offsetrect; oletext; oncolorchange; ondatachange; onlinestylechange; onpointchange; onsizechange; openstream; pointscale; polylinewndproc; queryinterface; rectangle; rectconvertmappings; rectget; rectset; rectstorect; recttorects; registerclass; registerclipboardformat; release; releasedc; releaseinterface; renderbitmap; rendermetafile; rendermetafilepict; resultfromscode; save; savecompleted; screentoclient; seek; selectobject; setbkcolor; setmapmode; setpixel; setrect; setsize; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; sizeget; sizeset; stdmethodimp_; text; uliset32; unadvise; undo; unlockdata; updatewindow; window; writefmtusertypestg


Chapter 9

Click to open or copy the files for the Chapter 9 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 9 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Idescrip (Chapter 9)

Click to open or copy the Idescrip sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_idescrip_check_iid; _idescrip_iid_lookup; addref; code_seg; data_seg; defined; dlldata_routines; extern_proxy_file; getexceptioncode; gettext; idescription_addref; idescription_gettext; idescription_gettext_proxy; idescription_gettext_stub; idescription_queryinterface; idescription_release; iid_generic_check_iid; libmain; libmain32; midl_user_allocate; midl_user_free; ndrclearoutparameters; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrpointerfree; ndrproxyerrorhandler; ndrproxyfreebuffer; ndrproxygetbuffer; ndrproxyinitialize; ndrproxysendreceive; ndrstubgetbuffer; ndrstubinitialize; queryinterface; reference_proxy_file; release; rpcexcept


Linksrc (Chapter 9)

Click to open or copy the Linksrc sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_tcsncicmp; _ttoi; addref; alloc; capp; cch; ccontaineritem; cfileobject; cfileobjectfactory; cimpidescription; cimpioleitemcontainer; cimpipersistfile; cogetmalloc; coinitialize; composewith; coregisterclassobject; corevokeclassobject; couninitialize; createfilemoniker; createinstance; createitemmoniker; createsamplefile; createstorage; createstore; createstream; createwindow; csimpleitem; defwindowproc; deleteinterfaceimp; dispatchmessage; enumobjects; failed; getclassid; getcurfile; getmessage; getobject; getobjectparam; getobjectstorage; getrunning; getrunningobjecttable; getscode; gettext; getwindowlong; inole_createitemmoniker; isdirty; isrunning; iswindow; linksrcwndproc; load; loadcursor; loadicon; lockcontainer; lockserver; lstrcmpia; lstrcpy; lstrcpyn; lstrlen; makeintresource; messagebox; multibytetowidechar; objectdestroyed; oletext; openstorage; openstream; parsedisplayname; postmessage; postquitmessage; queryinterface; register; registerclass; registerobjectparam; release; releaseinterface; resultfromscode; revoke; save; savecompleted; setclass; setstorage; setwindowlong; showwindow; stdmethodimp_; stgcreatedocfile; stgopenstorage; succeeded; text; translatemessage; updatewindow; wcsncpy; winmain; writedescription; wsprintf


Linkuser (Chapter 9)

Click to open or copy the Linkuser sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

bindandshow; bindmoniker; bindtoobject; capp; coinitialize; commandparams; composewith; couninitialize; createbindctx; createfilemoniker; createitemmoniker; createmonikers; createwindow; defwindowproc; destroywindow; dispatchmessage; failed; getclientrect; getdisplayname; getmessage; gettext; getwindowlong; iswindow; linkuserwndproc; listinitialize; loadcursor; loadicon; makeintresource; messagebox; mkparsedisplayname; parseandbind; postmessage; postquitmessage; registerclass; release; releaseinterface; sendmessage; setmessagequeue; setwindowlong; setwindowpos; showdescription; showwindow; succeeded; text; translatemessage; updatewindow; widechartomultibyte; winmain; wsprintf


Chapter 10

Click to open or copy the files for the Chapter 10 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 10 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Cocosmo (Chapter 10)

Click to open or copy the Cocosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

activedocument; addref; adjustwindowrect; advise; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cframe; check; checklineselection; checkmenuitem; choosecolor; cimpiadvisesink; clear; clip; closeclipboard; cocreateinstance; cofreeunusedlibraries; coinitialize; colorget; colorset; commandparams; couninitialize; cpolylineadvisesink; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createlinemenu; createpen; createstream; createtoolbar; dadvise; deletedc; deleteinterfaceimp; deleteobject; dunadvise; emptyclipboard; enable; enablemenuitem; errormessage; failed; fdirtyset; fmessagehook; fquerypaste; getclassinfo; getclientrect; getclipboarddata; getdata; getdc; getmenu; getsubmenu; gettextmetrics; getwindowlong; getwindowrect; globalfree; inflaterect; initnew; isclipboardformatavailable; linestyleget; linestyleset; lineto; load; lstrcmpi; memset; messagebox; messageloop; modifymenu; movetoex; newdocument; oletext; onclose; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onrename; onsave; onsizechange; onviewchange; openclipboard; openstream; paste; patblt; preshowinit; queryinterface; rectset; registerallclasses; registerclass; release; releasedc; releaseinterface; rename; renderformat; resultfromscode; save; savecompleted; saveopendialog; selectobject; setclipboarddata; setdata; setdefformatetc; setrect; setwindowpos; stdmethodimp_; stgcreatedocfile; stgopenstorage; succeeded; unadvise; undo; unregisterclass; updatemenus; updatetoolbar; window


Datauser (Chapter 10)

Click to open or copy the Datauser sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; beginpaint; bitblt; cadvisesink; capp; checkmenuitem; cocreateinstance; cofreeunusedlibraries; coinitialize; couninitialize; createcompatibledc; createwindow; dadvise; datauserwndproc; defwindowproc; deletedc; destroywindow; dispatchmessage; drawtext; dunadvise; enablemenuitem; endpaint; failed; freloaddataobjects; getclientrect; getdata; getdc; getmenu; getmessage; getsyscolor; getwindowlong; globallock; globalunlock; invalidaterect; iswindow; loadcursor; loadicon; lstrlen; makeintresource; onclose; ondatachange; onrename; onsave; onviewchange; paint; playmetafile; postmessage; postquitmessage; querygetdata; queryinterface; registerclass; release; releasedc; releaseinterface; releasestgmedium; resultfromscode; selectobject; setbkcolor; setbkmode; setcursor; setdefformatetc; setmapmode; setmessagequeue; settextcolor; setviewportextex; setwindowextex; setwindowlong; setwindoworgex; showcursor; showwindow; stdmethodimp_; succeeded; text; textout; translatemessage; tryquerygetdata; updatewindow; winmain; wsprintf


Ddataobj (Chapter 10)

Click to open or copy the Ddataobj sample.

Click to open or copy the resource files (required).

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; advise; advisorwndproc; bitblt; cch; cdataobject; cdataobjectclassfactory; cenumformatetc; cimpidataobject; clone; closemetafile; createcompatiblebitmap; createcompatibledc; createdataadviseholder; createinstance; createmetafile; createsolidbrush; createwindow; dadvise; defwindowproc; deletedc; deleteinterfaceimp; deletemetafile; deleteobject; destroywindow; dispatchmessage; dllcanunloadnow; dllgetclassobject; dunadvise; enumadvise; enumdadvise; enumformatetc; failed; fillrect; getcanonicalformatetc; getdata; getdatahere; getdc; getsystemmetrics; gettickcount; getwindowlong; getwindowtext; globalalloc; globallock; globalunlock; libmain; libmain32; loadbitmap; loadcursor; loadicon; lockserver; makeintresource; messagebox; next; objectdestroyed; peekmessage; querygetdata; queryinterface; registerclass; release; releasedc; releaseinterface; renderbitmap; rendermetafilepict; rendertext; reset; resultfromscode; selectobject; setcursor; setdata; setdefformatetc; setrect; setwindowlong; showcursor; skip; stdmethodimp_; text; translatemessage; unadvise; unlockdata; unregisterclass; wsprintf


Edataobj (Chapter 10)

Click to open or copy the Edataobj sample.

Click to open or copy the resource files (required).

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; advise; advisorwndproc; bitblt; capp; cch; cdataobject; cdataobjectclassfactory; cenumformatetc; cimpidataobject; clone; closemetafile; coinitialize; coregisterclassobject; corevokeclassobject; couninitialize; createcompatiblebitmap; createcompatibledc; createdataadviseholder; createinstance; createmetafile; createsolidbrush; createwindow; dadvise; dataobjectwndproc; defwindowproc; deletedc; deleteinterfaceimp; deletemetafile; deleteobject; destroywindow; dispatchmessage; dunadvise; enumadvise; enumdadvise; enumformatetc; failed; fillrect; getcanonicalformatetc; getdata; getdatahere; getdc; getmessage; getsystemmetrics; gettickcount; getwindowlong; getwindowtext; globalalloc; globallock; globalunlock; iswindow; loadbitmap; loadcursor; loadicon; lockserver; lstrcmpia; makeintresource; messagebox; next; objectdestroyed; peekmessage; postmessage; postquitmessage; querygetdata; queryinterface; registerclass; release; releasedc; releaseinterface; renderbitmap; rendermetafilepict; rendertext; reset; resultfromscode; selectobject; setcursor; setdata; setdefformatetc; setmessagequeue; setrect; setwindowlong; showcursor; skip; stdmethodimp_; text; translatemessage; unadvise; winmain; wsprintf


Polyline (Chapter 10)

Click to open or copy the Polyline sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; advise; beginpaint; cconnectionpoint; cimpiconnptcont; cimpidataobject; cimpipersiststorage; cimpipersiststreaminit; cimpipolyline; closemetafile; colorget; colorset; cpolyline; cpolylineclassfactory; createcompatiblebitmap; createcompatibledc; createdataadviseholder; createinstance; createmetafile; createpen; createsolidbrush; createstream; createwindowex; cstringtable; dadvise; dataget; dataset; defwindowproc; deletedc; deleteinterfaceimp; deletemetafile; deleteobject; dllcanunloadnow; dllgetclassobject; dptolp; draw; dunadvise; endpaint; enumadvise; enumconnectionpoints; enumconnections; enumdadvise; enumformatetc; failed; findconnectionpoint; getcanonicalformatetc; getclassid; getclassinfo; getclientrect; getconnectioninterface; getdata; getdatahere; getdc; getdevicecaps; getmapmode; getparent; getsizemax; getstockobject; getsyscolor; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; handsoffstorage; initnew; invalidaterect; isdirty; libmain; libmain32; linestyleget; linestyleset; lineto; liset32; load; loadcursor; lockserver; lptodp; makepoints; messagebeep; movetoex; muldiv; objectdestroyed; offsetrect; oleregenumformatetc; oletext; oncolorchange; onlinestylechange; onpointchange; onsizechange; openstream; pointscale; polylinewndproc; querygetdata; queryinterface; rectangle; rectconvertmappings; rectget; rectset; rectstorect; recttorects; registerclass; registerclipboardformat; release; releasedc; releaseinterface; releasestgmedium; renderbitmap; rendermetafilepict; rendernative; resultfromscode; save; savecompleted; screentoclient; seek; selectobject; sendondatachange; setbkcolor; setdata; setmapmode; setpixel; setrect; setsize; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; sizeget; sizeset; stdmethodimp_; text; uliset32; unadvise; undo; unlockdata; updatewindow; window; writefmtusertypestg


Targdev (Chapter 10)

Click to open or copy the Targdev sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_fmemcmp; _fmemcpy; cotaskmemalloc; createdc; createic; globallock; globalunlock; memcmp; memcpy; stdapi_; targetdevicecompare; targetdevicecopy; targetdevicefromprintdlg; targetdevicetodc; text


Chapter 11

Click to open or copy the files for the Chapter 11 samples.

The samples in this section are from Chapter 11 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Freeload (Chapter 11)

Click to open or copy the Freeload sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

activedocument; adjustwindowrect; beginpaint; cache; cclient; cdocument; cframe; cfreeloaderclient; cfreeloaderdoc; cfreeloaderframe; clip; closeclipboard; cofreeunusedlibraries; commandparams; commit; continuepaint; copyto; createcclient; createcdocument; createdatacache; draw; emptyclipboard; enablemenuitem; endpaint; failed; fdirtyset; finit; fmessagehook; fquerypaste; getasynckeystate; getclassid; getclientrect; getclipboarddata; getdata; getdc; getdevicecaps; getextent; getwindowlong; handsoffstorage; initnew; invalidaterect; isclipboardformatavailable; iszoomed; load; lstrcmpi; messagedisplay; messageloop; messageset; muldiv; oleduplicatedata; oleinitialize; oleuninitialize; oncommand; openclipboard; paste; queryinterface; readclassstg; rectlfromrect; release; releasedc; releaseinterface; releaseobject; releasestgmedium; rename; renderformat; save; savecompleted; setclipboarddata; setdata; setdefformatetc; setmessagequeue; setrect; setwindowpos; showwindow; sizetographic; statusline; stgcreatedocfile; stgopenstorage; succeeded; uncache; updatemenus; updatewindow; writeclassstg


Chapter 12

Click to open or copy the files for the Chapter 12 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 12 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Cocosmo (Chapter 12)

Click to open or copy the Cocosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

activedocument; addref; adjustwindowrect; advise; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cframe; check; checklineselection; checkmenuitem; choosecolor; cimpiadvisesink; clear; clip; cocreateinstance; cofreeunusedlibraries; colorget; colorset; commandparams; cpolylineadvisesink; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createlinemenu; createpen; createstream; createtoolbar; dadvise; deletedc; deleteinterfaceimp; deleteobject; dunadvise; enable; enablemenuitem; errormessage; failed; fdirtyset; fmessagehook; fquerypaste; getclassinfo; getclientrect; getdata; getdc; getmenu; getsubmenu; gettextmetrics; getwindowlong; getwindowrect; inflaterect; initnew; linestyleget; linestyleset; lineto; load; lstrcmpi; memset; messagebox; messageloop; modifymenu; movetoex; newdocument; oleflushclipboard; olegetclipboard; oleinitialize; oleiscurrentclipboard; olesetclipboard; oletext; oleuninitialize; onclose; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onrename; onsave; onsizechange; onviewchange; openstream; paste; patblt; preshowinit; querygetdata; queryinterface; rectget; rectset; registerallclasses; registerclass; release; releasedc; releaseinterface; rename; resultfromscode; save; savecompleted; saveopendialog; selectobject; setdata; setdefformatetc; setrect; setwindowpos; stdmethodimp_; stgcreatedocfile; stgopenstorage; succeeded; unadvise; undo; unregisterclass; updatemenus; updatetoolbar; window


Cosmo (Chapter 12)

Click to open or copy the Cosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; activedocument; adjustwindowrect; beginpaint; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cframe; check; checklineselection; checkmenuitem; choosecolor; clear; clip; closemetafile; cocreateinstance; cogetclassobject; colorget; colorset; commandparams; cpolyline; cpolylineadvisesink; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createlinemenu; createmetafile; createpen; createsolidbrush; createstream; createtoolbar; createwindowex; cwindow; dataget; datagetmem; dataset; datasetmem; defwindowproc; deletedc; deletemetafile; deleteobject; dptolp; draw; enable; enablemenuitem; endpaint; errormessage; failed; fdirtyset; fmessagehook; fquerypaste; fquerypastefromdata; getclassinfo; getclientrect; getdata; getdc; getdevicecaps; getmapmode; getmenu; getparent; getscode; getstockobject; getsubmenu; getsyscolor; gettextmetrics; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; inflaterect; invalidaterect; iswindow; linestyleget; linestyleset; lineto; liset32; load; loadcursor; lockserver; makelong; makepoints; memset; messagebeep; messagebox; messageloop; modifymenu; movetoex; muldiv; newdocument; offsetrect; oleflushclipboard; olegetclipboard; oleinitialize; olesetclipboard; oletext; oleuninitialize; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onsizechange; openfile; openfilew; openstream; paste; pastefromdata; patblt; pointscale; polylinewndproc; preshowinit; querygetdata; readfromfile; readfromstorage; rectangle; rectconvertmappings; rectget; rectset; rectstorect; recttorects; registerallclasses; registerclass; release; releasedc; releasestgmedium; rename; renderbitmap; renderformat; rendermetafile; rendermetafilepict; save; saveopendialog; screentoclient; seek; selectobject; setbkcolor; setdata; setdefformatetc; setmapmode; setpixel; setrect; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; sizeget; sizeset; stgcreatedocfile; stgisstoragefile; stgopenstorage; succeeded; text; undo; unicodetoansi; unregisterclass; updatemenus; updatetoolbar; updatewindow; window; writeclassstg; writefmtusertypestg; writetofile; writetostorage; wsprintf


Datatran (Chapter 12)

Click to open or copy the Datatran sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; alloc; cdataobject; cdatatransferclassfactory; cenumformatetc; cimpidataobject; citems; clone; cogetmalloc; copyto; createinstance; createwindow; dadvise; destroywindow; dllcanunloadnow; dllgetclassobject; dunadvise; enumdadvise; enumformatetc; failed; free; getcanonicalformatetc; getdata; getdatahere; libmain; libmain32; lockserver; memcpy; next; objectdestroyed; purge; querygetdata; queryinterface; release; releasestgmedium; reset; resultfromscode; sendmessage; setdata; skip; stat; stdmethodimp_; succeeded; text; unlockdata


Patron (Chapter 12)

Click to open or copy the Patron sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

abortdoc; abortproc; activate; activedocument; activepage; addref; alloc; beginpaint; cache; calcboundingrect; cb; cbdevmode; cchdevicename; cchdevicename; cclient; cdocument; cframe; clear; clienttoscreen; clip; cocreateinstance; cofreeunusedlibraries; cogetclassobject; cogetmalloc; commandparams; commit; configurefordevice; copyto; cpage; cpages; cpages; cpatronclient; cpatrondoc; cpatronframe; create; createcclient; createcdocument; createdatacache; createdialog; createfont; createic; createpen; createsolidbrush; createstatic; createstorage; createstream; createtoolbar; createwindow; createwindowex; ctenant; ctenants; curpageget; curpageset; cwindow; defwindowproc; delete; deletedc; deletefile; deleteobject; deletepage; destroy; destroyelement; destroywindow; devmodeget; devmodeset; devreadconfig; dispatchmessage; dptolp; draw; drawfocusrect; enable; enablemenuitem; enablewindow; enddoc; endpage; endpaint; equalrect; escape; exttextout; failed; fdirtyget; fdirtyset; firstpage; fisdirty; fmessagehook; formatetcget; fqueryobjectselected; fquerypaste; fquerypastefromdata; fqueryprintersetup; frameget; free; getclientrect; getdata; getdc; getdevicecaps; getdlgitem; getdlgitemtext; getextent; getid; getinfo; getparent; getscode; getscrollpos; getscrollrange; getstockobject; getstoragename; getsyscolor; getsystemmenu; getsystemmetrics; gettextextentpoint; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalsize; globalunlock; initnew; intersectrect; invalidate; invalidaterect; ipage; isdialogmessage; killtimer; lastpage; lineto; liset32; load; loadcursor; lockserver; lptodp; lstrcmpi; lstrcpy; makeintresource; max; memcpy; memset; messagebeep; messagebox; messageloop; min; movetoex; muldiv; multibytetowidechar; newpage; nextpage; numpagesget; objectget; offsetrect; oledraw; oleflushclipboard; olegetclipboard; oleinitialize; oleload; olesave; olesetclipboard; oletext; oleuipastespecial; oleuninitialize; oncommand; onleftdoubleclick; onleftdown; onleftup; onmousemove; onnchittest; onsetcursor; ontimer; open; openstorage; openstream; pageadd; pagedelete; pageget; pageinsert; pageswndproc; paste; pastefromdata; pastespecial; peekmessage; previouspage; print; printdlg; printdlghook; printdlgproc; printersetup; querygetdata; queryinterface; readclassstg; rectangle; rectconvertmappings; rectfromrectl; rectget; rectlfromrect; rectset; registerallclasses; registerclass; release; releasecapture; releasedc; releaseinterface; releasestgmedium; remove; rename; repaint; resultfromscode; save; savecompleted; screentoclient; scrollthumbposition; scrollwindow; seek; select; selectobject; sendmessage; setabortproc; setbkcolor; setcapture; setcursor; setdata; setdefformatetc; setdlgitemtext; setextent; setfocus; setmapmode; setpoint; setrect; setrectl; setscrollpos; setscrollrange; setsizel; settextcolor; settimer; setwindowlong; setwindowpos; showwindow; sizeget; sizeset; startdoc; startpage; startsizetracking; stgcreatedocfile; stgopenstorage; storageset; storageupdate; succeeded; switchtofile; tenantadd; tenantclip; tenantcreate; tenantdestroy; tenantfrompoint; tenantget; text; textout; top; transferobjectcreate; translatemessage; uicursorload; uidrawhandles; update; updatemenus; updatescrollranges; updatetoolbar; updatewindow; window; writeclassstg; writefmtusertypestg; wsprintf


Chapter 13

Click to open or copy the files for the Chapter 13 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 13 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Cocosmo (Chapter 13)

Click to open or copy the Cocosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

activedocument; addref; adjustwindowrect; advise; bringwindowtotop; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cdropsource; cdroptarget; cframe; check; checklineselection; checkmenuitem; choosecolor; cimpiadvisesink; clear; clip; cocreateinstance; cofreeunusedlibraries; colockobjectexternal; colorget; colorset; commandparams; cpolylineadvisesink; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createlinemenu; createpen; createstream; createtoolbar; dadvise; deletedc; deleteinterfaceimp; deleteobject; dodragdrop; dragenter; dragleave; dragover; drop; dropselecttargetwindow; dunadvise; enable; enablemenuitem; errormessage; failed; fdirtyset; fmessagehook; fquerypaste; fquerypastefromdata; getclassinfo; getclientrect; getdata; getdc; getmenu; getscode; getsubmenu; gettextmetrics; getwindowdc; getwindowlong; getwindowrect; givefeedback; inflaterect; initnew; linestyleget; linestyleset; lineto; load; lstrcmpi; memset; messagebox; messageloop; modifymenu; movetoex; newdocument; oleflushclipboard; olegetclipboard; oleinitialize; oleiscurrentclipboard; olesetclipboard; oletext; oleuninitialize; onclose; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onrename; onsave; onsizechange; onviewchange; openstream; paste; pastefromdata; patblt; preshowinit; querycontinuedrag; querygetdata; queryinterface; rectset; registerallclasses; registerclass; registerdragdrop; release; releasedc; releaseinterface; rename; resultfromscode; revokedragdrop; save; savecompleted; saveopendialog; selectobject; setdata; setdefformatetc; setrect; setwindowpos; stdmethodimp_; stgcreatedocfile; stgopenstorage; succeeded; top; transferobjectcreate; unadvise; undo; unregisterclass; updatemenus; updatetoolbar; updatewindow; window


Cosmo (Chapter 13)

Click to open or copy the Cosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; activedocument; addref; adjustwindowrect; beginpaint; bringwindowtotop; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cdropsource; cdroptarget; cframe; check; checklineselection; checkmenuitem; choosecolor; clear; clip; closemetafile; cocreateinstance; cogetclassobject; colockobjectexternal; colorget; colorset; commandparams; cpolyline; cpolylineadvisesink; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createlinemenu; createmetafile; createpen; createsolidbrush; createstream; createtoolbar; createwindowex; cwindow; dataget; datagetmem; dataset; datasetmem; defwindowproc; deletedc; deletemetafile; deleteobject; dodragdrop; dptolp; dragenter; dragleave; dragover; draw; drop; dropselecttargetwindow; enable; enablemenuitem; endpaint; errormessage; failed; fdirtyset; fmessagehook; fquerypaste; fquerypastefromdata; getclassinfo; getclientrect; getdata; getdc; getdevicecaps; getmapmode; getmenu; getparent; getscode; getstockobject; getsubmenu; getsyscolor; gettextmetrics; getwindowdc; getwindowlong; getwindowrect; givefeedback; globalalloc; globalfree; globallock; globalunlock; inflaterect; invalidaterect; iswindow; linestyleget; linestyleset; lineto; liset32; load; loadcursor; lockserver; makelong; makepoints; memset; messagebeep; messagebox; messageloop; modifymenu; movetoex; muldiv; newdocument; offsetrect; oleflushclipboard; olegetclipboard; oleinitialize; olesetclipboard; oletext; oleuninitialize; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onsizechange; openfile; openfilew; openstream; paste; pastefromdata; patblt; pointscale; polylinewndproc; preshowinit; querycontinuedrag; querygetdata; queryinterface; readfromfile; readfromstorage; rectangle; rectconvertmappings; rectget; rectset; rectstorect; recttorects; registerallclasses; registerclass; registerdragdrop; release; releasedc; releaseinterface; releasestgmedium; rename; renderbitmap; renderformat; rendermetafile; rendermetafilepict; resultfromscode; revokedragdrop; save; saveopendialog; screentoclient; seek; selectobject; setbkcolor; setdata; setdefformatetc; setmapmode; setpixel; setrect; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; sizeget; sizeset; stdmethodimp_; stgcreatedocfile; stgisstoragefile; stgopenstorage; succeeded; text; top; transferobjectcreate; undo; unicodetoansi; unregisterclass; updatemenus; updatetoolbar; updatewindow; window; writeclassstg; writefmtusertypestg; writetofile; writetostorage; wsprintf


Patron (Chapter 13)

Click to open or copy the Patron sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

abortdoc; abortproc; activate; activedocument; activepage; addref; adjustposition; alloc; beginpaint; bottom; bringwindowtotop; cache; calcboundingrect; cb; cbdevmode; cchdevicename; cchdevicename; cclient; cdocument; cdropsource; cdroptarget; cframe; clear; clienttoscreen; clip; cocreateinstance; cofreeunusedlibraries; cogetclassobject; cogetmalloc; colockobjectexternal; commandparams; commit; configurefordevice; copyto; cpage; cpages; cpages; cpatronclient; cpatrondoc; cpatronframe; create; createcclient; createcdocument; createdatacache; createdialog; createfont; createic; createpen; createsolidbrush; createstatic; createstorage; createstream; createtoolbar; createwindow; createwindowex; ctenant; ctenants; curpageget; curpageset; cwindow; defwindowproc; delete; deletedc; deletefile; deleteobject; deletepage; destroy; destroyelement; destroywindow; devmodeget; devmodeset; devreadconfig; dispatchmessage; dodragdrop; dptolp; dragdrop; dragenter; dragleave; dragover; draw; drawdroptargetrect; drawfocusrect; drop; enable; enablemenuitem; enablewindow; enddoc; endpage; endpaint; equalrect; escape; exttextout; failed; fdirtyget; fdirtyset; firstpage; fisdirty; fmessagehook; formatetcget; fqueryobjectselected; fquerypaste; fquerypastefromdata; fqueryprintersetup; frameget; free; getclientrect; getcursorpos; getdata; getdc; getdevicecaps; getdlgitem; getdlgitemtext; getextent; getid; getinfo; getparent; getprofileint; getscode; getscrollpos; getscrollrange; getstockobject; getstoragename; getsyscolor; getsystemmenu; getsystemmetrics; gettextextentpoint; gettickcount; getwindowlong; getwindowrect; givefeedback; globalalloc; globalfree; globallock; globalsize; globalunlock; initnew; intersectrect; invalidate; invalidaterect; ipage; isdialogmessage; isrectempty; killtimer; lastpage; left; lineto; liset32; load; loadcursor; lockserver; lptodp; lstrcmpi; lstrcpy; makeintresource; max; memcpy; memset; messagebeep; messagebox; messageloop; min; movetoex; muldiv; multibytetowidechar; newpage; nextpage; numpagesget; objectget; offsetrect; oledraw; oleflushclipboard; olegetclipboard; oleinitialize; oleload; olesave; olesetclipboard; oletext; oleuipastespecial; oleuninitialize; oncommand; onleftdoubleclick; onleftdown; onleftup; onmousemove; onnchittest; onsetcursor; ontimer; open; openstorage; openstream; pageadd; pagedelete; pageget; pageinsert; pageswndproc; paste; pastefromdata; pastespecial; peekmessage; pointfrompointl; pointlfrompoint; previouspage; print; printdlg; printdlghook; printdlgproc; printersetup; ptinrect; querycontinuedrag; querygetdata; queryinterface; readclassstg; rectangle; rectconvertmappings; rectfromrectl; rectget; rectlfromrect; rectset; registerallclasses; registerclass; registerdragdrop; release; releasecapture; releasedc; releaseinterface; releasestgmedium; remove; rename; repaint; resultfromscode; revokedragdrop; right; save; savecompleted; screentoclient; scrollthumbposition; scrollwindow; seek; select; selectobject; sendmessage; setabortproc; setbkcolor; setcapture; setcursor; setdata; setdefformatetc; setdlgitemtext; setextent; setfocus; setmapmode; setpoint; setrect; setrectl; setscrollpos; setscrollrange; setsizel; settextcolor; settimer; setwindowlong; setwindowpos; showwindow; sizeget; sizeset; startdoc; startpage; startsizetracking; stdmethodimp_; stgcreatedocfile; stgopenstorage; storageset; storageupdate; succeeded; switchtofile; tenantadd; tenantclip; tenantcreate; tenantdestroy; tenantfrompoint; tenantget; text; textout; top; transferobjectcreate; translatemessage; uicursorload; uidrawhandles; update; updatemenus; updatescrollranges; updatetoolbar; updatewindow; utestdroppablepoint; window; writeclassstg; writefmtusertypestg; wsprintf


Chapter 14

Click to open or copy the files for the Chapter 14 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 14 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Beeper1 (Chapter 14)

Click to open or copy the Beeper1 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; cbeeper; cbeeperfactory; cimpidispatch; createinstance; deleteinterfaceimp; dispgetparam; dllcanunloadnow; dllgetclassobject; failed; fillexception; free; getidsofnames; gettypeinfo; gettypeinfocount; initexcepinfo; invoke; libmain; libmain32; loadstring; lockserver; lstrcmpi; makelong; malloc; messagebeep; multibytetowidechar; objectdestroyed; oletext; primarylangid; queryinterface; release; resultfromscode; stdmethodimp_; succeeded; sysallocstring; unlockdata; variantchangetype; variantinit; widechartomultibyte


Beeper2 (Chapter 14)

Click to open or copy the Beeper2 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; beep; cbeeper; cbeeperfactory; cimpidispatch; createinstance; declare_interface_; define_guid; deleteinterfaceimp; dispgetidsofnames; dllcanunloadnow; dllgetclassobject; exception; failed; fillexception; free; get_sound; getidsofnames; gettypeinfo; gettypeinfocount; gettypeinfoofguid; initexcepinfo; invoke; libmain; libmain32; loadregtypelib; loadstring; loadtypelib; lockserver; makelong; malloc; messagebeep; multibytetowidechar; objectdestroyed; oletext; primarylangid; put_sound; queryinterface; release; releaseinterface; resultfromscode; stdmethod; stdmethod_; stdmethodimp_; succeeded; sysallocstring; unlockdata


Beeper3 (Chapter 14)

Click to open or copy the Beeper3 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; beep; cbeeper; cbeeperfactory; cimpidispatch; cimpisupporterrorinfo; createerrorinfo; createinstance; declare_interface_; define_guid; deleteinterfaceimp; dispgetidsofnames; dllcanunloadnow; dllgetclassobject; exception; failed; free; get_sound; getidsofnames; gettypeinfo; gettypeinfocount; gettypeinfoofguid; interfacesupportserrorinfo; invoke; libmain; libmain32; loadregtypelib; loadstring; loadtypelib; lockserver; malloc; messagebeep; multibytetowidechar; objectdestroyed; oletext; primarylangid; put_sound; queryinterface; release; releaseinterface; resultfromscode; setdescription; seterrorinfo; setguid; sethelpcontext; sethelpfile; setsource; stdmethod; stdmethod_; stdmethodimp_; succeeded; tlsalloc; tlsfree; tlsgetvalue; tlssetvalue; unlockdata


Beeper4 (Chapter 14)

Click to open or copy the Beeper4 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; beep; cbeeper; cbeeperfactory; cimpisupporterrorinfo; createerrorinfo; createinstance; declare_interface_; define_guid; dispgetidsofnames; dllcanunloadnow; dllgetclassobject; exception; failed; free; get_sound; getidsofnames; gettypeinfo; gettypeinfocount; gettypeinfoofguid; interfacesupportserrorinfo; invoke; libmain; libmain32; loadregtypelib; loadstring; loadtypelib; lockserver; malloc; messagebeep; multibytetowidechar; objectdestroyed; oletext; primarylangid; put_sound; queryinterface; release; releaseinterface; resultfromscode; setdescription; seterrorinfo; setguid; sethelpcontext; sethelpfile; setsource; stdmethod; stdmethod_; stdmethodimp_; succeeded; tlsalloc; tlsfree; tlsgetvalue; tlssetvalue; unlockdata


Beeper5 (Chapter 14)

Click to open or copy the Beeper5 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; beep; cbeeper; cbeeperfactory; cimpiprovideclassinfo; createinstance; createstddispatch; declare_interface_; define_guid; dllcanunloadnow; dllgetclassobject; failed; get_sound; getclassinfo; gettypeinfoofguid; libmain; libmain32; loadregtypelib; loadtypelib; lockserver; messagebeep; objectdestroyed; oletext; put_sound; queryinterface; release; releaseinterface; resultfromscode; stdmethod; stdmethod_; stdmethodimp_; unlockdata


Cosmo (Chapter 14)

Click to open or copy the Cosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; _newenum; _tcsstr; activate; activedocument; addconnection; addpoint; addref; adjustwindowrect; autoapp; autofigure; autofigures; beginpaint; cautoapp; cautobase; cautofigure; cautofigures; cclassfactory; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cenumfigures; cframe; check; checklineselection; checkmenuitem; choosecolor; cimpidispatch; cimpiextconn; clear; clip; clone; closedocument; closemetafile; cocreateinstance; cogetclassobject; colorget; colorset; commandparams; copy; coregisterclassobject; corevokeclassobject; cpolyline; cpolylineadvisesink; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createinstance; createlinemenu; createmetafile; createpen; createsolidbrush; createstream; createtoolbar; createwindow; createwindowex; cut; cwindow; dataget; datagetmem; dataset; datasetmem; declare_interface_; define_guid; defwindowproc; deletedc; deleteinterfaceimp; deletemetafile; deleteobject; destroywindow; dispgetidsofnames; dptolp; draw; enable; enablemenuitem; endpaint; errormessage; failed; fdirtyget; fdirtyset; filenameget; fmessagehook; fquerypaste; fquerypastefromdata; frame; get_activefigure; get_application; get_backcolor; get_caption; get_count; get_figures; get_fullname; get_height; get_left; get_linecolor; get_linestyle; get_name; get_numberofpoints; get_parent; get_path; get_saved; get_statusbar; get_top; get_visible; get_width; getclassinfo; getclientrect; getdata; getdc; getdevicecaps; getfiletitle; getidsofnames; getmapmode; getmenu; getmodulefilename; getparent; getscode; getstockobject; getsubmenu; getsyscolor; gettextmetrics; gettypeinfo; gettypeinfocount; gettypeinfoofguid; getwindowlong; getwindowrect; getwindowtext; globalalloc; globalfree; globallock; globalunlock; import; inflaterect; instance; invalidaterect; invoke; iswindow; iswindowvisible; item; linestyleget; linestyleset; lineto; liset32; load; loadcursor; loadregtypelib; loadtypelib; lockserver; lstrcmpi; makelong; makelparam; makepoints; memset; messagebeep; messagebox; messageget; messageloop; messageset; modifymenu; movesize; movetoex; muldiv; multibytetowidechar; newdocument; newfigure; next; objectdestroyed; offsetrect; oleflushclipboard; olegetclipboard; oleinitialize; olesetclipboard; oletext; oleuninitialize; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onsizechange; open; openfile; openfilew; openstream; parsecommandline; paste; pastefromdata; patblt; pointscale; polylinewndproc; postmessage; preshowinit; primarylangid; put_backcolor; put_height; put_left; put_linecolor; put_linestyle; put_statusbar; put_top; put_visible; put_width; queryclosealldocuments; querygetdata; queryinterface; quit; readfromfile; readfromstorage; rectangle; rectconvertmappings; rectget; rectset; rectstorect; recttorects; registeractiveobject; registerallclasses; registerclass; release; releaseconnection; releasedc; releaseinterface; releasestgmedium; removepoint; rename; renderbitmap; renderformat; rendermetafile; rendermetafilepict; reset; resultfromscode; reverttosaved; revokeactiveobject; save; saveas; saveopendialog; screentoclient; seek; selectobject; sendmessage; setbkcolor; setdata; setdefformatetc; setmapmode; setpixel; setpoint; setrect; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; showwindow; sizeget; sizeset; skip; statusline; stdmethod; stdmethod_; stdmethodimp_; stgcreatedocfile; stgisstoragefile; stgopenstorage; succeeded; sysallocstring; sysallocstringlen; sysfreestring; text; undo; unicodetoansi; unregisterclass; updatemenus; updatetoolbar; updatewindow; vtableinterface; wcsstr; widechartomultibyte; window; writeclassstg; writefmtusertypestg; writetofile; writetostorage; wsprintf


Chapter 15

Click to open or copy the files for the Chapter 15 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 15 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Autocli (Chapter 15)

Click to open or copy the Autocli sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

autoclientwndproc; capp; cchstringmax; cocreateinstance; coinitialize; couninitialize; createwindow; defwindowproc; destroywindow; dispatchmessage; exttextout; failed; free; getclientrect; getdc; getidsofnames; getmessage; getscode; getsyscolor; getuserdefaultlcid; getwindowlong; helpdirfromclsid; invoke; iswindow; loadcursor; loadicon; loadstring; lstrcpy; lstrlen; makeintresource; malloc; message; messagebox; nametoid; oletext; postmessage; postquitmessage; registerclass; regqueryvalue; release; releasedc; resultfromscode; setbkcolor; setdispparams; setnoparams; settextcolor; setwindowlong; showwindow; stringfromguid2; succeeded; sysfreestring; text; translatemessage; updatewindow; variantinit; wcslen; widechartomultibyte; winhelp; winmain; wsprintf


Square (Chapter 15)

Click to open or copy the Square sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; beginpaint; capp; coinitialize; coregisterclassobject; corevokeclassobject; cos; couninitialize; createinstance; createpen; createpens; createstddispatch; createwindow; csquare; csquareclassfactory; declare_interface_; define_guid; defwindowproc; deleteobject; destroywindow; dispatchmessage; draw; endpaint; exttextout; failed; get_backcolor; get_declination; get_linecolornegative; get_linecolorpositive; get_radius; get_theta; getclientrect; getmessage; getstockobject; getsyscolor; gettypeinfoofguid; getwindowlong; invalidaterect; iswindow; lineto; loadcursor; loadregtypelib; loadtypelib; lockserver; lstrcmpia; mainwndproc; movetoex; objectdestroyed; oletext; polyline; postmessage; postquitmessage; put_backcolor; put_declination; put_linecolornegative; put_linecolorpositive; put_radius; put_theta; queryinterface; registerclass; release; releaseinterface; resultfromscode; selectobject; setbkcolor; setcenterpoint; setpoint; setrect; setwindowlong; setwindowpos; setwindowposition; setwindowsize; showwindow; squarewndproc; stdmethod; stdmethod_; stdmethodimp_; text; translatemessage; updatewindow; winmain


Chapter 16

Click to open or copy the files for the Chapter 16 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 16 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Autocli2 (Chapter 16)

Click to open or copy the Autocli2 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; advise; autoclientwndproc; capp; cchstringmax; checkmenuitem; cocreateinstance; coinitialize; cotaskmemfree; couninitialize; cpropertynotifysink; createwindow; defwindowproc; destroywindow; dispatchmessage; enablemenuitem; exttextout; failed; free; getclientrect; getdc; getidsofnames; getmenu; getmessage; getpages; getscode; getsyscolor; getuserdefaultlcid; getwindowlong; helpdirfromclsid; invoke; iswindow; loadcursor; loadicon; loadstring; lstrcpy; lstrlen; makeintresource; malloc; message; messagebox; nametoid; olecreatepropertyframe; oletext; onchanged; onrequestedit; postmessage; postquitmessage; queryinterface; registerclass; regqueryvalue; release; releasedc; releaseinterface; resultfromscode; setbkcolor; setdispparams; setnoparams; settextcolor; setwindowlong; showproperties; showwindow; stdmethodimp_; stringfromguid2; succeeded; sysfreestring; text; translatemessage; unadvise; updatewindow; variantinit; wcslen; widechartomultibyte; winhelp; winmain; wsprintf


Beeper6 (Chapter 16)

Click to open or copy the Beeper6 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; advise; alloc; beep; cbeeper; cbeeperfactory; cconnectionpoint; cimpiconnptcont; cimpidispatch; cimpispecifypp; cogetmalloc; cproppages; createinstance; declare_interface_; define_guid; deleteinterfaceimp; dispgetidsofnames; dllcanunloadnow; dllgetclassobject; enumconnectionpoints; enumconnections; exception; failed; fillexception; findconnectionpoint; free; get_sound; getconnectioninterface; getidsofnames; getpages; gettypeinfo; gettypeinfocount; gettypeinfoofguid; initexcepinfo; invoke; libmain; libmain32; loadregtypelib; loadstring; loadtypelib; lockserver; makelong; malloc; messagebeep; multibytetowidechar; objectdestroyed; oletext; onchanged; onrequestedit; primarylangid; put_sound; queryinterface; release; releaseinterface; resultfromscode; stdmethod; stdmethod_; stdmethodimp_; succeeded; sysallocstring; unadvise; unlockdata


Beepprop (Chapter 16)

Click to open or copy the Beepprop sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

activate; addref; alloc; apply; beepproppageproc; cbeeperppfactory; cbeeperproppage; checkradiobutton; cogetmalloc; createdialogparam; createinstance; deactivate; destroywindow; dllcanunloadnow; dllgetclassobject; failed; freeallobjects; get_sound; getdesktopwindow; getdlgitem; getlocaleid; getpageinfo; getprop; getwindowrect; help; ispagedirty; libmain; libmain32; loadstring; lockserver; makeintresource; makelong; messagebeep; move; multibytetowidechar; onstatuschange; primarylangid; put_sound; queryinterface; release; releaseinterface; removeprop; resultfromscode; setfocus; setobjects; setpagesite; setprop; setwindowpos; show; showwindow; stdmethodimp_; succeeded; text; translateaccelerator; unlockdata


Chapter 17

Click to open or copy the files for the Chapter 17 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 17 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Patron (Chapter 17)

Click to open or copy the Patron sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

abortdoc; abortproc; activate; activateobject; activedocument; activepage; addref; addverbmenu; adjustposition; advise; alloc; ansiupper; appendmenu; beginpaint; bottom-; bringwindowtotop; cache; calcboundingrect; cb; cbdevmode; cchdevicename; cclient; cdocument; cdropsource; cdroptarget; cframe; cimpiadvisesink; cimpioleclientsite; clear; clienttoscreen; clip; cocreateinstance; cofreeunusedlibraries; cogetclassobject; cogetmalloc; colockobjectexternal; commandparams; commit; configurefordevice; convertobject; copyembeddedobject; copyto; cotaskmemfree; cotreatasclass; cpage; cpages; cpages; cpatronclient; cpatrondoc; cpatronframe; create; createcclient; createcdocument; createdatacache; createdialog; createfont; createic; createpen; createpopupmenu; createsolidbrush; createstatic; createstorage; createstream; createtoolbar; createwindow; createwindowex; ctenant; ctenants; curpageget; curpageset; cwindow; defwindowproc; delete; deletedc; deletefile; deleteinterfaceimp; deleteobject; deletepage; destroy; destroyelement; destroymenu; destroywindow; devmodeget; devmodeset; devreadconfig; dispatchmessage; dodragdrop; doverb; dptolp; dragdrop; dragenter; dragleave; dragover; draw; drawdroptargetrect; drawfocusrect; drop; enable; enablemenuitem; enablerepaint; enablewindow; enddoc; endpage; endpaint; equalrect; escape; exttextout; failed; fdirtyget; fdirtyset; filenameget; firstpage; fisdirty; fmessagehook; formatetcget; fqueryobjectselected; fquerypaste; fquerypastefromdata; fqueryprintersetup; frameget; free; getclassid; getclientrect; getcontainer; getcursorpos; getdata; getdc; getdevicecaps; getdlgitem; getdlgitemtext; getextent; getfiletitle; getid; getinfo; getmenuitemcount; getmenuitemid; getmenustring; getmiscstatus; getmoniker; getparent; getprofileint; getscode; getscrollpos; getscrollrange; getstockobject; getstoragename; getsubmenu; getsyscolor; getsystemmenu; getsystemmetrics; gettextextentpoint; gettickcount; getuserclassid; getwindowinstance; getwindowlong; getwindowrect; givefeedback; globalalloc; globalfree; globallock; globalsize; globalunlock; initnew; inole_copystring; inole_doconvert; inole_getusertypeofclass; inole_metafilepicticonfree; inole_seticonincache; inole_switchdisplayaspect; insertobject; intersectrect; invalidate; invalidaterect; ipage-; isdialogmessage; isdirty; isrectempty; iswindowvisible; killtimer; lastpage; lineto; liset32; load; loadcursor; loadmenu; loadstring; lockserver; lptodp; lstrcmpi; lstrcpy; makeintresource; max; memcpy; memset; menuselectparams; messagebeep; messagebox; messagedisplay; messageloop; min; movetoex; muldiv; multibytetowidechar; newpage; nextpage; notifyofrename; notifytenantsofrename; numpagesget; objectclassformatandicon; objectget; objectinitialize; offsetrect; olecreate; olecreatefromdata; olecreatefromfile; oledraw; oleflushclipboard; olegetclipboard; olegeticonofclass; oleinitialize; oleisrunning; oleload; olequerycreatefromdata; olerun; olesave; olesetclipboard; olesetcontainedobject; oletext; oleuiaddverbmenu; oleuiconvert; oleuiinsertobject; oleuipastespecial; oleuninitialize; onclose; oncommand; ondatachange; onleftdoubleclick; onleftdown; onleftup; onmousemove; onnchittest; onrename; onrightdown; onsave; onsetcursor; onshowwindow; ontimer; onviewchange; open; openstorage; openstream; pageadd; pagedelete; pageget; pageinsert; pageswndproc; paste; pastefromdata; pastespecial; peekmessage; pointfrompointl; pointlfrompoint; previouspage; print; printdlg; printdlghook; printdlgproc; printersetup; ptinrect; querycontinuedrag; querygetdata; queryinterface; readclassstg; readfmtusertypestg; rectangle; rectconvertmappings; rectfromrectl; rectget; rectlfromrect; rectset; registerallclasses; registerclass; registerclipboardformat; registerdragdrop; release; releasecapture; releasedc; releaseinterface; releasestgmedium; remove; rename; repaint; requestnewobjectlayout; resultfromscode; revokedragdrop; right; save; savecompleted; saveobject; screentoclient; scrollthumbposition; scrollwindow; seek; select; selectobject; selecttenantatpoint; sendmessage; sendscrollposition; setabortproc; setadvise; setbkcolor; setcapture; setclientsite; setcursor; setdata; setdefformatetc; setdlgitemtext; setextent; setfocus; setformatetc; sethostnames; setmapmode; setpoint; setpointl; setrect; setrectl; setscrollpos; setscrollrange; setsizel; settextcolor; settimer; setwindowlong; setwindowpos; showasopen; showobject; showwindow; showyourself; sizeget; sizeset; startdoc; startpage; startsizetracking; stdmethodimp_; stgcreatedocfile; stgopenstorage; storageget; storageset; storageupdate; succeeded; switchorupdateaspect; switchtofile; tenantadd; tenantclip; tenantcreate; tenantdestroy; tenantfrompoint; tenantget; text; textout; trackpopupmenu; transferobjectcreate; translatemessage; typeget; uicursorload; uidrawhandles; uidrawshading; update; updatemenus; updatescrollranges; updatetoolbar; updatewindow; utestdroppablepoint; window; writeclassstg; writefmtusertypestg; wsprintf; xformrectinpixelstohimetric; xformsizeinhimetrictopixels; xformsizeinpixelstohimetric


Chapter 18

Click to open or copy the files for the Chapter 18 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 18 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Cosmo (Chapter 18)

Click to open or copy the Cosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; activedocument; addref; adjustwindowrect; advise; beginpaint; bringwindowtotop; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cdropsource; cdroptarget; cfigure; cfigureclassfactory; cframe; check; checklineselection; checkmenuitem; choosecolor; cimpidataobject; cimpioleobject; cimpipersiststorage; clear; clip; closedocument; closemetafile; cocreateinstance; codisconnectobject; cogetclassobject; colockobjectexternal; colorget; colorset; commandparams; coregisterclassobject; corevokeclassobject; cpolyline; cpolylineadvisesink; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createdataadviseholder; createinstance; createlinemenu; createmetafile; createoleadviseholder; createpen; createsolidbrush; createstream; createtoolbar; createwindowex; cstringtable; cwindow; dadvise; dataget; datagetmem; dataset; datasetmem; defwindowproc; deletedc; deleteinterfaceimp; deletemenu; deletemetafile; deleteobject; destroyelement; dodragdrop; doverb; dptolp; dragenter; dragleave; dragover; draw; drawmenubar; drop; dropselecttargetwindow; dunadvise; enable; enablemenuitem; endpaint; enumadvise; enumdadvise; enumformatetc; enumverbs; errormessage; failed; fdirtyget; fdirtyset; fisdirty; fisembedded; fmessagehook; fquerypaste; fquerypastefromdata; frameset; getcanonicalformatetc; getclassid; getclassinfo; getclientrect; getclientsite; getclipboarddata; getconvertstg; getdata; getdatahere; getdc; getdevicecaps; getextent; getmapmode; getmenu; getmiscstatus; getmoniker; getparent; getscode; getstockobject; getsubmenu; getsyscolor; gettextmetrics; getuserclassid; getusertype; getwindowdc; getwindowlong; getwindowrect; givefeedback; globalalloc; globalfree; globallock; globalunlock; handsoffstorage; inflaterect; initfromdata; initnew; inole_createstorageonhglobal; insertmenu; invalidaterect; isdirty; isuptodate; iswindow; linestyleget; linestyleset; lineto; liset32; load; loadcursor; lockserver; lstrcmpi; lstrcpy; makelong; makepoints; memset; messagebeep; messagebox; messageloop; modifymenu; movetoex; muldiv; newdocument; objectdestroyed; offsetrect; oleflushclipboard; olegetclipboard; oleinitialize; olesetclipboard; oletext; oleuninitialize; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onshowwindow; onsizechange; openfile; openfilew; openstream; parsecommandline; paste; pastefromdata; patblt; pointscale; polylinewndproc; postmessage; preshowinit; querycontinuedrag; querygetdata; queryinterface; readclassstg; readfromfile; readfromstorage; readfromstream; rectangle; rectconvertmappings; rectget; rectset; rectstorect; recttorects; registerallclasses; registerclass; registerclipboardformat; registerdragdrop; release; releasedc; releaseinterface; releasestgmedium; rename; renderbitmap; renderformat; rendermedium; rendermetafile; rendermetafilepict; resultfromscode; revokedragdrop; save; savecompleted; saveobject; saveopendialog; screentoclient; seek; selectobject; sendadvise; sendonclose; sendonsave; setbkcolor; setclientsite; setcolorscheme; setconvertstg; setdata; setdefformatetc; setextent; setfocus; setforegroundwindow; sethostnames; setmapmode; setmoniker; setpixel; setpointl; setrect; setsizel; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; setwindowtext; show; showobject; showwindow; sizeget; sizeset; stdmethodimp_; stgcreatedocfile; stgisstoragefile; stgopenstorage; succeeded; text; top; transferobjectcreate; unadvise; undo; unicodetoansi; unregisterclass; update; updateembeddingui; updatemenus; updatetoolbar; updatewindow; widechartomultibyte; window; writeclassstg; writefmtusertypestg; writetofile; writetostorage; writetostream; wsprintf; xformsizeinhimetrictopixels; xformsizeinpixelstohimetric


Cosmo1.0 (Chapter 18)

Click to open or copy the Cosmo1.0 sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _lread; _lwrite; aboutproc; addatom; adjustwindowrect; beginpaint; closeclipboard; closemetafile; copyright; cosmowndproc; createcompatiblebitmap; createcompatibledc; createmetafile; createpen; createsolidbrush; createwindow; createwindowex; defwindowproc; deleteatom; deletedc; deletemetafile; deleteobject; destroywindow; dialogbox; dispatchmessage; docclose; docexecute; docgetobject; docrelease; docsave; docsetcolorscheme; docsetdocdimensions; docsethostnames; documentclean; dptolp; emptyclipboard; enablemenuitem; enddialog; endpaint; fapplicationexit; fapplicationinit; fclassregister; fcleanverify; fcosfileread; fcosfilewrite; fdirtyset; feditcopy; feditcut; feditpaste; ffileexit; ffileinit; ffilenew; ffileopen; ffilesave; ffilesaveas; fkeycreate; folecopylink; folecopynative; foleexit; foleinstanceinit; folereleasewait; foleserverinstall; folevtblinitdocument; folevtblinitobject; folevtblinitserver; freeprocinstance; fregdbinstall; fsaveopendialog; getatomname; getclientrect; getclipboarddata; getdc; getmapmode; getmenu; getmessage; getmodulefilename; getmodulehandle; getopenfilename; getparent; getstockobject; getsyscolor; getwindowlong; getwindowrect; getwindowword; globalalloc; globalfree; globallock; globalunlock; hgetbitmap; hgetmetafilepict; hgetpolyline; hlinkconstruct; hlistparse; hloadappstrings; hpolylinewindowcreate; inflaterect; invalidaterect; isclipboardformatavailable; iswindowvisible; left; lineto; loadaccelerators; loadcursor; loadicon; loadstring; localalloc; localfree; localrealloc; lpolylineusermessage; lptodp; lstrcat; lstrcmp; lstrcpy; lstrlen; makeintresource; makelong; makeprocinstance; menuembeddingset; messagebeep; messagebox; modifymenu; movetoex; objdoverb; objenumformats; objgetdata; objqueryprotocol; objrelease; objsetbounds; objsetcolorscheme; objsetdata; objsettargetdevice; objshow; oleclientnotify; oleregisterserver; oleregisterserverdoc; olerenameserverdoc; olerevokeserver; olerevokeserverdoc; olesavedserverdoc; olevtblfreedocument; olevtblfreeobject; olevtblfreeserver; openclipboard; openfile; pdocrevokeandcreate; pdocumentallocate; peekmessage; pobjectallocate; polylinedraw; polylinewndproc; postmessage; postquitmessage; pserverallocate; pszwhitespacescan; rectangle; rectconverttodevice; rectconverttohimetric; rectstorect; recttorects; regclosekey; regcreatekey; regdeletekey; registerclass; registerclipboardformat; regqueryvalue; regsetvalue; releasedc; right; selectobject; sendmessage; servercreate; servercreatefromtemplate; serveredit; serverexecute; serverexit; serveropen; serverrelease; setclipboarddata; setfocus; setmapmode; setpixel; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; setwindowtext; setwindowword; showwindow; translateaccelerator; translatemessage; updatewindow; waitmessage; warning; window; windowtitleset; wsprintf


Chapter 19

Click to open or copy the files for the Chapter 19 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 19 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Hcosmo (Chapter 19)

Click to open or copy the Hcosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; advise; cfigure; cfigureclassfactory; cimpiadvisesink; cimpioleobject; cimpipersiststorage; cimpiviewobject2; createinstance; createpen; createsolidbrush; createstream; dadvise; deleteinterfaceimp; deleteobject; dllcanunloadnow; dllgetclassobject; doverb; draw; enumadvise; enumverbs; failed; freeze; getadvise; getclassid; getclientsite; getclipboarddata; getcolorset; getconvertstg; getdc; getdevicecaps; getextent; getmiscstatus; getmoniker; getstockobject; getsyscolor; getuserclassid; getusertype; globallock; globalunlock; handsoffstorage; initfromdata; initnew; isdirty; isuptodate; left; libmain; libmain32; lineto; load; lockserver; memcpy; messagebox; movetoex; muldiv; objectdestroyed; olecreatedefaulthandler; oleisrunning; oletext; onclose; ondatachange; onrename; onsave; onviewchange; openstream; pointscale; queryinterface; readclassstg; rectangle; rectfromrectl; rectstorect; registerclipboardformat; release; releasedc; releaseinterface; restoredc; resultfromscode; save; savecompleted; savedc; selectobject; setadvise; setbkcolor; setclientsite; setcolorscheme; setconvertstg; setdefformatetc; setextent; sethostnames; setmoniker; setpixel; stdmethodimp_; succeeded; text; unadvise; unfreeze; unlockdata; update; writeclassstg; writefmtusertypestg


Polyline (Chapter 19)

Click to open or copy the Polyline sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; advise; beginpaint; cconnectionpoint; cenumformatetc; checkradiobutton; choosecolor; cimpiconnptcont; cimpidataobject; cimpioleobject; cimpipersiststorage; cimpipersiststreaminit; cimpipolyline; cimpirunnableobject; cimpiviewobject; clone; closemetafile; colockobjectexternal; colorget; colorset; cpolyline; cpolylineclassfactory; createcompatiblebitmap; createcompatibledc; createdataadviseholder; createdatacache; createdialogparam; createinstance; createmetafile; createoleadviseholder; createpen; createsolidbrush; createstream; createwindowex; cstringtable; dadvise; dataget; dataset; defwindowproc; deletedc; deleteinterfaceimp; deletemetafile; deleteobject; destroywindow; dllcanunloadnow; dllgetclassobject; doverb; draw; dunadvise; endpaint; enumadvise; enumconnectionpoints; enumconnections; enumdadvise; enumformatetc; enumverbs; failed; findconnectionpoint; freeze; getadvise; getcanonicalformatetc; getclassid; getclassinfo; getclientrect; getclientsite; getclipboarddata; getcolorset; getconnectioninterface; getdata; getdatahere; getdc; getdevicecaps; getdlgitem; getextent; getmiscstatus; getmoniker; getparent; getprop; getrunningclass; getsizemax; getstockobject; getsyscolor; getsystemmetrics; getuserclassid; getusertype; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; handsoffstorage; inflaterect; initfromdata; initnew; instance; invalidaterect; isdirty; isrunning; isuptodate; left; libmain; libmain32; linestyleget; linestyleset; lineto; liset32; load; loadcursor; lockrunning; lockserver; lstrcpy; makeintresource; makelp; makepoints; memcpy; memset; messagebeep; messagebox; movetoex; muldiv; next; objectdestroyed; offsetof; offsetrect; oleregenumverbs; olereggetmiscstatus; olereggetusertype; oletext; oncolorchange; onlinestylechange; onpointchange; onshowwindow; onsizechange; onviewchange; openstream; pointscale; polydlgproc; polylinewndproc; postmessage; querygetdata; queryinterface; rectangle; rectconvertmappings; rectfromrectl; rectget; rectset; rectstorect; recttorects; registerclass; registerclipboardformat; release; releasedc; releaseinterface; releasestgmedium; removeprop; renderbitmap; rendermetafilepict; rendernative; reset; restoredc; resultfromscode; run; save; savecompleted; savedc; saveobject; screentoclient; seek; selectobject; selectorof; sendadvise; sendcommand; sendonclose; sendonsave; setadvise; setbkcolor; setclientsite; setcolorscheme; setcontainedobject; setdata; setextent; setfocus; sethostnames; setmapmode; setmoniker; setpixel; setpoint; setprop; setrect; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; setwindowtext; showobject; showwindow; sizeget; sizeset; skip; stdmethodimp_; string; text; top; uliset32; unadvise; undo; unfreeze; unlockdata; update; updatewindow; widechartomultibyte; window; writefmtusertypestg; wsprintf


Chapter 20

Click to open or copy the files for the Chapter 20 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 20 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Lnkassis (Chapter 20)

Click to open or copy the Lnkassis sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addref; bindtoobject; cancellink; cchfileprefix; clinks; clinksclassfactory; cotaskmemalloc; cotaskmemfree; createbindctx; createfilemoniker; creategenericcomposite; createinstance; createitemmoniker; createnewsourcemoniker; dllcanunloadnow; dllgetclassobject; enum; failed; getdisplayname; getlinksource; getlinkupdateoptions; getnextlink; getsourcedisplayname; getsourcemoniker; getupdateoptions; getuserclassid; getusertype; issystemmoniker; isuptodate; libmain; libmain32; lockserver; lstrcpy; lstrcpyn; lstrlen; mkparsedisplayname; multibytetowidechar; next; objectdestroyed; openlinksource; queryinterface; release; resultfromscode; setlinksource; setlinkupdateoptions; setsourcedisplayname; setsourcemoniker; setupdateoptions; stdmethodimp_; succeeded; text; unlockdata; update; updatelink; validatelinksource; wcslen; widechartomultibyte


Patron (Chapter 20)

Click to open or copy the Patron sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

abortdoc; abortproc; activate; activateobject; activedocument; activepage; addref; addverbmenu; adjustposition; advise; alloc; ansiupper; appendmenu; beginpaint; bindifrunning; bottom; bringwindowtotop; cache; calcboundingrect; cancellink; cb; cbdevmode; cchdevicename; cchdevicename; cclient; cdocument; cdropsource; cdroptarget; cframe; checkmenuitem; cimpiadvisesink; cimpioleclientsite; cioleuilinkcontainer; clear; clienttoscreen; clip; cocreateinstance; cofreeunusedlibraries; cogetclassobject; cogetmalloc; colockobjectexternal; commandparams; commit; configurefordevice; convertobject; converttostatic; copyembeddedobject; copyto; cotaskmemfree; cotreatasclass; cpage; cpages; cpages; cpatronclient; cpatrondoc; cpatronframe; create; createcclient; createcdocument; createdatacache; createdialog; createfilemoniker; createfont; createic; createpen; createpopupmenu; createsolidbrush; createstatic; createstorage; createstream; createtoolbar; createwindow; createwindowex; ctenant; ctenants; curpageget; curpageset; cwindow; defwindowproc; delete; deletedc; deletefile; deleteinterfaceimp; deleteobject; deletepage; destroy; destroyelement; destroymenu; destroywindow; devmodeget; devmodeset; devreadconfig; dispatchmessage; dodragdrop; doverb; dptolp; dragdrop; dragenter; dragleave; dragover; draw; drawdroptargetrect; drawfocusrect; drop; editlinks; enable; enablemenuitem; enablerepaint; enablewindow; enddoc; endpage; endpaint; equalrect; escape; exttextout; failed; fdirtyget; fdirtyset; filenameget; firstpage; fisdirty; fisselected; fmessagehook; formatetcget; fqueryenableeditlinks; fquerylinksinpage; fqueryobjectselected; fquerypaste; fquerypastefromdata; fquerypastelinkfromdata; fqueryprintersetup; frameget; free; getclassid; getclientrect; getcontainer; getcursorpos; getdata; getdc; getdevicecaps; getdlgitem; getdlgitemtext; getextent; getfiletitle; getid; getinfo; getlinksource; getlinkupdateoptions; getmenuitemcount; getmenuitemid; getmenustring; getmiscstatus; getmoniker; getnextlink; getobjectinterface; getparent; getprofileint; getscode; getscrollpos; getscrollrange; getsourcemoniker; getstockobject; getstoragename; getsubmenu; getsyscolor; getsystemmenu; getsystemmetrics; gettextextentpoint; gettickcount; getuilinkcontainer; getupdateoptions; getuserclassid; getwindowinstance; getwindowlong; getwindowrect; givefeedback; globalalloc; globalfree; globallock; globalsize; globalunlock; initnew; inole_copystring; inole_doconvert; inole_getusertypeofclass; inole_metafilepicticonfree; inole_seticonincache; inole_switchdisplayaspect; insertobject; intersectrect; invalidate; invalidaterect; ipage; isdialogmessage; isdirty; isrectempty; killtimer; lastpage; lineto; liset32; load; loadcursor; loadmenu; loadstring; lockserver; lptodp; lstrcmpi; lstrcpy; makeintresource; max; memcpy; memset; menuselectparams; messagebeep; messagebox; messagedisplay; messageloop; min; movetoex; muldiv; multibytetowidechar; newpage; nextpage; notifyofrename; notifytenantsofrename; numpagesget; objectclassformatandicon; objectget; objectinitialize; offsetrect; olecreate; olecreatefromdata; olecreatefromfile; olecreatelinkfromdata; olecreatelinktofile; oledraw; oleflushclipboard; olegetclipboard; olegeticonofclass; oleinitialize; oleisrunning; oleload; olequerycreatefromdata; olequerylinkfromdata; olerun; olesave; olesetclipboard; olesetcontainedobject; oletext; oleuiaddverbmenu; oleuiconvert; oleuieditlinks; oleuiinsertobject; oleuipastespecial; oleuipromptuser; oleuiupdatelinks; oleuninitialize; onclose; oncommand; ondatachange; onleftdoubleclick; onleftdown; onleftup; onmousemove; onnchittest; onrename; onrightdown; onsave; onsetcursor; onshowwindow; ontimer; onviewchange; open; openlinksource; openstorage; openstream; pageadd; pagedelete; pageget; pageinsert; pageswndproc; paste; pastefromdata; pastespecial; peekmessage; pointfrompointl; pointlfrompoint; previouspage; print; printdlg; printdlghook; printdlgproc; printersetup; ptinrect; querycontinuedrag; querygetdata; queryinterface; readclassstg; readfmtusertypestg; rectangle; rectconvertmappings; rectfromrectl; rectget; rectlfromrect; rectset; registerallclasses; registerclass; registerclipboardformat; registerdragdrop; release; releasecapture; releasedc; releaseinterface; releasestgmedium; remove; rename; repaint; requestnewobjectlayout; resultfromscode; revokedragdrop; right; save; savecompleted; saveobject; screentoclient; scrollthumbposition; scrollwindow; seek; select; selectobject; selecttenantatpoint; sendmessage; sendscrollposition; setabortproc; setadvise; setbkcolor; setcapture; setclientsite; setcursor; setdata; setdefformatetc; setdlgitemtext; setextent; setfocus; setformatetc; sethostnames; setlinksource; setlinkupdateoptions; setmapmode; setmoniker; setpoint; setpointl; setrect; setrectl; setscrollpos; setscrollrange; setsizel; settextcolor; settimer; setupdateoptions; setwindowlong; setwindowpos; showasopen; showobject; showobjecttype; showobjecttypes; showorqueryobjecttypes; showwindow; showyourself; sizeget; sizeset; startdoc; startpage; startsizetracking; stdmethodimp_; stgcreatedocfile; stgopenstorage; storageget; storageset; storageupdate; succeeded; switchorupdateaspect; switchtofile; tenantadd; tenantclip; tenantcreate; tenantdestroy; tenantfrompoint; tenantget; text; textout; top; top-m_cy-; trackpopupmenu; transferobjectcreate; translatemessage; typeget; uicursorload; uidrawhandles; uidrawshading; uishowobject; update; updatelink; updatemenus; updatescrollranges; updatetoolbar; updatewindow; utestdroppablepoint; window; writeclassstg; writefmtusertypestg; wsprintf; xformrectinpixelstohimetric; xformsizeinhimetrictopixels; xformsizeinpixelstohimetric; xhit


Chapter 21

Click to open or copy the files for the Chapter 21 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 21 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Cosmo (Chapter 21)

Click to open or copy the Cosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; activedocument; addref; adjustwindowrect; advise; alloc; beginpaint; bringwindowtotop; cchpathmax; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cdropsource; cdroptarget; cfigure; cfigureclassfactory; cframe; check; checklineselection; checkmenuitem; choosecolor; cimpidataobject; cimpioleobject; cimpipersistfile; cimpipersiststorage; clear; clip; closedocument; closemetafile; cocreateinstance; codisconnectobject; cogetclassobject; cogetmalloc; colockobjectexternal; colorget; colorset; commandparams; coregisterclassobject; corevokeclassobject; cotaskmemalloc; cotaskmemfree; cpolyline; cpolylineadvisesink; createbindctx; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createdataadviseholder; createfilemoniker; createinstance; createlinemenu; createmetafile; createoleadviseholder; createpen; createsolidbrush; createstream; createtoolbar; createwindowex; cstringtable; cwindow; dadvise; dataget; datagetmem; dataset; datasetmem; defwindowproc; deletedc; deleteinterfaceimp; deletemenu; deletemetafile; deleteobject; destroyelement; dodragdrop; doverb; dptolp; dragenter; dragleave; dragover; draw; drawmenubar; drop; dropselecttargetwindow; dunadvise; enable; enablemenuitem; endpaint; enumadvise; enumdadvise; enumformatetc; enumverbs; errormessage; failed; fdirtyget; fdirtyset; filenameget; fisdirty; fisembedded; fmessagehook; fquerypaste; fquerypastefromdata; frameset; getcanonicalformatetc; getclassid; getclassinfo; getclientrect; getclientsite; getclipboarddata; getconvertstg; getcurfile; getdata; getdatahere; getdc; getdevicecaps; getdisplayname; getextent; getmapmode; getmenu; getmiscstatus; getmoniker; getparent; getscode; getstockobject; getsubmenu; getsyscolor; gettextmetrics; getuserclassid; getusertype; getwindowdc; getwindowlong; getwindowrect; givefeedback; globalalloc; globalfree; globallock; globalunlock; handsoffstorage; inflaterect; initfromdata; initnew; inole_createstorageonhglobal; inole_getlinksourcedata; inole_notechangetime; inole_registerasrunning; inole_revokeasrunning; insertmenu; invalidaterect; isdirty; isrunning; isuptodate; iswindow; linestyleget; linestyleset; lineto; liset32; load; loadcursor; lockserver; lstrcmpi; lstrcpy; makelong; makepoints; memset; messagebeep; messagebox; messageloop; modifymenu; movetoex; muldiv; multibytetowidechar; newdocument; objectdestroyed; offsetrect; oleflushclipboard; olegetclipboard; oleinitialize; olesetclipboard; oletext; oleuninitialize; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onlinestylechange; onpointchange; onshowwindow; onsizechange; openfile; openfilew; openstream; parsecommandline; paste; pastefromdata; patblt; pointscale; polylinewndproc; postmessage; preshowinit; querycontinuedrag; querygetdata; queryinterface; readclassstg; readfromfile; readfromstorage; readfromstream; rectangle; rectconvertmappings; rectget; rectset; rectstorect; recttorects; registerallclasses; registerclass; registerclipboardformat; registerdragdrop; release; releasedc; releaseinterface; releasestgmedium; rename; renderbitmap; renderformat; rendermedium; rendermetafile; rendermetafilepict; resultfromscode; revokedragdrop; save; savecompleted; saveobject; saveopendialog; screentoclient; seek; selectobject; sendadvise; sendonclose; sendonrename; sendonsave; setbkcolor; setclientsite; setcolorscheme; setconvertstg; setdata; setdefformatetc; setextent; setfocus; setforegroundwindow; sethostnames; setmapmode; setmoniker; setpixel; setpointl; setrect; setsizel; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; setwindowtext; show; showobject; showwindow; sizeget; sizeset; stdmethodimp_; stgcreatedocfile; stgisstoragefile; stgopenstorage; succeeded; text; top; transferobjectcreate; unadvise; undo; unicodetoansi; unregisterclass; update; updateembeddingui; updatemenus; updatetoolbar; updatewindow; widechartomultibyte; window; writeclassstg; writefmtusertypestg; writetofile; writetostorage; writetostream; wsprintf; xformsizeinhimetrictopixels; xformsizeinpixelstohimetric


Patron (Chapter 21)

Click to open or copy the Patron sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_tcsncicmp; _ttoi; abortdoc; abortproc; activate; activateobject; activedocument; activepage; addref; addverbmenu; adjustposition; advise; alloc; ansiupper; appendmenu; atol; beginpaint; bindifrunning; bottom; bringwindowtotop; cache; calcboundingrect; cancellink; cb; cbdevmode; cchdevicename; cchpathmax; cclient; cdocument; cdropsource; cdroptarget; cframe; checkmenuitem; cimpiadvisesink; cimpioleclientsite; cimpioleitemcontainer; cimpipersistfile; cioleuilinkcontainer; clear; clienttoscreen; clinkclassfactory; clip; closedocument; cocreateinstance; cofreeunusedlibraries; cogetclassobject; cogetmalloc; colockobjectexternal; commandparams; commit; composewith; configurefordevice; convertobject; converttostatic; copyembeddedobject; copylinkedobject; copyto; coregisterclassobject; corevokeclassobject; cotaskmemalloc; cotaskmemfree; cotreatasclass; cpage; cpages; cpages; cpatronclient; cpatrondoc; cpatronframe; create; createbindctx; createcclient; createcdocument; createdatacache; createdialog; createfilemoniker; createfont; createic; createinstance; createitemmoniker; createpen; createpopupmenu; createsolidbrush; createstatic; createstorage; createstream; createtoolbar; createwindow; createwindowex; ctenant; ctenants; curpageget; curpageset; cwindow; defwindowproc; delete; deletedc; deletefile; deleteinterfaceimp; deleteobject; deletepage; destroy; destroyelement; destroymenu; destroywindow; devmodeget; devmodeset; devreadconfig; dispatchmessage; dodragdrop; doverb; dptolp; dragdrop; dragenter; dragleave; dragover; draw; drawdroptargetrect; drawfocusrect; drop; editlinks; enable; enablemenuitem; enablerepaint; enablewindow; enddoc; endpage; endpaint; enumobjects; equalrect; escape; exttextout; failed; fdirtyget; fdirtyset; filenameget; firstpage; fisdirty; fisselected; fmessagehook; formatetcget; fqueryenableeditlinks; fquerylinksinpage; fqueryobjectselected; fquerypaste; fquerypastefromdata; fquerypastelinkfromdata; fqueryprintersetup; frameget; free; getclassid; getclientrect; getcontainer; getcurfile; getcursorpos; getdata; getdc; getdevicecaps; getdisplayname; getdlgitem; getdlgitemtext; getextent; getfiletitle; getid; getinfo; getlinksource; getlinkupdateoptions; getmenuitemcount; getmenuitemid; getmenustring; getmiscstatus; getmoniker; getnextlink; getobject; getobjectinterface; getobjectstorage; getparent; getprofileint; getscode; getscrollpos; getscrollrange; getsourcemoniker; getstockobject; getstoragename; getsubmenu; getsyscolor; getsystemmenu; getsystemmetrics; gettextextentpoint; gettickcount; getuilinkcontainer; getupdateoptions; getuserclassid; getwindowinstance; getwindowlong; getwindowrect; givefeedback; globalalloc; globalfree; globallock; globalsize; globalunlock; initnew; inole_copystring; inole_createitemmoniker; inole_doconvert; inole_getlinksourcedata; inole_getusertypeofclass; inole_metafilepicticonfree; inole_notechangetime; inole_registerasrunning; inole_revokeasrunning; inole_seticonincache; inole_switchdisplayaspect; insertobject; intersectrect; invalidate; invalidaterect; ipage; ipagegetfromid; isdialogmessage; isdirty; isrectempty; isrunning; iswindow; killtimer; lastpage; left; lineto; liset32; load; loadcursor; loadmenu; loadstring; lockcontainer; lockserver; lptodp; lstrcmpi; lstrcpy; lstrlen; makeintresource; max; memcpy; memset; menuselectparams; messagebeep; messagebox; messagedisplay; messageloop; min; movetoex; muldiv; multibytetowidechar; newdocument; newpage; nextpage; notifyofrename; notifytenantsofrename; numpagesget; objectclassformatandicon; objectdestroyed; objectget; objectinitialize; offsetrect; olecreate; olecreatefromdata; olecreatefromfile; olecreatelinkfromdata; olecreatelinktofile; oledraw; oleflushclipboard; olegetclipboard; olegeticonofclass; oleinitialize; oleisrunning; oleload; olequerycreatefromdata; olequerylinkfromdata; olerun; olesave; olesetclipboard; olesetcontainedobject; oletext; oleuiaddverbmenu; oleuiconvert; oleuieditlinks; oleuiinsertobject; oleuipastespecial; oleuipromptuser; oleuiupdatelinks; oleuninitialize; onclose; oncommand; ondatachange; onleftdoubleclick; onleftdown; onleftup; onmousemove; onnchittest; onrename; onrightdown; onsave; onsetcursor; onshowwindow; ontimer; onviewchange; open; openlinksource; openstorage; openstream; pageadd; pagedelete; pageget; pageinsert; pageswndproc; parsecommandline; parsedisplayname; paste; pastefromdata; pastespecial; peekmessage; pointfrompointl; pointlfrompoint; postmessage; preshowinit; previouspage; print; printdlg; printdlghook; printdlgproc; printersetup; ptinrect; querycontinuedrag; querygetdata; queryinterface; readclassstg; readfmtusertypestg; rectangle; rectconvertmappings; rectfromrectl; rectget; rectlfromrect; rectset; registerallclasses; registerclass; registerclipboardformat; registerdragdrop; release; releasecapture; releasedc; releaseinterface; releasestgmedium; remove; rename; repaint; requestnewobjectlayout; resultfromscode; revokedragdrop; right; save; savecompleted; saveobject; screentoclient; scrollthumbposition; scrollwindow; seek; select; selectobject; selecttenantatpoint; sendmessage; sendscrollposition; setabortproc; setadvise; setbkcolor; setcapture; setclientsite; setcursor; setdata; setdefformatetc; setdlgitemtext; setextent; setfocus; setformatetc; sethostnames; setlinksource; setlinkupdateoptions; setmapmode; setmoniker; setpoint; setpointl; setrect; setrectl; setscrollpos; setscrollrange; setsizel; settextcolor; settimer; setupdateoptions; setwindowlong; setwindowpos; showasopen; showobject; showobjecttype; showobjecttypes; showorqueryobjecttypes; showwindow; showyourself; sizeget; sizeset; startdoc; startpage; startsizetracking; stdmethodimp_; stgcreatedocfile; stgopenstorage; storageget; storageset; storageupdate; succeeded; switchorupdateaspect; switchtofile; tenantadd; tenantclip; tenantcreate; tenantdestroy; tenantfromname; tenantfrompoint; tenantget; tenantgetfromid; text; textout; top; trackpopupmenu; transferobjectcreate; translatemessage; typeget; uicursorload; uidrawhandles; uidrawshading; uishowobject; unicodetoansi; update; updatelink; updatemenus; updatescrollranges; updatetoolbar; updatewindow; utestdroppablepoint; widechartomultibyte; window; writeclassstg; writefmtusertypestg; wsprintf; xformrectinpixelstohimetric; xformsizeinhimetrictopixels; xformsizeinpixelstohimetric; xhit


Polyline (Chapter 21)

Click to open or copy the Polyline sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addconnection; addref; advise; beginpaint; cconnectionpoint; cenumformatetc; checkradiobutton; choosecolor; cimpiconnptcont; cimpidataobject; cimpiexternalconnection; cimpioleobject; cimpipersiststorage; cimpipersiststreaminit; cimpipolyline; cimpirunnableobject; cimpiviewobject; clone; closemetafile; colockobjectexternal; colorget; colorset; cpolyline; cpolylineclassfactory; createcompatiblebitmap; createcompatibledc; createdataadviseholder; createdatacache; createdialogparam; createinstance; createmetafile; createoleadviseholder; createpen; createsolidbrush; createstream; createwindowex; cstringtable; dadvise; dataget; dataset; defwindowproc; deletedc; deleteinterfaceimp; deletemetafile; deleteobject; destroywindow; dllcanunloadnow; dllgetclassobject; doverb; draw; dunadvise; endpaint; enumadvise; enumconnectionpoints; enumconnections; enumdadvise; enumformatetc; enumverbs; failed; findconnectionpoint; freeze; getadvise; getcanonicalformatetc; getclassid; getclassinfo; getclientrect; getclientsite; getclipboarddata; getcolorset; getconnectioninterface; getcontainer; getdata; getdatahere; getdc; getdevicecaps; getdlgitem; getextent; getmiscstatus; getmoniker; getparent; getprop; getrunningclass; getsizemax; getstockobject; getsyscolor; getsystemmetrics; getuserclassid; getusertype; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; handsoffstorage; inflaterect; initfromdata; initnew; inole_registerasrunning; inole_revokeasrunning; instance; invalidaterect; isdirty; isrunning; isuptodate; libmain; libmain32; linestyleget; linestyleset; lineto; liset32; load; loadcursor; lockcontainer; lockrunning; lockserver; lstrcpy; makeintresource; makelp; makepoints; memcpy; memset; messagebeep; messagebox; movetoex; muldiv; next; objectdestroyed; offsetof; offsetrect; oleregenumverbs; olereggetmiscstatus; olereggetusertype; oletext; oncolorchange; onlinestylechange; onpointchange; onshowwindow; onsizechange; onviewchange; openstream; pointscale; polydlgproc; polylinewndproc; postmessage; querygetdata; queryinterface; rectangle; rectconvertmappings; rectfromrectl; rectget; rectset; rectstorect; recttorects; registerclass; registerclipboardformat; release; releaseconnection; releasedc; releaseinterface; releasestgmedium; removeprop; renderbitmap; rendermetafilepict; rendernative; reset; restoredc; resultfromscode; run; save; savecompleted; savedc; saveobject; screentoclient; seek; selectobject; selectorof; sendadvise; sendcommand; sendonclose; sendonrename; sendonsave; setadvise; setbkcolor; setclientsite; setcolorscheme; setcontainedobject; setdata; setextent; setfocus; sethostnames; setmapmode; setmoniker; setpixel; setpoint; setprop; setrect; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; setwindowtext; showobject; showwindow; sizeget; sizeset; skip; stdmethodimp_; string; succeeded; text; uliset32; unadvise; undo; unfreeze; unlockdata; update; updatewindow; widechartomultibyte; window; writefmtusertypestg; wsprintf


Chapter 22

Click to open or copy the files for the Chapter 22 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 22 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Patron (Chapter 22)

Click to open or copy the Patron sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_tcsncicmp; _ttoi; abortdoc; abortproc; activate; activateobject; activedocument; activepage; addref; addverbmenu; adjustposition; advise; alloc; ansiupper; appendmenu; atol; beginpaint; bindifrunning; bottom; bringwindowtotop; cache; calcboundingrect; callcontexthelpondocuments; cancellink; caninplaceactivate; cbdevmode; cchdevicename; cchpathmax; cclient; cdocument; cdropsource; cdroptarget; cframe; checkmenuitem; cimpiadvisesink; cimpioleclientsite; cimpioleinplacesite; cimpioleinplaceuiwindow; cimpioleitemcontainer; cimpipersistfile; cioleuilinkcontainer; clear; clienttoscreen; clinkclassfactory; clip; closedocument; cocreateinstance; cofreeunusedlibraries; cogetclassobject; cogetmalloc; colockobjectexternal; commandparams; commit; composewith; configurefordevice; contextsensitivehelp; convertobject; converttostatic; copyembeddedobject; copylinkedobject; copyto; coregisterclassobject; corevokeclassobject; cotaskmemalloc; cotaskmemfree; cotreatasclass; cpage; cpages; cpages; cpatronclient; cpatrondoc; cpatronframe; create; createbindctx; createcclient; createcdocument; createdatacache; createdialog; createfilemoniker; createfont; createic; createinstance; createitemmoniker; createpen; createpopupmenu; createsolidbrush; createstatic; createstorage; createstream; createtoolbar; createwindow; createwindowex; ctenant; ctenants; curpageget; curpageset; cwindow; deactivateandundo; deactivateinplaceobject; defwindowproc; delete; deletedc; deletefile; deleteinterfaceimp; deleteobject; deletepage; destroy; destroyelement; destroymenu; destroywindow; devmodeget; devmodeset; devreadconfig; discardundostate; dispatchmessage; dodragdrop; doverb; dptolp; dragdrop; dragenter; dragleave; dragover; draw; drawdroptargetrect; drawfocusrect; drawmenubar; drop; editlinks; enable; enablemenuitem; enablemodeless; enablerepaint; enablewindow; enddoc; endpage; endpaint; enumobjects; equalrect; escape; exttextout; failed; fdirtyget; fdirtyset; filenameget; firstpage; fisdirty; fisselected; fmessagehook; formatetcget; fqueryenableeditlinks; fquerylinksinpage; fqueryobjectselected; fquerypaste; fquerypastefromdata; fquerypastelinkfromdata; fqueryprintersetup; frameget; free; getborder; getclassid; getclientrect; getcontainer; getcurfile; getcursorpos; getdata; getdc; getdevicecaps; getdisplayname; getdlgitem; getdlgitemtext; getextent; getfiletitle; getid; getinfo; getlinksource; getlinkupdateoptions; getmenu; getmenuitemcount; getmenuitemid; getmenustring; getmessage; getmessagepos; getmessagetime; getmiscstatus; getmoniker; getnextlink; getobject; getobjectinterface; getobjectstorage; getparent; getprofileint; getscode; getscrollpos; getscrollrange; getsourcemoniker; getstockobject; getstoragename; getsubmenu; getsyscolor; getsystemmenu; getsystemmetrics; gettextextentpoint; gettickcount; getuilinkcontainer; getupdateoptions; getuserclassid; getwindow; getwindowcontext; getwindowinstance; getwindowlong; getwindowrect; givefeedback; globalalloc; globalfree; globallock; globalsize; globalunlock; initnew; inole_copystring; inole_createitemmoniker; inole_doconvert; inole_getlinksourcedata; inole_getusertypeofclass; inole_metafilepicticonfree; inole_notechangetime; inole_registerasrunning; inole_revokeasrunning; inole_seticonincache; inole_switchdisplayaspect; inplacedeactivate; insertmenu; insertmenus; insertobject; intersectrect; invalidate; invalidaterect; ipage; ipagegetfromid; isdialogmessage; isdirty; isrectempty; isrunning; iswindow; iszoomed; killtimer; lastpage; left; lineto; liset32; load; loadaccelerators; loadcursor; loadmenu; loadstring; lockcontainer; lockserver; lptodp; lstrcmpi; lstrcpy; lstrlen; makeintresource; makelong; max; mdirefreshmenu; mdisetmenu; memcpy; memset; menuselectparams; messagebeep; messagebox; messagedisplay; messageloop; messageset; min; movetoex; movewithoutfamily; muldiv; multibytetowidechar; newdocument; newpage; nextpage; noobjectframetools; notifyofrename; notifytenantsofrename; numpagesget; objectclassformatandicon; objectdestroyed; objectget; objectinitialize; objectwindow; offsetrect; olecreate; olecreatefromdata; olecreatefromfile; olecreatelinkfromdata; olecreatelinktofile; oledraw; oleflushclipboard; olegetclipboard; olegeticonofclass; oleinitialize; oleisrunning; oleload; olequerycreatefromdata; olequerylinkfromdata; olerun; olesave; olesetclipboard; olesetcontainedobject; olesetmenudescriptor; oletext; oleuiaddverbmenu; oleuiconvert; oleuieditlinks; oleuiinsertobject; oleuipastespecial; oleuipromptuser; oleuiupdatelinks; oleuninitialize; onclose; oncommand; ondatachange; ondocwindowactivate; oninplaceactivate; oninplacedeactivate; onleftdoubleclick; onleftdown; onleftup; onmousemove; onnchittest; onposrectchange; onrename; onrightdown; onsave; onsetcursor; onshowwindow; onsize; ontimer; onuiactivate; onuideactivate; onviewchange; open; openlinksource; openstorage; openstream; pageadd; pagedelete; pageget; pageinsert; pageswndproc; parsecommandline; parsedisplayname; paste; pastefromdata; pastespecial; peekmessage; pointfrompointl; pointlfrompoint; postmessage; preshowinit; previouspage; print; printdlg; printdlghook; printdlgproc; printersetup; ptinrect; querycontinuedrag; querygetdata; queryinterface; readclassstg; readfmtusertypestg; rectangle; rectconvertmappings; rectfromrectl; rectget; rectlfromrect; rectset; registerallclasses; registerclass; registerclipboardformat; registerdragdrop; reinstateui; release; releasecapture; releasedc; releaseinterface; releasestgmedium; remove; removemenu; removemenus; rename; repaint; requestborderspace; requestnewobjectlayout; resizeborder; resultfromscode; revokedragdrop; right; save; savecompleted; saveobject; screentoclient; scroll; scrolledwindow; scrollthumbposition; scrollwindow; seek; select; selectobject; selecttenantatpoint; sendmessage; sendscrollposition; setabortproc; setactiveobject; setadvise; setbkcolor; setborderspace; setcapture; setclientsite; setcursor; setdata; setdefformatetc; setdlgitemtext; setextent; setfocus; setformatetc; sethostnames; setlinksource; setlinkupdateoptions; setmapmode; setmenu; setmoniker; setobjectrects; setpoint; setpointl; setrect; setrectl; setscrollpos; setscrollrange; setsizel; setstatustext; settextcolor; settimer; setupdateoptions; setwindowlong; setwindowpos; showasopen; showobject; showobjecttype; showobjecttypes; showorqueryobjecttypes; showuiandtools; showwindow; showyourself; sizeget; sizeset; startdoc; startpage; startsizetracking; stdmethodimp_; stgcreatedocfile; stgopenstorage; storageget; storageset; storageupdate; succeeded; switchactivetenant; switchorupdateaspect; switchtofile; tenantadd; tenantclip; tenantcreate; tenantdestroy; tenantfromname; tenantfrompoint; tenantget; tenantgetfromid; text; textout; trackpopupmenu; transferobjectcreate; translateaccelerator; translatemdisysaccel; translatemessage; typeget; uicursorload; uideactivate; uidrawhandles; uidrawshading; uishowobject; unicodetoansi; update; updateinplaceobjectrects; updatelink; updatemenus; updatescrollranges; updatetoolbar; updatewindow; utestdroppablepoint; widechartomultibyte; window; writeclassstg; writefmtusertypestg; wsprintf; xformrectinpixelstohimetric; xformsizeinhimetrictopixels; xformsizeinpixelstohimetric


Chapter 23

Click to open or copy the files for the Chapter 23 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 23 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Cosmo (Chapter 23)

Click to open or copy the Cosmo sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; activedocument; addref; adjustwindowrect; advise; alloc; appendmenu; beginpaint; bringwindowtotop; caninplaceactivate; cchpathmax; cclient; ccosmoclient; ccosmodoc; ccosmoframe; cdocument; cdropsource; cdroptarget; cfigure; cfigureclassfactory; cframe; chatchwin; check; checklineselection; checkmenuitem; childset; choosecolor; cimpidataobject; cimpioleinplaceactiveobject; cimpioleinplaceobject; cimpioleobject; cimpipersistfile; cimpipersiststorage; clear; clip; closedocument; closemetafile; cocreateinstance; codisconnectobject; cogetclassobject; cogetmalloc; colockobjectexternal; colorget; colorset; commandparams; contextsensitivehelp; coregisterclassobject; corevokeclassobject; cotaskmemalloc; cotaskmemfree; cpolyline; cpolylineadvisesink; createbindctx; createcclient; createcdocument; createcompatiblebitmap; createcompatibledc; createdataadviseholder; createfilemoniker; createinstance; createlinemenu; createmenu; createmetafile; createoleadviseholder; createpen; createsolidbrush; createstream; createtoolbar; createwindowex; cstringtable; ctoolbar; cwindow; dadvise; dataget; datagetmem; dataset; datasetmem; deactivateandundo; defwindowproc; deletedc; deleteinterfaceimp; deletemenu; deletemetafile; deleteobject; destroyelement; destroymenu; discardundostate; dispatchmessage; dodragdrop; doverb; dptolp; dragenter; dragleave; dragover; draw; drawmenubar; drop; dropselecttargetwindow; dunadvise; enable; enablemenuitem; enablemodeless; endpaint; enumadvise; enumdadvise; enumformatetc; enumverbs; errormessage; failed; fdirtyget; fdirtyset; filenameget; fisdirty; fisembedded; fmessagehook; fquerypaste; fquerypastefromdata; frameset; getborder; getcanonicalformatetc; getclassid; getclassinfo; getclientrect; getclientsite; getclipboarddata; getconvertstg; getcurfile; getdata; getdatahere; getdc; getdevicecaps; getdisplayname; getextent; getmapmode; getmenu; getmenuitemcount; getmessage; getmiscstatus; getmoniker; getparent; getscode; getstockobject; getsubmenu; getsyscolor; gettextmetrics; getuserclassid; getusertype; getwindow; getwindowcontext; getwindowdc; getwindowlong; getwindowrect; givefeedback; globalalloc; globalfree; globallock; globalunlock; handsoffstorage; hatchwindowregister; hwndassociateset; inflaterect; initfromdata; initnew; inole_createstorageonhglobal; inole_getlinksourcedata; inole_notechangetime; inole_registerasrunning; inole_revokeasrunning; inplaceactivate; inplacedeactivate; inplacemenucreate; inplacemenudestroy; inplacetoolscreate; inplacetoolsdestroy; inplacetoolsrenegotiate; insertmenu; insertmenus; invalidaterect; isdirty; isrunning; isuptodate; iswindow; linestyleget; linestyleset; lineto; liset32; load; loadcursor; lockserver; lstrcmpi; lstrcpy; makelong; makepoints; memset; menuselect; messagebeep; messagebox; messageget; messageloop; modifymenu; movetoex; muldiv; multibytetowidechar; newdocument; objectdestroyed; offsetrect; olecreatemenudescriptor; oledestroymenudescriptor; oleflushclipboard; olegetclipboard; oleinitialize; olesetclipboard; oletext; oletranslateaccelerator; oleuninitialize; oncolorchange; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; ondocwindowactivate; onframewindowactivate; oninplaceactivate; oninplacedeactivate; onlinestylechange; onpointchange; onshowwindow; onsizechange; onuiactivate; onuideactivate; openfile; openfilew; openinplaceobject; openintowindow; openstream; parsecommandline; paste; pastefromdata; patblt; pointscale; polylinewndproc; postmessage; preshowinit; querycontinuedrag; querygetdata; queryinterface; reactivateandundo; readclassstg; readfromfile; readfromstorage; readfromstream; rectangle; rectconvertmappings; rectget; rectset; rectsset; rectstorect; recttorects; registerallclasses; registerclass; registerclipboardformat; registerdragdrop; release; releasedc; releaseinterface; releasestgmedium; removemenu; removemenus; rename; renderbitmap; renderformat; rendermedium; rendermetafile; rendermetafilepict; requestborderspace; resizeborder; resultfromscode; revokedragdrop; save; savecompleted; saveobject; saveopendialog; screentoclient; seek; selectobject; sendadvise; sendonclose; sendonrename; sendonsave; setactiveobject; setbkcolor; setborderspace; setclientsite; setcolorscheme; setconvertstg; setdata; setdefformatetc; setextent; setfocus; setforegroundwindow; sethostnames; setmapmode; setmenu; setmoniker; setobjectrects; setparent; setpixel; setpointl; setrect; setrectempty; setsizel; setstatustext; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; setwindowtext; show; showobject; showwindow; sizeget; sizeset; stdmethodimp_; stgcreatedocfile; stgisstoragefile; stgopenstorage; succeeded; text; top; transferobjectcreate; translateaccelerator; translatemessage; uiactivate; uideactivate; unadvise; undo; unicodetoansi; unregisterclass; update; updateembeddingui; updatemenus; updatetoolbar; updatewindow; widechartomultibyte; window; writeclassstg; writefmtusertypestg; writetofile; writetostorage; writetostream; wsprintf; xformsizeinhimetrictopixels; xformsizeinpixelstohimetric


Polyline (Chapter 23)

Click to open or copy the Polyline sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

addconnection; addref; advise; beginpaint; calcpolyrectindialog; caninplaceactivate; cconnectionpoint; cenumformatetc; chatchwin; checkradiobutton; childset; choosecolor; cimpiconnptcont; cimpidataobject; cimpiexternalconnection; cimpioleinplaceactiveobject; cimpioleinplaceobject; cimpioleobject; cimpipersiststorage; cimpipersiststreaminit; cimpipolyline; cimpirunnableobject; cimpiviewobject; clone; closemetafile; colockobjectexternal; colorget; colorset; commandparams; contextsensitivehelp; cpolyline; cpolylineclassfactory; createcompatiblebitmap; createcompatibledc; createdataadviseholder; createdatacache; createdialogparam; createinstance; createmetafile; createoleadviseholder; createpen; createsolidbrush; createstream; createwindowex; cstringtable; dadvise; dataget; dataset; defwindowproc; deletedc; deleteinterfaceimp; deletemetafile; deleteobject; destroywindow; discardundostate; dllcanunloadnow; dllgetclassobject; doverb; draw; dunadvise; enablemodeless; endpaint; enumadvise; enumconnectionpoints; enumconnections; enumdadvise; enumformatetc; enumverbs; failed; findconnectionpoint; freeze; getadvise; getcanonicalformatetc; getclassid; getclassinfo; getclientrect; getclientsite; getclipboarddata; getcolorset; getconnectioninterface; getcontainer; getdata; getdatahere; getdc; getdevicecaps; getdlgitem; getextent; getmiscstatus; getmoniker; getparent; getprop; getrunningclass; getsizemax; getstockobject; getsyscolor; getsystemmetrics; getuserclassid; getusertype; getwindow; getwindowcontext; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; handsoffstorage; hatchwindowregister; hwndassociateset; inflaterect; initfromdata; initnew; inole_registerasrunning; inole_revokeasrunning; inplaceactivate; inplacedeactivate; instance; invalidaterect; isdirty; isrunning; isuptodate; left; libmain; libmain32; linestyleget; linestyleset; lineto; liset32; load; loadcursor; lockcontainer; lockrunning; lockserver; lstrcpy; makeintresource; makelp; makepoints; memcpy; memset; messagebeep; messagebox; movetoex; muldiv; multibytetowidechar; next; objectdestroyed; offsetof; offsetrect; oleregenumverbs; olereggetmiscstatus; olereggetusertype; oletext; oncolorchange; ondocwindowactivate; onframewindowactivate; oninplaceactivate; oninplacedeactivate; onlinestylechange; onpointchange; onshowwindow; onsizechange; onuiactivate; onuideactivate; onviewchange; openstream; pointscale; polydlgproc; polylinewndproc; postmessage; querygetdata; queryinterface; reactivateandundo; rectangle; rectconvertmappings; rectfromrectl; rectget; rectset; rectsset; rectstorect; recttorects; registerclass; registerclipboardformat; release; releaseconnection; releasedc; releaseinterface; releasestgmedium; removeprop; renderbitmap; rendermetafilepict; rendernative; reset; resizeborder; restoredc; resultfromscode; run; save; savecompleted; savedc; saveobject; screentoclient; seek; selectobject; selectorof; sendadvise; sendcommand; sendonclose; sendonrename; sendonsave; setactiveobject; setadvise; setbkcolor; setborderspace; setclientsite; setcolorscheme; setcontainedobject; setdata; setextent; setfocus; sethostnames; setmapmode; setmenu; setmoniker; setobjectrects; setparent; setpixel; setpoint; setprop; setrect; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; setwindowtext; showobject; showwindow; sizeget; sizeset; skip; stdmethodimp_; string; succeeded; text; top; translateaccelerator; uiactivate; uideactivate; uliset32; unadvise; undo; unfreeze; unlockdata; update; updatewindow; widechartomultibyte; window; writefmtusertypestg; wsprintf


Chapter 24

Click to open or copy the files for the Chapter 24 samples.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

The samples in this section are from Chapter 24 of Kraig Brockschmidt’s Inside OLE, 2nd Edition. See the online version of Inside OLE in the MSDN Library.


Patron (Chapter 24)

Click to open or copy the Patron sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

_tcsncicmp; _ttoi; abortdoc; abortproc; activate; activateobject; activedocument; activepage; addref; addverbmenu; adjustposition; advise; alloc; ambientchange; ansiupper; appendmenu; assignevents; atol; beginpaint; bindifrunning; bottom; bringwindowtotop; cache; calcboundingrect; callcontexthelpondocuments; cancellink; caninplaceactivate; cb; cbdevmode; cchdevicename; cchpathmax; cclient; cdispatchevents; cdocument; cdropsource; cdroptarget; ceventmap; cframe; checkaction; checkmenuitem; checkradiobutton; cimpiadvisesink; cimpidispatch; cimpioleclientsite; cimpiolecontrolsite; cimpioleinplacesite; cimpioleinplaceuiwindow; cimpioleitemcontainer; cimpipersistfile; cioleuilinkcontainer; clear; clienttoscreen; clinkclassfactory; clip; closedocument; cocreateinstance; cofreeunusedlibraries; cogetclassobject; cogetmalloc; colockobjectexternal; commandparams; commit; composewith; configurefordevice; contextsensitivehelp; controlinitialize; convertobject; converttostatic; copyembeddedobject; copylinkedobject; copyto; coregisterclassobject; corevokeclassobject; cotaskmemalloc; cotaskmemfree; cotreatasclass; cpage; cpages; cpages; cpatronclient; cpatrondoc; cpatronframe; create; createbindctx; createcclient; createcdocument; createdatacache; createdialog; createfilemoniker; createfont; createic; createinstance; createitemmoniker; createpen; createpopupmenu; createsolidbrush; createstatic; createstorage; createstream; createtoolbar; createwindow; createwindowex; ctenant; ctenants; curpageget; curpageset; cwindow; deactivateandundo; deactivateinplaceobject; defwindowproc; delete; deletedc; deletefile; deleteinterfaceimp; deleteobject; deletepage; deserialize; destroy; destroyelement; destroymenu; destroywindow; devmodeget; devmodeset; devreadconfig; dialogboxparam; discardundostate; dispatchmessage; dodragdrop; doverb; dptolp; dragdrop; dragenter; dragleave; dragover; draw; drawdroptargetrect; drawfocusrect; drawmenubar; drop; editlinks; enable; enablemenuitem; enablemodeless; enablerepaint; enablewindow; enddialog; enddoc; endpage; endpaint; enumobjects; equalrect; escape; eventmap; eventsdlgproc; exttextout; failed; fdirtyget; fdirtyset; filenameget; findconnectionpoint; firstpage; fisdirty; fisselected; fmessagehook; fontsize; formatetcget; fqueryenableeditlinks; fqueryenableevents; fquerylinksinpage; fqueryobjectselected; fquerypaste; fquerypastefromdata; fquerypastelinkfromdata; fqueryprintersetup; frameget; free; ftoggleorquerydesignmode; ftoggleorqueryhatchhandles; ftoggleorqueryuidead; get; getborder; getclassid; getclassinfo; getclientrect; getcontainer; getcontrolflags; getcontrolinfo; getcurfile; getcursorpos; getdata; getdc; getdevicecaps; getdisplayname; getdlgitem; getdlgitemtext; getextendedcontrol; getextent; getfiletitle; getfuncdesc; getid; getidsofnames; getimpltypeflags; getinfo; getkeystate; getlinksource; getlinkupdateoptions; getmenu; getmenuitemcount; getmenuitemid; getmenustring; getmessage; getmessagepos; getmessagetime; getmiscstatus; getmoniker; getnames; getnextlink; getobject; getobjectinterface; getobjectstorage; getparent; getprofileint; getprop; getreftypeinfo; getreftypeofimpltype; getscode; getscrollpos; getscrollrange; getsourcemoniker; getstockobject; getstoragename; getsubmenu; getsyscolor; getsystemmenu; getsystemmetrics; gettextextentpoint; gettickcount; gettypeattr; gettypeinfo; gettypeinfocount; getuilinkcontainer; getupdateoptions; getuserclassid; getwindow; getwindowcontext; getwindowinstance; getwindowlong; getwindowrect; givefeedback; globalalloc; globalfree; globallock; globalsize; globalunlock; initnew; inole_copystring; inole_createitemmoniker; inole_doconvert; inole_getlinksourcedata; inole_getusertypeofclass; inole_metafilepicticonfree; inole_notechangetime; inole_registerasrunning; inole_revokeasrunning; inole_seticonincache; inole_switchdisplayaspect; inplacedeactivate; insertmenu; insertmenus; insertobject; interfaceconnect; interfacedisconnect; intersectrect; invalidate; invalidaterect; invoke; ipage; ipagegetfromid; isdialogmessage; isdirty; isrectempty; isrunning; iswindow; iszoomed; killtimer; lastpage; lineto; liset32; load; loadaccelerators; loadcursor; loadmenu; loadstring; lockcontainer; lockinplaceactive; lockserver; lptodp; lstrcmpi; lstrcpy; lstrlen; makeintresource; makelong; makelp; max; mdirefreshmenu; mdisetmenu; memcpy; memset; menuselectparams; messagebeep; messagebox; messagedisplay; messageloop; messageset; min; movetoex; movewithoutfamily; muldiv; multibytetowidechar; newdocument; newpage; nextpage; noobjectframetools; notifyofrename; notifytenantsofrename; numpagesget; objectclassformatandicon; objectdestroyed; objecteventsiid; objectget; objectinitialize; objecttypeinfo; objecttypeinfoevents; objectwindow; odslu; offsetof; offsetrect; olecreate; olecreatefontindirect; olecreatefromdata; olecreatefromfile; olecreatelinkfromdata; olecreatelinktofile; oledraw; oleflushclipboard; olegetclipboard; olegeticonofclass; oleinitialize; oleisrunning; oleload; olequerycreatefromdata; olequerylinkfromdata; olerun; olesave; olesetclipboard; olesetcontainedobject; olesetmenudescriptor; oletext; oleuiaddverbmenu; oleuiconvert; oleuieditlinks; oleuiinsertobject; oleuipastespecial; oleuipromptuser; oleuiupdatelinks; oleuninitialize; onambientpropertychange; onclose; oncommand; oncontrolinfochanged; ondatachange; ondocwindowactivate; onfocus; oninplaceactivate; oninplacedeactivate; onleftdoubleclick; onleftdown; onleftup; onmnemonic; onmousemove; onnchittest; onposrectchange; onrename; onrightdown; onsave; onsetcursor; onshowwindow; onsize; ontimer; onuiactivate; onuideactivate; onviewchange; open; openlinksource; openstorage; openstream; pageadd; pagedelete; pageget; pageinsert; pageswndproc; parsecommandline; parsedisplayname; paste; pastefromdata; pastespecial; peekmessage; pointfrompointl; pointlfrompoint; postmessage; preshowinit; previouspage; print; printdlg; printdlghook; printdlgproc; printersetup; ptinrect; querycontinuedrag; querygetdata; queryinterface; readclassstg; readfmtusertypestg; rectangle; rectconvertmappings; rectfromrectl; rectget; rectlfromrect; rectset; registerallclasses; registerclass; registerclipboardformat; registerdragdrop; reinstateui; release; releasecapture; releasedc; releasefuncdesc; releaseinterface; releasestgmedium; releasetypeattr; remove; removemenu; removemenus; rename; repaint; requestborderspace; requestnewobjectlayout; resizeborder; resultfromscode; revokedragdrop; right; save; savecompleted; saveobject; screentoclient; scroll; scrolledwindow; scrollthumbposition; scrollwindow; seek; select; selectobject; selectorof; selecttenantatpoint; sendmessage; sendscrollposition; serialize; set; setabortproc; setactiveobject; setadvise; setbkcolor; setborderspace; setcapture; setclientsite; setcursor; setdata; setdefformatetc; setdlgitemtext; setextent; setfocus; setformatetc; sethostnames; setlinksource; setlinkupdateoptions; setmapmode; setmenu; setmoniker; setobjectrects; setpoint; setpointl; setprop; setrect; setrectl; setscrollpos; setscrollrange; setsizel; setstatustext; settextcolor; settimer; setupdateoptions; setwindowlong; setwindowpos; showasopen; showobject; showobjecttype; showobjecttypes; showorqueryobjecttypes; showpropertyframe; showuiandtools; showwindow; showyourself; sizeget; sizeset; startdoc; startpage; startsizetracking; stdmethodimp_; stgcreatedocfile; stgopenstorage; storageget; storageset; storageupdate; succeeded; switchactivetenant; switchorupdateaspect; switchtofile; sysfreestring; tenantadd; tenantclip; tenantcreate; tenantdestroy; tenantfromname; tenantfrompoint; tenantget; tenantgetfromid; testselection; text; textout; toggledesignmode; togglehatchhandles; toggleuidead; trackpopupmenu; transferobjectcreate; transformcoords; translateaccelerator; translatemdisysaccel; translatemessage; trymnemonic; typeget; uicursorload; uideactivate; uidrawhandles; uidrawshading; uishowobject; unadvise; unicodetoansi; update; updateaction; updateinplaceobjectrects; updatelink; updatemenus; updatescrollranges; updatetoolbar; updatewindow; utestdroppablepoint; variantinit; widechartomultibyte; window; writeclassstg; writefmtusertypestg; wsprintf; xformrectinpixelstohimetric; xformsizeinhimetrictopixels; xformsizeinpixelstohimetric


Polyline (Chapter 24)

Click to open or copy the Polyline sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

ambientget; addconnection; addref; advise; alloc; ambientget; ambientsinitialize; beginpaint; cadviserouter; calcpolyrectindialog; caninplaceactivate; cconnectionpoint; cenumformatetc; chatchwin; checkradiobutton; childset; choosecolor; cimpiconnptcont; cimpidataobject; cimpidispatch; cimpiexternalconnection; cimpiolecontrol; cimpioleinplaceactiveobject; cimpioleinplaceobject; cimpioleobject; cimpipersiststorage; cimpipersiststreaminit; cimpipolyline; cimpipolylinecontrol; cimpiprovideclassinfo; cimpirunnableobject; cimpispecifypp; cimpiviewobject; clear; clone; closemetafile; cogetmalloc; colockobjectexternal; colorget; colorset; commandparams; contextsensitivehelp; cotaskmemfree; cpolyline; cpolylineclassfactory; createcompatiblebitmap; createcompatibledc; createdataadviseholder; createdatacache; createdialogparam; createinstance; createmetafile; createoleadviseholder; createpen; createsolidbrush; createstream; createwindowex; cstringtable; dadvise; dataget; dataset; declare_interface_; define_guid; defwindowproc; deletedc; deleteinterfaceimp; deletemetafile; deleteobject; destroywindow; discardundostate; dispgetidsofnames; dllcanunloadnow; dllgetclassobject; doverb; draw; dunadvise; enablemodeless; endpaint; enumadvise; enumconnectionpoints; enumconnections; enumdadvise; enumformatetc; enumverbs; failed; findconnectionpoint; freeze; freezeevents; get_backcolor; get_linecolor; get_linestyle; getadvise; getcanonicalformatetc; getclassid; getclassinfo; getclientrect; getclientsite; getclipboarddata; getcolorset; getconnectioninterface; getcontainer; getcontrolinfo; getdata; getdatahere; getdc; getdevicecaps; getdlgitem; getextent; getidsofnames; getmiscstatus; getmoniker; getpages; getparent; getprop; getrunningclass; getsizemax; getstockobject; getsyscolor; getsystemmetrics; gettypeinfo; gettypeinfocount; gettypeinfoofguid; getuserclassid; getusertype; getwindow; getwindowcontext; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; handsoffstorage; hatchwindowregister; hwndassociateset; inflaterect; initfromdata; initnew; inole_registerasrunning; inole_revokeasrunning; inplaceactivate; inplacedeactivate; instance; invalidaterect; invoke; isdirty; isrunning; isuptodate; left; libmain; libmain32; linestyleget; linestyleset; lineto; liset32; load; loadcursor; loadregtypelib; loadtypelib; lockcontainer; lockrunning; lockserver; lstrcpy; makeintresource; makelp; makepoints; memcpy; memset; messagebeep; messagebox; movetoex; muldiv; multibytetowidechar; next; objectdestroyed; offsetof; offsetrect; olecreatepropertyframe; oleregenumverbs; olereggetmiscstatus; olereggetusertype; oletext; onambientpropertychange; oncolorchange; ondocwindowactivate; onframewindowactivate; oninplaceactivate; oninplacedeactivate; onlinestylechange; onmnemonic; onpointchange; onshowwindow; onsizechange; onuiactivate; onuideactivate; onviewchange; openstream; pointscale; polydlgproc; polylinewndproc; postmessage; put_backcolor; put_linecolor; put_linestyle; querygetdata; queryinterface; reactivateandundo; rectangle; rectconvertmappings; rectfromrectl; rectget; rectset; rectsset; rectstorect; recttorects; registerclass; registerclipboardformat; release; releaseconnection; releasedc; releaseinterface; releasestgmedium; removelastpoint; removeprop; renderbitmap; rendermetafilepict; rendernative; reset; resizeborder; restoredc; resultfromscode; run; save; savecompleted; savedc; saveobject; screentoclient; seek; selectobject; selectorof; sendadvise; sendcommand; sendonclose; sendonrename; sendonsave; setactiveobject; setadvise; setbkcolor; setborderspace; setclientsite; setcolorscheme; setcontainedobject; setdata; setextent; setfocus; sethostnames; setiid; setmapmode; setmenu; setmoniker; setnoparams; setobjectrects; setparent; setpixel; setpoint; setprop; setrect; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; setwindowtext; showhatch; showobject; showpropertyframe; showwindow; sizeget; sizeset; skip; stdmethod; stdmethod_; stdmethodimp_; string; succeeded; text; translateaccelerator; uiactivate; uideactivate; uliset32; unadvise; undo; unfreeze; unlockdata; update; updatewindow; widechartomultibyte; window; writefmtusertypestg; wsprintf


Polyprop (Chapter 24)

Click to open or copy the Polyprop sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

activate; addref; alloc; apply; checkradiobutton; choosecolor; cogetmalloc; cpolyppfactory; cpolyproppage; createdialogparam; createinstance; deactivate; destroywindow; dllcanunloadnow; dllgetclassobject; failed; freeallobjects; get_backcolor; get_linecolor; get_linestyle; getdesktopwindow; getdlgitem; getpageinfo; getparent; getprop; getwindowrect; help; ispagedirty; libmain; libmain32; lockserver; lstrcpy; makeintresource; makelong; memset; move; oletext; onstatuschange; polyproppageproc; put_backcolor; put_linecolor; put_linestyle; queryinterface; release; releaseinterface; removeprop; resultfromscode; setfocus; setobjects; setpagesite; setprop; setwindowpos; show; showwindow; stdmethodimp_; text; translateaccelerator; unlockdata; wcscpy


Chapter 25

There are no samples for this chapter.


Classlib

Click to open or copy the Classlib class library.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

This sample is the C++ class library that was created for the Inside OLE book, 2nd Edition. See the online version of Inside OLE in the MSDN Library for a description of this class library.

Building SDK Samples

This sample uses the following keywords:

aboutproc; activedocument; adjustwindowrect; ansiupper; askandsave; beginpaint; cclient; cdocument; cdocumentadvisesink; cframe; chatchwin; check; childset; chourglass; clear; clip; closedocument; commandparams; commdlgextendederror; createbitmap; createcclient; createcdocument; createdoc; createpatternbrush; createtoolbar; createwindow; createwindowex; cstatusline; cstringtable; ctoolbar; cwindow; dataget; dataset; defaultframeproc; defdocumentproc; defframeproc; defwindowproc; deleteobject; destroywindow; dialogbox; dispatchmessage; documentcount; documentlist; documentwndproc; drawmenubar; drawshading; enable; enablemenuitem; enablewindow; enddialog; endpaint; errormessage; exist; fcleanverify; fdirtyget; fdirtyset; filenameget; fmessagehook; focusset; fontget; fontset; fquerypaste; fquerysave; frame; frameget; framewndproc; free; gbgizmoadd; gbgizmocheck; gbgizmodataget; gbgizmodataset; gbgizmoenable; gbgizmoexist; gbgizmofocusset; gbgizmointget; gbgizmointset; gbgizmonotifyget; gbgizmonotifyset; gbgizmoremove; gbgizmosendmessage; gbgizmoshow; gbgizmotextget; gbgizmotextset; gbgizmotypeget; gbhwndassociateget; gbhwndassociateset; getclientrect; getcommandline; getfiletitle; getmenu; getmessage; getopenfilename; getparent; getprofileint; getsavefilename; getsubmenu; getwindowlong; getwindowrect; getwindowtext; getwindowtextlength; hatchwindowregister; hatchwndproc; hwndassociateget; hwndassociateset; inflaterect; instance; intersectrect; intget; intset; isclipboardformatavailable; iswindow; iswindowvisible; load; loadaccelerators; loadbitmap; loadcursor; loadicon; loadstring; lstrcmpi; lstrcpy; lstrcpyn; lstrlen; makeintresource; malloc; mdirefreshmenu; memset; menuselect; messagebox; messagedisplay; messageget; messagegetlength; messageloop; messagemap; messageset; newdocument; notifyget; notifyset; onactivate; oncaptionchange; oncloserequest; oncommand; ondatachange; ondocumentactivate; ondocumentdatachange; onsize; onsizechange; onwindowcommand; openinitialfiles; parsecommandline; paste; patblt; postmessage; postquitmessage; preshowinit; psz; pszwhitespacescan; queryclosealldocuments; rectsset; registerallclasses; registerclass; registerclipboardformat; releasecapture; remove; rename; renderformat; replacecharwithnull; rgb; save; saveopendialog; sdiclientwndproc; sdiverify; selectobject; sendcommand; sendmessage; setbkcolor; setcapture; setcursor; setfocus; setparent; setrect; settextcolor; setwindowlong; setwindowpos; setwindowtext; show; showdocument; showhatch; showwindow; statstripmenuselect; statstripmessagedisplay; statstripmessagemap; statusline; text; textget; textset; translateaccelerator; translatemdisysaccel; translatemessage; typeget; uitoolconfigurefordisplay; undo; updatemenus; updatetoolbar; updatewindow; window; windowtitleset; wsprintf


Classlib Skeleton

Click to open or copy the Classlib Skeleton sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

This classlibrary skeleton is for the C++ class library that was created for the Inside OLE book, 2nd Edition. See the online version of Inside OLE in the MSDN Library for a description of this class library.

Building SDK Samples

This sample uses the following keywords:

cframe; messageloop


InOLE Sample

Click to open or copy the InOLE sample.

In order to build any of the Samples for Inside OLE, 2nd Edition, you need to copy the required files. You only need to copy these files once.

See the online version of Inside OLE in the MSDN Library for a description of this sample.

Building SDK Samples

This sample uses the following keywords:

-muldiv; 1+widechartomultibyte; _dos_findfirst; alloc; ansitooem; beginpaint; bitblt; bitposition; cache; callwindowproc; cbstruct+; cch+sizeof; codosdatetimetofiletime; cofiletimenow; cogetmalloc; coisole1class; commandparams; convertstringalloc; copyrect; cotaskmemfree; createbindctx; createbitmap; createcompatiblebitmap; createcompatibledc; createdibitmap; createfilemoniker; createfont; createilockbytesonhglobal; createitemmoniker; createpatternbrush; createpen; createsolidbrush; createstreamonhglobal; createwindow; cursorscache; cursorsfree; defwindowproc; deletedc; deletemetafile; deleteobject; destroywindow; drawblankbutton; drawhandle; enablewindow; endpaint; enumcache; exttextout; failed; fenumchangefont; fenumenable; fenumhittest; fenumpaintgizmos; fillrect; findclose; findfirstfile; findresource; framerect; freeresource; gbgizmoadd; gbgizmocheck; gbgizmodataget; gbgizmodataset; gbgizmoenable; gbgizmoexist; gbgizmofocusset; gbgizmointget; gbgizmointset; gbgizmonotifyget; gbgizmonotifyset; gbgizmoremove; gbgizmosendmessage; gbgizmoshow; gbgizmotextget; gbgizmotextset; gbgizmotypeget; gbhwndassociateget; gbhwndassociateset; gbmessagehandler; genericsubproc; getbvalue; getclientrect; getdc; getdevicecaps; getdisplayname; getdlgitem; getdlgitemint; getdlgitemtext; getfiletimes; getgvalue; getkeystate; getmenu; getmiscstatus; getmoniker; getnextdlgtabitem; getparent; getprop; getrunningobjecttable; getrvalue; getscode; getsourcedisplayname; getstockobject; getsubmenu; getsyscolor; getsystemmetrics; gettextmetrics; getuserclassid; getusertype; getwindowinstance; getwindowlong; getwindowtext; gizmobarpaint; gizmobarpallocate; gizmobarpfree; gizmobarwndproc; gizmopallocate; gizmopcheck; gizmopenum; gizmopfind; gizmopfree; gizmopstateset; gizmoscompact; gizmosexpand; globalalloc; globalfree; globallock; globalunlock; hbrushdithercreate; hstringcache; hstringcachefree; idfromhmenu; inflaterect; initialize; inole_allocobjectdescriptor; inole_convertstringtoansi; inole_copystring; inole_createfilemoniker; inole_createitemmoniker; inole_createstorageonhglobal; inole_doconvert; inole_getlinksourcedata; inole_getusertypeofclass; inole_metafilepicticonfree; inole_mkparsedisplayname; inole_notechangetime; inole_olecreatefromfile; inole_olecreatelinktofile; inole_progidfromclsid; inole_readfmtusertypestg; inole_registerasrunning; inole_revokeasrunning; inole_seticonincache; inole_stgcreatedocfile; inole_stgisstoragefile; inole_stgopenstorage; inole_stringfromclsid; inole_stringfromguid2; inole_switchdisplayaspect; inole_writefmtusertypestg; intersectrect; invalidaterect; invertrect; isbadwriteptr; istringfromid; iswindow; iswindowenabled; left+; libmain; libmain32; lineto; loadbitmap; loadcursor; loadresource; loadstring; localalloc; localfree; lockresource; lstrcpy; lstrcpyn; lstrlen; makeintresource; map_loghim_to_pix; map_pix_to_loghim; maskcreate; max; menuselectparams; min; mkparsedisplayname; movetoex; muldiv; multibytetowidechar; next; notechangetime; olecreatefromfile; olecreatelinktofile; olesavetostream; patb; patblt; pgizmofromhwndid; pointfromlparam; positionbit; progidfromclsid; ptinrect; queryinterface; readclassstg; readfmtusertypestg; rectangle; register; registerclass; regqueryvalue; release; releasecapture; releasedc; removeprop; restoredc; resultfromscode; revoke; rgb; savedc; selectobject; sendcommand; sendmenuselect; sendmessage; setadvise; setbkcolor; setbkmode; setcapture; setconvertstg; setdata; setdlgitemint; setdlgitemtext; setfocus; setformatetc; setprop; setrect; settextcolor; setwindowlong; setwindowpos; setwindowtext; showwindow; sizeofresource; statmessagemapsort; statstripclean; statstripmenuselect; statstripmessagedisplay; statstripmessagemap; statstrippaint; statstripwndproc; stdapi_; stgcreatedocfile; stgcreatedocfileonilockbytes; stgisstoragefile; stgopenstorage; stringfromclsid; succeeded; text; textout; toolbuttonfree; toolbuttoninit; top+; uicursorload; uidrawhandles; uidrawshading; uishowobject; uitoolbuttondraw; uitoolconfigurefordisplay; uncache; unlockdata; unlockresource; unreferenced_parameter; updatewindow; virtualprotect; widechartomultibyte; writeclassstg; writeclassstm; writefmtusertypestg; wsprintf; xformheightinhimetrictopixels; xformheightinpixelstohimetric; xformrectinhimetrictopixels; xformrectinpixelstohimetric; xformsizeinhimetrictopixels; xformsizeinpixelstohimetric; xformwidthinhimetrictopixels; xformwidthinpixelstohimetric


Automation Samples

Click to open or copy the files for the Automation samples.

This section contains the Automation samples, formerly called the "OLE Automation" samples.


Browseh: Automation Controller to Browse Type Library

Click to open or copy the Browseh project files.

Browseh exposes a number of Automation objects that correspond to components of a type library. This allows an Automation controller like Browse to access the properties and methods of these objects to browse the type library instead of directly using ITypeLib and ITypeInfo. So Browseh is a type library browse helper.

The Browse sample controls the Automation objects of the Browseh (Browse Helper) inproc server to browse a type library. Browse is a developer-oriented type library browser.

In addition to displaying type library information, this sample shows how to control an Automation object by accessing its properties and methods. Browse provides generic helper functions (CreateObject and Invoke) to control any Automation server. For more information on how to use these functions, see the comments in Invhelp.cpp.

Browseh does not support vtable binding. Controllers must use IDispatch to control this server.

Building SDK Samples

This sample uses the following keywords:

_fmemcpy; _fmemset; _inittypeinfo; _wep; addref; alloc; browsetypelibrary; calias; carraybound; carraydesc; cbrowsehelper; cbrowsehelpercf; ccoclass; ccollection; cconstant; cdispinterface; cenum; cenumvariant; cfunction; cinterface; clone; cmodule; cmydispatch; cogetmalloc; converttoansi; converttounicode; cotaskmemfree; cparameter; cproperty; create; createinstance; cstruct; ctypedesc; ctypeinfo; ctypelibrary; cunion; delete; didalloc; dispgetidsofnames; dispinvoke; dllcanunloadnow; dllgetclassobject; failed; free; from_ole_string; get__newenum; get_arraybounds; get_arraydesc; get_baseinterface; get_basetype; get_callconvention; get_count; get_documentation; get_elements; get_elementscount; get_elementtype; get_funcflags; get_funckind; get_functions; get_guidasstring; get_helpcontext; get_helpfile; get_idlflags; get_interface; get_interfaces; get_invocationkind; get_item; get_kind; get_localeid; get_lowerbound; get_majorversion; get_memberid; get_members; get_methods; get_minorversion; get_name; get_numberofoptionalparams; get_offsetinvtbl; get_parameters; get_pointerdesc; get_properties; get_returntype; get_type; get_typeflags; get_typeinfokind; get_typeinfos; get_userdefineddesc; get_value; getcontainingtypelib; getdocumentation; getfuncdesc; getidsofnames; getinterfaceid; getlibattr; getnames; getreftypeinfo; getreftypeofimpltype; gettypeattr; gettypeinfo; gettypeinfocount; gettypeinfoofguid; gettypeinfotype; getvardesc; initdll; invoke; loadregtypelib; loadstring; loadtypeinfo; loadtypelib; lockserver; lstrcpyn; multibytetowidechar; next; olestr; outputdebugstring; queryinterface; raiseexception; release; releasefuncdesc; releasetlibattr; releasetypeattr; releasevardesc; reset; safearraycopy; safearraycreate; safearraydestroy; safearraygetelement; safearraygetlbound; safearrayputelement; skip; stdmethod; stdmethod_; stdmethodimp_; stringfromclsid; succeeded; sysallocstring; sysfreestring; text; to_ole_string; unlockdata; variantclear; variantinit; widechartomultibyte; wsprintf


Dispcalc: Simple, Accumulator-Based Sample

Click to open or copy the Dispcalc project files.

The Dispcalc sample is a simple accumulator-based calculator. Its user interface consists of buttons for the numbers (0-9), the operators (+, -, *, /), and some other necessary buttons (C for Clear, = for evaluation).

Building SDK Samples

This sample uses the following keywords:

addref; ansistring; assert; button; buttonpush; c2pstr; carith; ccalc; ccalccf; clear; convertstrwtoa; coregisterclassobject; corevokeclassobject; create; createdialog; createdisptypeinfo; createinstance; createstddispatch; data_seg; define_guid; defined; defwindowproc; delay; dim; dispatchmessage; dispinvoke; display; ensureregistration; eval; failed; get_accum; get_op; get_opnd; getditem; getitem; getmenuitemtext; getmessage; header; hilitecontrol; initapplication; initinstance; initole; isequaliid; loadcursor; loadicon; lockserver; mdata; method0; method1; oleinitialize; olestr; oleuninitialize; pdata1; postquitmessage; property; put_accum; put_op; put_opnd; queryinterface; quit; regclosekey; registeractiveobject; registerclass; regopenkey; regsetvalue; release; revokeactiveobject; sendmessage; setdlgitemtext; setitext; showwindow; stdmethod; stdmethod_; stdmethodimp_; strcpy; string; switch; sysstringlen; translatemessage; tstr; uninitole; unused; variantchangetype; variantclear; variantinit; warning; widechartomultibyte; widestring; winmain; wndproc


Dispdemo: Automation Controller

Click to open or copy the Dispdemo project files.

The Dispdemo sample is an Automation controller. Dispdemo drives the two polygon servers (spoly and spoly2) that are also provided as samples.

The interesting part of Dispdemo is in the remote polygon class. The remote polygon class was constructed so that the IDispatch members could be accessed conveniently from C++. The remote polygon class does this by transforming the C++ calls into IDispatch calls. The code that calls these routines does not detect that it is going through IDispatch.

Building SDK Samples

This sample uses the following keywords:

addref; ansistring; assert; button; buttonpush; c2pstr; carith; ccalc; ccalccf; clear; convertstrwtoa; coregisterclassobject; corevokeclassobject; create; createdialog; createdisptypeinfo; createinstance; createstddispatch; data_seg; define_guid; defined; defwindowproc; delay; dim; dispatchmessage; dispinvoke; display; ensureregistration; eval; failed; get_accum; get_op; get_opnd; getditem; getitem; getmenuitemtext; getmessage; header; hilitecontrol; initapplication; initinstance; initole; isequaliid; loadcursor; loadicon; lockserver; mdata; method0; method1; oleinitialize; olestr; oleuninitialize; pdata1; postquitmessage; property; put_accum; put_op; put_opnd; queryinterface; quit; regclosekey; registeractiveobject; registerclass; regopenkey; regsetvalue; release; revokeactiveobject; sendmessage; setdlgitemtext; setitext; showwindow; stdmethod; stdmethod_; stdmethodimp_; strcpy; string; switch; sysstringlen; translatemessage; tstr; uninitole; unused; variantchangetype; variantclear; variantinit; warning; widechartomultibyte; widestring; winmain; wndproc


Dspcalc2: Simple, Accumulator-Based Sample

Click to open or copy the Dspcalc2 project files.

The Dspcalc2 sample is a simple accumulator-based calculator. Its user interface consists of buttons for the numbers (0-9), the operators (+, -, *, /), and some other necessary buttons (C for Clear, = for evaluation).

Building SDK Samples

This sample uses the following keywords:

addref; ansistring; assert; button; buttonpush; c2pstr; carith; ccalc; ccalccf; convertstrwtoa; coregisterclassobject; corevokeclassobject; create; createdialog; createinstance; createstddispatch; data_seg; dcclear; define_guid; defined; defwindowproc; delay; dim; dispatchmessage; display; ensureregistration; eval; failed; get_accum; get_op; get_opnd; getditem; getitem; getmenuitemtext; getmessage; gettypeinfoofguid; header; hilitecontrol; initapplication; initinstance; initole; isequaliid; loadcursor; loadicon; loadregtypelib; loadtypelib; lockserver; messagebox; oleinitialize; olestr; oleuninitialize; postquitmessage; put_accum; put_op; put_opnd; queryinterface; quit; regclosekey; registeractiveobject; registerclass; regopenkey; regsetvalue; release; revokeactiveobject; safearraygetelement; safearraygetubound; sendmessage; setdlgitemtext; setitext; showwindow; stdmethod; stdmethod_; stdmethodimp_; strcpy; string; switch; sysstringlen; translatemessage; tstr; uninitole; unused; variantchangetype; variantclear; variantinit; warning; widechartomultibyte; widestring; winmain; wndproc


Hello Samples for Automation Server

Click to open or copy the files for the Hello samples.

Hello and Hellctrl are introductory samples for creating an Automation server.


Hello: Automation Server Sample

Click to open or copy the Hello project files.

The Hello sample is a simple Automation server. This is a good sample to use to learn to create your first Automation server. This sample has a Hello object that supports the HelloMessage property and the SayHello method.

This sample implements the following features:

  • Dual interfaces which allow access of Automation properties and methods through vtable binding and through IDispatch.

  • Rich error information for vtable-binding controllers. This is done by implementing ISupportErrorInfo and using IErrorInfo.

  • Active object registration, using RegisterActiveObject and RevokeActiveObject.

  • Correct shut-down behavior.

  • A registry file containing Hello.Application and Hello.Application.2 as progIDs.

  • Initial invisibility.

Building SDK Samples

This sample uses the following keywords:

_fstrstr; addref; chello; chellocf; codisconnectobject; colockobjectexternal; converttoansi; converttounicode; coregisterclassobject; corevokeclassobject; create; createdialog; createerrorinfo; createinstance; csupporterrorinfo; defdlgproc; destroywindow; dispatchmessage; dispgetidsofnames; dispinvoke; failed; from_ole_string; get_application; get_fullname; get_hellomessage; get_name; get_parent; get_visible; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getdlgitemtext; getidsofnames; getmessage; getmodulefilename; gettypeinfo; gettypeinfocount; gettypeinfoofguid; initapplication; initinstance; interfacesupportserrorinfo; invoke; iswindow; loadcursor; loadicon; loadregtypelib; loadstring; loadtypeinfo; loadtypelib; lockserver; make_scode; makeintresource; messagebox; multibytetowidechar; oleinitialize; olestr; oleuninitialize; outputdebugstring; postmessage; postquitmessage; processcmdline; put_hellomessage; put_visible; queryinterface; quit; raiseexception; registeractiveobject; registerclass; release; resultfromscode; revokeactiveobject; sayhello; setdescription; setdlgitemtext; seterrorinfo; setguid; setmessagequeue; setsource; showwindow; stdmethod; stdmethod_; stdmethodimp_; succeeded; switch; sysallocstring; sysfreestring; sysreallocstring; text; to_ole_string; translatemessage; uninitialize; widechartomultibyte; wsprintf


Hellctrl: Automation Sample for Vtable Binding

Click to open or copy the Hellctrl project files.

The Hellctrl sample is a vtable-binding Automation controller that controls the Hello sample.

Hellctrl uses CoCreateInstance to create an instance of Hello and obtains its IHello interface using Hellctrl. It then calls the methods of the IHello interface to access the properties and methods of the Hello object. Rich Error information is obtained by accessing the IErrorInfo interface.

Building SDK Samples

This sample uses the following keywords:

cocreateinstance; converttoansi; converttounicode; createwindow; declare_interface_; define_guid; defwindowproc; dispatchmessage; displayerror; enablemenuitem; failed; from_ole_string; get_hellomessage; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getdescription; geterrorinfo; getmessage; initapplication; initinstance; interfacesupportserrorinfo; loadcursor; loadicon; loadstring; messagebox; multibytetowidechar; oleinitialize; oleuninitialize; postquitmessage; put_visible; queryinterface; registerclass; release; sayhello; setmessagequeue; showwindow; stdmethod; stdmethod_; sysfreestring; text; to_ole_string; translatemessage; updatewindow; widechartomultibyte


Lines: Automation Server that Implements Collections

Click to open or copy the Lines project files.

The Lines sample is an Automation server application that implements collections. Lines allows a collection on lines to be drawn on a pane using Automation.

Building SDK Samples

This sample uses the following keywords:

_fstrstr; addendpointstopane; addpoint; addref; beginpaint; capplication; capplicationcf; cenumvariant; choosecolor; clear; clearpane; cline; clines; clone; codisconnectobject; colockobjectexternal; converttoansi; converttounicode; coregisterclassobject; corevokeclassobject; cpane; cpoint; cpoints; create; createanddrawline; createerrorinfo; createinstance; createline; createpen; createpoint; createwindow; csupporterrorinfo; declare_interface_; define_guid; defwindowproc; deleteobject; destroywindow; dialogboxparam; dispatchmessage; dispgetidsofnames; dispinvoke; dptolp; draw; drawlinedialogfunc; enddialog; endpaint; failed; from_ole_string; get__newenum; get_application; get_color; get_count; get_endpoint; get_fullname; get_item; get_lines; get_maxx; get_maxy; get_name; get_pane; get_parent; get_points; get_startpoint; get_thickness; get_visible; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; get_x; get_y; getdc; getdlgitemint; getidsofnames; getinvalidaterect; getmaxxmaxy; getmessage; getmodulefilename; gettypeinfo; gettypeinfocount; gettypeinfoofguid; inflaterect; initapplication; initinstance; interfacesupportserrorinfo; internaladdref; internalrelease; invalidaterect; invoke; iswindow; lineto; loadcursor; loadicon; loadregtypelib; loadstring; loadtypeinfo; loadtypelib; lockserver; lptodp; make_scode; makeintresource; memset; messagebox; movetoex; multibytetowidechar; next; oleinitialize; olestr; oleuninitialize; onsize; outputdebugstring; postmessage; postquitmessage; processcmdline; ptinrect; put_color; put_thickness; put_visible; put_x; put_y; putref_endpoint; putref_startpoint; queryinterface; quit; raiseexception; refresh; registeractiveobject; registerclass; release; releasedc; remove; removeendpointsfrompane; removepoint; reset; revokeactiveobject; rgb; safearrayaccessdata; safearrayallocdata; safearraycopy; safearraycreate; safearraydestroy; safearraydestroydata; safearraygetelement; safearraygetlbound; safearrayputelement; safearrayunaccessdata; selectobject; setdescription; setdlgitemtext; seterrorinfo; setguid; setmapmode; setmessagequeue; setrect; setsource; setwindoworgex; showwindow; skip; stdmethod; stdmethod_; stdmethodimp_; succeeded; switch; sysallocstring; sysfreestring; text; to_ole_string; translatemessage; uninitialize; update; updatewindow; variantclear; variantinit; widechartomultibyte; wsprintf


Spoly: Draw Polygons

Click to open or copy the Spoly project files.

The Spoly sample draws polygons. The only way to make Spoly draw a polygon is to use its Automation interface.

The spoly.application is one Automation object that is exposed by Spoly. The object spoly.application is associated with Spoly's main application window. It controls drawing polygons and clearing the display.

Building SDK Samples

This sample uses the following keywords:

addpoint; addref; ansistring; appliczone; assert; assertsz; beginpaint; c2pstr; cenumpoint; clone; comparestring; convertstratow; convertstrwtoa; coregisterclassobject; corevokeclassobject; cpoint; cpointcf; cpoly; cpolycf; create; createinstance; createpen; createrectrgn; createwindow; cstatbar; data_seg; debugbreak; debugstr; decobjectcount; defframeproc; define_guid; defined; defwindowproc; deleteobject; destroywindow; dim; dispatchmessage; dispgetparam; draw; dump; endpaint; ensureregistration; enumpoints; failed; framewndoncreate; framewndonsize; framewndproc; get_blue; get_green; get_red; getclassinfo; getclientrect; getdc; getfont; getheight; getidsofnames; getitem; getmenuitemtext; getmessage; getport; getstockobject; getsyscolor; getsystemmetrics; gettext; gettextmetrics; gettypeinfo; gettypeinfocount; getwidth; getwindow; getwindowlong; getx; getxorigin; gety; getyorigin; getzone; header; incobjectcount; initapplication; initinstance; initole; invalidaterect; invoke; isequaliid; lineto; loadcursor; loadicon; lockserver; move; moveto; movetoex; movewindow; multibytetowidechar; next; oleinitialize; olestr; oleuninitialize; outputdebugstring; outputdebugstringa; pennormal; pensize; polydraw; polydump; polyterm; postquitmessage; queryinterface; quit; regclosekey; register; registerclass; regopenkey; regsetvalue; release; releasedc; reset; revoke; rgb; rgbforecolor; safearraycopy; safearraycreate; safearraydestroy; safearraygetdim; safearraygetelement; safearraygetlbound; safearraygetubound; safearrayputelement; sbprintf; selectcliprgn; selectobject; sendmessage; set_blue; set_green; set_red; setbkmode; setfont; setheight; setport; settext; setwidth; setwindowlong; setx; setxorigin; sety; setyorigin; show; showwindow; skip; spolygetidsofnames; sprintf; statbarwndproc; stdmethod; stdmethod_; stdmethodimp_; string; switch; sysallocstring; sysfreestring; sysstringlen; textout; translatemessage; tstr; uninitole; unused; update; updatewindow; va_start; variantclear; variantinit; wcsicmp; widechartomultibyte; widestring; winmain; wmpaint; wsprintf; wvsprintf


Spoly2: Draw Polygons

Click to open or copy the Spoly2 project files.

The Spoly2 sample draws polygons. The only way to make Spoly2 draw a polygon is to use its programmability interface.

The spoly2.application is one Automation object that is exposed by Spoly2. The object Spoly2.application is associated with Spoly2's main application window. It controls drawing polygons and clearing the display.

Building SDK Samples

This sample uses the following keywords:

addpoint; addref; ansistring; assert; assertsz; beginpaint; c2pstr; cenumpoint; clone; convertstratow; convertstrwtoa; coregisterclassobject; corevokeclassobject; cpoint; cpointcf; cpoly; cpolycf; create; createdisptypeinfo; createinstance; createpen; createrectrgn; createwindow; cstatbar; data_seg; debugbreak; debugstr; decobjectcount; defframeproc; define_guid; defined; defwindowproc; deleteobject; destroywindow; dim; dispatchmessage; dispgetidsofnames; dispinvoke; draw; dump; endpaint; ensureregistration; enumpoints; failed; framewndoncreate; framewndonsize; framewndproc; get_blue; get_green; get_red; getclassinfo; getclientrect; getdc; getfont; getheight; getidsofnames; getitem; getmenuitemtext; getmessage; getport; getstockobject; getsyscolor; getsystemmetrics; gettext; gettextmetrics; gettypeinfo; gettypeinfocount; getwidth; getwindow; getwindowlong; getx; getxorigin; gety; getyorigin; header; incobjectcount; initapplication; initinstance; initole; invalidaterect; invoke; isequaliid; lineto; loadcursor; loadicon; lockserver; move; moveto; movetoex; movewindow; multibytetowidechar; next; oleinitialize; olestr; oleuninitialize; outputdebugstring; outputdebugstringa; pennormal; pensize; polydraw; polydump; polyterm; postquitmessage; queryinterface; quit; regclosekey; register; registerclass; regopenkey; regsetvalue; release; releasedc; reset; revoke; rgb; rgbforecolor; safearraycopy; safearraycreate; safearraydestroy; safearraygetdim; safearraygetelement; safearraygetlbound; safearraygetubound; safearrayputelement; sbprintf; selectcliprgn; selectobject; sendmessage; set_blue; set_green; set_red; setbkmode; setfont; setheight; setport; settext; setwidth; setwindowlong; setx; setxorigin; sety; setyorigin; show; showwindow; skip; sprintf; statbarwndproc; stdmethod; stdmethod_; stdmethodimp_; stricmp; string; switch; sysallocstring; sysfreestring; sysstringlen; textout; tolower; translatemessage; tstr; uninitole; unused; update; updatewindow; va_start; variantclear; variantinit; widechartomultibyte; widestring; winmain; wmpaint; wsprintf; wvsprintf


Tibrowse: Automation Sample

Click to open or copy the Tibrowse project files.

The Tibrowse sample is an Automation browser. When started, it asks the user to selected a type library (.tlb) file. The browser then displays the contents of the file.

Building SDK Samples

This sample uses the following keywords:

addresmenu; adjustmenus; alert; assert; assertfail; c2pstr; checkresult; cleanup; cogetmalloc; commdlgextendederror; createdialog; createlistbox; data_seg; debugbreak; debugstr; declare_routine_desc; defined; dialogselect; dim; disableitem; disposhandle; dodialogevent; doevent; domenucommand; dragwindow; drawlistbox; drawmenubar; enable; enableitem; eventloop; exit; exittoshell; failed; fatal; fillmemberlist; findwindow; flushevents; framerect; free; frontwindow; getditem; getdlgitem; getdocumentation; getfilename; getfuncdesc; getitem; getlibattr; getmenuitemtext; getmhandle; getnames; getnewdialog; getnewmbar; getopenfilename; getport; getscode; gettypeattr; gettypeinfo; gettypeinfocount; gettypeinfotype; getvardesc; globaltolocal; hilitemenu; init_routine_desc; initcursor; initdialogs; initfonts; initgraf; initmenus; initolemanager; initwindows; insetrect; isappwindow; isdawindow; isdialogevent; laddrow; lclick; ldelrow; ldodraw; lgetselect; lnew; loadtypelib; lsetcell; lsetselect; lupdate; maxapplzone; memfree; memset; menukey; menuselect; messagebox; methoderror; multibytetowidechar; newrgn; oleinitialize; olestr; oleuninitialize; opendeskacc; openfile; opentypelib; outputdebugstring; p2cstr; paramtext; postquitmessage; quit; release; releasefuncdesc; releasetlibattr; releasetypeattr; releasevardesc; routine_desc; selectwindow; senddlgitemmessage; sendmessage; setcursor; setditem; setitext; setmenubar; setport; setpt; setrect; setselectedmember; setselectedparam; setselectedtype; sfgetfile; showwindow; sprintf; strcat; strcpy; stringfromclsid; strncpy; switch; sysallocstring; sysfreestring; systemclick; systemedit; teinit; tstr; uninit; uninitolemanager; unused; updatememberinfo; waitnextevent; widechartomultibyte; winmain; wndproc; xadddlgitemlist; xclrdlgitemlist; xsetdlgitemtext


COM Tutorial Samples

Click to open or copy the files for the COM Tutorial samples.

These are the COM Tutorial samples. These code samples include an integrated tutorial narrative that covers the foundations of COM technology; see the samples\sdk\com\tutsamp\tutorial.txt file. Among other things, the tutorial.txt file discusses the order in which you should do the tutorial samples.

All source files for these samples use C++. MFC is not used. The series is for advanced programmers using their proficiency in C++ Win32 programming to code COM and ActiveX applications.


Apputil: Application Utility Library

Click to open or copy the AppUtil project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

The Apputil library provides utility classes and functions that are useful for making simple C++ Win32® Windows applications.

For functional descriptions and a code tour of Apputil, see the Code Tour section in Apputil.txt (one of the Apputil project files).

For details on setting up your system to build and test the code samples, see samples\sdk\com\tutsamp\tutorial.txt. The supplied Makefile is Microsoft NMAKE-compatible. To create a debug build, issue the nmake command in the Command Prompt window.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

_tsplitpath; alloc; ansitouc; assert; beginpaint; ckhr; clear; closeclipboard; closehandle; cmdexec; cmsgbox; cmsglog; cogetmalloc; copy; cotaskmemfree; create; createcolorscalepalette; createfile; createmutex; createpalette; createprocess; createserverlog; createsolidbrush; createwindow; createwindowex; csendlog; cthreaded; cvirwindow; dcomok; defined; defwindowproc; delaybox; delete_pointer; deleteobject; dialogboxparam; dialogproc; emptyclipboard; enddialog; endpaint; error; errorbox; errorid; failed; fileexist; fillrect; formatmessage; getclassbrush; getclasslong; getclientrect; getcurrentthreadid; getdevicecaps; getdlgitem; geterrormsg; getexename; gethwnd; getinstance; getmodulefilename; getmodulehandle; getopenfilename; getprocaddress; gettickcount; getwindowlong; globalalloc; globalfree; globallock; globalunlock; goweb; hrmsg; hrmsgid; invalidaterect; iswindow; loadstring; log; logassert; logerror; logf1; logf2; logf3; logging; logid; logtoserver; lrandom; lstrcat; lstrcpy; lstrlen; makefamilypath; makelangid; memset; messagebox; movewindow; msg; msgfmt; msgfmtid; msgid; multibytetowidechar; note; notefmt; notefmtid; noteid; odf1; odf2; odf3; ods; openclipboard; outputdebugfmt; outputdebugstring; ownthis; paintwindow; paletteindex; postmessage; readhelp; readsource; readtutorial; realizepalette; release; release_interface; releasemutex; resize; rgb; selectpalette; sendmessage; setclient; setclipboarddata; setfocus; setmapmode; setrect; setviewportextex; setviewportorgex; setwindowextex; setwindowlong; setwindowtext; shellexecute; showdialog; skipansi; stgcreatedocfile; stgisstoragefile; stgopenstorage; stringfromguid2; succeeded; switch; text; uctoansi; unownthis; va_start; waitforsingleobject; warning; widechartomultibyte; windowproc; writefmtusertypestg; wsprintf; wvsprintf


Aptclien: Client of Apt-Threaded, Out-of-Process Local Server

Click to open or copy the Aptclien project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Aptserve sample.

The Aptclien sample shows a client of the Aptserve apartment-threaded server. Aptclien is a client of the multiple component apartments in Aptserve. Its main purpose is to exercise and reveal for study the multiple apartments in the Aptserve local out-of-process server. The Remclien sample, run in conjunction with Aptclien, shows the effects of multiple clients on the Aptserve multithreaded server, with one client controlling from a remote machine.

Aptclien manipulates objects that represent various automobiles and are from other samples in this tutorial series (see samples\sdk\com\tutsamp\tutorial.txt), with the following interfaces: ICar, IUtility, and ICruise. Aptclien works in conjunction with the separate Aptserve.exe, which provides the COCar, COUtilityCar, and COCruiseCar COM objects.

Aptclien.exe creates its own COUtilityCruiseCar COM object by reusing the COCruiseCar COM object by containment and augmenting it with a native implementation of the IUtility interface. Like Locclien, Aptclien's COUtilityCruiseCar composite object reuses COCruiseCar by containment. However, because COCruiseCar and COCar are in different apartments, COCruiseCar reuses COCar by containment.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; adjust; checkmenuitem; cimpicar; cimpicruise; cimpiutility; clear; clutch; cmainwindow; cocreateinstance; cofreeunusedlibraries; cogetclassobject; coinitialize; copy; couninitialize; coutilitycruisecar; create; createinstance; createutilitycruisecar; defined; defwindowproc; delete_pointer; dispatchmessage; domenu; engage; errorbox; failed; findwindow; getdc; gethwnd; getinterface; getlasterror; getmenu; getmenustate; getmessage; getsystemmetrics; gettextmetrics; getusername; initapplication; initinstance; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; log; logerror; logf1; logging; logid; makefamilypath; makeintresource; messageboxa; msg; offroad; outputdebugstring; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; registerclassex; release; release_interface; releasedc; resize; shift; showdialog; showwindow; speed; stdmethodimp_; steer; style; succeeded; text; translateaccelerator; translatemessage; unicodeok; updatewindow; winch; windowproc; winmain


Aptserve: Apartment Model Local Server

Click to open or copy the Aptserve project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register and Marshal samples.

The apartment model is a way of COM programming that associates a single thread of execution with a family of COM objects so that an object in the family will be executed only on the thread of its apartment. When this arrangement is constructed in a server, COM plays a role in enforcing the single-thread rule for objects in the apartment by ensuring that client calls on any thread to objects in a server apartment will be executed only on the thread of the apartment.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

_beginthreadex; addref; adjust; apt_init_data; aptthreadproc; cfcar; cfcruisecar; cfutilitycar; cimpicar; cimpiclassfactory; cimpicruise; cimpiutility; clear; closefactories; closehandle; clutch; cmainwindow; cocar; cocreateinstance; cocruisecar; coinitialize; copy; coregisterclassobject; corevokeclassobject; couninitialize; coutilitycar; create; createinstance; createserverlog; cserver; defined; defwindowproc; delete_pointer; dispatchmessage; domenu; engage; errorbox; failed; findwindow; getlasterror; getmenu; getmessage; getmodulefilename; getsystemmetrics; getusername; initapplication; initinstance; iswindow; loadcursor; loadicon; loadimage; loadstringa; lock; lockserver; logerror; logf1; logf2; logid; logtoserver; lstrcat; lstrcmpia; lstrcpy; lstrlen; makeintresource; messageboxa; objectsdown; objectsup; offroad; openfactories; ownthis; postmessage; postquitmessage; postthreadmessage; queryinterface; rclsid; regclosekey; regcreatekeyex; regdeletekey; registerclassex; registerserver; regsetvalueex; release; release_interface; releasemutex; setclient; setregkeyvalue; shift; showdialog; showwindow; speed; startthread; stdmethodimp_; steer; stringfromguid2; style; succeeded; text; translatemessage; unicodeok; unlock; unownthis; unregisterserver; updatewindow; waitformultipleobjects; waitforsingleobject; winch; windowproc; winmain; wsprintf


COMobj: COM Objects in a DLL

Click to open or copy the COMobj project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note You must build COMobj.DLL before building COMuser.

The COMobj.dll offers several COM object classes, which relate to automobiles. Because COMobj.dll supports no object handlers, class factories, full in-process servers, or marshaling, it is not a full-featured OLE server. Rather, it is a primitive precursor to an OLE in-process server.

This DLL exposes the following COM objects: COCar, COUtilityCar, and COCruiseCar. Appropriate create functions are exported from this DLL: CreateCar, CreateUtilityCar, and CreateCruiseCar.

In this sample, COMobj works with the COMuser code sample to show how an EXE client (COMuser.exe) calls COM object creation services and manipulates the COM objects that are created.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; adjust; cimpicar; cimpicruise; cimpiutility; clutch; cocar; cocruisecar; comobjaboutbox; comobjinitmsglog; coutilitycar; createcar; createcruisecar; createutilitycar; defined; delete_pointer; dllmain; engage; getlasterror; getusername; log; logf1; makeintresource; offroad; queryinterface; release; release_interface; shift; showdialog; speed; stdentry_; stdmethodimp_; steer; succeeded; unicodeok; winch


COMuser: User of COM Objects in COMobj.DLL

Click to open or copy the COMuser project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the COMobj sample.

The COMuser sample presents a series of COM objects, several of which are introduced in the COMobj sample. These objects represent various types of cars, and they expose the following interfaces: ICar, IUtility, and ICruise. COMuser works in conjunction with the separate COMobj.dll, which creates COCar, COUtilityCar, and COCruiseCar COM objects.

COMuser.exe creates its own COUtilityCruiseCar COM object, which is constructed by reusing the COCruiseCar COM object by aggregation and augmenting it with the IUtility interface. Because the COCruiseCar COM object class is also an aggregate, that is, it reuses an inner COCar object by aggregation, COMuser illustrates nested aggregation of COM objects.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; adjust; checkmenuitem; cimpiutility; clear; clutch; cmainwindow; coinitialize; comobjaboutbox; comobjinitmsglog; copy; couninitialize; coutilitycruisecar; create; createcar; createcruisecar; createutilitycar; createutilitycruisecar; defined; defwindowproc; delete_pointer; dispatchmessage; domenu; engage; errorbox; failed; getdc; gethwnd; getinterface; getlasterror; getmenu; getmenustate; getmessage; getsystemmetrics; gettextmetrics; getusername; initapplication; initinstance; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; log; logerror; logf1; logging; logid; makefamilypath; makeintresource; messageboxa; offroad; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; registerclassex; release; release_interface; releasedc; resize; shift; showdialog; showwindow; speed; stdmethodimp_; steer; style; succeeded; text; translateaccelerator; translatemessage; unicodeok; updatewindow; winch; windowproc; winmain


Conclien: Client of Connectable Components

Click to open or copy the Conclien project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

The Conclien sample creates and uses the connectable COBall COM object that is housed in the Conserve server as the DllSndBall component. The Conclien client creates one COBall object and controls it through the IBall interface that the object exposes. Conclien sets up a system timer to use IBall to periodically move the ball and obtain updates of data describing the COBall object's position, size, and color. It uses that data, obtained by calling the IBall::GetBall method, to display graphical snapshot images of the ball in the client's main window.

Conclien also implements a COBallSink COM object and connects it to an appropriate connection point in the server's COBall object. In response to the system's WM_TIMER timer messages, which are sent periodically to the display window, Conclien uses the IBall interface to move and paint images of the ball. COBall also sends notifications back to Conclien, using the IBallSink interface, when the ball bounces off of a side of its bounding rectangle. Conclien responds to these event notifications to produce a different sound when the ball collides with a Top, Side, or Bottom boundary of the display window.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; advise; beep; beginpaint; bouncebottom; bounceleft; bounceright; bounceside; bouncetop; cguiball; checkmenuitem; cimpiballsink; cmainwindow; coballsink; cocreateinstance; cofreeunusedlibraries; coinitialize; combinergn; connectballsink; couninitialize; create; createellipticrgn; createrectrgn; createsolidbrush; defined; defwindowproc; delete_pointer; deleteobject; disconnectballsink; dispatchmessage; domenu; endpaint; errorbox; fillrect; fillrgn; findconnectionpoint; getball; getclassbrush; getclientrect; getconnectionpoint; getdc; gethwnd; getlasterror; getmenu; getmenustate; getmessage; getstockobject; getsystemmetrics; getusername; initapplication; initinstance; killtimer; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; makefamilypath; makeintresource; messageboxa; move; paintball; paintwin; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; registerclassex; release; release_interface; releasedc; reset; restart; rgb; settimer; showdialog; showwindow; stdmethodimp_; style; succeeded; text; translateaccelerator; translatemessage; unadvise; unicodeok; updatewindow; windowproc; winmain


Conserve: Connectable COM Objects in an In-Process Server

Click to open or copy the Conserve project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register sample.

The Conserve sample shows how to construct a connectable COM object, COBall, in a thread-safe in-process server. To expose connectable object features, COBall implements the standard COM interface, IConnectionPointContainer. COBall also implements the custom interface, IBall, that is introduced in the Freserve sample.

The principal focus of Conserve is the connectable object support in COBall and how connected clients are notified of ball events. Conserve works with the Conclien client sample.

Conserve's COBall implements a virtual moving ball similar to the one coded in the Freserve sample. However, rather than Freserve's free-threaded COM object, Conserve houses COBall in an apartment model server. COBall defines the internal logic of a moving ball that exists within a specified two-dimensional bounding rectangle. COBall provides only a description of a ball. It is up to the client to create a graphical representation based on the data managed in COBall.

Clients move the virtual ball using its IBall interface. COBall's internal logic will bounce the ball when it collides with a boundary. The client can obtain the ball's current position, size, and color to permit display of the ball's moving image. The client can also use the connection facilities of COBall to receive notifications of ball bounce events. The Conclien sample uses these connection facilities to produce various sounds when the ball bounces.

Conserve uses the CThreaded facility in Apputil for thread safety, as in the Freserve sample. COBall objects are derived from the CThreaded class and inherit its OwnThis and UnOwnThis methods. These methods allow only one thread at a time to have access to the Conserve server and to COBall objects managed by the server.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; addregnamedvalue; advise; bouncebottom; bounceleft; bounceright; bouncetop; canunloadnow; cballthread; cfball; checkbounce; cimpiball; cimpiclassfactory; cimpiconnectionpointcontainer; clear; clone; coball; coconnectionpoint; coenumconnectionpoints; coenumconnections; createinstance; cserver; cxform; defined; delete_pointer; dllcanunloadnow; dllgetclassobject; dllmain; dllregisterserver; dllunregisterserver; enumconnectionpoints; enumconnections; failed; findconnectionpoint; findslot; findthread; getball; getconnectioninterface; getconnectionpointcontainer; getcurrentthreadid; getdimensions; getdirection; getlasterror; getmodulefilename; getposition; getslot; getusername; lock; lockserver; lrandom; lstrcat; lstrcpy; lstrlen; max; memset; move; next; notifysinks; objectsdown; objectsup; ownthis; point; queryinterface; regclosekey; regcreatekeyex; regdeletekey; regopenkeyex; regsetvalueex; release; release_interface; reset; rgb; scale; setdimensions; setdirection; setposition; setregkeyvalue; skip; stdentry_; stdmethodimp_; stringfromguid2; succeeded; text; trans; unadvise; unicodeok; unlock; unownthis; wsprintf


DCDMarsh: Proxy Server and Stub Server

Click to open or copy the DCDMarsh project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register sample.

The DCDMarsh sample builds the DCDMARSH.DLL proxy/stub server. DCDMARSH.DLL works with DCDSERVE.EXE and DCOMDRAW.EXE to provide standard marshaling of the ISharePaper and IPaperSink custom interfaces across process and machine boundaries.

In this set of samples, DCDMARSH.DLL is the marshaling server, DCDSERVE.EXE is the out-of-process component server, and DCOMDRAW.EXE is the client. As a Distributed COM (DCOM) sample, DCOMDRAW.EXE creates and uses components housed in the DCDSERVE.EXE server. Multiple DCOMDraw clients running on multiple computers connected to a network can access a shared single COPaper object housed in the DCDSERVE.EXE server.

Compared to previous samples requiring marshaling across process or machine boundaries, DCDMarsh requires no significant differences in how you provide standard marshaling for your custom interfaces. This lesson is therefore almost completely based on the standard marshaling techniques that were used in the Marshal sample.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.


DCDServe: DCOM Server Using Security

Click to open or copy the DCDServe project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build (or otherwise register) the DCDMarsh sample on the client and server, and you must first build the Register sample.

The DCOMDraw, DCDServe, and DCDMarsh samples together form a distributed drawing application. Using Distributed COM (DCOM) technology, they allow users on different client machines in a network to interactively draw on a shared drawing. All DCOMDraw clients see the same drawing and any client can take ownership of the pen to draw. The user of DCOMDraw can use a mouse or tablet device to draw in the client window and can choose the color and width of the electronic ink. As clients draw, the application echoes the drawing activity from DCDServe to all connected clients using DCOM over the network. Although these samples do not build an optimized and complete application, the functionality is suggestive of the shared whiteboards offered by some workgroup applications.

In addition to providing a standard way to construct applications from reusable software components, COM technology fosters a strong architectural separation between client and server. This separation has been the repeated pattern in other samples of this series. For example, the Stoserve server houses a COPaper COM object that is used by the Stoclien client. Although they are a client/server pair, the Stoclien and Stoserve samples use an in-process server for the COPaper COM object. With the DCOMDraw and DCServe client/server samples, the architectural separation between client and server is retained but the COPaper COM object is housed in an out-of-process server, DCDServe. COPaper implements a custom ISharePaper interface to permit multiple clients to use the COPaper object simultaneously. The application also requires a DCDMarsh server to provide standard marshaling for the custom interfaces used across process and machine boundaries.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; addregnamedvalue; advise; cfpaper; cimpiclassfactory; cimpiconnectionpointcontainer; cimpisharepaper; client; clone; closefactories; cmainwindow; coconnectionpoint; coenumconnectionpoints; coenumconnections; coinitialize; coinitializesecurity; copaper; coregisterclassobject; corevokeclassobject; couninitialize; create; createinstance; createstream; cserver; dcomok; defined; defwindowproc; delete_pointer; dispatchmessage; domenu; enumconnectionpoints; enumconnections; erase; erased; errorbox; failed; findconnectionpoint; findslot; getconnectioninterface; getconnectionpointcontainer; getexename; getink; getlasterror; getmenu; getmessage; getmodulefilename; getslot; getsystemmetrics; getusername; initapplication; initinstance; initpaper; inkdraw; inkstart; inkstop; iswindow; load; loadcursor; loaded; loadicon; loadimage; loadstringa; lock; locked; lockserver; lstrcat; lstrcmpia; lstrcpy; lstrlen; makefamilypath; makeintresource; makelong; memcpy; memset; messageboxa; next; nextslot; notifysinks; objectfirst; objectqi; objectsdown; objectset; objectsup; openfactories; openstream; ownthis; postmessage; postquitmessage; queryinterface; regclosekey; regcreatekeyex; regdeletekey; registerclassex; registerclipboardformat; registerserver; regopenkeyex; regsetvalueex; release; release_interface; reset; resize; resized; rgb; save; saved; setregkeyvalue; showdialog; skip; stdmethodimp_; stgcreatedocfile; stgisstoragefile; stgopenstorage; stringfromguid2; style; succeeded; text; translatemessage; unadvise; unicodeok; unlock; unlocked; unownthis; unregisterserver; windowproc; winmain; writeclassstg; writefmtusertypestg; wsprintf


DCOMDraw: Client of Structured Storage Server

Click to open or copy the DCOMDraw project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build (or otherwise register) the DCDMarsh sample on the client and server, and you must first build DCDServe on the remote machine.

The DCOMDraw, DCDServe, and DCDMarsh samples together form a distributed drawing application. Using Distributed COM (DCOM) technology, they allow users on different client machines in a network to interactively draw on a shared drawing. All DCOMDraw clients see the same drawing and any client can take ownership of the pen to draw. The user of DCOMDraw can use a mouse or tablet device to draw in the client window and can choose the color and width of the electronic ink. As clients draw, the application echoes the drawing activity from DCDServe to all connected clients using DCOM over the network. Although these samples do not build an optimized and complete application, the functionality is suggestive of the shared whiteboards offered by some workgroup applications.

Although DCOMDraw, DCDServe, and DCDMarsh work on the same machine across process boundaries, the main goal is to provide a distributed application that enables multiple DCOMDraw clients on different machines to access a single shared drawing object housed in a DCDServe server running on a common server machine. A typical scenario would have numerous client machines connected to an intranet consisting of a Windows NT network domain or peer-to-peer workgroup. DCOMDraw can run on any of these client machines. DCDServe is installed and runs on a common server machine in the domain. The user of the DCOMDraw client can interactively choose the remote server machine to determine which DCDServe COM server to use for the shared drawing.

DCDServe manages a shared, single COPaper COM object that models a sheet of white drawing paper. Clients can use the methods of the COPaper object to draw on the paper surface using "ink" of specified color and width. This functionality is outwardly similar to the Scribble tutorial samples included with Microsoft Visual C++. The drawing paper features of COPaper objects are exposed to DCOMDraw clients by a custom ISharePaper interface. COPaper implements the ISharePaper interface. A clear architectural distinction is kept between client and server. No graphical user interface (GUI) is provided by the COPaper object. It relies on the DCOMDraw client for all GUI behavior. COPaper encapsulates only the server-based capture and storage of the drawn ink data.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; advise; ansitouc; asksave; beep; beginpaint; cguipaper; checkmenuitem; choosecolor; cimpipapersink; clearwin; cmainwindow; cocreateinstance; cocreateinstanceex; cofreeunusedlibraries; coinitialize; coinitializesecurity; connectpapersink; copapersink; couninitialize; create; createpen; dcomok; defined; defwindowproc; delete_pointer; deleteobject; dialogproc; disconnectpapersink; dispatchmessage; domenu; enddialog; endpaint; erase; erased; errorbox; failed; fillrect; findconnectionpoint; getclassbrush; getclientrect; getconnectionpoint; getdc; getdlgitem; getdlgitemtext; gethwnd; getink; getlasterror; getmenu; getmessage; getstockobject; getsystemmetrics; getusername; hrmsg; initapplication; initinstance; initpaper; inkcolor; inkdraw; inkstart; inkstop; inkwidth; lineto; load; loadaccelerators; loadcursor; loaded; loadicon; loadimage; loadlocal; loadremote; loadstring; loadstringa; lock; locked; lstrcat; lstrcpy; makefamilypath; makeintresource; master; memset; messagebox; messageboxa; movetoex; paintwin; pickcolor; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; registerclassex; release; release_interface; releasecapture; resize; resized; resizewin; rgb; save; saved; selectobject; setcapture; setclasslong; setcursor; setdlgitemtext; setfocus; setpencur; setwindowpos; setwindowtext; showdialog; showwindow; stdmethodimp_; style; succeeded; text; translateaccelerator; translatemessage; unadvise; unicodeok; unlocked; updatewindow; windowproc; winmain


DLLclien: Client of DLL Server

Click to open or copy the DLLclien project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the DLLserve sample.

The DLLclien sample illustrates nested aggregation of COM objects. DLLclien presents a series of COM objects, several of which are introduced in the DLLserve code sample. These objects represent various types of cars, and they expose the following interfaces: ICar, IUtility, and ICruise. DLLclien works in conjunction with the separate DLLserve.dll, which creates COCar, COUtilityCar, and COCruiseCar COM objects.

DLLclien.exe creates its own COUtilityCruiseCar COM object, which is constructed by reusing the COCruiseCar COM object by aggregation and augmenting it with the IUtility interface. Because the COCruiseCar COM object class is also an aggregate—that is, it reuses an inner COCar object by aggregation—DLLclien illustrates nested aggregation of COM objects.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

aboutbox; addref; adjust; checkmenuitem; cimpiutility; clear; clutch; cmainwindow; cocreateinstance; cofreeunusedlibraries; cogetclassobject; coinitialize; copy; couninitialize; coutilitycruisecar; create; createinstance; createutilitycruisecar; defined; defwindowproc; delete_pointer; dispatchmessage; domenu; engage; errorbox; errorid; failed; getdc; gethwnd; getinterface; getlasterror; getmenu; getmenustate; getmessage; getsystemmetrics; gettextmetrics; getusername; initapplication; initinstance; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; log; logerror; logf1; logging; logid; makefamilypath; makeintresource; messageboxa; offroad; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; registerclassex; release; release_interface; releasedc; resize; shift; showdialog; showwindow; speed; stdmethodimp_; steer; style; succeeded; text; translateaccelerator; translatemessage; unicodeok; updatewindow; winch; windowproc; winmain


DLLserve: COM Server in a DLL

Click to open or copy the DLLserve project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register sample

The DLLserve sample begins with the automobile COM objects of the COMobj sample and refashions them into components. To do so requires little change to the COM objects themselves (COCar, COUtilityCar, and COCruiseCar). But to make them components, this sample introduces new facilities to house them in a DLL COM server. These facilities include class factories for each component and a CarSample utility component that allows clients to see logged behavior in the server itself.

The DLL server provides the following components: Car, UtilityCar, CruiseCar, and CarSample.

In the series of COM tutorial samples, DLLserve works with the DLLclien code sample to illustrate DLLSserve's COM server facilities for creating components that can be used by an EXE client and the subsequent manipulation of those components by DLLclien.exe.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

aboutbox; addref; adjust; cfcar; cfcarsample; cfcruisecar; cfutilitycar; cimpicar; cimpiclassfactory; cimpicruise; cimpisample; cimpiutility; clutch; cocar; cocarsample; cocreateinstance; cocruisecar; coutilitycar; create; createinstance; cserver; defined; delete_pointer; dllcanunloadnow; dllgetclassobject; dllmain; dllregisterserver; dllunregisterserver; engage; failed; getlasterror; getmodulefilename; getusername; interlockeddecrement; interlockedincrement; lock; lockserver; log; logf1; logf2; lstrcat; lstrcpy; lstrlen; makeintresource; objectsdown; objectsup; offroad; queryinterface; regclosekey; regcreatekeyex; regdeletekey; regsetvalueex; release; release_interface; setregkeyvalue; shift; showdialog; speed; stdentry_; stdmethodimp_; steer; stringfromguid2; succeeded; text; unicodeok; unlock; winch; wsprintf


DLLskel: DLL Skeleton

Click to open or copy the DLLskel project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the DLLuser sample. You must build DLLSKEL.DLL before building DLLUSER.

The DLLskel sample introduces the basic DLL (dynamic link libraries) skeleton, which can be used as a point of departure for more complex COM DLLs. It is used as a base for other COM samples. In this series of COM samples, DLLskel works with the DLLuser code sample to illustrate how DLLskel's function services are called by an .EXE consumer.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

closehandle; createfilemapping; defined; delete_pointer; dllaboutbox; dllhellobox; dllmain; getlasterror; getusername; interlockedincrement; makeintresource; mapviewoffile; memset; notefmtid; showdialog; stdentry_; unicodeok; unmapviewoffile


DLLuser: DLL User Application Skeleton

Click to open or copy the DLLuser project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the DLLskel sample.

The DLLuser sample introduces the basic skeleton for an EXE that implicitly loads a Win32® DLL and makes calls to it. In this case, DLLuser works with DLLskel.dll from the DLLskel lesson. You must build DLLskel before you try to build DLLuser.exe, because the DLLskel makefile copies the necessary DLLskel.h, DLLskel.lib, and DLLskel.dll files it produces into the DLLuser sibling directory.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

cmainwindow; coinitialize; couninitialize; create; defined; defwindowproc; delete_pointer; dispatchmessage; dllaboutbox; dllhellobox; domenu; errorbox; getdc; gethwnd; getlasterror; getmessage; getsystemmetrics; gettextmetrics; getusername; initapplication; initinstance; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; makefamilypath; makeintresource; messageboxa; postmessage; postquitmessage; readhelp; readsource; readtutorial; registerclassex; releasedc; showdialog; showwindow; style; succeeded; text; translateaccelerator; translatemessage; unicodeok; updatewindow; windowproc; winmain


Exeskel: Exe Skeleton

Click to open or copy the Exeskel project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

The Exeskel sample introduces the basic application skeleton, which can be used as a point of departure for more complex COM applications. It is used as a base for the COM series of code samples. Of particular interest in this code sample is the support for initializing and uninitializing the COM libraries. The general use of Apputil to construct this application is also worthy of study.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

cmainwindow; coinitialize; couninitialize; create; defined; defwindowproc; delete_pointer; dispatchmessage; domenu; errorbox; getdc; gethwnd; getlasterror; getmessage; getsystemmetrics; gettextmetrics; getusername; initapplication; initinstance; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; makefamilypath; makeintresource; messageboxa; postmessage; postquitmessage; readhelp; readsource; readtutorial; registerclassex; releasedc; showdialog; showwindow; style; succeeded; text; translateaccelerator; translatemessage; unicodeok; updatewindow; windowproc; winmain


Freclien: Multithreaded Client of a Free-Threaded Server

Click to open or copy the Freclien project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Freserve sample.

The Freclien sample spawns multiple threads to create and use the COBall COM object provided by the Freserve free-threaded server. The COBall object itself spawns no threads; instead, it passively responds to IBall interface requests from many possible client threads. The Freclien client creates and controls one COBall object through the IBall interface that the object exposes. As three of Freclien's threads move the ball through calls to IBall::Move, the remaining main thread uses a system timer to obtain timed updates of the COBall object's position, size, and color. This main thread uses that data, obtained by calling the IBall::GetBall method, to display graphical snapshot images of the ball in the client's main window.

As explained in the Freserve sample, the COBall object internally updates its color property to reflect the last thread that called the object's Move method. The display thread uses this data for each ball image it displays. As the ball moves, it changes color to reflect each thread that moves the ball. As the ball moves, it also leaves a trail that provides a striking visual history of these passing threads. This trail demonstrates that, with COM's free-threading model, every thread that makes interface requests to the same object accesses the object on the calling thread. Each different color of the single ball object represents a different calling thread.

This free-threading model is in contrast to the apartment model presented in the Aptserve and Aptclien samples. In apartment model threading, each COM object is associated with an apartment thread. Calls from multiple client threads are switched by COM to the thread of the apartment that owns the object. Only one thread, the object's apartment thread, is permitted to execute the methods of the object. This provides a serialization of access to the object's data.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; ballthreadproc; beginpaint; cguiball; closehandle; cmainwindow; cocreateinstance; cofreeunusedlibraries; coinitializeex; couninitialize; create; createellipticrgn; createsolidbrush; createthread; dcomok; defined; defwindowproc; delete_pointer; deleteobject; dispatchmessage; domenu; endpaint; errorbox; failed; fillrect; fillrgn; getball; getclassbrush; getclientrect; getdc; gethwnd; getlasterror; getmenu; getmessage; getstockobject; getsystemmetrics; gettickcount; getusername; hrmsg; initapplication; initinstance; killtimer; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; makefamilypath; makeintresource; messageboxa; move; paintball; paintwin; postmessage; postquitmessage; readhelp; readsource; readtutorial; registerclassex; release; release_interface; releasedc; reset; restart; rgb; settimer; showdialog; showwindow; style; succeeded; text; translateaccelerator; translatemessage; unicodeok; updatewindow; waitformultipleobjects; windowproc; winmain


Freserve: Free-Threaded COM Objects in an In-Process Server

Click to open or copy the Freserve project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register sample.

The Freserve sample shows how to construct a COM object in a free-threaded in-process server. This sample departs from the truck metaphor and associated interfaces used in other samples of this series. Freserve introduces a new custom interface, IBall, and a new COM object, COBall. COBall implements the IBall interface. Both COBall and its in-process server are coded to support COM free threading in anticipation of their use by the free-threaded client, Freclien.

The CThreaded facility in Apputil is used to achieve thread safety as it is in the Aptserve sample. COBall objects are derived from the CThreaded class and so inherit its OwnThis and UnOwnThis methods. These methods enforce mutually exclusive access to the Freserve server and to COBall objects managed by the server.

Freserve works with the Freclien code sample to illustrate Freserve's COM server facilities in a free-threaded server and the subsequent manipulation of its components by a free-threaded client.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; addregnamedvalue; canunloadnow; cballthread; cfball; checkbounce; cimpiball; cimpiclassfactory; clear; coball; createinstance; cserver; cxform; defined; delete_pointer; dllcanunloadnow; dllgetclassobject; dllmain; dllregisterserver; dllunregisterserver; failed; findthread; getball; getcurrentthreadid; getdimensions; getdirection; getlasterror; getmodulefilename; getposition; getusername; lock; lockserver; lrandom; lstrcat; lstrcpy; lstrlen; max; move; objectsdown; objectsup; ownthis; point; queryinterface; regclosekey; regcreatekeyex; regdeletekey; regopenkeyex; regsetvalueex; release; reset; rgb; scale; setdimensions; setdirection; setposition; setregkeyvalue; stdentry_; stdmethodimp_; stringfromguid2; text; trans; unicodeok; unlock; unownthis; wsprintf


Licclien: Client of Licensed DLL Server

Click to open or copy the Licclien project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Licserve sample.

The Licclien sample examines how a client application uses licensed components provided by a COM server. Licclien works with the COM servers of two other samples, Licserve and Dllserve. It manipulates a set of components similar to those presented in Dllclien: COCar, COUtilityCar, COLicCruiseCar, and COUtilityCruiseCar. In this lesson, the COCar and COUtilityCar components are obtained, as they were in Dllclien, from the Dllserve server. This sample, however, uses a new licensed version of the COCruiseCar component that is presented in Dllserve and Dllclien. This licensed component, COLicCruiseCar, is housed in a different server, Licserve.

Like Dllclien, Licclien.exe creates its own COUtilityCruiseCar COM object, which is constructed by reusing the licensed COLicCruiseCar COM object by aggregation and augmenting it with a native IUtility interface. Because the COLicCruiseCar COM object class is a licensed aggregatable component, Licclien illustrates nested aggregation involving a licensed component.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

aboutbox; addref; adjust; checkmenuitem; cimpiutility; clear; clutch; cmainwindow; cocreateinstance; cofreeunusedlibraries; cogetclassobject; coinitialize; copy; couninitialize; coutilitycruisecar; create; createinstancelic; createutilitycruisecar; defined; defwindowproc; delete_pointer; dispatchmessage; domenu; engage; errorbox; errorid; failed; getdc; gethwnd; getinterface; getlasterror; getmenu; getmenustate; getmessage; getsystemmetrics; gettextmetrics; getusername; initapplication; initinstance; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; log; logerror; logf1; logging; logid; makefamilypath; makeintresource; messageboxa; offroad; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; registerclassex; release; release_interface; releasedc; requestlickey; resize; shift; showdialog; showwindow; speed; stdmethodimp_; steer; style; succeeded; sysfreestring; text; translateaccelerator; translatemessage; unicodeok; updatewindow; winch; windowproc; winmain


Licserve: Licensed DLL Server

Click to open or copy the Licserve project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register sample.

The Licserve sample introduces licensed components. Licserve modifies the COCruiseCar component of the DLLserve code sample and houses it as a licensed LicCruiseCar component in the Licserve.dll COM server. This in-process server provides the components LicCruiseCar and LicCarSample. LicCarSample is the utility component that allows clients access to this server's logged behavior.

Licserve provides class factories for each of these components. The class factory for the LicCruiseCar component implements IClassFactory2, instead of the usual IClassFactory, to provide the licensing mechanism for this component. The LicCarSample component is not licensed and thus implements IClassFactory.

Licserve works with the Licclien code sample to illustrate Licserve's COM server facilities for creating licensed components and supporting the subsequent manipulation of those components by the Licclien.exe client.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

aboutbox; addref; adjust; cfliccarsample; cfliccruisecar; checklicense; cimpiclassfactory; cimpicruise; cimpisample; closehandle; cocreateinstance; coliccarsample; coliccruisecar; create; createfile; createinstance; createinstancelic; createliccruisecar; cserver; defined; delete_pointer; dllcanunloadnow; dllgetclassobject; dllmain; dllregisterserver; dllunregisterserver; engage; failed; getlasterror; getlicinfo; getmodulefilename; getusername; interlockeddecrement; interlockedincrement; lock; lockserver; log; logf1; logf2; lstrcat; lstrcpy; lstrcpya; lstrlen; lstrlena; makefamilypath; makeintresource; mbstowcs; memcmp; objectsdown; objectsup; queryinterface; readfile; regclosekey; regcreatekeyex; regdeletekey; regsetvalueex; release; release_interface; requestlickey; setregkeyvalue; showdialog; stdentry_; stdmethodimp_; stringfromguid2; succeeded; sysallocstring; sysfreestring; text; unicodeok; unlock; wsprintf


Locclien: Client of Out-of-process Local Server

Click to open or copy the Locclien project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Marshal sample, and you must build LOCSERVE.EXE before building or running Locclien.

The Locclien sample illustrates how a client can access and control components in an out-of-process local server. This sample presents the same series of automobile-related components that are used in other COM samples. The Locclien/Locserve client/server pair is analogous to the DLLclien/DLLserve pair. The main difference is that Locclien must cross process boundaries to access components in the out-of-process local server Locserve. In contrast, DLLclien can directly access components in the in-process server DLLserve.

The COM objects that Locclien manipulates are the automobile-related components of other samples, with the following interfaces: ICar, IUtility, and ICruise. Locclien works in conjunction with the separate Locserve.exe, which provides the COCar, COUtilityCar, and COCruiseCar COM objects.

Locclien.exe creates its own COUtilityCruiseCar COM object, which is constructed by reusing the COCruiseCar COM object by containment and augmenting it with a native implementation of the IUtility interface. Because the COCruiseCar COM object class is an aggregate—that is, it reuses an inner COCar object by aggregation—Locclien illustrates nesting COM objects by mixed reuse. The composite COUtilityCruiseCar object is constructed by containment reuse of COCruiseCar, another composite COM object. COCruiseCar is constructed by aggregation reuse of the COCar COM object. The composition of COUtilityCruiseCar is also interesting because the COUtilityCruiseCar object's containment of the COCruiseCar object crosses the process boundary between Locclien and the out-of-process local server Locserve.exe. Locclien thus relies on standard marshaling support for the custom interfaces it uses on the COCruiseCar object. This marshaling support is built separately as Marshal.dll in the Marshal sample.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; adjust; checkmenuitem; cimpicar; cimpicruise; cimpiutility; clear; clutch; cmainwindow; cocreateinstance; cofreeunusedlibraries; cogetclassobject; coinitialize; copy; couninitialize; coutilitycruisecar; create; createinstance; createutilitycruisecar; defined; defwindowproc; delete_pointer; dispatchmessage; domenu; engage; errorbox; failed; findwindow; getdc; gethwnd; getinterface; getlasterror; getmenu; getmenustate; getmessage; getsystemmetrics; gettextmetrics; getusername; initapplication; initinstance; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; log; logerror; logf1; logging; logid; makefamilypath; makeintresource; messageboxa; msg; offroad; outputdebugstring; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; registerclassex; release; release_interface; releasedc; resize; shift; showdialog; showwindow; speed; stdmethodimp_; steer; style; succeeded; text; translateaccelerator; translatemessage; unicodeok; updatewindow; winch; windowproc; winmain


Locserve: Local Server

Click to open or copy the Locserve project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note This sample requires a prior build of the Register and Marshal samples.

The Locserve sample works with the Locclien code sample to illustrate Locserve's out-of-process local server facilities for creating components that can be used by an EXE client and the subsequent manipulation of those components by Locclien.exe.

The Locserve sample begins with the automobile-related COM objects of the DLLserve sample and rehouses them in an out-of-process local server, Locserve.exe. To do so requires little change to the COM objects themselves (COCar, COUtilityCar, and COCruiseCar). This sample introduces the new facilities to house them in a out-of-process COM server, including class factories for each component.

This out-of-process server provides the following components: LocCar, LocUtilityCar, and LocCruiseCar.

For functional descriptions and a code tour of Locserve, see the Code Tour section in Locserve.txt (one of the Locserve project files). See also Locclien.txt in the sibling \Locclien directory for more details on the Locclien client application and how it works with Locserve.exe itself. You must build Locserve.exe before building or running Locclien. Locserve's makefile automatically registers Locserve's components in the registry. These components must be registered before Locserve is available to outside COM clients as a server for those components. This registration is done using the Register.exe utility built in the Register sample.

As an out-of-process local server, Locserve relies on standard marshaling for clients to use its interfaces across process boundaries. Such standard marshaling for the interfaces used in Locserve's COM objects is provided in the Marshal.dll server built in the Locclien sample.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; adjust; cfcar; cfcruisecar; cfutilitycar; cimpicar; cimpiclassfactory; cimpicruise; cimpiutility; clear; closefactories; clutch; cmainwindow; cocar; cocreateinstance; cocruisecar; coinitialize; copy; coregisterclassobject; corevokeclassobject; couninitialize; coutilitycar; create; createinstance; createserverlog; cserver; defined; defwindowproc; delete_pointer; dispatchmessage; domenu; engage; errorbox; failed; findwindow; getlasterror; getmenu; getmessage; getmodulefilename; getsystemmetrics; getusername; initapplication; initinstance; interlockeddecrement; interlockedincrement; iswindow; loadcursor; loadicon; loadimage; loadstringa; lock; lockserver; log; logerror; logf1; logid; logtoserver; lstrcat; lstrcmpia; lstrcpy; lstrlen; makeintresource; messageboxa; objectsdown; objectsup; offroad; openfactories; postmessage; postquitmessage; queryinterface; regclosekey; regcreatekeyex; regdeletekey; registerclassex; registerserver; regsetvalueex; release; release_interface; setclient; setregkeyvalue; shift; showdialog; showwindow; speed; stdmethodimp_; steer; stringfromguid2; style; succeeded; text; translatemessage; unicodeok; unlock; unregisterserver; updatewindow; winch; windowproc; winmain; wsprintf


Marshal: Standard Marshaling of Custom Interfaces

Click to open or copy the Marshal project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register sample.

The Marshal sample anticipates the interaction of client and out-of-process servers in the Locclien and Locserve samples. For the Locclien client to use the services in the Locserve server requires marshaling of the automobile-related interfaces used in the other COM samples. This code sample creates a standard marshaling server for the ICar, IUtility, and ICruise custom interfaces.

The Microsoft Interface Definition Language (MIDL) compiler is used to compile the interface specifications (expressed in MIDL in MICARS.IDL). MIDL.EXE is a utility provided as part of the Platform SDK. The MIDL compilation of MICARS.IDL produces additional source files: MICARS.H, MICARS_I.C, MICARS_P.C, and DLLDATA.C.

The Marshal sample works with the Locserve and Locclien code samples to illustrate a COM client using the interfaces on COM objects in an out-of-process local server. In these samples, only standard marshaling is used for the custom ICar, IUtility, and ICruise interfaces.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.


Marshal2: Self-Registration of Standard Marshaling Servers

Click to open or copy the Marshal2 project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register sample.

The Marshal2 sample shows an alternate and more advanced technique for building a proxy/stub marshaling DLL for the ICar, IUtility, and ICruise custom interfaces. The previous Marshal sample illustrates the system default method of producing the marshaling DLL. That method controls the conditional compilation of the DLLDATA.C file to generate default definitions for the DllMain, DllRegisterServer, and DllUnregisterServer functions in the DLL. Marshal2 does not generate these default functions. Instead, they are coded explicitly. Thus, this lesson has more detail on the content of these functions.

Although the default definitions of these functions are adequate for most programming, there may be occasions when you want more control over the content of the marshaling DLL. For example, you might want to perform some action within DllMain during DLL_PROCESS_ATTACH, you might want to code explicit control over the registration and unregistration of the marshaling server, or you might want to add standard module version information to the DLL resources. This sample covers these areas.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

dllmain; dllregisterserver; dllunregisterserver; getlasterror; getmodulefilename; getusername; lstrcat; lstrcpy; lstrlen; regclosekey; regcreatekeyex; regdeletekey; regsetvalueex; setregkeyvalue; stringfromguid2; text; unicodeok


Perclien: Client of Persistent Components

Click to open or copy the Perclien project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To run this sample, you must first build the Perserve, Pertext, and Perdraw server samples.

The Perclien sample completes a sequence of four samples that cover persistent COM objects. The first three samples discuss three COM servers that each house COM objects having a different kind of object persistence. The first sample, Perserve, shows how to use the IPersistStream interface to give COPageList COM objects their persistence in a stream of a structured storage compound file. The second sample, Pertext, shows how to use the IPersistStreamInit interface to give COTextPage COM objects their persistence in streams. The IPersistStreamInit::InitNew method is covered in detail. The third sample, Perdraw, shows how to use the IPersistStorage interface to give CODrawPage COM objects their persistence in substorages of a compound file. The IPersistStorage::HandsOffStorage and IPersistStorage::SaveCompleted methods are covered in detail. This sample, Perclien, integrates the use of the three previous servers into a single COM client application.

The Perclien client uses the components in Perserve, Pertext, and Perdraw to build a document-editing application that presents a list of pages to users. The user can add, delete, open, and name the page items in the list. When an item is opened, the content appears in a separate window for editing. The separate edit windows are child windows of Perclien's main window. Two types of pages are supported: text pages and drawing pages.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

_tsplitpath; addfmt; addopenitem; addref; advise; ansitouc; asksave; beginpaint; bringwindowtotop; cguidraw; cguilist; cguitext; checkmenuitem; choosecolor; cimpidrawpagesink; cimpipagelistsink; cimpitextpagesink; clear; cleared; clearwin; clistwin; closeopenitem; closeopenpages; closetextpages; cmainwindow; cocreateinstance; codrawpagesink; cofreeunusedlibraries; coinitialize; connectsink; copagelistsink; copyfile; cotextpagesink; couninitialize; cpagefile; create; createpen; createstorage; createstream; createwindowex; ctextwin; defined; defwindowproc; delete; delete_pointer; deleteobject; deleteopenitem; destroyelement; dialogproc; disconnectsink; dispatchmessage; docommand; editcopy; editcut; editdelete; editpaste; editselectall; editundo; enablemenuitem; enddialog; endpaint; errorbox; failed; fileexist; fillrect; findconnectionpoint; get; getclassbrush; getclientrect; getconnectionpoint; getcursel; getdc; getdlgitem; getdlgitemtext; gethwnd; getlasterror; getlength; getmenu; getmenustate; getmessage; getmodulefilename; getopenfilename; getopenitem; getsavefilename; getsizemax; getstockobject; getsystemmetrics; gettext; getusername; handsoffstorage; hrmsgid; initapplication; initeditmenu; initinstance; initnew; inkcolor; inkdraw; inksaving; inkstart; inkstop; inkwidth; insertfmt; isclipboardformatavailable; isdirty; iswindow; lineto; liset32; load; loadaccelerators; loadcursor; loaded; loadicon; loadimage; loadstring; loadstringa; lstrcat; lstrcpy; makefamilypath; makeintresource; memcpy; memset; messagebox; messageboxa; movetoex; movewindow; open; openstorage; openstream; openwin; pageadd; pageadded; pagechanged; pageclosed; pagedelete; pagedeleted; pageopen; pageset; pagetitle; paintwin; pickcolor; postmessage; postquitmessage; put; puttext; queryinterface; readclassstg; readclassstm; readhelp; readsource; readtutorial; redraw; registerclassex; release; release_interface; releasecapture; releaseopenpages; releasepage; renumber; renumopenitems; resize; resized; resizewin; restoreopenpages; restorepage; rgb; save; saveas; savecompleted; saved; saveopenpages; seek; selectobject; sendmessage; set; setcapture; setcursel; setcursor; setdlgitemtext; setfocus; setsize; setwindowtext; show; showdialog; showwindow; stdmethodimp_; stgcreatedocfile; stgisstoragefile; stgopenstorage; style; succeeded; text; topwin; translateaccelerator; translatemessage; uctoansi; unadvise; unicodeok; updatewindow; va_start; windowproc; winmain; writeclassstg; writeclassstm; wvsprintf


Perdraw: IPersistStorage Persistent Object Server

Click to open or copy the Perdraw project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register sample.

Perdraw is the third sample in a group of samples that illustrate various techniques for implementing COM object persistence. The first sample, Perserve, illustrates persistence by implementing the IPersistStream standard interface. The second sample, Pertext, illustrates persistence by implementing the IPersistStreamInit standard interface. This sample, Perdraw, illustrates persistence by implementing the IPersistStorage standard interface. The fourth sample, Perclien, shows how a client exploits the kinds of persistence provided by the Perserve, Pertext, and Perdraw server components.

The Perdraw sample introduces the CODrawPage COM object, which models a sheet of white drawing paper. CODrawPage objects expose a set of features for free-form drawing on a virtual surface using "ink" of specified color and width. CODrawPage is based on the scribble-like functionality of the COPaper object from the Stoserve sample.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; addregnamedvalue; advise; canunloadnow; cfdrawpage; cimpiclassfactory; cimpiconnectionpointcontainer; cimpidrawpage; cimpipersiststorage; clear; cleared; clone; coconnectionpoint; codrawpage; coenumconnectionpoints; coenumconnections; createinstance; createstream; cserver; defined; delete_pointer; dllcanunloadnow; dllgetclassobject; dllmain; dllregisterserver; dllunregisterserver; enumconnectionpoints; enumconnections; failed; findconnectionpoint; findslot; getclassid; getconnectioninterface; getconnectionpointcontainer; getlasterror; getmodulefilename; getslot; getusername; handsoffstorage; initnew; inkdraw; inkstart; inkstop; isdirty; liset32; load; loaded; lock; lockserver; lstrcat; lstrcpy; lstrlen; makelong; memcpy; memset; next; nextslot; notifysinks; objectsdown; objectsup; openstream; ownthis; queryinterface; redraw; regclosekey; regcreatekeyex; regdeletekey; registerclipboardformat; regopenkeyex; regsetvalueex; release; release_interface; reset; resize; resized; rgb; save; savecompleted; saved; seek; setregkeyvalue; skip; stdentry_; stdmethodimp_; stringfromguid2; succeeded; text; unadvise; unicodeok; unlock; unownthis; writefmtusertypestg; wsprintf


Perserve: IPersistStream Persistent Object Server

Click to open or copy the Perserve project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register sample.

The Perserve sample introduces the COPageList COM object, which encapsulates a page list. The list contains elements that correspond to pages of text or drawing data. COPageList objects expose a set of interfaces that make the objects connectable, persistent managers of the list data. Client access to this data is available through an IPageList custom interface. COPageList implements the IPageList interface.

A clear architectural distinction is kept between client and server. COPageList provides no graphical user interface (GUI). Instead, the COPageList object relies on the client for all GUI behavior.

The Perclien client provides the GUI display and manages the list of pages, the content of which are stored in a compound file that contains both the contents of the list and of each page in that list. The user of Perclien can edit the content of two type of pages: text pages and drawing pages. Text pages have text data that the user can edit using a simple windowed text editor. Drawing pages have drawing data that the user can edit using free-form, scribble-like functionality based on the Stoserve and Stoclien samples. Both types of editing are done in separate client windows. The details of the client are covered in the Perclien sample.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

_ltoa; _ltow; addref; addregnamedvalue; advise; ansitouc; canunloadnow; cfpagelist; cimpiclassfactory; cimpiconnectionpointcontainer; cimpipagelist; cimpipersiststream; clear; cleared; clone; coconnectionpoint; coenumconnectionpoints; coenumconnections; copagelist; createinstance; cserver; defined; delete; delete_pointer; dllcanunloadnow; dllgetclassobject; dllmain; dllregisterserver; dllunregisterserver; enumconnectionpoints; enumconnections; failed; findconnectionpoint; findslot; get; getclassid; getconnectioninterface; getconnectionpointcontainer; getlasterror; getmodulefilename; getsizemax; getslot; getusername; interlockeddecrement; interlockedincrement; isdirty; load; loaded; lock; lockserver; lstrcat; lstrcpy; lstrlen; makelong; memcpy; memset; next; nextname; nextslot; notifysinks; objectsdown; objectsup; ownthis; pageadded; pagedeleted; pageset; queryinterface; regclosekey; regcreatekeyex; regdeletekey; regopenkeyex; regsetvalueex; release; release_interface; reset; save; saved; set; setregkeyvalue; skip; stdentry_; stdmethodimp_; stringfromguid2; succeeded; text; uliset32; unadvise; unicodeok; unlock; unownthis; wsprintf


Pertext: IPersistStreamInit Persistent Object Server

Click to open or copy the Pertext project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register sample.

Pertext is the second sample in a group of samples that covers various techniques for implementing COM object persistence. The first sample, Perserve, covers persistence by implementing the IPersistStream standard interface. This sample, Pertext, covers persistence by implementing the IPersistStreamInit standard interface. The third sample, Perdraw, covers persistence by implementing the IPersistStorage standard interface. The fourth sample, Perclien, covers how a client exploits the kinds of persistence provided the Perserve, Pertext, and Perdraw server components.

The Pertext sample introduces the COTextPage COM object, which encapsulates the data of an editable page of text. COTextPage objects expose a set of interfaces whose methods make the objects connectable, persistent managers of text data. Client access to this data is available through an ITextPage custom interface. COTextPage implements the ITextPage interface.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; addregnamedvalue; advise; canunloadnow; cftextpage; cimpiclassfactory; cimpiconnectionpointcontainer; cimpipersiststreaminit; cimpitextpage; clear; cleared; clone; coconnectionpoint; coenumconnectionpoints; coenumconnections; cotextpage; createinstance; cserver; defined; delete_pointer; dllcanunloadnow; dllgetclassobject; dllmain; dllregisterserver; dllunregisterserver; enumconnectionpoints; enumconnections; failed; findconnectionpoint; findslot; getclassid; getconnectioninterface; getconnectionpointcontainer; getlasterror; getlength; getmodulefilename; getsizemax; getslot; gettext; getusername; initnew; interlockeddecrement; interlockedincrement; isdirty; load; loaded; lock; lockserver; lstrcat; lstrcpy; lstrlen; makelong; memcpy; memset; next; notifysinks; objectsdown; objectsup; ownthis; put; puttext; queryinterface; regclosekey; regcreatekeyex; regdeletekey; regopenkeyex; regsetvalueex; release; release_interface; reset; save; saved; setregkeyvalue; skip; stdentry_; stdmethodimp_; stringfromguid2; succeeded; text; uliset32; unadvise; unicodeok; unlock; unownthis; wsprintf


Readtut: Tutorial Reading Utility

Click to open or copy the Readtut project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

The Readtut sample builds a simple readtut.exe application that is used as the main utility for reading the online tutorial for the COM Tutorial samples. The tutorial.exe utility, found in the main tutorial directory, is produced in this sample. To do this, a copy of readtut.exe is simply renamed to tutorial.exe and placed in the main tutorial directory where it provides the main tutorial entry for the entire series. This lesson shows the technique used by each tutorial sample to read the tutorial page for that sample from within the running sample. This lesson also shows a very simple Win32 EXE application that links to the Apputil library and uses utility functions in it. Apputil is linked to and used in this manner throughout the tutorial sample series.

For functional descriptions and a tutorial code tour of Readtut, see the Code Tour section in readtut.htm. For details on the external user operation of Readtut, see both the Usage and Operation sections in readtut.htm. To read readtut.htm, run tutorial.exe in the main tutorial directory and click the READTUT lesson in the table of lessons. You can also achieve the same thing by clicking the readtut.htmfile after locating the main tutorial directory in the Windows Explorer.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

coinitialize; couninitialize; defined; delaybox; goweb; makeintresource; messagebox; readtutorial; skipansi; succeeded; text; winmain


Register: Server Registration Utility

Click to open or copy the Register project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

The Register sample builds a simple Register.exe utility that is used in subsequent code samples to invoke DLL- or EXE-housed COM servers and command them to register or unregister their components in the system registry.

For functional descriptions and a code tour of Register, see the Code Tour section in Register.txt (one of the Register project files). For details on the external user operation of Register, see the Operation and Usage sections of Register.txt.

In general, to set up your system to build and test the code samples in this COM sample series, see the samples\sdk\com\tutsamp\tutorial.txt file for details. The accompanying makefile (Makefile) is Microsoft NMAKE-compatible. To create a debug build, issue the nmake command in the Command Prompt window.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

cofreelibrary; coinitialize; couninitialize; defined; delaybox; errorboxid; failed; getprocaddress; loadlibrarya; loadstringa; makeintresource; messageboxa; skipansistring; succeeded; winexec; winmain; wsprintfa


Remclien: Distributed COM (DCOM) Remote Client

Click to open or copy the Remclien project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register and Marshal samples on your client machine and the Register, Marshal, and Aptserve samples on your server machine.

The Remclien sample shows how a client can access and control components in an out-of-process remote server. This sample uses the out-of-process server Aptserve, but here Aptserve is accesses across machine boundaries by Remclien. In other samples, Aptclien accessed Aptserve’s components on the same machine by crossing only process and thread boundaries.

No changes to Aptserve are required for Remclien to work. Distributed COM (DCOM) supports local/remote transparency between client and server.

The Remclien sample presents the automobile-related components that are demonstrated in other COM samples. These COM objects use the following interfaces: ICar, IUtility, and ICruise. Remclien works in conjunction with the separate Aptserve.exe, which provides the COCar, COUtilityCar, and COCruiseCar COM objects.

Remclien.exe creates its own COUtilityCruiseCar COM object by reusing the COCruiseCar COM object by containment and augmenting it with a native implementation of the IUtility interface. Because the COCruiseCar COM object class is a composite, that is, it reuses an inner COCar object by containment, Remclien illustrates nested reuse of COM objects. The composite COUtilityCruiseCar object reuses COCruiseCar, another composite COM object, by containment. COCruiseCar further reuses the COCar COM object by containment.

The composition of COUtilityCruiseCar is also interesting because the COUtilityCruiseCar object's containment of the COCruiseCar object crosses the machine boundary between Remclien and the out-of-process remote server Aptserve.exe. Remclien uses standard marshaling support for the custom interfaces it uses on the COCruiseCar object. This marshaling support is built separately as Marshal.dll in the Marshal sample.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; adjust; ansitouc; checkmenuitem; cimpicar; cimpicruise; cimpiutility; clear; clutch; cmainwindow; cofreeunusedlibraries; cogetclassobject; coinitialize; copy; couninitialize; coutilitycruisecar; create; createinstance; createremote; createutilitycruisecar; dcomok; defined; defwindowproc; delete_pointer; dialogproc; dispatchmessage; domenu; enddialog; engage; errorbox; failed; getdc; getdlgitem; getdlgitemtext; gethwnd; getinterface; getlasterror; getmenu; getmenustate; getmessage; getsystemmetrics; gettextmetrics; getusername; initapplication; initinstance; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; log; logerror; logf1; logging; logid; makefamilypath; makeintresource; memset; messageboxa; msg; offroad; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; registerclassex; release; release_interface; releasedc; resize; setcursor; setdlgitemtext; setfocus; shift; showdialog; showwindow; speed; stdmethodimp_; steer; style; succeeded; text; translateaccelerator; translatemessage; unicodeok; updatewindow; winch; windowproc; winmain


Stoclien: Client of Structured Storage Server

Click to open or copy the Stoclien project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To build and run this sample, you must first build the Stoserve sample.

The principal focus of the Stoclien sample is how the client uses structured storage and how it directs a server component to use this storage. The programming of structured storage services is shown in the sample.

The Stoclien sample introduces a simple drawing application. The user can use a mouse or tablet device to do free-form drawing in the client window. The color and width of the electronic ink can be chosen, and the drawings can be saved in files.

The functionality is externally similar to Scribble tutorial samples in Visual C++. The difference in the Stoclien/Stoserve samples is an internal architecture based on OLE technology. A clear architectural distinction is kept between COM client and COM server. A COPaper COM object encapsulates only the server-based storage of the drawing paper data: no graphical user interface (GUI) behavior is provided on the server side. All GUI behavior is isolated in the client. The data management and storage features of COPaper objects are available only through an COM custom interface, IPaper.

Stoclien can load and save its drawings in the structured storage of OLE compound files.

The Stoclien sample creates and uses the connectable COPaper COM object that is provided as the CLSID_DllPaper component in the Stoserve server. The Stoclien client creates a COPaper object and controls it through the IPaper interface that the object exposes. Stoclien obtains drawing data from the user and graphically represents it in a window that it manages. Stoclien uses COPaper's IPaper interface to save the drawing data in COPaper and to direct file storage operations on this data.

Stoclien cooperates with the COPaper object to load and save COPaper's drawing data. Stoclien obtains an IStorage interface for the storage object in a compound file. In its load and save operations, Stoclien passes a pointer to this IStorage interface to COPaper in the server. COPaper uses the provided IStorage to create streams in the storage. COPaper can then use the standard IStream interface for reading and writing the drawing data it manages.

COPaper only manages the drawing data; it performs no GUI actions. Stoclien provides the GUI for the drawing application. It encapsulates this in a central CGuiPaper object.

Stoclien also implements the custom IPaperSink interface in a COPaperSink COM object and connects this interface to an appropriate connection point in the server's COPaper object. COPaper uses the connected IPaperSink interface to send notifications back to Stoclien. The normal GUI repainting of COPaper's drawing data is done in Stoclien using COPaper's connectable object technology.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

_tsplitpath; addref; advise; ansitouc; asksave; beginpaint; cguipaper; checkmenuitem; choosecolor; cimpipapersink; clearwin; cmainwindow; cocreateinstance; cofreeunusedlibraries; coinitialize; connectpapersink; copapersink; couninitialize; cpapfile; create; createpen; defined; defwindowproc; delete_pointer; deleteobject; disconnectpapersink; dispatchmessage; domenu; drawoff; drawon; endpaint; erase; erased; errorbox; fileexist; fillrect; findconnectionpoint; getclassbrush; getclientrect; getconnectionpoint; getdc; gethwnd; getlasterror; getmenu; getmenustate; getmessage; getmodulefilename; getopenfilename; getsavefilename; getstockobject; getsystemmetrics; getusername; initapplication; initinstance; initpaper; inkcolor; inkdraw; inksaving; inkstart; inkstop; inkwidth; lineto; load; loadaccelerators; loadcursor; loaded; loadicon; loadimage; loadstring; loadstringa; lock; locked; lstrcat; lstrcpy; makefamilypath; makeintresource; messagebox; messageboxa; movetoex; open; paintwin; pickcolor; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; redraw; registerclassex; release; release_interface; releasecapture; resize; resized; rgb; save; saveas; saved; selectobject; setcapture; setcursor; setwindowpos; setwindowtext; showdialog; showwindow; stdmethodimp_; stgcreatedocfile; stgisstoragefile; stgopenstorage; style; succeeded; text; translateaccelerator; translatemessage; unadvise; unicodeok; unlock; unlocked; updatewindow; windowproc; winmain


Stoserve: Structured Storage in an In-Process Server

Click to open or copy the Stoserve project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note To use this sample, you must first build the Register sample.

The primary focus of the Stoserve sample is on the use of OLE structured storage services as provided in the OLE compound files implementation. Stoserve works with the Stoclien code sample to illustrate the joint use of compound file storage by client and server.

The Stoserve sample introduces the COPaper COM object, which models a sheet of white drawing paper. COPaper objects expose a set of features for free-form drawing on the paper surface using "ink" of specified color and width. The functionality is outwardly similar to other Scribble tutorials in Visual C++ tutorial samples. The difference in the Stoserve/Stoclien samples is an architecture based primarily on OLE technology. The electronic drawing paper features of COPaper objects are available to clients through a custom IPaper interface. COPaper implements the IPaper interface. A clear architectural distinction is kept between client and server. No graphical user interface (GUI) is provided by COPaper. The design of the COPaper object relies on the client for all GUI behavior. COPaper encapsulates only the server-based capture and storage of the drawn ink data.

The ink data that is drawn on the COPaper surface can be stored in and loaded from OLE compound files. The IPaper Save and Load methods accept an IStorage interface pointer. COPaper uses this client-provided IStorage interface to store the drawing data.

COPaper is housed in an in-process server and is made publicly available as a custom COM component. Like all other servers in these COM samples, Stoserve is a self-registering COM server. It makes the COPaper object type available to clients as the DllPaper component using a CLSID_DllPaper registration in the Registry.

As is the case with the Conserve server, connectable object features are supported in COPaper. The IConnectionPointContainer interface is exposed, and an appropriate connection point is implemented. In this context, an outgoing custom IPaperSink interface is declared for use in sending notifications to the client.

The IPaper and IPaperSink custom interfaces are declared in IPAPER.H located in the common sibling \INC directory. The GUIDs for the interfaces and objects are defined in PAPGUIDS.H located in that same common include directory.

The CThreaded facility in Apputil is used by Stoserve to achieve thread safety, as it is in the Freserve sample. COPaper objects are derived from the CThreaded class and inherit its OwnThis and UnOwnThis methods. These methods allow only one thread at a time to have access to the Stoserve server and to COPaper objects managed by the server.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; addregnamedvalue; advise; canunloadnow; cfpaper; cimpiclassfactory; cimpiconnectionpointcontainer; cimpipaper; clone; coconnectionpoint; coenumconnectionpoints; coenumconnections; copaper; createinstance; createstream; cserver; defined; delete_pointer; dllcanunloadnow; dllgetclassobject; dllmain; dllregisterserver; dllunregisterserver; enumconnectionpoints; enumconnections; erase; erased; failed; findconnectionpoint; findslot; getconnectioninterface; getconnectionpointcontainer; getlasterror; getmodulefilename; getslot; getusername; initpaper; inkdraw; inkstart; inkstop; load; loaded; lock; locked; lockserver; lstrcat; lstrcpy; lstrlen; makelong; memcpy; memset; next; nextslot; notifysinks; objectsdown; objectsup; openstream; ownthis; queryinterface; redraw; regclosekey; regcreatekeyex; regdeletekey; registerclipboardformat; regopenkeyex; regsetvalueex; release; release_interface; reset; resize; resized; rgb; save; saved; setregkeyvalue; skip; stdentry_; stdmethodimp_; stringfromguid2; succeeded; text; unadvise; unicodeok; unlock; unlocked; unownthis; writeclassstg; writefmtusertypestg; wsprintf


DbMsg Samples

Click to open or copy the files for the DbMsg samples.


ADO Samples

Click to open or copy the files for the ADO samples.


Employee: ADO Form Sample

Click to open or copy the files for the Employee sample.

This sample displays employee data in a form. It allows users to scroll, insert, update and delete data. Note that existing employee records cannot be deleted from the table because of referential integrity constraints.

Building SDK Samples

This sample uses the following keywords:

_t; addnew; addrecord; afxgetapp; afxmessagebox; allocsysstring; appendmenu; assert; begin_message_map; bstr; caboutdlg; cancelupdate; catch; cdialog; cempapp; cempbiz; cempdlg; clear; clearfilter; cocreateinstance; coinitialize; commitalteredemprec; connecttodatabase; cstring; cvar; dc; ddx_text; declare_message_map; delete; deleterecord; dodataexchange; domodal; drawicon; enable3dcontrols; enable3dcontrolsstatic; enablewindow; end_message_map; failed; findforward; get_bof; get_bookmark; get_collect; get_editmode; get_eof; get_fields; get_filter; get_item; getclientrect; getdlgitem; getemployeeid; geterrormessage; getfirstname; gethomephone; getlastname; getsafehdc; getsystemmenu; getsystemmetrics; gettitle; height; initinstance; isaddmode; isempty; isiconic; loadicon; loadstring; messagebeep; movefirst; movelast; movenext; moveprevious; on_bn_clicked; on_command; on_wm_paint; on_wm_querydragicon; on_wm_syscommand; onappopenrecord; oneditadd; oneditdelete; oneditfindf; oneditfirst; oneditlast; oneditnext; oneditprevious; oninitdialog; onpaint; onquerydragicon; onsyscommand; open; preparecriteria; put_bookmark; put_filter; put_source; put_value; putref_activeconnection; release; sendmessage; setfieldstates; setfocus; seticon; str; sysallocstring; sysallocstringlen; throw_err; update; updatedata; updateemprec; variantclear; variantcopy; variantinit; varindex; vnull; vtocstr; vtodate; vtolong; wcslen; width; wsprintf


GetRows: Recordset GetRows Sample

Click to open or copy the files for the GetRows sample.

This C/C++ sample demonstrates the use of the Recordset object's GetRows method to retrieve all the rows of a rowset into a 2-dimensional array of variants.

Building SDK Samples

This sample uses the following keywords:

_t; addstring; afxgetapp; afxmessagebox; allocsysstring; appendmenu; assert; begin_message_map; caboutdlg; cdialog; cgetrowsapp; cgetrowsdlg; clear; cocreateinstance; coinitialize; dc; declare_message_map; dodataexchange; dogetrows; domodal; drawicon; empty; enable3dcontrols; enable3dcontrolsstatic; end_message_map; failed; getclientrect; getdlgitem; getrows; getsafehdc; getsystemmenu; getsystemmetrics; height; initinstance; isempty; isiconic; loadicon; loadstring; movefirst; on_bn_clicked; on_command; on_wm_paint; on_wm_querydragicon; on_wm_syscommand; onexecute; oninitdialog; onpaint; onquerydragicon; onsyscommand; open; put_source; putref_activeconnection; release; resetcontent; safearraygetelement; safearraygetubound; sendmessage; seticon; sysfreestring; variantchangetype; width; wsprintf


ISAPI: ADO ISAPI IIS Sample

Click to open or copy the files for the ISAPI sample.

ISAPI is a sample ISAPI application that runs on Microsoft Internet Information Server (IIS). The application is written to ActiveX Data Objects to fetch data from the database and return the data back to the client in HTML format.

Building SDK Samples

This sample uses the following keywords:

_t; clear; cocreateinstance; coinitialize; colevariant; converthextodec; couninitialize; cstring; dllentrypoint; failed; fetchdata; get_count; get_description; get_eof; get_errors; get_fields; get_item; get_name; get_value; getextensionversion; httpextensionproc; lstrcpyna; makelong; movenext; multibytetowidechar; open; outputerrors; outputstring; patchquery; put_source; putref_activeconnection; release; sprintf; sysallocstring; sysallocstringlen; sysfreestring; toupper; variantchangetype; writeclient; wsprintf


Read: ADO Cursor Timings Sample

Click to open or copy the files for the Read sample.

This C/C++ sample generates timings for fetching data using different cursor types and cache sizes. (Also called "the ADORead sample.")

Building SDK Samples

This sample uses the following keywords:

_t; addfieldtolist; addstring; afxenablewin40compatibility; afxgetapp; afxmessagebox; allocsysstring; appendmenu; assert; begin_message_map; caboutdlg; cadoreadapp; cadoreaddlg; cdialog; cfiledialog; cocreateinstance; coinitialize; colevariant; create; crect; dc; ddv_maxchars; ddv_minmaxlong; ddx_check; ddx_control; ddx_text; declare_message_map; displayquerytime; dodataexchange; domodal; drawicon; end_message_map; execute; fail; failed; format; get_collect; get_eof; getclientrect; getcursel; getdlgitem; getpathname; getsafehdc; getsystemmenu; getsystemmetrics; getwindowtext; height; initinstance; isempty; isiconic; loadicon; loadstdprofilesettings; loadstring; messagebox; movenext; on_bn_clicked; on_cbn_selchange; on_command; on_wm_paint; on_wm_querydragicon; on_wm_syscommand; ondatabase; onexecute; oninitdialog; onpaint; onquerydragicon; onselchangeconnectmode; onselchangeconnectoption; onsyscommand; open; prepareeditctrl; put_cachesize; put_provider; put_source; putref_activeconnection; release; resetcontent; sendmessage; setdlgitemtext; setwindowtext; strunits; switch; sysfreestring; timegettime; updatedata; width; wsprintf


VBS Sample: 2-Tier ADO VBScript Sample

Click to open or copy the files for the VBS sample.

This sample demonstrates the use of ADO from VBScript and HTML. It shows how ADO, VBScript and HTML on the client can be used to build a 2-tier weblication for an intranet. In this sample, some of the VBScript and HTML code is generated at run time in order to generate fields based on the schema information in the Recordset.

(Also called "the ADOVBS sample.")


MAPI Samples: Messaging Applications Programming Interface

MAPI Samples

Click to open or copy the files for the MAPI samples.

Use this download link to get a detailed MAPI Readme file, the Common subdirectory (needed by the other subdirectories), and all the individual samples.


Checkers.frm: Custom Sendable Form Sample

Click to open or copy the files for the Checkers.frm sample.

Click to open or copy the common files (required).

This sample demonstrates how to use a custom sendable form. It is an executable (.exe) server. It implements the minimum form interface required to launch and send a form.

Building SDK Samples

This sample uses the following keywords:

_itoa; _ltoa; addref; address; addressform; advise; assert; assertfunc; assertsz; atoi; atol; backmove; beginpaint; bitblt; checkchar; checkcreate; checkerswndproc; checkgenpieces; checkmenuitem; checkmouseclick; checkmousemove; checkpaint; clearboard; clearboards; cmovelist; computermove; converttocorrectcharset; copyboard; copyto; coregisterclassobject; createcompatiblebitmap; createcompatibledc; createfont; createform; createinstance; createpen; createsolidbrush; createwindow; define_guid; defined; defwindowproc; deletedc; deleteobject; dialogbox; dispatchmessage; displaygamedrawn; displaygameover; dotagsdialog; doverb; drawboard; dumpclsid; ellipse; enablemenuitem; enddialog; endpaint; failed; fclose; fhandle_wm_create; fillboard; fopen; forget; fork; forward_wm_command; forwardmove; fprintf; freelibrary; freeprocinstance; frm; frmfac; frmfmr; fvalidplayerpiece; fvalidsetuppiece; gameover; getcheckersdata; getclassid; getdc; getdevicecaps; getdlgitemint; getdlgitemlong; getdlgitemtext; getfileversioninfo; getfileversioninfosize; getfirstboard; getfocus; getformmanager; getkeystate; getlasterror; getmenu; getmessage; getnearestcolor; getnextboard; getprivateprofileint; getprivateprofilelong; getprivateprofilestring; getprocaddress; getprops; getrecipienttable; getsession; getstockobject; gettextmetrics; gettickcount; getviewcontext; globalalloc; globalfree; globallock; globalunlock; handle_msg; handsoffmessage; hrstartoleandregisterclassfactory; hrstopforms; initapplication; initinstance; initnew; invalidaterect; isdirty; isequaliid; isiconic; iswindow; iswindowenabled; launchreplymessage; lineto; load; loadcursor; loadlibrary; loadmenu; lockserver; lstrcat; lstrcmp; lstrcpy; lstrlen; makemove_black0; makemove_black2; makemove_black_jump0; makemove_black_jump2; makemove_red0; makemove_red2; makemove_red_jump0; makemove_red_jump2; makemovenoking_black_jump0; makemovenoking_black_jump2; makemovenoking_red_jump0; makemovenoking_red_jump2; makeprocinstance; malloc; mapi_getlasterror_method; mapi_imapiform_methods; mapi_ipersistmessage_methods; mapi_iunknown_methods; memcpy; message; messagebeep; messagebox; messageint; modifyrecipients; moveto; movetoex; movevalid; newmessage; newmove; next; normallbuttondown; normallbuttonup; nyi; ongameplayableaftermove; openaddressbook; opencheckers; optimize; patblt; playbestmove; postquitmessage; prop_id; prop_tag; prop_type; purgeboards; qualityofboard; querycolumns; queryinterface; readini; readplayerinfo; registerclass; release; releasecapture; releasedc; releaseobj; remember; resolvemessageclass; restoredefaultdebugstate; resultfromscode; rgb; save; saveasboard; savechanges; savecompleted; savemessage; scgetrecipientadrlist; selectobject; senddlgitemmessage; sendform; sendmessage; setbkmode; setcapture; setcheckersdata; setcursor; setdlgitemint; setdlgitemlong; setdlgitemtext; setmenu; setprops; setuplbuttondown; setuplbuttonup; setuprbuttondown; setuprbuttonup; setviewcontext; setwindowtext; showcurrentmessage; showwindow; shutdownform; sizedsproptagarray; sleep; spoon; stdmethod; stdmethod_; stdmethodimp_; submitmessage; succeeded; switch; text; textizeboard; traceerror; tracefunc; tracetag; translatemessage; unadvise; updatecursor; updatewindow; va_end; va_start; validatenumeric; vclearmovingpiece; verqueryvalue; vhandle_wm_command; vhandle_wm_destroy; vhandle_wm_getminmaxinfo; vhandle_wm_hscroll; vhandle_wm_initmenu; vhandle_wm_lbuttondown; vhandle_wm_lbuttonup; vhandle_wm_mousemove; vhandle_wm_paint; vhandle_wm_rbuttondown; vhandle_wm_rbuttonup; vhandle_wm_timer; vhandle_wm_vscroll; vtranslatecurpostosquare; vtranslateenginetouisquare; vtranslateuitoenginesquare; winmain; writeini; writeplayerinfo; writeprivateprofileint; writeprivateprofilelong; writeprivateprofilestring; wsprintf; wvsprintf


Chsfld.cli: MAPI Container Hierarchy Viewer Sample

Click to open or copy the files for the Chsfld.cli sample.

Click to open or copy the common files (required).

This sample illustrates implementing a MAPI container hierarchy viewer. It uses standard Win32 Tree View Control to display the folder hierarchy of a message store and to allow a user to choose a particular folder. Chsfld32.dll exports a single entry point, HrPickFolder. See Chsfld.h, located in Common directory, for the exact description of arguments and return values.

Building SDK Samples

This sample uses the following keywords:

addoneitem; addref; align4; assert; assertsz; catch; cchsflddlg; chsflddlgproc; compareentryids; copymemory; createfolder; ctistack; ctvnode; ctvnodefactory; debugtrace; debugtracearg; debugtraceresult; debugtracesc; delete; dialogboxparam; edit_gettextlength; enablewindow; enddialog; failed; freeprows; get_wm_command_cmd; get_wm_command_id; getcb; getdlgitem; gethierarchytable; getlevel; getmodulehandle; getmsgstorestable; getname; getwindowlong; getwindowtext; hinst; hr_failed; hr_succeeded; hrcreatenode; hrexpand; hrgetfolder; hrgetnewname; hrgetoneprop; hrinittree; hrinsertroot; hrloadroots; hrnewfolder; hropenfolder; hropenmdb; hrpick; hrpickfolder; hrqueryallrows; hrrestoretreestate; hrsavetreestate; hrsavetreestateex; hrsetlasterror; htifindchild; hwdialog; hwtreectl; imagelist_addicon; imagelist_create; imagelist_destroy; imagelist_getimagecount; indallstores; indclsdfld; indopenfld; indrootfld; initcommoncontrols; insert; isbadwriteptr; isempty; istreeroot; iswindow; loadicon; lstrcpy; lstrlen; makeintresource; mapiallocatebuffer; mapiallocatemore; mapifreebuffer; messagebox; newnamedlgproc; openentry; openmsgstore; pickdlg; pop; push; release; resultfromscode; session; seterror; setfocus; setfolder; sethandle; setkidsloaded; setwindowlong; setwindowtext; showerror; sizedsproptagarray; succeeded; switch; treeview_expand; treeview_getchild; treeview_getitem; treeview_getnextsibling; treeview_getroot; treeview_getselection; treeview_insertitem; treeview_setimagelist; treeview_setitem; ulrelease; zeromemor


CMC.cli: Common Messaging Calls Sample

Click to open or copy the files for the Cmc.cli sample.

Click to open or copy the common files (required).

This sample demonstrates using Common Messaging Calls (CMC) functions. The sample is a very simple mail client. Using it is intuitive and straightforward.

Before running this application, install the MAPI run-time binaries on your system.

Building SDK Samples

This sample uses the following keywords:

_fmemcmp; _fmemcpy; _fmemset; _lclose; _llseek; _lread; _lwrite; aboutdlgproc; atoi; checkdlgbutton; checkradiobutton; cmcacton; cmcfree; cmclist; cmclookup; cmcqueryconfiguration; cmcread; cmcsend; copyattachment; copyfile; copyrecipient; createsolidbrush; deinitapplication; deinitsimplecmc; deleteobject; dialogbox; drawmsgicon; fcmcinstalled; findnode; getdlgitem; getprofileint; getprofilestring; getsyscolor; globalallocptr; globalfreeptr; inboxdlgproc; initapplication; initinstance; invalidaterect; isdlgbuttonchecked; loadcursor; loadstring; logsendmail; lstrcmp; lstrcpy; lstrlen; lzclose; lzcopy; lzopenfile; mainwndproc; makedisplaynamestr; makemessagebox; messagebox; openfile; pvalloc; pvallocmore; pvfree; readmaildlgproc; regclosekey; regopenkeyex; regqueryvalueex; resolvefriendlynames; savefileattachments; securemenu; selectobject; senddlgitemmessage; setcursor; setdlgitemtext; setfocus; sprintf; switch; togglemenustate; winmain; wsprintf


Command.ext: Exchange Custom Command Extensions Sample

Click to open or copy the files for the Command.ext sample.

Click to open or copy the common files (required).

The Command.ext sample demonstrates how to implement custom command extensions for the Microsoft Exchange Client. This sample demonstrates:

  • Adding a menu command

  • Adding a toolbar button

  • Disabling or enabling the menu item and toolbar item depending on what object is selected in the viewer

  • Making MAPI calls from an extension

  • Extending a command in the Main Viewer and the Search Viewer dialog box

  • Implementing F1 response for context help on the menu item

  • Implementing custom ToolTip and status bar text

The custom command displays the number of subfolders, read messages, and unread messages in a selected folder.

Building SDK Samples

This sample uses the following keywords:

addref; appendmenu; dllmain; docommand; enablemenuitem; exchentrypoint; failed; freeprows; getcmdid; getcontentstable; getfolderstats; gethierarchytable; getmenu; getmenupos; getobject; getrowcount; getselectionitem; getsession; getversion; help; initmenu; installcommands; lstrcpyn; mapifreebuffer; messagebox; myexchextuserevents; onobjectchange; onselectionchange; openentry; querybuttoninfo; queryhelptext; queryinterface; queryrows; release; resettoolbar; sendmessage; setcolumns; setcontext; setiexchext; sizedsproptagarray; stdmethodimp_; wsprintf


Common Files for MAPI Samples

Click to open or copy the files for the Common sample.

The common files are used by the MAPI samples. The following files are representative of the contents of this directory.

File | Description
Traces.cpp | Implements tracing functions for sending debug/trace strings to an attached debug monitor, the serial port, or a log file.
Cindex.c | Creates and extends PR_CONVERSATION_INDEX.
Imem.c | Per-instance global data for WIN32 (trivial), WIN16, and Mac.
Mapidbg.c | MAPI debugging utilities.
Pvalloc.c | A chained memory manager.
Wep.c | WEP function for MAPI DLLs. This function is placed in a separate segment so marking the segment as FIXED is not hard on the system.
Lasterr.cpp | Implements CLastError, which implements the GetLastError helper.
_Tags.h | Property tag definitions for standard properties of MAPI objects.
Chsfld.h | Prototype for HrPickFolder. Displays a dialog box allowing user to choose a folder from message stores in the current profile.

Building SDK Samples

This sample uses the following keywords:

_fmemset; _strdate; _strtime; addref; alloc; allocateandinitializesid; allocconsole; assert; assertmsg; assertsz; assertsz2; bytes; clasterror; closehandle; closeoutputhandles; code_seg; createthread; ctl3d_autosubclass; ctl3d_ceaseautosubclass; ctl3d_colorchange; ctl3d_getver; ctl3d_initialize; ctl3d_isautosubclass; ctl3d_subclass; ctl3d_subclassctl; ctl3d_uninitialize; ctl3dautosubclass; ctl3dautosubclassex; ctl3dcolorchange; ctl3dctlcolor; ctl3dctlcolorex; ctl3ddlgframepaint; ctl3denabled; ctl3dgetver; ctl3disautosubclass; ctl3dregister; ctl3dsubclassctl; ctl3dsubclassctlex; ctl3dsubclassdlg; ctl3dsubclassdlgex; ctl3dunautosubclass; ctl3dunregister; ctl3dunsubclassctl; ctl3dwininichange; dbgmem_addref; dbgmem_alloc; dbgmem_checkmemfn; dbgmem_didalloc; dbgmem_encapsulatefn; dbgmem_entercriticalsection; dbgmem_free; dbgmem_getsize; dbgmem_heapminimize; dbgmem_leakhook; dbgmem_leavecriticalsection; dbgmem_noleakdetectfn; dbgmem_queryinterface; dbgmem_realloc; dbgmem_release; dbgmem_reportleak; dbgmem_setfailureatfn; dbgmem_shutdownfn; dbgmem_validatepblk; dbgmem_validatepv; debugbreak; debugoutputfn; debugstr; debugtrace; debugtracefn; debugtraceproblemsfn; debugtrapfn; declare_interface; define_oleguid; defined; deletecriticalsection; disposeinstdata; disposeptr; entercriticalsection; equalsid; errorboxcallback; fcleanupinstanceglobals; fclose; fnnetalertraiseex; fopen; fpcolorchange; fpgetver; fpisautosubclass; fprintf; fpsubclassctl; free; freeconsole; freelibrary; freesid; getactivewindow; getasynckeystate; getcallstack; getcurrentprocess; getenv; getlasterror; getmodulehandle; getprivateprofileinta; getprivateprofilestring; getprocaddress; getscode; gettickcount; gettokeninformation; getversion; globalalloc; globalfree; globallock; globalsize; globalunlock; heapminimize; hresult_from_win32; hrgetlasterror; hrpickfolder; hrsetlasterror; ifindinst; ifromhr; initializecriticalsection; inittraces; isbadreadptr; isbadwriteptr; isdbgserviceanexe; leavecriticalsection; lmgetcurrenta5; loadlibrary; loadlibrarya; localalloc; localfree; logit; lstrcata; lstrcmpa; lstrcpy; lstrcpya; lstrcpyn; lstrlen; lstrlena; lstrlenw; make_hresult; make_mapi_e; makelangid; mapiallocatebuffer; mapifreebuffer; memcmp; memcopy; memcpy; memset; messageboxa; messageboxfn; messageboxfnthreadmain; messageboxindirect; multibytetowidechar; newptrclear; openprocesstoken; outputdebugstring; outputdebugstringa; pblkallocsize; pblkclientsize; pblkdequeue; pblkenqueue; pblktopv; pfnregistereventsourcea; pfnreportevent; prop_id; prop_tag; prop_type; pt; pvalloc; pvallocmore; pvfree; pvgetinstanceglobals; pvgetverifyinstanceglobals; pvslowgetinstanceglobals; pvtopblk; pvtovmbase; queryinterface; realloc; release; resultfromscode; sc; scaddconversationindex; sccheckscfn; scfillconvheader; scode; scode_facility; scodefromszfn; scsetinstanceglobals; scsetverifyinstanceglobals; setconsolescreenbuffersize; seterrormode; showerror; stdapi_; stdmethod; stdmethod_; stdmethodimp_; strcat; strcpy; switch; szdecodescode; szdecodescodefn; szdecodeulproptagfn; szdecodeulproptype; szdecodeulproptypefn; tracedebugger; traceinfomessage; traceio; traceio2; tracemessage; tracemessageif; traceprop; traceraw; traceresult; tracerpcerror; tracestring1; tracestring2; tracestring3; tracestring4; tracesyserror; tracesz3; trapsz; trapsz1; trapsz2; trapsz3; trapsz4; ulproptagfromszfn; uninittraces; va_end; va_start; verify; virtualalloc; virtualfree; vmalloc; vmallocex; vmfree; vmfreeex; vmgetsize; vmgetsizeex; vmrealloc; vmreallocex; vmvalidatepv; vmvalidatepvex; waitforsingleobject; warning; wep; winhelp; writeoutputstring; wsprintf; wsprintfa; wvsprintfa; zeromemory


Docfile.ms: MAPI Message Store Sample

Click to open or copy the files for the Docfile.ms sample.

Click to open or copy the common files (required).

This sample demonstrates how to use a sample message store.

The message store is based on the file system. Each folder is a directory and each message is a file. Additional files hold properties of folders and of the message store itself.

Building SDK Samples

This sample uses the following keywords:

addrfn; alloc; ansilowerbuff; assert; assertsz; assertsz1; assertsz2; atch_validateparameters; bringwindowtotop; cbdrw; cbeid; cbeidpath; cbnewdrw; cbneweid; cbnewnotifkey; cbnewonb; cbnewspropattrarray; cbnewsproptagarray; cbnewtnb; cbonb; cbssortorderset; cbtnb; cbtszsize; changetable; checkdlgbutton; closehandle; closeidsearch; closeimsgsession; closerfs; closerfsstream; commit; compareentryids; comparefiletime; copyfile; copyfolder; copymemory; copymessages; copyprops; copyto; createattach; createdirectory; createfile; createmutex; createstream; createtable; ctl3d_initialize; ctl3d_subclass; ctl3d_uninitialize; dbgmem_encapsulate; dbgmem_shutdown; debugtrace; debugtraceresult; debugtracesc; declare_mapi_interface; decodespoolsecurity; define_oleguid; defined; deinitmsinstance; deleteattach; deletecriticalsection; deletefile; deletemessages; deleteprops; deleterfn; destroymessagelist; dialogboxparam; docopyprops; docopyto; dosentmail; emptyfolder; emptytable; enablewindow; enddialog; entercriticalsection; expandrecips; failed; falreadyopenstore; fappendpathnomem; fcheckeidtype; fcontainsprop; ffindpropinpspb; ffolderexists; ffoldinsamestore; findclose; findfirstfile; findnextfile; fisancestor; fisfolder; fisinvalideid; fismessage; fisroot; fissubmittedmessage; fisunsavedeid; fisunsavedmsg; fisvalidmessageclass; fisvalidpath; fld_validateparameters; fqueryinterface; free; freenull; freeproparrays; freeprows; freerfn; getattachmenttable; getattribimsgonistg; getdlgitem; getdlgitemtext; getfileattributes; getfullpathname; gethierarchytable; getidsfromnames; getlasterror; getmemallocroutines; getnamesfromids; getproplist; getprops; getprovidertable; getrecipienttable; getresourceuid; getrfn; getrowcount; getscode; getsystemtime; getwindowlong; hr_failed; hr_succeeded; hraddcolumns; hraddmissingtablerows; hralloc; hrallocadvisesink; hrallocproparrays; hrallocz; hrappendpath; hrapplyoqnotifchanges; hrapplytblnotifchanges; hrcheckandopenstore; hrcheckhr; hrcheckstoreintegrity; hrconfirmcred; hrconstructeid; hrconvertsztohex; hrcopycontents; hrcopyfolder; hrcreateconttblmutex; hrcreatefolder; hrcreatefolderstorage; hrcreatemessagelist; hrcreateogqueuemutex; hrdeconstructeid; hrdeleterow; hrdeletesubdirectory; hrdestroyfolderstorage; hrduplicateifld; hreidfromdisplayname; hrenumrow; hrfilepathexists; hrfillhierarchytable; hrfindfirstid; hrfindnextid; hrfullpathname; hrfulltorelative; hrgetfilemodtime; hrgetlogondlgcred; hrgetoneprop; hrgetoutgoingnotificationkey; hrgetparenteid; hrgetpassword; hrgetprofilecred; hrgetsequencenum; hrgetsingleprop; hrgetsmsstandardnotifkey; hrgetsortorder; hrgetspoolsecurity; hrgettablename; hrgettablenotificationkey; hrgettime; hrgetview; hrincrementoneroprop; hrinitimsprops; hrisparent; hrisread; hrmodifyrow; hrnewcounts; hrneweid; hrnewiatch; hrnewifld; hrnewims; hrnewimsg; hrnewoutgoingtabledata; hrnotifyonoutgoingqueue; hropenimsg; hropenimsgsession; hropenimspropsfileretry; hropenparent; hropenpropertymessage; hropenpropertymessageretry; hropensingleprovider; hropentblfileretry; hrqueryrow; hrreadbytes; hrreadtablefromdisk; hrrealloc; hrremovebadtablerows; hrremoverow; hrsavemsginmsg; hrsendnotif; hrsetflags; hrsetinternalprops; hrsetoneprop; hrsetonerofolderprop; hrsetoneroprop; hrsetprofilecred; hrsetsingleprop; hrsetsubfolderprop; hrsetupprivatenotifications; hrsynccontentstable; hrsyncoutgoingtable; hruniquefilename; hrupdateoutgoingqueue; hrupdaterow; hrwrap_getprops; hrwritebytes; hrwritecounts; hrwriterow; hrwritetableondisk; iatch_copyprops; iatch_copyto; iatch_deleteprops; iatch_entercriticalsection; iatch_getproplist; iatch_getprops; iatch_leavecriticalsection; iatch_neuter; iatch_openproperty; iatch_savechanges; iatch_setprops; ifdbg; ifld_copyfolder; ifld_copymessages; ifld_copyprops; ifld_copyto; ifld_createfolder; ifld_createmessage; ifld_deletefolder; ifld_deletemessages; ifld_deleteprops; ifld_emptyfolder; ifld_entercriticalsection; ifld_getcontentstable; ifld_gethierarchytable; ifld_getmessagestatus; ifld_getproplist; ifld_getprops; ifld_getsearchcriteria; ifld_isinvalid; ifld_leavecriticalsection; ifld_neuter; ifld_openproperty; ifld_release; ifld_savecontentssort; ifld_setmessagestatus; ifld_setprops; ifld_setreadflags; ifld_setsearchcriteria; ims_abortsubmit; ims_advise; ims_compareentryids; ims_copyprops; ims_copyto; ims_deleteprops; ims_entercriticalsection; ims_finishedmsg; ims_getidsfromnames; ims_getlasterror; ims_getnamesfromids; ims_getoutgoingqueue; ims_getproplist; ims_getprops; ims_getreceivefolder; ims_getreceivefoldertable; ims_isinvalid; ims_leavecriticalsection; ims_neuter; ims_neuterchildren; ims_notifynewmail; ims_openentry; ims_openproperty; ims_savechanges; ims_setlockstate; ims_setprops; ims_setreceivefolder; ims_storelogoff; ims_unadvise; imsg_copyprops; imsg_copyto; imsg_createattach; imsg_deleteattach; imsg_deleteprops; imsg_entercriticalsection; imsg_getattachmenttable; imsg_getproplist; imsg_getprops; imsg_getrecipienttable; imsg_leavecriticalsection; imsg_modifyrecipients; imsg_neuter; imsg_openattach; imsg_openproperty; imsg_savechanges; imsg_setprops; imsg_setreadflag; imsg_submitmessage; initializecriticalsection; initimsgprops; isbadifaceptr; isbadreadptr; isbadstringptr; isbadwriteptr; isdlgbuttonchecked; isequalguid; isequaliid; isequalmapiuid; leavecriticalsection; liset32; lmalloc; lmallocmore; lmallocz; lmfree; loadstring; logondlgproc; lpallocbuf; lpallocmore; lpfnneuter; lpfreebuf; lsmsoqnotifcallback; lsmstblnotifcallback; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lstrlena; mapi_iattach_methods; mapi_imapicontainer_methods; mapi_imapifolder_methods; mapi_imapiprop_methods; mapi_imessage_methods; mapi_imsgstore_methods; mapi_imslogon_methods; mapi_imsprovider_methods; mapi_iunknown_methods; mapiallocatebuffer; mapifreebuffer; mapimethod_; mapimethod_declare; mapimethod_typedef; mapscodesz; mapstoragescode; memcmp; memcpy; memset; messagebox; modifyprofile; modifyrecipients; movefile; ms_validateparameters; msg_validateparameters; msl_checkparameters; msl_entercriticalsection; msl_leavecriticalsection; msl_logoff; msl_openstatusentry; msl_release; msp_checkparameters; msp_comparestoreids; msp_entercriticalsection; msp_leavecriticalsection; msp_logon; msp_release; msp_shutdown; msp_spoolerlogon; msproviderinit; multibytetowidechar; newimsginiatch; newuid; nfassertsz; nfsideassertsz; notify; obj_addref; obj_checkparameters; obj_clearflag; obj_dequeue; obj_destroy; obj_enqueue; obj_entercriticalsection; obj_initialize; obj_isinvalid; obj_leavecriticalsection; obj_queryinterface; obj_release; obj_setflag; obj_testflag; obj_validateparameters; offsetof; openattach; openentry; openimsgonistg; openimsgsession; openprofilesection; openproperty; openrfs; openrfsstream; openstream; outgoingviewrelease; pack; passworddlgproc; ppropfindprop; preparesubmit; processgetprops; prop_id; prop_tag; prop_type; pvgetinstanceglobals; queryinterface; queryrows; readfile; readreceipt; realloc; releasemutex; removedirectory; replaceext; resultfromscode; savechanges; scalloc; scallocz; scchecksc; sccopynotifications; sccopyprops; sccountnotifications; sccountprops; sccreatefile; sccreatemsl; sccreateorconfigure; sccreatestore; scfillonesbpval; scgetfullfilename; scinitmsinstance; screalloc; screlocnotifications; screlocprops; scsetinstanceglobals; seek; seekrow; setattribimsgonistg; setcolumns; setdlgitemtext; setendoffile; setfocus; setforegroundwindow; setprops; setprovideruid; setreadflag; setwindowlong; sideassert; sizedspropattrarray; sizedsproptagarray; sizedssortorderset; sleep; smsserviceentry; stdapi_; stdmethod_; stdmethodimp_; stgcreatedocfile; stgopenstorage; storelogofftransports; submitmessage; subscribe; switch; systemtimetofiletime; szbasename; szdecodescode; szdecodeulproptag; szfindlastch; szfindsz; text; tracesz; tracesz1; tracesz2; translatefileerror; trapsz; trapsz1; uladdref; ulrelease; unsubscribe; validate_imapicontainer_openentry; validate_imapiprop_getidsfromnames; validate_imapiprop_getlasterror; validate_imapiprop_getnamesfromids; validate_imapiprop_savechanges; validate_imsgstore_advise; validate_imsgstore_compareentryids; validate_imsgstore_unadvise; viewrelease; waitforsingleobject; wrapstoreentryid; writefile; wsprintf


Events.ext: Message Event Extension Sample

Click to open or copy the files for the Events.ext sample.

Click to open or copy the common files (required).

The Events.ext sample demonstrates how to implement a custom message event extension for the Microsoft Exchange Client. This sample demonstrates:

  • Reading message text before displayed in the read note form.

  • Reading message text as it is submitted to MAPI.

This sample uses a very basic form of signing a message. A checksum on the message as it is written is stored as a custom property. Upon reading the message, the extension verifies the checksum and displays one of two possible outcomes: the message has been verified with correct contents, or the message text has been altered.

Building SDK Samples

This sample uses the following keywords:

addref; calculongchecksum; createbrushindirect; deleteobject; dllmain; errormessagebox; exchentrypoint; failed; freepages; getidsfromnames; getmaxpagecount; getobject; getpages; getparent; getscode; getsyscolor; getversion; getwindow; hrgetoneprop; hrsetoneprop; install; loadcursor; makeintresource; mapifreebuffer; memset; messagebox; myexchext; myexchextmessageevents; myexchextpropertysheets; onchecknames; onchecknamescomplete; onread; onreadcomplete; onsubmit; onsubmitcomplete; onwrite; onwritecomplete; openproperty; prop_id; prop_tag; queryinterface; release; seek; senddlgitemmessage; sendmessage; setbkcolor; setcursor; setwindowlong; signatureoptionsdlgproc; stdmethodimp_; ulrelease; wsprintf


Flatfile.ab: Address Book Service Provider Sample

Click to open or copy the files for the Flatfile.ab sample.

Click to open or copy the common files (required).

The FlatFile.ab sample is an address book service provider (SMPAB.DLL) that is part of the prerelease MAPI SDK.

Building SDK Samples

This sample uses the following keywords:

abc_getcontentstable; abc_gethierarchytable; abc_openproperty; abc_release; abc_savechanges; abc_validateobject; abcbutt_activate; abcbutt_getstate; abcbutt_queryinterface; abcbutt_release; abcbutt_validateobject; aboouser_openproperty; aboouser_validateobject; abp_logon; abp_queryinterface; abp_release; abp_shutdown; abplogon_advise; abplogon_compareentryids; abplogon_getoneofftable; abplogon_logoff; abplogon_openentry; abplogon_openstatusentry; abplogon_opentemplateid; abplogon_preparerecips; abplogon_queryinterface; abplogon_release; abplogon_unadvise; abproviderinit; abs_changepassword; abs_flushqueues; abs_queryinterface; abs_release; abs_settingsdialog; abs_validatestate; absrch_getsearchcriteria; absrch_openproperty; absrch_release; absrch_savechanges; absrch_validateobject; abu_openproperty; abu_queryinterface; abu_release; abu_validateobject; addref; alloc; assert; assertsz; builddisplaytable; cbitsb; cbnewentryid; cbnewsproptagarray; cbnewssortorderset; charupperbuff; charupperbuffa; checkparameters_iabcontainer_resolvenames; closehandle; commdlgextendederror; comparefiletime; comparestringa; copyprops; copyto; createfile; createiprop; createtable; debugtrace; debugtracearg; debugtraceresult; debugtracesc; declare_mapi_interface; define_oleguid; deletecriticalsection; deleteprops; deregisteridleroutine; entercriticalsection; failed; fcharinstring; fchecked; fequalsabfiles; fillmemory; findlogonobject; fivtabcidleroutine; fmatched; fnamematch; free; freeanrbitmaps; freeprows; ftgregisteridleroutine; generatecontainerdn; getfilesize; getfiletime; getidsfromnames; getlasterror; getmemallocroutines; getnamesfromids; getopenfilename; getproplist; getprops; getprovidertable; getuserdefaultlcid; hr_failed; hrbuildcomboboxtable; hrbuildddlistboxtable; hrbuildlistboxtable; hrbuildroothier; hrgetdetailsdialog; hrgetpropaccess; hrgetsearchdialog; hrgetview; hrlpszgetcurrentfilename; hrmodifyrow; hrnewabcbutton; hrnewablogon; hrnewivtabc; hrnewootid; hrnewroot; hrnewsampdirectory; hrnewsampoouser; hrnewsampuser; hrnewsearch; hrnewstatusobject; hrnewtid; hrnotify; hropenfile; hropensingleprovider; hrreplacecurrentfilename; hrsetobjaccess; hrsetpropaccess; hrvalidateentry; initializecriticalsection; isbadcodeptr; isbadreadptr; isbadwriteptr; ivtabc_abort; ivtabc_advise; ivtabc_collapserow; ivtabc_createbookmark; ivtabc_expandrow; ivtabc_findrow; ivtabc_freebookmark; ivtabc_getcollapsestate; ivtabc_getrowcount; ivtabc_getstatus; ivtabc_querycolumns; ivtabc_queryinterface; ivtabc_queryposition; ivtabc_queryrows; ivtabc_querysortorder; ivtabc_release; ivtabc_restrict; ivtabc_seekrow; ivtabc_seekrowapprox; ivtabc_setcollapsestate; ivtabc_setcolumns; ivtabc_sorttable; ivtabc_unadvise; ivtabc_validateobject; ivtabc_waitforcompletion; leavecriticalsection; loadstring; loadstringa; lpallocbuff; lpallocmore; lpfreebuff; lpmuidfromlogon; lstrcata; lstrcmp; lstrcmpa; lstrcmpi; lstrcpy; lstrcpya; lstrlena; makeintresource; makeresult; mapi_iabcontainer_methods; mapi_iablogon_methods; mapi_iabprovider_methods; mapi_imailuser_methods; mapi_imapicontainer_methods; mapi_imapicontrol_methods; mapi_imapiprop_methods; mapi_imapistatus_methods; mapi_imapitable_methods; mapi_iunknown_methods; mapideinitidle; mapiinitidle; mapimethod_; mapimethod_declare; mapimethod_typedef; memcmp; memcpy; modifystatusrow; muldiv; newuid; nfassertsz; offsetof; onnotify; ootid_savechanges; openentry; openprofilesection; openproperty; pack; ppropfindprop; prop_id; prop_tag; prop_type; propcopymore; queryinterface; queryrows; readfile; realloc; release; removelogonobject; resultfromscode; root_addref; root_copyentries; root_createentry; root_deleteentries; root_getcontentstable; root_gethierarchytable; root_getlasterror; root_getsearchcriteria; root_openentry; root_openproperty; root_queryinterface; root_release; root_resolvenames; root_savechanges; root_setsearchcriteria; root_validateobject; savechanges; scloadstring; serviceentry; setcolumns; seterrorids; setfilepointer; setprops; setprovideruid; sizedsproptagarray; sizedssortorderset; stdmethod_; stdmethodimp_; szdecodescode; text; tid_openproperty; tid_release; tracesz1; validate_iabcontainer_copyentries; validate_iabcontainer_createentry; validate_iabcontainer_deleteentries; validate_iablogon_getoneofftable; validate_iablogon_openentry; validate_iablogon_openstatusentry; validate_iablogon_opentemplateid; validate_imapicontainer_getcontentstable; validate_imapicontainer_gethierarchytable; validate_imapicontainer_getsearchcriteria; validate_imapicontainer_setsearchcriteria; validate_imapicontrol_activate; validate_imapicontrol_getstate; validate_imapiprop_getlasterror; validate_imapiprop_openproperty; validate_imapiprop_savechanges; validate_imapistatus_changepassword; validate_imapistatus_flushqueues; validate_imapistatus_settingsdialog; validate_imapistatus_validatestate; validate_imapitable_abort; validate_imapitable_advise; validate_imapitable_collapserow; validate_imapitable_createbookmark; validate_imapitable_expandrow; validate_imapitable_findrow; validate_imapitable_freebookmark; validate_imapitable_getcollapsestate; validate_imapitable_getrowcount; validate_imapitable_getstatus; validate_imapitable_querycolumns; validate_imapitable_queryposition; validate_imapitable_queryrows; validate_imapitable_querysortorder; validate_imapitable_restrict; validate_imapitable_seekrow; validate_imapitable_seekrowapprox; validate_imapitable_setcollapsestate; validate_imapitable_setcolumns; validate_imapitable_sorttable; validate_imapitable_unadvise; validate_imapitable_waitforcompletion; validate_iunknown_addref; validate_iunknown_queryinterface; validate_iunknown_release; wrap_addref; wrap_copyprops; wrap_copyto; wrap_deleteprops; wrap_getidsfromnames; wrap_getlasterror; wrap_getnamesfromids; wrap_getproplist; wrap_getprops; wrap_openproperty; wrap_queryinterface; wrap_release; wrap_savechanges; wrap_setprops; wsprintfa; zeromemory


Manager.sh: Spooler Message Hook Provider Sample

Click to open or copy the files for the Manager.sh sample.

Click to open or copy the common files (required).

The Manager.sh sample is a spooler message hook provider (SMH32.DLL). The sample spooler hook is an example of an extension to MAPI that uses the documented MAPI spooler message hook interfaces to categorize and archive sent and received mail.

Building SDK Samples

This sample uses the following keywords:

align; align8; cbnewadrlist; change_prop_type; comparestringa; copyprops; createpopupmenu; ctl3d_ceaseautosubclass; ctl3d_getver; ctl3d_isautosubclass; ctl3d_subclass; ctl3dsubclassdlgex; debugtrace; debugtraceproblems; define_oleguid; deleteprops; failed; fhandlewm; fisleapyear; flpszcontainslpsz; fontsize; frkfindsubpsz; fwin4shell; getcurrentthread; getdc; getdlgitem; getparent; getsyscolor; getsystemmetrics; getuserdefaultlcid; getversion; handle_wm_##_wm; handle_wm_notify; hr_failed; hraddentryiestopab; hrarchivemessage; hrbuildrecipient; hrbuildrule; hrcachefolder; hrcachehashedfolder; hrcheckexclusions; hrcheckrule; hrcopyoriginalbody; hrcreatehashedfolder; hrcreateresponse; hrdisplaypropsheets; hreditfilterproperties; hrfilterdeleted; hrfolderfrompath; hrgenerateresponse; hrinitdeletedmailfilter; hrinitoof; hrinitsmh; hrinitstorestable; hrinitunreadsearch; hrinsertannotation; hrinsertbody; hrinsertoriginalheader; hrmergevalues; hroffsetattachments; hropenmdbfromeid; hropenstoentry; hrregoofrecip; hrtagattachments; hrupdateprofileformat; lstrlen; make_smh_version; makedlg3d; makeintresource; makelong; mapi_iricheditolecallback_methods; mapifreebuffer; mapimethod; mapimethod_; mapimethod_declare; mapimethod_typedef; memcmp; messagebox; muldiv; off; prop_tag; pvrelocpv; regdlg3d; reoc_getnewstorage; rgb; sccreatetoolbar; scexportfilters; scflattenprops; scimportfilters; scinsertimportedrule; scnewricheditcallback; scnormalizeflattenedprops; scpickresponserecip; scresolveresponserecip; scsizeflattenedprops; scwriterule; seg; setwindowlong; sizedsproptagarray; smh_inboundmsghook; smh_init; smh_outboundmsghook; smh_queryinterface; smh_serviceentry; stdapi_; stdmethod_; stdmethodimp_; text; unregdlg3d; warning


Peer.xp: Transport Service Provider Sample

Click to open or copy the files for the Peer.xp sample.

Click to open or copy the common files (required).

The Peer.xp sample is a transport service provider (SMPXP.DLL).

Building SDK Samples

This sample uses the following keywords:

addprops; addref; allocatebuffer; allocatemore; arrayindex; assert; atoi; builddisplaytable; cbflatentry; cbflatentrylist; cbnewadrlist; cbnewflatentry; cbnewflatentrylist; cbnewsproptagarray; cbtszsize; charupperbuff; cleanupsession; clone; closehandle; commit; copyprops; copyto; createfile; createiprop; createoneoff; debugtrace; debugtraceproblems; debugtraceresult; debugtracesc; declare_mapi_interface; define_oleguid; deinittransportlog; deletecriticalsection; deletefile; deleteprops; dlgdump; doconfigpropsheet; enablewindow; entercriticalsection; extractprops; failed; fbadunknown; fgettagandtoken; filetimefromsztime; filetimetosystemtime; findclose; findfirstfile; findnextfile; findrow; finish; fistextizedprop; fistransmittable; fisvalidsession; formatfiletime; fpropindex; freebuffer; freemyadrlist; freeprows; getfilesize; getidsfromnames; getlasterror; getlocaltime; getmemallocroutines; getnamesfromids; getproplist; getprops; getprovidertable; getrecipienttable; getscode; gettickcount; gettnefprops; globalalloc; globalfree; globallock; globalunlock; hmemcopy; hr_failed; hradddeferred; hraddreciptoadrlist; hraddreciptoreplylist; hrbuildadrlist; hrbuildsenderprops; hrbuildtransportstatus; hrcheckspooleryield; hrcracksendereid; hrdeletedeferred; hrgetline; hrgetoneprop; hrgetstreamedprop; hrimsgfromtextmsg; hrimsgtotextmsg; hrloadstatusstring; hrmakesearchkey; hropensingleprovider; hrpreparerecipienttable; hrrewindstream; hrsendonemessage; hrsetoneprop; hrupdatetransportstatus; hrwrapstreamonfile; initializecriticalsection; inittransportlog; isbadreadptr; isbadstringptr; isbadwriteptr; leavecriticalsection; loadstring; lockregion; lpallocbuffer; lpallocmore; lpfncallback; lpfreebuff; lpfreebuffer; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; makeintresource; makelong; mapi_imapiprop_methods; mapi_imapistatus_methods; mapi_istream_methods; mapi_iunknown_methods; mapi_ixplogon_methods; mapi_ixpprovider_methods; mapimethod; mapimethod_; mapimethod_declare; mapimethod_typedef; mapscodesz; memcmp; memcpy; memset; messagebox; modifyrecipients; modifystatusrow; newsob; offsetof; openentry; openprofilesection; openproperty; openstreamonfile; opentnef; opentnefstream; preprocessmessage; printftransportlog; prop_id; prop_tag; prop_type; propindex; putstransportlog; querycolumns; queryinterface; queryrows; readfile; release; removepreprocessinfo; restrict; resultfromscode; revert; savechanges; scchecklogonprops; sccopysessionprops; scdologondialog; scdologondlg; scduppropset; scmergelogonprops; scnewwrappedmapiprop; scoptiondatacallback; seek; seekrow; serviceentry; setcolumns; setendoffile; setfilepointer; setfrommeflag; setprops; setsize; shutdown; sizedsproptagarray; sizedssortorderset; sob_accessdenied; sob_addref; sob_changepassword; sob_copyprops; sob_copyto; sob_deleteprops; sob_flushqueues; sob_getidsfromnames; sob_getlasterror; sob_getnamesfromids; sob_getproplist; sob_getprops; sob_openproperty; sob_queryinterface; sob_release; sob_savechanges; sob_setprops; sob_settingsdialog; sob_validatestate; sorttable; spoolernotify; spooleryield; startmessage; stat; statusrecips; stdinitmethodimp_; stdmethod_; stdmethodimp_; strchr; strtok; systemtimetofiletime; text; tracefailedread; tracefailedwrite; uladdref; ulrelease; ult-sizeof; unlockregion; va_end; va_start; wmprop_addref; wmprop_copyprops; wmprop_copyto; wmprop_deleteprops; wmprop_getidsfromnames; wmprop_getlasterror; wmprop_getnamesfromids; wmprop_getproplist; wmprop_getprops; wmprop_openproperty; wmprop_queryinterface; wmprop_release; wmprop_savechanges; wmprop_setprops; writefile; wsprintf; wvsprintf; xpl_addref; xpl_addresstypes; xpl_endmessage; xpl_flushqueues; xpl_idle; xpl_openstatusentry; xpl_poll; xpl_queryinterface; xpl_registeroptions; xpl_release; xpl_startmessage; xpl_submitmessage; xpl_transportlogoff; xpl_transportnotify; xpl_validatestate; xpp_addref; xpp_queryinterface; xpp_release; xpp_shutdown; xpp_transportlogon; xpproviderinit; xpsof_addref; xpsof_clone; xpsof_commit; xpsof_copyto; xpsof_lockregion; xpsof_queryinterface; xpsof_read; xpsof_release; xpsof_revert; xpsof_seek; xpsof_setsize; xpsof_stat; xpsof_unlockregion; xpsof_write


Profile.cli: Profile Creation Sample

Click to open or copy the files for the Profile.cli sample.

Click to open or copy the common files (required).

The Profile.cli sample is a very simple console application creating a profile with hardcoded values.

Building SDK Samples

This sample uses the following keywords:

adminservices; assert; configuremsgservice; createmsgservice; createprofile; deleteprofile; freeprows; getmsgservicetable; getscode; hr_failed; hrcreateprofile; hrqueryallrows; lstrcmp; mapiadminprofiles; mapiinitialize; mapilogonex; mapiuninitialize; printf; szdecodescode; tracefnresult; ulrelease


Propsh.ext: Property Sheet Extension Sample

Click to open or copy the files for the Propsh.ext sample.

Click to open or copy the common files (required).

The Propsh.ext sample demonstrates how to implement custom property sheet extensions for the Microsoft Exchange Client. In particular, it demonstrates adding a custom property page that displays summary sheet information for Microsoft Office documents in a message store. It adds the custom page when viewing properties for a message of class IPM.Document.

Building SDK Samples

This sample uses the following keywords:

addref; createbrushindirect; deleteobject; dllmain; errormessagebox; exchentrypoint; failed; filetimetolocalfiletime; filetimetosystemtime; free; freepages; getfiletimestring; getidsfromnames; getmaxpagecount; getnamedids; getobject; getpages; getprops; getsummarysheetinfo; getsyscolor; getversion; install; lstrcat; lstrcpy; lstrlen; makeintresource; malloc; mapifreebuffer; memset; messagebox; myexchext; myexchextpropertysheets; prop_type; queryinterface; release; setbkcolor; setdlgitemtext; setwindowlong; sizedsproptagarray; stdmethodimp_; strstr; summarypagedlgproc; ulrelease; validdocobject; wsprintf


Remote.srv: Server Message Host Sample

Click to open or copy the files for the Remote.srv sample.

Click to open or copy the common files (required).

The Remote.srv sample is the server-based message repository for MAPI 1.0 transports that handle the Windows Developer Support (WINDS) address type. This program simulates a foreign messaging system.

WINDS also acts as the server host for address book with a global address list. The global address list is the list of recipients in the WINDS host. Since WINDS supports gateways, foreign message recipients appear in the user directories of the gateways currently installed.

Building SDK Samples

This sample uses the following keywords:

abortremotecall; atol; cancelthreadproc; cexception; cnotiflink; cobjectlist; couninitialize; createevent; createfile; ctl3d_autosubclass; ctl3d_initialize; ctl3d_subclass; ctl3d_uninitialize; defined; deletemessage; destroyelement; dlm_xmit_list_a_free_inst; dlm_xmit_list_a_free_xmit; dlm_xmit_list_a_from_xmit; dlm_xmit_list_a_to_xmit; dlm_xmit_list_a_xmitfreeinst_0000; dlm_xmit_list_a_xmitfreexmit_0000; dlm_xmit_list_a_xmittranslatefromxmit_0000; dlm_xmit_list_a_xmittranslatetoxmit_0000; dlm_xmit_list_w_free_inst; dlm_xmit_list_w_free_xmit; dlm_xmit_list_w_from_xmit; dlm_xmit_list_w_to_xmit; dlm_xmit_list_w_xmitfreeinst_0001; dlm_xmit_list_w_xmitfreexmit_0001; dlm_xmit_list_w_xmittranslatefromxmit_0001; dlm_xmit_list_w_xmittranslatetoxmit_0001; drawitemcolumn; endnotifications; facility; failed; filecopy; freedlmlist; getanimatedtimercursor; getdesktopwindow; geterror; getexceptioncode; getlasterror; getlistenmailslot; getlocaltempfilename; getnextpipeid; getprocessheap; getservicestate; getsyscolor; hresult_facility; hresult_from_win32; infotrace; infotraceprop; infotraceraw; initcommoncontrols; initlistviewcolumns; initrpcserver; initwindsservice; isalpha; isdigit; loadsettingsfromregistry; lstrcmpi; lstrcpy; lstrlen; make_hresult; makeintresource; makelangid; makewparam; midl_user_allocate; midl_user_free; min; msgdownloadthread; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrpointerfree; ndrsendreceive; ndrserverinitializenew; ndrsimplestructbuffersize; ndrsimplestructmarshall; ndrsimplestructunmarshall; ndrxmitorrepasbuffersize; ndrxmitorrepasmarshall; ndrxmitorrepasunmarshall; olestr; openmessage; pausewindsservice; pfnallocate; readfile; registerwindsprivateclass; release; releasesyncobj; remoteadmcreatedistlista; remoteadmcreatedistlistw; remoteadmcreatemailboxa; remoteadmcreatemailboxw; remoteadmdeleteobject; remoteadmemptymailbox; remoteadmgetdlpropsa; remoteadmgetdlpropsw; remoteadmgetgaldirectory; remoteadmgetmailboxpropsa; remoteadmgetmailboxpropsw; remoteadmgetserverdistlists; remoteadmgetservermailboxes; remoteadmisserverrunning; remoteadmsetdlpropsa; remoteadmsetdlpropsw; remoteadmsetmailboxpropsa; remoteadmsetmailboxpropsw; remoteadmterminatenotifa; remoteadmterminatenotifw; remoteadmvalidatenotifa; remoteadmvalidatenotifw; remotechangepassworda; remotechangepasswordw; remotechecknewmaila; remotechecknewmailw; remotefinishupload; remotegetallaccounts; remotegetcontainerprops; remotegetcontainerrecipients; remotegetdistlistpropsa; remotegetdistlistpropsw; remotegetpublicfoldermessages; remotegetpublicfolderslist; remotegetrecipientpropsa; remotegetrecipientpropsw; remoteisserverrunning; remotelogonmailboxa; remotelogonmailboxandsetnotifa; remotelogonmailboxandsetnotifw; remotelogonmailboxw; remoteopenheaderdownloadpipea; remoteopenheaderdownloadpipew; remoteopenmsgdownloadpipea; remoteopenmsgdownloadpipew; remoteopenmsguploadpipea; remoteopenmsguploadpipew; remoteopenonemsgdownloadpipea; remoteopenonemsgdownloadpipew; remotesendmsgtoaccounta; remotesendmsgtoaccountw; remoteterminatenotifa; remoteterminatenotifw; remotevalidatenotifa; remotevalidatenotifw; removeallnotiflinks; removewindsservice; resumewindsservice; rpcexcept; rpcexceptioncode; rpcraiseexception; savesettingstoregistry; setevent; setfilepointer; startnotification; static_seticon; stopwindsservice; succeeded; terminateallrpcserver; text; traceinfomessage; traceprop; traceraw; waitforsingleobject; windsadm_remoteadmcreatedistlista; windsadm_remoteadmcreatedistlistw; windsadm_remoteadmcreatemailboxa; windsadm_remoteadmcreatemailboxw; windsadm_remoteadmdeleteobject; windsadm_remoteadmemptymailbox; windsadm_remoteadmgetdlpropsa; windsadm_remoteadmgetdlpropsw; windsadm_remoteadmgetgaldirectory; windsadm_remoteadmgetmailboxpropsa; windsadm_remoteadmgetmailboxpropsw; windsadm_remoteadmgetserverdistlists; windsadm_remoteadmgetservermailboxes; windsadm_remoteadmisserverrunning; windsadm_remoteadmsetdlpropsa; windsadm_remoteadmsetdlpropsw; windsadm_remoteadmsetmailboxpropsa; windsadm_remoteadmsetmailboxpropsw; windsadm_remoteadmterminatenotifa; windsadm_remoteadmterminatenotifw; windsadm_remoteadmvalidatenotifa; windsadm_remoteadmvalidatenotifw; windsrem_remotechangepassworda; windsrem_remotechangepasswordw; windsrem_remotechecknewmaila; windsrem_remotechecknewmailw; windsrem_remotefinishupload; windsrem_remotegetallaccounts; windsrem_remotegetcontainerprops; windsrem_remotegetcontainerrecipients; windsrem_remotegetdistlistpropsa; windsrem_remotegetdistlistpropsw; windsrem_remotegetpublicfoldermessages; windsrem_remotegetpublicfolderslist; windsrem_remotegetrecipientpropsa; windsrem_remotegetrecipientpropsw; windsrem_remoteisserverrunning; windsrem_remotelogonmailboxa; windsrem_remotelogonmailboxandsetnotifa; windsrem_remotelogonmailboxandsetnotifw; windsrem_remotelogonmailboxw; windsrem_remoteopenheaderdownloadpipea; windsrem_remoteopenheaderdownloadpipew; windsrem_remoteopenmsgdownloadpipea; windsrem_remoteopenmsgdownloadpipew; windsrem_remoteopenmsguploadpipea; windsrem_remoteopenmsguploadpipew; windsrem_remoteopenonemsgdownloadpipea; windsrem_remoteopenonemsgdownloadpipew; windsrem_remotesendmsgtoaccounta; windsrem_remotesendmsgtoaccountw; windsrem_remoteterminatenotifa; windsrem_remoteterminatenotifw; windsrem_remotevalidatenotifa; windsrem_remotevalidatenotifw; workingioproc; writefile


Remote.xp: Remote Transport Provider (XPWDSR) Sample

Click to open or copy the files for the Remote.xp sample.

Click to open or copy the common files (required).

The Remote.xp sample is a remote transport provider (XPWDSR) implemented in C++. This transport demonstrates the following extended MAPI features:

  • REMOTE interface for slow-link connection to a remote host. This includes implementation of the IMAPIFolder methods needed to interact with a client remote viewer application.

  • Deferred delivery mechanism for scheduled message submission to a remote host at a user-defined upload time.

  • Forced immediate connection and submission (using the FlushQueues method implemented in the IMAPIStatus object) in response to Deliver Mail Now and Transfer Mail in the Microsoft Exchange Client.

  • Server-based messaging.

  • Real world working mail transport, which sends messages to a Windows® NT workstation or server running the Windows Developer Support (WINDS) Sample Server Messaging Host included with this and other MAPI samples.

  • Transport Neutral Encapsulation Format (TNEF) interface to encapsulate ALL the message properties.

  • IMAPIStatus interface for client access to transport status.

  • Multithread safe.

  • Configuration dialogs.

  • Generation of delivery and nondelivery reports.

  • Profile Wizard for interactive profile configuration.

  • WINDS address type.

  • Background download and FlushQueues spooler interaction for spooler-marshalled remote connections.

  • Single binary file for Windows NT and Windows® 95.

Building SDK Samples

This sample uses the following keywords:

addref; aretherependingdownloads; assert; atoi; cbnewsproptagarray; cbtszsize; cexception; checkforunfinisheddownloads; checkspooleryield; clist; closehandle; cmsgqueue; copymemory; copytabletofile; defined; defwindowproc; delete; downloadmessageheaders; empty; emptyinboundqueue; failed; fistransmittable; freeprows; getaccountname; getdownloadnode; geterror; getexceptioncode; getinstance; getlasterror; getlocalheaderscache; getprocessheap; getremotefoldertabledata; getservername; gettickcount; gettransportstate; gettransportstatuscode; gpfnallocatemore; gpfnfreebuffer; hr_failed; hresult_facility; hresult_from_win32; infotrace; initializestatusrow; initializetimer; lstrlen; make_hresult; makeintresource; mapi_imapicontainer_methods; mapi_imapifolder_methods; mapi_imapiprop_methods; mapi_imapistatus_methods; mapi_ixplogon_methods; mapi_ixpprovider_methods; midl_user_allocate; midl_user_free; min; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrpointerfree; ndrsendreceive; ndrserverinitializenew; pfnallocate; problem; processheaders; prop_id; prop_tag; prop_type; release; remotechangepassworda; remotechangepasswordw; remotechecknewmaila; remotechecknewmailw; remotefinishupload; remotegetallaccounts; remotegetcontainerprops; remotegetcontainerrecipients; remotegetdistlistpropsa; remotegetdistlistpropsw; remotegetpublicfoldermessages; remotegetpublicfolderslist; remotegetrecipientpropsa; remotegetrecipientpropsw; remoteisserverrunning; remotelogonmailboxa; remotelogonmailboxandsetnotifa; remotelogonmailboxandsetnotifw; remotelogonmailboxw; remoteopenheaderdownloadpipea; remoteopenheaderdownloadpipew; remoteopenmsgdownloadpipea; remoteopenmsgdownloadpipew; remoteopenmsguploadpipea; remoteopenmsguploadpipew; remoteopenonemsgdownloadpipea; remoteopenonemsgdownloadpipew; remotesendmsgtoaccounta; remotesendmsgtoaccountw; remoteterminatenotifa; remoteterminatenotifw; remotevalidatenotifa; remotevalidatenotifw; revert; rpcexcept; rpcexceptioncode; rpcraiseexception; setidentityprops; setlogon; sizedsproptagarray; startuploadtimer; stdmethodimp_; stopuploadtimer; strtok; succeeded; terminateremoteconnections; text; traceinfomessage; tracemessage; uninittraces; updateprogress; updatestatus; windsrem_remotechangepassworda; windsrem_remotechangepasswordw; windsrem_remotechecknewmaila; windsrem_remotechecknewmailw; windsrem_remotefinishupload; windsrem_remotegetallaccounts; windsrem_remotegetcontainerprops; windsrem_remotegetcontainerrecipients; windsrem_remotegetdistlistpropsa; windsrem_remotegetdistlistpropsw; windsrem_remotegetpublicfoldermessages; windsrem_remotegetpublicfolderslist; windsrem_remotegetrecipientpropsa; windsrem_remotegetrecipientpropsw; windsrem_remoteisserverrunning; windsrem_remotelogonmailboxa; windsrem_remotelogonmailboxandsetnotifa; windsrem_remotelogonmailboxandsetnotifw; windsrem_remotelogonmailboxw; windsrem_remoteopenheaderdownloadpipea; windsrem_remoteopenheaderdownloadpipew; windsrem_remoteopenmsgdownloadpipea; windsrem_remoteopenmsgdownloadpipew; windsrem_remoteopenmsguploadpipea; windsrem_remoteopenmsguploadpipew; windsrem_remoteopenonemsgdownloadpipea; windsrem_remoteopenonemsgdownloadpipew; windsrem_remotesendmsgtoaccounta; windsrem_remotesendmsgtoaccountw; windsrem_remoteterminatenotifa; windsrem_remoteterminatenotifw; windsrem_remotevalidatenotifa; windsrem_remotevalidatenotifw


Route.cli: MAPI Routing Client Sample

Click to open or copy the files for the Route.cli sample.

Click to open or copy the common files (required).

The Route.cli sample illustrates two important aspects of MAPI:

  • How to use specially defined named properties, known as routing property sets, for storing addressing information when sending messages across different messaging systems.

  • How to use basic MAPI facilities, as an e-mail client might.

Different messaging systems use different address formats. So when a message crosses a domain boundary, usually passing through a gateway, the addressing information needs to be translated from the format used by the original domain to the format used by the new domain. Almost all gateways do this for the sender and ordinary message recipients. MAPI defines a special mechanism for preserving the addressing information for users who are not on the message recipient list. See "Sending Messages Between Domains" in the MAPI online documentation for more information. This sample uses the mechanism to route a message to a list of people one after another.

The routing client demonstrates the use of routing property sets by implementing a simple linear route for a message with optional attached documents. The routing list is stored in the routing property sets, and each user who receives the message has an opportunity to edit the message and pass it to the next person in the routing list. Each user may optionally edit the remainder of the route as well.

The sample routing client also serves as a simple e-mail client. Features include:

  • Viewing the contents table of any folder in any message store.

  • Sending or reading any message, using the form registered for it.

  • Forcing new mail to be downloaded to the default message store.

  • Deleting mail.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; address; assert; bitblt; cbnewadrlist; clientlogoff; clientlogon; common_oncommand; commondlgproc; compareentryids; composedlgproc; configmovebuttons; convertdaterec; copyfile; copymemory; copyto; createattach; createcompatiblebitmap; createcompatibledc; createdialogdata; createdibitmap; creatediscardablebitmap; createfontindirect; createmessage; createnewattachment; createoutmessage; createsolidbrush; ctl3d_autosubclass; ctl3d_initialize; ctl3d_uninitialize; debugtrace; debugtraceproblems; debugtraceresult; deinitapplication; deinitbmps; deinitmapi; deinitroutedata; deleteattach; deletebitmaplb; deletedc; deletemessages; deletemsgnode; deleteobject; deleteprops; delivernow; delrouteprops; details; detailsdlgproc; dialogboxparam; drawfocusrect; drawitem; edit_getlinecount; edit_getmodify; edit_lineindex; edit_linelength; enablewindow; enddialog; exttextout; fgetfoldchooser; filetimetolocalfiletime; filetimetosystemtime; findresource; firstrecipient; flushqueues; formatfiletime; formatmessageid; freelibrary; freemsglist; freeoarlist; freepadrlist; freeprows; freeresource; getattachmenttable; getbvalue; getcontentstable; getdc; getdlgitem; getgvalue; gethierarchytable; getidsfromnames; getlasterror; getmsgstorestable; getobject; getparent; getprocaddress; getprops; getreceivefolder; getrouteaddrlists; getrouteindices; getrouteproptagarray; getrouteproptagarrayfast; getrvalue; getscode; getstatustable; getstockobject; getsyscolor; gettextmetrics; getwindowfont; getwindowlong; globalallocptr; globalfreeptr; handle_msg; hasattachment; hr_failed; hr_succeeded; hrgetoneprop; hrqueryallrows; hrsetoneprop; inbox_oncommand; inboxdlgproc; initapplication; initbmps; initinstance; initmapi; initroutenameidarray; insertmsgnode; invalidaterect; listbox_addstring; listbox_deletestring; listbox_getcount; listbox_getcursel; listbox_getitemdata; listbox_getitemrect; listbox_gettext; listbox_insertstring; listbox_resetcontent; listbox_setcursel; listbox_setitemdata; loadalterbitmap; loadbitmaplb; loadcursor; loadlibrary; loadresource; loadstring; lockresource; logoff; logsendmail; lstrcat; lstrcmpi; lstrcpy; lstrlen; main_oncommand; mainwndproc; makeintresource; makemessagebox; makemsgnode; makenewroutemessage; mapdialogrect; mapiallocatebuffer; mapiallocatemore; mapifreebuffer; mapiinitialize; mapilogonex; mapiopenformmgr; mapiuninitialize; max; measureitem; memcpy; memset; messagebox; modifyrecipients; openaddressbook; openattach; opendefaultstore; openentry; openmsgstore; openoutfolder; openproperty; optionsdlgproc; outtextformat; populateattachlist; populatemessages; populateroutelistbox; ppropfindprop; prepareform; preparerecips; prop_id; prop_tag; prop_type; rbox_oncommand; rbox_oninitdialog; read_oncommand; read_oninitdialog; readmaildlgproc; release; releasedc; resultfromscode; rgb; rgbinvertrgb; rt_oncommand; rt_oninitdialog; saveattachment; savechanges; scaddconversationindex; scduppropset; securemenu; selectform; selectobject; setbkcolor; setcursor; setdlgitemtext; seterrormode; setfocus; setlbfont; setmessageclass; setprops; setreadflag; setrect; setrgbvalues; setrouteindices; setrouteprops; settextcolor; setwindowfont; setwindowlong; setwindowpos; setwindowtext; showform; sizedsproptagarray; sizedssortorderset; stat; submitmessage; switch; szfindlastch; text; togglemenustate; ulrelease; unlockresource; winmain; wsprintf; zeromemory


Simple.cli: Simple MAPI Client Sample

Click to open or copy the files for the Simple.cli sample.

Click to open or copy the common files (required).

The Simple.cli sample application illustrates using Simple MAPI functions. The sample is a very simple mail client. Using it is intuitive and straightforward.

When writing simple MAPI applications, the addresses of all of the simple MAPI functions have to be obtained explicitly (using GetProcAddress), as opposed to linking to the import library for MAPI.DLL.

If sending or receiving mail is not the primary function of your application, you can test the presence of simple MAPI in a system without incurring high cost of trying to load a DLL by testing the value of the MAPI variable. It is 1 if simple MAPI is installed. The variable is located in the [mail] section of Win.ini on 16-bit Windows and Windows® NT version 3.51 and earlier; it is under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem in the registry on Windows® 95 and Windows NT 4.0 and later.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; aboutdlgproc; assert; atoi; bitblt; composedlgproc; convertdaterec; copyattachment; copyfile; copymemory; copyrecipient; createcompatiblebitmap; createcompatibledc; createdibitmap; creatediscardablebitmap; createfontindirect; deinitapplication; deinitbmps; deinitsimplemapi; deletebitmaplb; deletedc; deletefile; deletemsgnode; deleteobject; detailsdlgproc; dialogbox; drawfocusrect; drawitem; exttextout; findnode; findresource; fnameinlist; freemsglist; freeresource; fsmapiinstalled; getbvalue; getdc; getdlgitem; getgvalue; getnextfile; getobject; getprofileint; getprofilestring; getrvalue; getstockobject; getsyscolor; gettextmetrics; getversionex; getwindowfont; globalallocptr; globalfreeptr; inboxdlgproc; initapplication; initbmps; initinstance; initsimplemapi; insertmsgnode; invalidaterect; loadalterbitmap; loadbitmaplb; loadcursor; loadlibrary; loadresource; loadstring; lockresource; logsendmail; lstrcmp; lstrcpy; lstrlen; mainwndproc; makedisplaynamestr; makeintresource; makelong; makemessagebox; makemsgnode; makenewmessage; mapifreebuffer; mapisendmail; max; measureitem; memcpy; memset; messagebox; messageboxa; openfile; optionsdlgproc; outtextformat; pvalloc; pvallocmore; pvfree; readmaildlgproc; regclosekey; regopenkeyex; regqueryvalueex; releasedc; resolvefriendlynames; rgb; rgbinvertrgb; savefileattachments; savemsgchanges; securemenu; selectobject; senddlgitemmessage; sendmessage; setbkcolor; setcursor; setdlgitemtext; seterrormode; setfocus; setlbfont; setrect; setrgbvalues; settextcolor; setwindowfont; strtok; text; togglemenustate; unlockresource; winmain; wsprintf


Simple.frm: MAPI Simple Form Sample

Click to open or copy the files for the Simple.frm sample.

Click to open or copy the common files (required).

The Simple.frm sample application illustrates writing a MAPI form in C++. The form can be used by form-aware mail clients for sending or receiving messages of IPM.Note.Sample.Simple message class instead of standard send/read forms.

Building SDK Samples

This sample uses the following keywords:

activatenext; addref; address; advise; assert; begindeferwindowpos; cbaseform; cbnewadrlist; cclassfactory; cleardirty; clearwindow; configmenu; configwinmenu; copymemory; copymessage; copyto; coregisterclassobject; createdialog; createinstance; createwindow; ctl3d_autosubclass; ctl3d_initialize; ctl3d_uninitialize; debugtrace; debugtraceproblems; deferwindowpos; define_guid; defwindowproc; deinitobjects; deletemessage; destroywindow; dispatchmessage; displaymessage; docopy; dodelete; domove; donext; doreply; dosave; dosubmit; doverb; edit_getmodify; edit_gettext; edit_setmodify; edit_settext; enablemenuitem; enddeferwindowpos; exitinstance; failed; fgetfoldchooser; filetimetolocalfiletime; filetimetosystemtime; findatom; formattime; formdlgprocread; formdlgprocsend; freelibrary; freepadrlist; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getclassid; getdlgitem; getlasterror; getmenu; getmessage; getnext; getparent; getprocaddress; getprops; getscode; getsession; getsitestatus; getsystemmetrics; getversion; getviewcontext; getviewstatus; getwindowlong; getwindowrect; getwindowtext; getwindowtextlength; globaladdatom; globaldeleteatom; handle_wm_size; hr_failed; hr_succeeded; hrgetlasterror; hrgetmsgdatafrommsg; hrgetmsgdatafromui; hropenform; hrqueryallrows; hrquerysave; hrreply; hrsaveinto; hrsavetostring; hrsetlasterror; hrstreaminmsgbody; hrstreamoutmsgbody; initapplication; initialize; initinstance; initnew; isaddressed; ischild; isdialogmessage; isdirty; load; loadaccelerators; loadcursor; loadicon; loadlibrary; lockserver; lstrcat; lstrcmpi; lstrcpyn; lstrlen; makeintresource; mapi_getlasterror_method; mapi_imapiform_methods; mapi_imapiformadvisesink_methods; mapi_ipersistmessage_methods; mapi_iunknown_methods; mapiallocatebuffer; mapiallocatemore; mapifreebuffer; mapiuninitialize; message; messagebox; modifyrecipients; movemessage; movewindow; msgsite; newmessage; objdestroyedcallback; offsetrect; on_size; onactivatenext; onchange; onnewmessage; onprint; onsaved; onsubmitted; openaddressbook; openproperty; postquitmessage; prop_type; queryinterface; registerclassex; release; resultfromscode; save; savecompleted; savemessage; scaddconversationindex; sendmessage; setadvisesink; setdlgitemtext; seterrormode; setfocus; setforegroundwindow; setminsize; setprops; setviewcontext; setwindowlong; setwindowpos; setwindowtext; showerror; showmessagebox; showwindow; shutdownform; sizedsproptagarray; stat; stdmethod; stdmethod_; stdmethodimp_; str; submitmessage; switch; translateaccelerator; translatemessage; ulrelease; unadvise; updaterecipientsdisplay; viewctx; warning; winmain; wndprocform; wndprocmain; wsprintf; zeromemory


SimpleMAPI: Demonstration of MAPI

Click to open or copy the files for the Simplemapi sample.

This sample demonstrates the basics of the Messaging Applications Programming Interface (MAPI).

Building SDK Samples

This sample uses the following keywords:

beginpaint; createwindow; cwunregisterclasses; defwindowproc; deinitmapi; destroywindow; dispatchmessage; enablemenuitem; endpaint; freelibrary; getdialogbaseunits; getfocus; getmenu; getmessage; getprocaddress; getstringres; initmapi; initmessage; loadcursor; loadicon; loadlibrary; loadstring; lpfnmapifreebuffer; mapiaddress; mapideletemail; mapidetails; mapifindnext; mapifreebuffer; mapilogoff; mapilogon; mapireadmail; mapiresolvename; mapisavemail; mapisenddocuments; mapisendmail; memset; messagebox; mycpystr; ncwregisterclasses; outofmemory; postquitmessage; registerclass; setbkmode; showwindow; sprintf; strcpy; translatemessage; unregisterclass; winmain; wndproc


ODBC Samples

Click to open or copy the files for the ODBC samples.


Admndemo: ODBC SA Tool Sample

Click to open or copy the files for the Admndemo sample.

This sample has the following parts:

File | Description
Admndemo.c | Contains the main interface modules for SATOOL, including the MDI client support.
Child.h | Defines the CHILDINFO type, which is the main data structure for a connection window.
Dialogs.c | Contains the dialog procedures which are used to display catalog function arguments and display the results. Note that the best way to determine the size of the arguments would be to use SQLGetInfo; however, to simplify the coding, the values are hard-coded as constants.
Dialogs.h | Contains all of the constant definitions for the dialog boxes used for the lists.
Errcheck.c | Contains common error checking functions.
Execute.c | Contains the code to execute SQL statements and display them. This file is dependent on the SA Tool data structures and the independent module RESULTS.
Execute.h | Contains the prototypes and defines for executing SQL statements and displaying their results.
Info.c | Contains the functions which handle the Info menu items. This module relies on RESULTS and EXECUTE. This file contains the actual code to execute SQL statements and display them. This file is dependent on the SA Tool data structures and the independent module RESULTS.
Info.h | Contains the functions which handle the Info menu items.
Ini.c | Contains the functions which work with SAtool.ini.
Menu.c | Takes care of enabling and disabling menus.
Menu.h | Contains menu IDs.
Results.c | Contains functions that allow you to view results via an owner-drawn list box. The list box functionality makes it easy to implement pipes, but it has some serious drawbacks with record limits, storage methods, etc. If you need a great way to paint data in a grid, see the C++ or Cursor Demo samples that came with this SDK.
Standard.c | Contains standard functions, which can be used by many different tools. The DumpDebugInfo function, when enabled, will cause all memory requests and frees to be written to a comma-separated file. You can then query this file via the sample Text ODBC Driver to find memory problems.
Standard.h | Contains standard includes that are required by many modules. This include file is not specific for any tool. If using this file for a DLL, #define STANDARD_DLL, otherwise it is assumed that it is being used for a Windows application.
Strings.h | Contains the defines for the string table error and information messages. Load these strings using the GetidsString function.

Building SDK Samples

This sample uses the following keywords:

_based; _fmemset; _fstrcat; _fstrchr; _fstrstr; _lclose; _llseek; _lopen; _lread; _lwrite; _segname; _vsnprintf; aboutwndproc; abs; addresultsinfonode; addrowdata; allocaterowdata; atoi; beginpaint; bintochar; bit32_item; bitclear; bitflip; bitget; bitset; busy; catalogwndproc; centerdialog; checkdisplaymode; checkdlgbutton; checkforresults; checkradiobutton; childwndproc; chknull; choosefont; cleanup; connect; convertsqltypetochar; createfontindirect; createresultsfont; createresultsset; createresultswindow; createwindow; dcseg; debugaddr; debuggetmemory; debugmsg; debugreleasememory; defframeproc; defmdichildproc; deleteobject; destroyresultswindow; destroywindow; dex32_item; dialogboxparam; disconnect; dispatchmessage; displayabout; displayerrors; displaygetinfo; displayodbcdatasources; displayodbcdatatypes; displayodbcfunctions; docatalogfunction; doclosedown; docommitrollback; doconnect; dodisconnect; dofileopen; dofilesave; dofilesaveas; dogetmemory; dolist; domain; dopipe; dopipebyvalue; dopipewndproc; doposterror; doreleasememory; drawcolumntitles; drawfocusrect; drawrow; drawrowdata; dumpdebuginfo; editpipe; editpipewndproc; enablemenuitem; enablewindow; enddialog; endpaint; executecmds; executefile; executefilewndproc; exttextout; fetchallrecordstoresults; fillrect; findrightcol; findterminator; freeconnectwindowresults; freeresultsset; freerowdata; get_wm_command_id; getactivewindow; getbitval; getcipointer; getclientrect; getconndex; getconnectwindowresultsnode; getdc; getdefaultfont; getdefaultrgb; getdlgitem; getdlgitemtext; geteditwindow; getfocus; getfontstyle; getidsstring; getindexval; getmemory; getmenunum; getmessage; getnewdirectory; getnumresultscols; getopenfilename; getparent; getpipenames; getprivateprofileint; getprivateprofilestring; getradiovalue; getrwpointer; getsavefilename; getscrollpos; getsqlstate; getstockobject; getsubmenu; getsyscolor; getsystemmetrics; gettext; gettextextentpoint; gettextmetrics; gettypename; getwindow; getwindowlong; getwindowrect; getwindowsdirectory; getwindowtext; globalallocptr; globalfreeptr; globalptrhandle; globalsize; handlehscroll; handlepipe; handlevirtualhscroll; iloadstring; info_value_row; inforow; int16_item; int32_item; internaldestroyresultswindow; invalidaterect; isclipboardformatavailable; isdlgbuttonchecked; isradiobuttonon; isvalidparms; iszoomed; lineto; loadaccelerators; loadcursor; loadicon; loadmenu; loadstring; localtime; lpatoi; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; makeintresource; makelong; makelparam; max; memcpy; memmove; memset; messagebox; min; minrequiredints; moveto; movetoex; movewindow; newpipe; newpipewndproc; notinquote; numitems; openfile; outputdebugstring; parsecommandline; parseoptionsvalues; posterror; postquitmessage; prepareparmlist; printaffectedrows; printerrors; printerrorshwnd; promptforfontname; rc_notsuccessful; rc_successful; rectangle; refreshlist; refreshpipelist; registerclass; releasedc; releasememory; removecrlf; resetmenu; resolveinifile; resultswndproc; rgb; selectobject; sendmessage; setbkcolor; setbkmode; setcipointer; setcolumndata; setcursor; setdefaultfont; setdefaultrgb; setdlgitemtext; setfocus; setfontstyle; setmetadatacolumn; setmetadatafromsql; setrwpointer; setscrollpos; setscrollrange; settextalign; settextcolor; setup; setwindowlong; setwindowtext; showcatalogresults; showcursor; showwindow; sprintf; sqlallochandle; sqlbindparameter; sqlcolumnprivileges; sqlcolumns; sqldatasources; sqldescribecol; sqldisconnect; sqldriverconnect; sqlendtran; sqlexecdirect; sqlexecute; sqlfetch; sqlforeignkeys; sqlfreehandle; sqlfreestmt; sqlgetdata; sqlgetdiagrec; sqlgetfunctions; sqlgetinfo; sqlgettypeinfo; sqlmanagedatasources; sqlmoreresults; sqlnumresultcols; sqlparamdata; sqlprepare; sqlprimarykeys; sqlprocedurecolumns; sqlprocedures; sqlputdata; sqlrowcount; sqlsetconnectattr; sqlsetenvattr; sqlspecialcolumns; sqlstatistics; sqltableprivileges; sqltables; strchr; strcmp; strncmp; strng_item; strstr; strtok; strtoul; switch; szmessagebox; szwrite; time; translateaccelerator; translatemdisysaccel; translatemessage; updatewindow; va_end; va_start; validname; validsqlstmt; winassert; winassertreal; winhelp; wndproc; writeprivateprofilestring; wsprintf


ConvDSN: ODBC File DSN Pointers Sample

Click to open or copy the files for the ConvDSN sample.

This sample contains ODBC code for creating File DSN pointers to machine DSNs.

Building SDK Samples

This sample uses the following keywords:

expandfilename; isalpha; isdbcsleadbyte; isdigit; makelegalname; sql_succeeded; sqlallochandle; sqldatasources; sqlfreehandle; sqlsetenvattr; sqlwritefiledsn; strcat; strcpy; winmain


CrsrDemo: ODBC Cursors Demonstration

Click to open or copy the files for the CrsrDemo sample.

This sample has the following parts:

File | Description
Child.c | Contains routines that maintain a child window. These include most interfaces with ODBC, including all data retrieval and display.
Crsrdemo.c | Main file; contains the standard functions used in a Windows program (such as WinMain), plus two functions shared between all the files.
Dialogs.c | Contains routines used to display and manage cursors dialogs.
Frame.c | Main window procedure; contains functions used to manage the main frame window. The frame window, created by code in Main.c, owns the MDI client window, the menu bar, and other major parts of the interface.

Building SDK Samples

This sample uses the following keywords:

_fstrncpy; _fstrnicmp; _fstrstr; _gcvt; _ltoa; aboutdlgproc; absdlgproc; addeditcontrols; adjustmenus; adjustwindowrect; aligntocontrol; allocchild; alloccliprgn; allocptr; ansinext; async; beginpaint; button_getcheck; button_setcheck; cancel; cancelsql; centerdialog; char; childoptdlgproc; childproc; classoncommand; closeall; closeallenum; closechild; conststr; controlvalue; createchild; createdialogparam; createfont; createrectrgn; createsolidbrush; createwindow; cvtsqltoctype; datadlgproc; dbcerror; defframeproc; defmdichildproc; deleteobject; deleterow; deleterowthread; destroymenu; destroywindow; dialogboxparam; dispatchmessage; dlgprocfilter; dlgx; dlgy; dochildmenu; doconnect; dodialog; dodisconnect; doframemenu; domessage; dosql; dosqlthread; drawmenubar; drawtext; edit_enable; edit_gettext; edit_limittext; edit_settext; enablemenuitem; enddialog; endinstance; endpaint; enumchildwindows; enverror; fetch; fetchthread; fillrect; finddlgproc; forward_wm_mdicascade; forward_wm_mdicreate; forward_wm_mdidestroy; forward_wm_mdigetactive; forward_wm_mdiiconarrange; forward_wm_mdinext; forward_wm_mdisetmenu; forward_wm_mditile; forward_wm_setfont; frameproc; freeprocinstance; freeptr; freestmt; get_em_setsel_mps; get_wm_command_id; get_wm_hscroll_code; get_wm_hscroll_pos; get_wm_mdiactivate_factivate; get_wm_vscroll_code; getbkcolor; getclientrect; getclipbox; getcurrentthreadid; getcurrentvalue; getdata; getdatathread; getdc; getdesktopwindow; getdevicecaps; getdialogbaseunits; getdlgctrlid; getdlgitem; geteditcontrols; getkeystate; getmenu; getmenuitemcount; getmessage; getparent; getrgnbox; getscrollpos; getscrollrange; getsubmenu; getsyscolor; getsystemmetrics; gettablename; gettextcolor; gettextextentpoint; gettextmetrics; getwindow; getwindowlong; getwindowrect; getwindowtext; globalallocptr; globalfreeptr; handle_wm_command; inflaterect; initapplication; initcontrolcallback; inithand; initializedialogcontrols; initializelistbox; initinstance; intersectrect; invalidaterect; invertrect; is_allwfetch; isblank; iscomma; isdialogmessage; islparen; ismsgwaiting; isnum; isperiod; isreturn; isrparen; istab; isupdateable; iswhite; listbox_addstring; listbox_findstringexact; listbox_getcursel; listbox_getitemdata; listbox_gettext; listbox_setcursel; listbox_setitemdata; loadaccelerators; loadcursor; loadicon; loadmenu; loadstring; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrcpyn; lstrlen; makeintresource; makeprocinstance; maketable; maketabledlgproc; max; memcpy; messagebox; movewindow; mycreatedialog; nullifempty; odbcerror; offsetrect; ondatarow; optdlgproc; optimize; optionsdlgproc; paintchild; paramvalid; patblt; peekmessage; postmessage; postquitmessage; preparestmt; print; processresults; registerclass; reldlgproc; releasecapture; releasedc; rgb; row_binding; screentoclient; selectcliprgn; selectobject; senddlgitemmessage; sendmessage; setbkcolor; setcapture; setcurrentvalue; setcursor; setdlgtext; setfocus; sethiddenfields; setorgetcheck; setorgeteditarray; setpos; setscroll; setscrollpos; setscrollrange; settextcolor; setwindowlong; setwindoworgex; setwindowtext; showwindow; sizescroll; sqlallochandle; sqlbindcol; sqlcancel; sqlcolattribute; sqlcolattributes; sqlcolumns; sqlcreatedatasource; sqldisconnect; sqldriverconnect; sqlexecdirect; sqlexecute; sqlfetchscroll; sqlfreehandle; sqlfreestmt; sqlgetcursorname; sqlgetdata; sqlgetdiagrec; sqlgetinfo; sqlgetstmtattr; sqlgettypeinfo; sqlnumresultcols; sqlprepare; sqlprocedures; sqlrowcount; sqlsetconnectattr; sqlsetcursorname; sqlsetenvattr; sqlsetparam; sqlsetpos; sqlsetstmtattr; sqlstatistics; sqltableprivileges; sqltables; sqltablesdlgproc; static_enable; static_settext; stmtdlgproc; stmterror; strcmp; strncmp; strncpy; strtod; strtol; success; switch; tabbedtextout; tabledlgproc; textout; translateaccelerator; translatemdisysaccel; translatemessage; unref_param; updatedlgproc; updaterow; updaterowthread; updatewindow; warning; winhelp; winmain; wsprintf; wvsprintf


QuikTest: ODBC Auto-Test DLL Sample

Click to open or copy the files for the QuikTest sample.

This sample has the following parts:

File | Description
Custom.c | Shows how an ODBC auto test DLL may be written and subsequently run via the ODBC Test application.
Custom.h | Contains the defines required for the resource strings in Custom.rc. This file is optional for an auto test DLL.
Dllstub.c | Generic module that contains the entry points required to compile a DLL.
Quiktest.c | Quick Test of the basic functionality of an ODBC driver.
Autotest.h | Contains constants and prototypes required to compile a custom Auto Test DLL.

Building SDK Samples

This sample uses the following keywords:

_crt_init; _ltot; _sntprintf; _tcschr; _tcscpy; _tcslen; _tcsnccat; _tcsnccmp; _tcsncmp; _tcsstr; _tcstod; _tcstok; _tcstoul; _tstrtime; _ttoi; _ttol; aborttest; allocatememory; allochdbc; allochenv; allochstmt; allowedtype; autotestdesc; autotestfunc; autotestname; bindallcolumns; bindfetchcolumns; bintohex; buildcreatestmt; buildinsertstmt; canallochdesc; checkconformancelevel; checkdata; checkdataresults; checkdescop; checkdescrecord; checkdescriptor; checkerrs; checktest; cleanup; clearerrorqueue; closehandle; cmpodbctochar; compareansitounicode; compareansiunicoderesults; comparedescfield; comparedescriptor; comparewithexpected; connect; count; createdescrecord; createparamquery; createthread; cvtchartoodbc; descbindcol; descbindparameter; diagretcheck; displayallerrors; displayerror; displaytestname; dodisplayinfodesc; dohelloworld; dosimpleconnect; drophdbc; drophenv; droptable; errshandle; execendtran; finderror; freestmt; fulldisconnect; getbit; getdiagrecs; getdmversion; geterrors; getqbit; getrcstring; getrowcnt; getsomedata; gettypeinfo; globalalloc; globalfree; globalhandle; globallock; globalunlock; ignoretype; inittest; insertonerow; irowsetrow%; is3xdriver; libmain; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; max; memcmp; memcpy; min; multibytetowidechar; numitems; qtdisplayerror; qtmakedata; rc_notsuccessful; rc_successful; releasememory; resethstmt; retcheck; retcodetotchar; retrievedata; returncheck; searchforerror; selectfromtable; selectfromtablefetch; selectorof; setconnectionattributes; seterrorcondition; setstatementattributes; settablename; sql_len_data_at_exec; sql_succeeded; sqlallocconnect; sqlallocenv; sqlallochandle; sqlallocstmt; sqlbindcol; sqlbindparam; sqlbindparameter; sqlbrowseconnect; sqlcancel; sqlclosecursor; sqlcolattributes; sqlcolumnprivileges; sqlcolumns; sqlcolumnsa; sqlcolumnsw; sqlconnect; sqlconnecta; sqlconnectw; sqlcopydesc; sqldatasources; sqldescribecol; sqldescribeparam; sqldisconnect; sqldriverconnect; sqldrivers; sqlendtran; sqlerror; sqlexecdirect; sqlexecdirecta; sqlexecdirectw; sqlexecute; sqlextendedfetch; sqlfetch; sqlfetchscroll; sqlforeignkeys; sqlfreeconnect; sqlfreeenv; sqlfreehandle; sqlfreestmt; sqlgetconnectattr; sqlgetconnectoption; sqlgetcursorname; sqlgetdata; sqlgetdescfield; sqlgetdescrec; sqlgetdiagfield; sqlgetdiagrec; sqlgetenvattr; sqlgetfunctions; sqlgetinfo; sqlgetstmtattr; sqlgetstmtoption; sqlgettypeinfo; sqlmoreresults; sqlnativesql; sqlnativesqla; sqlnativesqlw; sqlnumparams; sqlnumresultcols; sqlparamdata; sqlparamoptions; sqlprepare; sqlprimarykeys; sqlprocedurecolumns; sqlprocedures; sqlputdata; sqlrowcount; sqlsetconnectattr; sqlsetconnectoption; sqlsetdescfield; sqlsetdescrec; sqlsetenvattr; sqlsetparam; sqlsetscrolloptions; sqlsetstmtattr; sqlsetstmtoption; sqlspecialcolumns; sqlstatistics; sqltableprivileges; sqltables; sqltablesa; sqltablesw; strcat; strcmp; strcpy; supported; switch; szlogprintf; szmessagebox; szwrite; testbindparam; testconnectattr; testconnectionoptions; testcopydesc; testcursorname; testdata; testdescdefaults; testdiagfield; testdiagrec; testendtran; testenvattr; testextendedfetch; testfetchscroll; testgetdescfield; testgetdescrec; testlargequery; testlikequery; testmetadata; testmixedansiunicode; testnumrescols; testojcap; testonethread; testquickrebind; testsearchedquery; testsetdescfield; testsetdescrec; testsqlbrowseconnect; testsqlcolumnprivileges; testsqldatasources; testsqldescribeparam; testsqldrivers; testsqlforeignkeys; testsqlmoreresults; testsqlnativesql; testsqlnumparams; testsqlparamoptions; testsqlprimarykeys; testsqlprocedurecolumns; testsqlprocedures; testsqlsetconnectattr; testsqlsetscrolloptions; testsqlsetstmtattr; testsqlspecialcols; testsqlstatistics; testsqltableprivileges; testsqltables; teststmtoptions; testthreading; testusedesc; text; threadloop; toupper; tstlibmain; unlockdata; values; verifyindex; waitformultipleobjects; wcscat; wcscpy; wcslen; wep; widechartomultibyte; wsprintf


QuryDemo: MDI Multi-database Query Sample

Click to open or copy the files for the QuryDemo sample.

Demonstrates a simple MDI (Multiple Document Interface) application that allows a user to simultaneously connect to multiple heterogeneous databases and perform SQL queries to get results. The application uses MDI Child Window Titles to store values of connected SQLHDBCs and SQLHSTMTs. These values are also stored in the combo boxes that are displayed on the toolbar.

Functions in Main.c:

Function | Description
WinMain | Main routine.
MainWndProc | Processes Main Application Window messages.
MDIChildProc | Processes MDI child window messages.
ToolbarProc | Processes tool bar messages.
StatusbarProc | Processes status bar messages.
ConnectDlgProc | Processes Connection dialog box messages.
DisconnectDlgProc | Processes Disconnect dialog box messages.
AboutDlgProc | Processes messages for the About dialog box.
MDIChildDlgProc | Processes messages for the dummy child dialog box in an MDI child window.
DrawBitmap | Draws bitmaps for toolbuttons.

Functions in Query.c:

Function | Description
InitSQLEnvironment | Initializes the ODBC library.
DisplayDatabases | Displays available data sources.
ConnectDatabase | Connects to a specific data source.
DriverConnectDatabase | Connects through driver specific dialogs.
DisplayConnections | Displays a list of made connections.
DisplayQueries | Displays a list of query handles (hstmts).
NewQueryWindow | Opens a new hstmt and updates displays.
ChangeCurrentCursor | Changes the current cursor display.
ChangeCurrentQuery | Changes the current query display.
DisplayNewCrsrAndStmt | Updates cusor and query displays.
FreeConnect | Frees a connection.
FreeQuery | Frees a query handle.
CloseQueryWindow | Closes a query window.
ExecuteQuery | Executes a user specified query.
CloseDatabases | Checks if all connections are closed.
FreeSQLEnvironment | Frees the ODBC library.
DisplayError | Displays SQL errors and warnings.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; activatewindow; beginpaint; bitblt; bringwindowtotop; changecurrentcursor; changecurrentquery; closedatabases; closequerywindow; connectdatabase; connectdlgproc; conststr; createcompatibledc; createdialog; createpen; createwindow; defframeproc; defmdichildproc; defwindowproc; deletedc; deleteobject; destroyicon; destroywindow; dialogbox; disconnectdlgproc; dispatchmessage; displayconnections; displaydatabases; displayerror; displaynewcrsrandstmt; displayqueries; dptolp; drawbitmap; drawbttnlift1; drawbttnlift2; drawbttnrect; drawtext; driverconnectdatabase; enablemenuitem; enablewindow; enddialog; endpaint; executequery; findwindow; freeconnect; freeprocinstance; freequery; freesqlenvironment; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; get_wm_command_mps; get_wm_mdiactivate_factivate; get_wm_menuselect_cmd; get_wm_menuselect_flags; getcapture; getclassname; getclientrect; getdc; getdlgitem; getdlgitemtext; getlastactivepopup; getmapmode; getmenu; getmenuitemcount; getmenuitemid; getmenustring; getmessage; getobject; getstockobject; getsubmenu; getsyscolor; gettextextentpoint; getwindow; getwindowlong; getwindowrect; getwindowtext; id; initsqlenvironment; invalidaterect; isdialogmessage; isiconic; iszoomed; lineto; loadaccelerators; loadbitmap; loadcursor; loadicon; localtime; mainwndproc; makeintresource; max; mdichilddlgproc; mdichildproc; messagebox; movetoex; movewindow; newquerywindow; openicon; postmessage; postquitmessage; ptinrect; rectangle; registerclass; releasecapture; releasedc; selectobject; senddlgitemmessage; sendmessage; setbkmode; setcapture; setcursor; setfocus; setforegroundwindow; setmapmode; settextcolor; settimer; setwindowlong; setwindowtext; showwindow; sprintf; sqlallochandle; sqlbindcol; sqlclosecursor; sqlconnect; sqldatasources; sqldescribecol; sqldisconnect; sqldriverconnect; sqlexecdirect; sqlfetch; sqlfreehandle; sqlfreestmt; sqlgetdiagrec; sqlgetinfo; sqlnumresultcols; sqlsetenvattr; sscanf; statusbarproc; strcat; strcmp; strcpy; strftime; strstr; time; toolbarproc; translateaccelerator; translatemdisysaccel; translatemessage; updatewindow; winhelp; winmain; wsprintf


OLE DB Samples

Click to open or copy the files for the OLE DB samples.


QuryDemo: MDI Child Window Multi-database Query Sample

Click to open or copy the files for the QuryDemo sample.

Demonstrates a simple MDI (Multiple Document Interface) application that allows a user to simultaneously connect to multiple heterogeneous databases and perform SQL queries to get results.

The application uses MDI Child Window Titles to store values of PROVIDERs and Command Objects. These values are also stored in the combo boxes that are displayed on the toolbar.

Main.cpp Functions

Function | Description
WinMain | Main routine
MainWndProc | Processes Main Application Window messages
MDIChildProc | Processes MDI child window messages
ToolbarProc | Processes tool bar messages
StatusbarProc | Processes status bar messages
ConnectDlgProc | Processes Connection dialog box messages
DisconnectDlgProc | Processes Disconnect dialog box messages
AboutDlgProc | Processes messages for About dialog box
MDIChildDlgProc | Processes messages for dummy child dialog box in MDI window
DrawBitmap | Draws bitmaps for toolbuttons

Query.cpp Functions

Function | Description
InitEnvironment | Initializes OLE
DisplayProviders | Displays available providers
ConnectDatabase | Connects to a specific data source
DisplayConnections | Displays list of made connections
DisplayICommands | Displays list of ICommands
NewICommandWindow | Opens a new ICommand and update displays
ChangeCurrentCursor | Changes current cursor display
ChangeCurrentICommand | Changes current ICommand display
DisplayNewCrsrAndICommand | Updates cursor and ICommand displays
FreeConnect | Frees an IDBCreateCommand
FreeICommand | Frees an ICommand
CloseICommandWindow | Closes an ICommand window
ExecuteQuery | Executes a user-specified query
CloseIDBCreateCommand | Checks if all connections are closed
FreeEnvironment | Frees OLE
ExecuteCommand | Executes the ICommand and returns an IRowset
GetDataFromRowset | Gets the data from the IRowset
SetupBindings | Sets the binding structure
CreateAccessor | Creates an accessor to store the data
GetData | Gets the data out of the rowset

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; activatewindow; assert; beginpaint; bindmoniker; bitblt; bringwindowtotop; changecurrentcursor; changecurrenticommand; cleanuprowset; closeicommandwindow; closeidbcreatecommand; cocreateinstance; cofreeunusedlibraries; cogetmalloc; coinitialize; connectdatabase; connectdlgproc; couninitialize; createaccessor; createcommand; createcompatibledc; createdialog; createpen; createsession; createwindow; ctl3dautosubclass; ctl3dcolorchange; ctl3dregister; ctl3dunregister; defframeproc; defmdichildproc; defwindowproc; deletedc; deleteobject; destroyicon; destroywindow; dialogbox; disconnectdlgproc; dispatchmessage; displayconnections; displaydatasource; displayicommands; displaynewcrsrandicommand; displayproviders; dptolp; drawbitmap; drawbttnlift1; drawbttnlift2; drawbttnrect; drawtext; dumperror; dumperrorhresult; dumprow; enablemenuitem; enablewindow; enddialog; endpaint; enumerateproviders; execute; executecommand; executequery; failed; findwindow; formatmessage; free; freeconnect; freeenvironment; freeicommand; freeprocinstance; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; get_wm_command_mps; get_wm_mdiactivate_factivate; get_wm_menuselect_cmd; get_wm_menuselect_flags; getcapture; getclassname; getclientrect; getcolumninfo; getcolumnsinfo; getdata; getdatafromrowset; getdc; getdlgitem; getdlgitemtext; geterrorinfo; getlastactivepopup; getmapmode; getmenu; getmenuitemcount; getmenuitemid; getmenustring; getmessage; getnextrows; getobject; getrowset; getschemarowset; getsourcesrowset; getstockobject; getsubmenu; getsyscolor; gettextextentpoint; getwindow; getwindowlong; getwindowrect; getwindowtext; id; initenvironment; initialize; interfacesupportserrorinfo; invalidaterect; isdialogmessage; isiconic; iszoomed; lineto; loadaccelerators; loadbitmap; loadcursor; loadicon; localalloc; localfree; localtime; mainwndproc; makeintresource; makelangid; malloc; max; mdichilddlgproc; mdichildproc; memset; messagebox; movetoex; movewindow; multibytetowidechar; newicommandwindow; newiopenrowsetwindow; numelem; offsetof; openicon; openrowset; parsedisplayname; postmessage; postquitmessage; ptinrect; queryinterface; rectangle; registerclass; release; releaseaccessor; releasecapture; releasedc; releaserows; resultfromscode; round_up; selectobject; sendmessage; setbkmode; setcapture; setcommandtext; setcursor; seterrorinfo; setfocus; setforegroundwindow; setmapmode; setproperties; settextcolor; settimer; setupbindings; setwindowlong; setwindowtext; showwindow; sprintf; sscanf; statusbarproc; strcat; strcmp; strcpy; strftime; strstr; succeeded; sysallocstring; time; toolbarproc; translateaccelerator; translatemdisysaccel; translatemessage; updatewindow; variantclear; variantinit; wcscpy; widechartomultibyte; winmain; wsprintf


SampClnt: OLE DB Sample Consumer

Click to open or copy the files for the SampClnt sample.

This sample is an OLE DB consumer. See the OLE DB SDK Guide for information on building and running this sample, as well as notes about the implementation of a simple OLE DB consumer.

This sample has the following parts:

File | Description
Dump.cpp | Dump\output routines. See Readme.txt for more information.
Sampclnt.cpp | Implementation file for a simple OLE DB consumer. This file is structured to match the steps required for simple OLE DB data access.
Sampclnt.h | Declaration file for a simple OLE DB consumer.

Building SDK Samples

This sample uses the following keywords:

_getch; _vsnprintf; assert; calcprettyprintmaxcolwidth; cleanuprowset; cocreateinstance; cofreeunusedlibraries; cogetmalloc; createaccessor; createsession; ctime; define_guid; dotests; dump_error_linenumber; dumpcolumnheadings; dumpcolumnsinfo; dumperrorhresult; dumperrormsg; dumprow; dumpstatusmsg; failed; fclose; fopen; fputs; free; getcolumninfo; getcolumnsinfo; getdata; getdatafromrowset; getdbsessionfromdatasource; getnextrows; getnotestring; getnotestringbitvals; getrowsetfromdbsession; getsampprovdatasource; getscode; initialize; lookupcolumnname; malloc; min; note; numelem; offsetof; olebuildversion; oleinitialize; oleuninitialize; printcolumn; printf; queryinterface; release; releaseaccessor; releaserows; resultfromscode; round_up; setproperties; setupbindings; strcat; strcpy; stringfromguid2; swprintf; sysallocstring; tfprintf; time; tvfprintf; va_end; va_start; variantchangetypeex; variantclear; variantinit; wcscpy; writecolumninfo


TableCopy: OLE DB Sample

Click to open or copy the files for the TableCopy sample.

Building SDK Samples

This sample uses the following keywords:

_snprintf; _vsnprintf; _vsnwprintf; addhead; addref; addtail; adjust_size; assert; binding_length; binding_status; binding_value; buffer_id; buffer_length; busy; cancel; cdatasource; cdialog; centerdialog; check_errors; check_memory; checkdlgbutton; checkradiobutton; clist; cmallocspy; cnode; cocreateinstance; coinitialize; colinfo_size; connect; converttombcs; converttowchar; copydata; copyindexes; copytables; coregistermallocspy; corevokemallocspy; cotaskmemalloc; cotaskmemfree; cotaskmemrealloc; couninitialize; cprogress; createaccessor; createcommand; createdialogparam; createindexes; createsession; createsqlstmt; createtable; cs1dialog; cs2dialog; cs3dialog; cs4dialog; cstep1; cstep2; cstep3; cstep4; ctable; ctablecopy; ctypes; ctypesdialog; cwizard; debugbreak; destroywindow; dialogboxparam; disconnect; dispatchmessage; display; displayallerrors; displayerrorrecords; dlgproc; dumpleaks; enabletable; enablewindow; enddialog; execute; failed; find; findnextstep; freebindings; freeproperties; freevariants; get_wm_command_cmd; get_wm_command_id; getbasicerrorinfo; getcolinfo; getcolumninfo; getconnectionprops; getcount; getcreateparams; getcustomerrorobject; getdata; getdbtypename; getdescription; getdesktopwindow; getdlgitem; getdlgitemtexta; geteditboxvalue; geterrorinfo; geterrorname; geterrorrecords; gethead; getinterfacename; getliteralinfo; getnext; getnextrows; getparent; getprev; getprimarykeys; getpromotedtype; getproperties; getproperty; getquotedid; getrecordcount; getrowset; getsqlerrorinfo; getsqlinfo; getsqltypename; getsystemdefaultlcid; getsystemmetrics; gettablecolinfo; gettail; gettypeinfo; gettypeinforowset; gettypes; getwindowlong; getwindowrect; head_offset; head_signiture; header_offset; id_offset; initcontrols; initialize; initvariants; insertafter; insertbefore; insertrow; internalassert; internaltrace; isconnected; isdialogmessage; isdlgbuttonchecked; isempty; isequal; isfixedtype; isnumerictype; issimilar; isvariabletype; iswalnum; length_is_bound; length_offset; loadcursor; makealphanumeric; makeintresource; mallocspydump; mallocspyregister; mallocspyunregister; maptableinfo; maptypes; max; memcpy; memset; messageboxa; messageboxw; min; movewindow; multibytetowidechar; numele; offsetof; outofmemory; outputdebugstring; outputdebugstringa; peekmessage; postalloc; postdidalloc; postfree; postgetsize; postheapminimize; postrealloc; prealloc; predidalloc; prefree; pregetsize; preheapminimize; prerealloc; queryinterface; recordselectedindexes; refreshcontrols; refreshlists; release; releaseaccessor; releaserows; remove; removeall; removeat; removehead; removetail; resetcolinfo; resetindexlist; resettablelist; restartposition; restartprogress; roundup; roundup_; run; safe_alloc; safe_free; safe_realloc; safe_release; safe_sysalloc; safe_sysfree; senddlgitemmessage; sendmessage; setcommandtext; setcursor; setdlgitemtexta; setfocus; setprogresstext; setproperties; setupinitprops; setwindowlong; setworkingitem; showcancel; showcursor; showwindow; status_is_bound; stdmethodimp_; stopprogress; succeeded; switch; swprintf; syncsibling; sysallocstring; sysfreestring; tail_offset; tail_signiture; test; testc; trace; translatemessage; translatenames; updateprogress; users_offset; va_end; va_start; value_is_bound; value_wchar; variantclear; variantinit; wcscat; wcscmp; wcscpy; wcsduplicate; wcslen; wcsncmp; wcsncpy; wcsstr; wcstoul; wgetdlgitemtext; widechartomultibyte; winmain; wmessagebox; wsendmessage; wsetdlgitemtext; xtest; xtestc


SQL Samples

Click to open or copy the files for the SQL samples.


DbLib: DB-Library for C Sample Programs

Click to open or copy the files for the DbLib samples.


C: DB-Library for C Sample Programs

Click to open or copy the files for the DbLib C samples.

These samples are for the Microsoft SQL Server Workstation System 6.5, for Windows NT for Intel, Alpha AXP, MIPS, and PowerPC platforms.

The Readme file in this directory describes the DB-Library for C sample programs included with Microsoft(R) SQL Server(TM) Workstation System 6.5.

For additional information about SQL Server 6.5, DB-Library for C, and ODBC, see the following sections in the Microsoft SQL Server Programmer's Toolkit:

  • DB-Library for C Applications

  • What's New in SQL Server 6.5

  • Programming DB-Library for C

  • Programming ODBC for SQL Server

Overview of DB-Library Samples

Sample | Description
Example1 | Demonstrates sending queries in a command batch.
Example2 | Demonstrates working with data files.
Example3 | Demonstrates binding aggregate and computing results.
Example4 | Demonstrates using row buffering.
Example5 | Demonstrates converting data with dbconvert.
Example6 | Demonstrates querying and updating the database.
Example7 | Demonstrates using browse-mode functions.
Example8 | Demonstrates using remote stored procedures and return parameters.
DataFile | Data file used by the Example2 and Example6 programs.
NmPsDmp | Demonstrates using a named pipe dump device. A Windows NT-based console sample.
SqlCurs | Demonstrates using cursor functions.
SQLexamp | Command-line interpreter.
SQLtestC | Windows NT-based console sample.
SQLtestN | Windows NT-based GUI sample.
TextCopy | Windows NT-based console text and image sample. Uses GETOPT.
TwoPhase | Two-phase commit example.


Example1: Sending Queries in a Command Batch

Click to open or copy the files for the Example1 sample.

This example illustrates how to send two queries to SQL Server in a command batch. It binds each set of results and prints the rows.

Building SDK Samples

This sample uses the following keywords:

dbbind; dbcmd; dbcurcmd; dbcurrow; dbdead; dberrhandle; dbexit; dbinit; dblogin; dbmsghandle; dbnextrow; dbopen; dbresults; dbsetlapp; dbsetlpwd; dbsetluser; dbsetlversion; dbsqlexec; defined; err_handler; msg_handler; printf


Example2: Working with Data Files

Click to open or copy the files for the Example2 sample.

This example opens a data file, inserts data from the file into a newly created table containing several of the SQL Server datatypes, and binds and prints the results. You must have a file named datafile and CREATE DATABASE permission in your login database. You must have enough room in your default device to create a new database (minimum 2 MB).

Building SDK Samples

This sample uses the following keywords:

char; dbbind; dbcmd; dbdatlen; dbdead; dberrhandle; dbexit; dbfcmd; dbinit; dblogin; dbmsghandle; dbnextrow; dbopen; dbresults; dbsetlapp; dbsetlpwd; dbsetluser; dbsetlversion; dbsqlexec; dbuse; decimal; defined; err_handler; fgets; fopen; msg_handler; printf; values; varbinary; varchar


Example3: Binding Aggregate and Compute Results

Click to open or copy the files for the Example3 sample.

This example selects some information from the Pubs database. It illustrates binding of both aggregate and compute results. This example requires that the Pubs database exists on your SQL Server.

Building SDK Samples

This sample uses the following keywords:

avg; count; dbaltbind; dbbind; dbcmd; dbdead; dberrhandle; dbexit; dbinit; dblogin; dbmsghandle; dbnextrow; dbopen; dbresults; dbsetlapp; dbsetlpwd; dbsetluser; dbsetlversion; dbsqlexec; dbuse; defined; err_handler; msg_handler; printf; sum


Example4: Using Row Buffering

Click to open or copy the files for the Example4 sample.

This example accesses the data within each row without using dbbind and illustrates the use of row buffering. It runs a query, saves all of the returned rows (up to a maximum of 100) using DB-Library row buffering, and allows the user to examine data rows at random.

Building SDK Samples

This sample uses the following keywords:

atoi; dbclrbuf; dbcmd; dbconvert; dbdata; dbdatlen; dbdead; dberrhandle; dbexit; dbgetrow; dbinit; dblogin; dbmsghandle; dbnextrow; dbopen; dbresults; dbsetlapp; dbsetlpwd; dbsetlversion; dbsetopt; dbsqlexec; defined; err_handler; gets; msg_handler; printf; puts


Example5: Converting Data with DBconvert

Click to open or copy the files for the Example5 sample.

This example illustrates dbconvert. It converts a number of constants to strings, a number of strings to numerical or binary quantities, and a number of numerical quantities to other numerical types.

Building SDK Samples

This sample uses the following keywords:

dbdead; dberrhandle; dbinit; dbmsghandle; defined; err_handler; msg_handler; printf


Example6: Querying and Updating the Database

Click to open or copy the files for the Example6 sample.

This example illustrates opening a data file, inserting data from the file into a newly created table containing several SQL Server datatypes, and updating the table using browse-mode techniques.

Building SDK Samples

This sample uses the following keywords:

alltypes; char; dbcmd; dbdata; dbdead; dberrhandle; dbexit; dbfcmd; dbfreequal; dbinit; dblogin; dbmsghandle; dbnextrow; dbopen; dbprrow; dbqual; dbresults; dbsetlapp; dbsetlpwd; dbsetluser; dbsetlversion; dbsqlexec; decimal; defined; err_handler; exists; fgets; fopen; msg_handler; printf; values; varbinary; varchar


Example7: Using Browse-Mode Functions

Click to open or copy the files for the Example7 sample.

This example illustrates the use of browse-mode functions to determine the source of result columns from ad hoc queries.

Building SDK Samples

This sample uses the following keywords:

dbcanquery; dbcmd; dbcmdrow; dbcolbrowse; dbcolname; dbcolsource; dbdead; dberrhandle; dbinit; dblogin; dbmsghandle; dbnumcols; dbopen; dbresults; dbsetlapp; dbsetlpwd; dbsetluser; dbsetlversion; dbsqlexec; dbtabbrowse; dbtabcount; dbtabname; dbtabsource; defined; err_handler; examine_results; gets; msg_handler; printf; send_command; sprintf; strcmp; strcpy


Example8: Using Remote Stored Procedures and Return Parameters

Click to open or copy the files for the Example8 sample.

The example uses the following stored procedure, Rpctest, which it assumes is located in the user's default database. Before running this example, you must create Rpctest in your default database.

Building SDK Samples

This sample uses the following keywords:

dbdead; dberrhandle; dbexit; dbhasretstat; dbinit; dblogin; dbmsghandle; dbnumrets; dbopen; dbprrow; dbprtype; dbresults; dbretdata; dbretlen; dbretname; dbretstatus; dbrettype; dbrpcinit; dbrpcparam; dbrpcsend; dbsetlapp; dbsetlpwd; dbsetluser; dbsetlversion; dbsqlok; defined; err_handler; exit; msg_handler; printf


SQLtestr: MSDOS SQL Data Server Tester

Click to open or copy the files for the SQLtestr sample.

In addition to SQLtestr (in the SQLtestr subdirectory), this sample provides SQLcommn.loc (in this directory level). SQLcommn.loc is a SQL Server localization file. This sample file can be used to change the default character formats for datetime and money that DB-Library performs when binding these data types to characters. This file is optional. If no such file is found, DB-Library simply uses its default formatting.

SQLcommn.loc is not applicable for SQL Server NT. For NT, on the Control Panel, choose International.

Building SDK Samples

This sample uses the following keywords:

dbdead; dberrhandle; dbexit; dbinit; dblogin; dbmsghandle; dbnextrow; dbresults; dbsetlversion; err_handler; exit; msg_handler; printf


NmPsDmp: Windows NT-Based Console Named-Pipe Dump Device Sample

NmPsDmp: Console Named Pipe Dump Device Sample

Click to open or copy the files for the NmPsDmp sample.

This sample is a DB-Library program for using named pipe dump devices for backup and restore data from SQL Server 95. This program shows the usage of named pipe dump devices on the client side.

The program needs the following arguments (it asks from the user interactively):

  • Operation: DUMP/LOAD.

  • Servername: Name of the server to dump from/load into.

  • Databasename: Name of the database to dump/load.

  • Stripenum: Number of pipes to use for dump/load.

  • Dumpname: Prefix of the files to write/read the dumped/loaded data (DMP postfix).

Building SDK Samples

This sample uses the following keywords:

_beginthread; argvalue; atoi; bufalign; close_up_pipes; closehandle; createfile; dbclose; dbcmd; dberrhandle; dbfreelogin; dblogin; dbmsghandle; dbnextrow; dbopen; dbresults; dbsetlpwd; dbsetluser; dbsqlexec; dump_proc; err_handler; exit; flushfilebuffers; free; getlasterror; getnamedpipeinfo; load_proc; malloc; msg_handler; newarg; parse_parms; printf; readfile; set_up_pipes; setfilepointer; setnamedpipehandlestate; sleepex; sprintf; strcat; strcmp; strcpy; switch; waitnamedpipe; writefile


SQLcurs: Using Cursor Functions

Click to open or copy the files for the SQLcurs sample.

This sample demonstrates SQL DB-Library cursors.

Building SDK Samples

This sample uses the following keywords:

_getch; atoi; dbcmd; dbcursor; dbcursorbind; dbcursorclose; dbcursorfetchex; dbcursoropen; dbdead; dberrhandle; dbexit; dblogin; dbmsghandle; dbresults; dbsetlversion; dbsqlexec; defined; err_handler; gets; memcpy; min; msg_handler; printf; processresults; tolower


SQLexamp: Command-Line Interpreter

Click to open or copy the files for the SQLexamp sample.

This program provides a simple example of logging onto a SQL Server, sending down commands, and retrieving metadata and result rows. It also demonstrates formatting and printing the results on the console.

Building SDK Samples

This sample uses the following keywords:

dbcancel; dbclose; dbcmd; dbcolinfo; dbcollen; dbcolname; dbcoltype; dbconvert; dbcount; dbdata; dbdatlen; dberrhandle; dbinit; dblogin; dbmsghandle; dbnextrow; dbnumcols; dbopen; dbresults; dbsetlhost; dbsetluser; dbsetlversion; dbsettime; dbsqlexec; defined; determinerowsize; err_handler; free; gets; malloc; memmove; memset; msg_handler; printf; printheaders; printrow; strcat; strcpy; strncpy; strnicmp; switch


SQLtestC: Windows NT-Based Console Sample

Click to open or copy the files for the SQLtestC sample.

This is a SQL Data Server sample program for console-based Windows NT, to demonstrate DB-Library using C.

Building SDK Samples

This sample uses the following keywords:

dbdead; dberrhandle; dbexit; dbinit; dblogin; dbmsghandle; dbnextrow; dbresults; dbsetlversion; err_handler; msg_handler; printf


SQLtestN: Windows NT-Based GUI Sample

Click to open or copy the files for the SQLtestN sample.

This is a SQL Data Server sample program for use in the Windows NT graphical environment.

Win32 can have several copies of your application running at the same time. The variable hInst keeps track of which instance of the application this is so that processing will be to the correct window.

You only need to initialize the application once. After it is initialized, all other copies of the application will use the same window class, and do not need to be separately initialized.

Main Functions

Function | Description
WinMain | Calls initialization function, processes message loop.
SqlTestInit | Initializes window data and registers window.
SqlTestWndProc | Processes messages.
AboutSQL | Processes messages for "About" dialog box.
SelectSQL | Processes input of author name.
ConnectSQL | Processes input of server name and connects to server.

Building SDK Samples

This sample uses the following keywords:

aboutsql; appendmenu; checkforscroll; connectsql; createwindow; dbbind; dbclose; dbcmd; dberrhandle; dbexit; dbfreelogin; dbinit; dblocklib; dblogin; dbmsghandle; dbnextrow; dbopen; dbresults; dbsetluser; dbsetlversion; dbsqlexec; dbunlocklib; dbuse; dbwinerrorhandler; dbwinmessagehandler; defwindowproc; dialogbox; dispatchmessage; enddialog; getclientrect; getdc; getdlgitemtext; getmessage; getparent; getstockobject; getsystemmenu; gettextmetrics; loadcursor; loadicon; localalloc; localfree; messagebox; postmessage; postquitmessage; registerclass; releasedc; scrollwindow; selectsql; senddlgitemmessage; sendmessage; showwindow; sprintf; sqltestinit; sqltestprocessresults; sqltestwndproc; switch; textout; translatemessage; updatewindow; validaterect; winmain


TextCopy: Windows NT-Based Console Text and Image Sample Using GETOPT

Click to open or copy the files for the TextCopy sample.

This sample is a text and image copying application.

Building SDK Samples

This sample uses the following keywords:

cleanup; comparenocase; dbdead; dbinit; dblogin; dbsetlogintime; dbsettime; delete; displayusage; getbuffer; getlength; getoption; isalnum; isempty; ispunct; releasebuffer; strchr


TwoPhase: Two-Phase Commit Example

Click to open or copy the files for the TwoPhase sample.

This example uses the two-phase commit service to perform a simultaneous update on two servers. In this example, one of the servers participating in the distributed transaction also functions as the commit service.

In this particular example, the same update is performed on both servers. You can, however, use the commit server to perform completely different updates on each server.

Building SDK Samples

This sample uses the following keywords:

abort_xact; abortall; close_commit; commit_xact; dbcancel; dbcmd; dbdead; dberrhandle; dbexit; dblogin; dbmsghandle; dbsetlapp; dbsetlpwd; dbsetluser; dbsetlversion; dbsqlexec; dbuse; defined; err_handler; exit; msg_handler; printf; remove_xact; sprintf; start_xact; strcat


MSDTC: Microsoft® Distributed Transaction Coordinator (MS DTC)

Click to open or copy the files for the MSDTC samples.

These are the Microsoft Distributed Transaction Coordinator (MS DTC) sample programs included with Microsoft(R) SQL Server(TM) Workstation System 6.5.

For additional information about SQL Server 6.5, MS DTC, and ODBC, see the following sections in the Microsoft SQL Server Programmer's Toolkit:

  • What's New in SQL Server 6.5

  • Guide to Microsoft Distributed Management Coordinator

  • Programming ODBC for SQL Server

See also About the Example Programs in the Guide to Microsoft Distributed Transaction Coordinator.


DbLib: DB-Library Interface for MS DTC and SQL Server

Click to open or copy the files for the DbLib sample.

This sample C++ program uses 32-bit Visual C++ and the DB-Library interface to communicate with both MS DTC and SQL Server.

This example uses MS DTC (Distributed Transaction Coordinator) to perform simultaneous updates on two SQL Servers. The transaction in this example is client-initiated. The client also initiates the commit operation.

This sample uses the DB-Library interface to communicate with both MS DTC and SQL Server. In this particular example, the preinstalled SQL Server table Authors is used.

Building SDK Samples

This sample uses the following keywords:

begintransaction; commit; dbcmd; dbdead; dberrhandle; dbexit; dblogin; dbmsghandle; dbresults; dbsetlapp; dbsetlpwd; dbsetluser; dbsqlexec; dbuse; dtcgettransactionmanager; enlist; err_handler; executestatement; exit; failed; initglobals; logontodb; lstrcpy; msg_handler; printf; ptransaction-release; release; sprintf


ODBC: Communicating with MS DTC and SQL Server

Click to open or copy the files for the ODBC sample.

This is a sample C++ program using 32-bit Visual C++ and the ODBC interface to communicate with both MS DTC and SQL Server.

This example uses MS DTC (distributed transaction coordinator) to perform simultaneous updates on two SQL Servers. The transaction in this example is client-initiated. The client also initiates the commit operation.

This sample uses the ODBC interface, so you need to configure ODBC data source names for two SQL servers that you can use to run this sample. Each DSN (data source name) must point to the pubs database in a separate SQL Server. The authors table in the pubs database is used in this sample.

Building SDK Samples

This sample uses the following keywords:

begintransaction; commit; dosqlerror; dtcgettransactionmanager; enlist; executestatement; exit; failed; freeodbchandles; initglobals; logontodb; lstrcpy; printf; processrc; ptransaction-release; release; sprintf; sqlallocconnect; sqlallocenv; sqlallocstmt; sqlconnect; sqldisconnect; sqlerror; sqlexecdirect; sqlfreeconnect; sqlfreeenv; sqlfreestmt


TSQL

Click to open or copy the files for the Tsql sample.

This sample includes Chgaddr.sql, which does the following:

  1. Starts a DTC Transaction.

  2. Changes local author information.

  3. Makes a string with the server name, procedure to execute and parameters.

  4. Updates the remote server.

  5. Commits the DTC transaction.

This directory also contains Updadr.sql.


ODS: Open Data Services Sample Programs

Click to open or copy the files for the ODS samples.

These are Open Data Services sample programs included with Microsoft(R) SQL Server(TM) Workstation System 6.5.

For additional information about SQL Server 6.5, Open Data Services, and ODBC, see the following sections in the Microsoft SQL Server Programmer's Toolkit:

  • What's New in SQL Server 6.5

  • Programming Open Data Services

  • Programming ODBC for SQL Server


Gateway: ODS SQL Server Pass-Through Connection

Click to open or copy the files for the Gateway sample.

This is a sample C gateway application that connects to SQL Server as an alternate data source and demonstrates a pass-through application.

Building SDK Samples

This sample uses the following keywords:

attn_handler; bcp_setl; check_stack; chk_err; createmutex; dbcancel; dbclose; dbcmd; dbcolinfo; dbcollen; dbcolname; dbcolntype; dbcoltype; dbcount; dbdata; dbdatlen; dbdead; dberrhandle; dbfcmd; dbfreelogin; dbgetuserdata; dbhasretstat; dbinit; dbiscount; dblogin; dbmsghandle; dbnextrow; dbnumcols; dbnumrets; dbopen; dbresults; dbretdata; dbretlen; dbretname; dbretstatus; dbrettype; dbrowtype; dbrpcinit; dbrpcparam; dbrpcsend; dbsetlapp; dbsetlnatlang; dbsetlpwd; dbsetlsecure; dbsetluser; dbsetlversion; dbsetmaxprocs; dbsetuserdata; dbsqlexec; dbsqlok; exit_remote; exitprocess; getargs; handle_results; init_remote; init_server; itoa; lang_execute; memcpy; memmove; memset; printf; releasemutex; remoteerr; remotemsgs; rpc_execute; set_remote_server_name; sprintf; srv_alloc; srv_config; srv_config_alloc; srv_describe; srv_errhandle; srv_event; srv_free; srv_getuserdata; srv_got_attention; srv_handle; srv_impersonate_client; srv_init; srv_langlen; srv_langptr; srv_log; srv_paramdata; srv_paramlen; srv_parammaxlen; srv_paramname; srv_paramset; srv_paramstatus; srv_paramtype; srv_pfield; srv_returnval; srv_revert_to_self; srv_rpcdb; srv_rpcname; srv_rpcnumber; srv_rpcoptions; srv_rpcowner; srv_rpcparams; srv_run; srv_senddone; srv_sendmsg; srv_sendrow; srv_sendstatus; srv_setcoldata; srv_setcollen; srv_setuserdata; srv_setutype; srv_sfield; srv_tdsversion; strcat; strcmp; strnicmp; waitforsingleobject


ProcSrv: ODS Procedure Server Sample

Click to open or copy the files for the ProcSrv sample.

This sample demonstrates how to implement a procedure server using Open Data Services to handle specific predefined requests.

Building SDK Samples

This sample uses the following keywords:

_beginthread; _flushall; addtoregistry; chk_err; closehandle; closeservicehandle; completesignal; createevent; createpipe; createprocess; createservice; ctrlc_hndl; deleteservice; diskfree; disklist; duplicateentry; dwsizesm+strlen; entercriticalsection; exit_remote; exitprocess; fclose; feof; fopen; formatmessage; fread; free; get_last_error_str; getch; getdiskfreespace; getlasterror; getlogicaldrives; getmodulefilename; getmodulehandle; getsystemdefaultlangid; init_remote; init_server; initializecriticalsection; initsignal; lang_execute; lang_parser; leavecriticalsection; localfree; lockservicedatabase; malloc; memcpy; memset; ntbservicectrlhandler; ntbshutdown; openevent; openscmanager; openservice; printf; proclist; procsrvmain; readfile; refreshstoplight; regclosekey; regcreatekeyex; regdeletekey; regflushkey; registerservicectrlhandler; regopenkeyex; regqueryvalueex; regsetvalueex; removefromregistry; scan_next; scan_xbase; setconsolectrlhandler; seterror; seterrormode; setevent; setservicestatus; setthreadpriority; sleep; sp_exec; sp_execute; sprintf; srv_alloc; srv_bmove; srv_config; srv_config_alloc; srv_convert; srv_describe; srv_errhandle; srv_handle; srv_init; srv_langptr; srv_log; srv_paramdata; srv_paramlen; srv_paramname; srv_paramset; srv_paramstatus; srv_paramtype; srv_pfield; srv_rpcname; srv_rpcparams; srv_run; srv_senddone; srv_sendmsg; srv_sendrow; srv_sendstatus; srv_setcoldata; srv_setcollen; srv_setevent; srv_sfield; sscanf; startservicectrldispatcher; strcat; strchr; strcmp; strcpy; stricmp; strncmp; strncpy; strnicmp; strupr; switch; unlockservicedatabase; waitforsingleobject


XP: ODS Extended Procedures Sample

Click to open or copy the files for the XP sample.

This is a sample extended procedure DLL built with Open Data Services. The functions within the DLL can be invoked by using the extended stored procedures support in SQL Server. To register the functions and allow all users to use them, run the Transact-SQL script Instxp.sql.

Building SDK Samples

This sample uses the following keywords:

_itoa; _strtime; fclose; feof; fopen; fread; getdiskfreespace; getlasterror; getlogicaldrives; malloc; printf; seterror; sprintf; srv_bmove; srv_convert; srv_describe; srv_getserver; srv_langlen; srv_langptr; srv_paramdata; srv_paramlen; srv_parammaxlen; srv_paramname; srv_paramset; srv_paramstatus; srv_paramtype; srv_pfield; srv_pre_handle; srv_rpcdb; srv_rpcname; srv_rpcnumber; srv_rpcowner; srv_rpcparams; srv_senddone; srv_sendmsg; srv_sendrow; srv_setcoldata; srv_setcollen; strcat; strcpy; stricmp; strupr; switch; trace_lang; trace_rpc; xp_diskfree; xp_disklist; xp_echo; xp_proclist; xp_scan_xbase; xp_trace


XP_DBlib: Extended Stored Procedure DB-Library Connection

Click to open or copy the files for the XP_DBlib sample.

This is a sample extended stored procedure using 32-bit Visual C++ and the DB-Library interface to open a new connection to the SQL Server that called the extended stored procedure. Returns a result set and passes the results to the client. Uses a bound session for the loopback connection.

Building SDK Samples

This sample uses the following keywords:

dbclose; dbdata; dbdead; dbfreelogin; dbgetuserdata; dblogin; dbopen; dbprocerrhandle; dbprocmsghandle; dbsetlpwd; dbsetlsecure; dbsetluser; dbsetuserdata; dbsqlexec; err_handler; msg_handler; sprintf; srv_bzero; srv_impersonate_client; srv_paramdata; srv_paramlen; srv_paramtype; srv_pfield; srv_revert_to_self; srv_rpcparams; srv_senddone; srv_sendmsg; strcmp; xp_gettable


XP_ODBC: Extended Stored Procedure ODBC SQL Server Interface

Click to open or copy the files for the XP_ODBC sample.

This is a sample extended stored procedure using 32-bit Visual C++ and the ODBC interface to open a new connection to the SQL Server that called the extended stored procedure. This extended stored procedure returns a result set and passes the results to the client. It uses a bound session for the loopback connection.

To connect to the server using integrated security, you must use the local server data source name (registered using ODBC in the Control Panel).

Building SDK Samples

This sample uses the following keywords:

error; free; handle_odbc_err; malloc; message; printf; sprintf; sqlallocconnect; sqlallocenv; sqlallocstmt; sqlbindcol; sqlcolattributes; sqlconnect; sqldisconnect; sqlerror; sqlexecdirect; sqlfetch; sqlfreeconnect; sqlfreeenv; sqlfreestmt; sqlsetconnectoption; srv_describe; srv_getbindtoken; srv_impersonate_client; srv_paramdata; srv_paramlen; srv_paramtype; srv_pfield; srv_revert_to_self; srv_rpcparams; srv_senddone; srv_sendmsg; srv_sendrow; srv_setcoldata; srv_setcollen; strcmp; switch; xp_gettable


OLEAuto Traverse: Traversal Syntax for Object Hierarchies

Click to open or copy the files for the OLEAuto sample.

Traverse is a Transact-SQL script that demonstrates how to use traversal syntax for object hierarchies. It uses the SQL-DMO administration objects.


SQLDMO: SQL Distributed Management Objects Sample Programs

Click to open or copy the files for the SQLDMO samples.

The Readme file describes the SQL-DMO sample programs included with Microsoft(R) SQL Server(TM) 6.5 and Microsoft SQL Server Workstation System 6.5.

For additional information about SQL Server 6.5, SQL Distributed Management Objects, and ODBC, see the following sections in the Microsoft SQL Server Programmer's Toolkit:

  • What's New in SQL Server 6.5

  • Programming SQL Distributed Management Objects

  • Programming ODBC for SQL Server


C

Click to open or copy the files for the C sample.


SOC: SQLOLE Sample Using C

Click to open or copy the files for the SOC sample.

This sample demonstrates how to program SQLOLE in C. Differences from C++ are noted.

Building SDK Samples

This sample uses the following keywords:

cocreateinstance; connect; failed; getname; hresult_code; printf; release; setlogintimeout; sqlolefreestring


Cpp

Click to open or copy the files for the Cpp sample.


SOcpp: SQLOLE Sample Using C++

Click to open or copy the files for the SOcpp sample.

This sample demonstrates how to program SQLOLE in C++.

Building SDK Samples

This sample uses the following keywords:

_tprintf; cocreateinstance; connect; failed; getapplication; getname; getversionmajor; getversionstring; hresult_code; interfacesupportserrorinfo; queryinterface; scode_code; setlogintimeout; succeeded; sysfreestring; text


VB

Click to open or copy the files for the VB samples.


Explore: SQL-DMO Object Browser Sample

Click to open or copy the files for the Explore sample.

Sample SQL-DMO object browser using 32-bit Visual Basic.


Generic: SQL-DMO Generic Sample

Click to open or copy the files for the Generic sample.

Sample SQL-DMO generic program using 32-bit Visual Basic.


VBSQL: DB-Library for Visual Basic Sample Programs

Click to open or copy the files for the VBSQL sample.

DB-Library for Visual Basic provides a set of sample applications that demonstrate the use of many DB-Library for Visual Basic functions and routines.

You can use the code in these sample applications as models or templates for your own applications. By cutting and pasting code from specific application files, by using global procedures from the sample common code files, and by including the declarations for those procedures from the sample include files, you can quickly create the foundation for your own applications.


Graphics and Multimedia Samples

Click to open or copy the files for the Graphics samples.

The Audio, Input, Video, and other subdirectories contain samples for Windows 95/98 and Windows NT base multimedia services.


Audio Samples

Click to open or copy the files for the Audio samples.

Sample | Description
ACMAPP | Displays wave file format, and plays, records, and converts wave files. Demonstrates how to use the Audio Compression Manager API's in Windows. Can be used as an ACM driver test.
IDFEDIT | MIDI IDF (Instrument Definition File) editor.
LOWPASS | Low-pass filter for waveform audio.
MCIAPP | MCI test application.
MCIPLAY | Simple video playback application. Uses MCIWnd.
MCIPUZZL | Application lets you make a 15-square puzzle of a playing video sequence. Shows how to use installable draw procedures.
MIDIMON | Sample that displays textual listing of MIDI input messages.
MIDIPLYR | Sample MIDI player.
MIXAPP | Sample mixer application.
MMCAPS | Sample that shows the multimedia capabilities of the hardware.
REVERSE | Simple application that will play a waveform in reverse.
SOUNDAPP | Simple application showing the SndPlaySound API.
WAVEFILE | Sample AVIFile file handler for waveform audio files. To install, execute dseqfile.reg and copy dll to system dir. Can be used with AVIEDIT or AVIVIEW.

See also, in the Video Samples section:

LANGPLAY Plays back multi-audio stream AVI files. MULTILNG.AVI is an example file found on the CD.


ACMapp: Audio Compression Manager for Wave Files

Click to open or copy the files for the ACMapp sample.

This sample application does the following:

  • Demonstrates how to use the Audio Compression Manager API's in Windows.

  • Can be used as an ACM driver test.

  • Displays, plays, records, and converts wave files.

Building SDK Samples

This sample uses the following keywords:

_based; _fmemcpy; _fmemset; _lclose; _llseek; _segname; _tcstol; _tcstoul; acmappchoosefont; acmappchooserfilter; acmappchooserfilterhook; acmappchooserformat; acmappchooserformathook; acmappchooserformatsuggest; acmappchooserproperties; acmappchoosersavefile; acmappchooserupdatedisplay; acmappconvertbegin; acmappconvertconvert; acmappconvertend; acmappdebuglog; acmappdisplaydriverdetails; acmappdisplayfileproperties; acmappdisplayformats; acmappdisplaysysteminfo; acmappdisplaywaveindevcaps; acmappdisplaywaveoutdevcaps; acmappdriverselected; acmappdumpextraheaderdata; acmappexit; acmappfileconvert; acmappfilenew; acmappfileopen; acmappfilesave; acmappfilesavemodified; acmappgeterrorstring; acmappgetfilterdescription; acmappgetformatdescription; acmappgetselecteddriver; acmappinit; acmappmultithreadconvert; acmappmultithreadedconvertall; acmappnotify; acmappopeninstance; acmappplayrecordclose; acmappplayrecordcommand; acmappplayrecordend; acmappplayrecordinitcommands; acmappplayrecordopen; acmappplayrecordpause; acmappplayrecordplay; acmappplayrecordrecord; acmappplayrecordstart; acmappplayrecordstatus; acmappplayrecordstop; acmappsettingsrestore; acmappsettingssave; acmappshutdown; acmappwaveingetdevcaps; acmappwaveoutgetdevcaps; acmdriveradd; acmdriverclose; acmdriverdetails; acmdriverenum; acmdriverid; acmdrivermessage; acmdriveropen; acmdriverpriority; acmdriverremove; acmfilterchoose; acmfilterdetails; acmfiltertagdetails; acmformatchoose; acmformatdetails; acmformatenum; acmformatsuggest; acmformattagdetails; acmgetversion; acmmetrics; acmplayrecordsendcommand; acmstreamclose; acmstreamconvert; acmstreamopen; acmstreamprepareheader; acmstreamsize; acmstreamunprepareheader; acmthunkinitialize; acmthunkterminate; appchoosefont; appcreate; appdlgyield; appdropfiles; appendsession; appexit; appfilenew; appfileopen; appfilesave; appformatbignumber; appformatdosdatetime; appgetfilename; appgetfiletitle; apphourglass; appinit; appinitmenupopup; appmsgbox; appmsgboxid; appprofilereadbytes; appprofilewritebytes; appqueryendsession; appregisterpenapp; appsetwindowtext; appsize; apptitle; appwininichanged; beginconvert; beginpaint; button_setstyle; char2nibble; checkdlgbutton; checkmenuitem; choosefont; closehandle; cls_oncommand; cls_oninitdialog; combobox_addstring; combobox_getcursel; combobox_getitemdata; combobox_resetcontent; combobox_setcursel; combobox_setitemdata; createfile; createfontindirect; createprocess; createthread; createwindow; createwindowex; dbgenable; dbggetlevel; dbginitialize; dbgsetlevel; dbgvprintf; debug_qquote; debug_quote; debugbreak; defwindowproc; deletefont; destroywindow; dialogbox; dialogboxparam; dispatchmessage; dlgprocinfoedit; dosgetdatetime; dosgetfileattributes; dpf; dpi; dprintf; dragfinish; dragqueryfile; drawmenubar; edit_getselex; edit_gettext; edit_replacesel; edit_setsel; edit_settext; enablemenuitem; enablewindow; endconvert; enddialog; endpaint; exttextout; field_offset; filetimetodosdatetime; findresource; forward_wm_close; forward_wm_command; freelibrary; freeprocinstance; freeresource; get_em_linescroll_mps; get_em_setsel_end; get_em_setsel_mps; get_em_setsel_start; get_wm_activate_fminimized; get_wm_activate_hwnd; get_wm_activate_mps; get_wm_activate_state; get_wm_changecbchain_hwndnext; get_wm_chartoitem_char; get_wm_chartoitem_hwnd; get_wm_chartoitem_mps; get_wm_chartoitem_pos; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; get_wm_command_mps; get_wm_ctlcolor_hdc; get_wm_ctlcolor_hwnd; get_wm_ctlcolor_mps; get_wm_ctlcolor_type; get_wm_hscroll_code; get_wm_hscroll_hwnd; get_wm_hscroll_mps; get_wm_hscroll_pos; get_wm_mdiactivate_factivate; get_wm_mdiactivate_hwndactivate; get_wm_mdiactivate_hwnddeact; get_wm_mdiactivate_mps; get_wm_mdisetmenu_mps; get_wm_menuchar_char; get_wm_menuchar_fmenu; get_wm_menuchar_hmenu; get_wm_menuchar_mps; get_wm_menuselect_cmd; get_wm_menuselect_flags; get_wm_menuselect_hmenu; get_wm_menuselect_mps; get_wm_parentnotify2_mps; get_wm_parentnotify_hwndchild; get_wm_parentnotify_id; get_wm_parentnotify_mps; get_wm_parentnotify_msg; get_wm_parentnotify_x; get_wm_parentnotify_y; get_wm_vkeytoitem_code; get_wm_vkeytoitem_hwnd; get_wm_vkeytoitem_item; get_wm_vkeytoitem_mps; get_wm_vscroll_code; get_wm_vscroll_hwnd; get_wm_vscroll_mps; get_wm_vscroll_pos; getclientrect; getcommandline; getdc; getdesktopwindow; getdlgitem; getdlgitemtext; getfileinformationbyhandle; getfilesize; getfocus; getkeystate; getlasterror; getmenu; getmessage; getmodulefilename; getobject; getopenfilename; getparent; getprivateprofileint; getprivateprofilestring; getprocaddress; getprofileinta; getprofilestring; getrealtextmetrics; getsavefilename; getscrollpos; getscrollrange; getstockfont; getsyscolor; getsystemmetrics; gettextextentpoint; gettextmetrics; getversion; getwindow; getwindowfont; getwindowinstance; getwindowlong; getwindowplacement; getwindowrect; globalalloc; globalallocptr; globalexactlock; globalfreeptr; globallock; globalptrhandle; globalrealloc; globalreallocptr; globalsize; globalunlockptr; handle_wm_close; handle_wm_command; handle_wm_create; handle_wm_endsession; handle_wm_hscroll; handle_wm_initdialog; handle_wm_initmenupopup; handle_wm_queryendsession; handle_wm_size; handle_wm_wininichange; inflaterect; int32x32to64; invalidaterect; is_slash; isdialogmessage; isdlgbuttonchecked; killtimer; listbox_addstring; listbox_getcursel; listbox_getitemdata; listbox_resetcontent; listbox_setcursel; listbox_setitemdata; listbox_settabstops; loadaccelerators; loadcursor; loadicon; loadlibrary; loadresource; loadstring; localalloc; localfree; lstrcat; lstrcata; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lstrlena; makeintresource; makelong; makelparam; makeprocinstace; makeprocinstance; max; mcigeterrorstring; mcisendstring; meditprintf; memcpy; memset; message; messagebeep; messagebox; min; mmioascend; mmioclose; mmiocreatechunk; mmiodescend; mmiofourcc; mmioopen; mmioread; mmioseek; mmiostringtofourcc; mmiowrite; muldiv; muldiv32; muldivrd; muldivrn; muldivru; nibble2char; openfile; optimize; outputdebugstr; outputdebugstring; outputdebugstringa; pack; peekmessage; postmessage; postquitmessage; ptinrect; rcid; registerclass; registerwindowmessage; releasedc; remind; riffcopychunk; riffcopylist; riffcreateinfo; riffeditinfo; rifffindainfo; rifffindpiinfo; rifffreedisp; rifffreeinfo; riffinitinfo; riffinsertinfo; riffmodifyinfo; riffparseinfo; riffreaddisp; riffreadinfo; riffsetupeditboxinfo; riffwritedisp; riffwriteinfo; screentoclient; selectobject; senddlgitemmessage; sendmessage; setbkcolor; setcursor; setdlgitemtext; seterrormode; setfocus; setscrollpos; setscrollrange; settextcolor; settimer; setwindowfont; setwindowlong; setwindowplacement; setwindowpos; setwindowredraw; setwindowtext; showcursor; showwindow; sizeof_waveformatex; sndplaysound; switch; tabbedtextout; text; timegettime; tlbcreate; tlbdestroy; tlbmove; tlbpaint; tlbrecalctabs; tlbsetfont; tlbsettitleandtabs; translateaccelerator; translatemessage; uint32x32to64; updatewindow; va_end; va_start; waitforinputidle; warning; waveinclose; waveingetdevcaps; waveingetnumdevs; waveinopen; waveoutclose; waveoutgetdevcaps; waveoutgetnumdevs; waveoutopen; winexec; winhelp; wiofileclose; wiofileopen; writeprivateprofilestring; wsprintf; wvsprintf; wvsprintfa


IDFedit: MIDI IDF Editor

Click to open or copy the files for the IDFedit sample.

This sample is an MIDI IDF (Instrument Definition File) editor. To work correctly, it requires Windows® 95.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; accessfilter; ansinext; assert; createsolidbrush; debugbreak; deleteobject; displayabout; drawdragedge; enddialog; errorbox; fieldoff; fieldrefsiz; fieldsiz; findlistchunk; fld; get_wm_command_id; getcapture; getclipboarddata; getdialogbaseunits; getdlgctrlid; getexceptioncode; getfocus; getkeystate; getlasterror; getopenfilename; getparent; getprocessheap; getsavefilename; getsyscolor; getwindowinstance; getwindowpos; globalsize; head_refreshtree; isbadwriteptr; isclipboardformatavailable; isidentitymap; loadstring; loadtree; lstrcmpi; lstrlen; makefourcc; makeintresource; makepoints; max; min; multibytetowidechar; nextriff; numelms; openclipboard; outputdebugstring; patblt; pfld; promptforidfname; rgb; saveinstrumtoriff; savewindowpos; selectobject; sendmessage; setstandardcaption; squawknum; squawknumz; stdfld; text; treeview_deleteallitems; trideecreate; trideedestroy; trideewellshadow; view_editnext; view_getdata; view_invalidateline; view_invalidatelines; view_setdata; view_setsel; waitmessage; zeromemory


Lowpass: RIFF Multimedia I/O Services (Low-pass WAV Filter)

Click to open or copy the files for the Lowpass sample.

Lowpass is a sample application illustrating how to use the multimedia file I/O services to read and write RIFF files.

Lowpass runs a simple low-pass filter over an 8-bit-per-sample mono WAVE file.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; appendmenu; dialogbox; dolowpass; enddialog; getdlgitemtext; getsystemmenu; globalallocptr; globalfreeptr; loadcursor; loadstring; lowpassdlgproc; messagebox; mmioadvance; mmioascend; mmioclose; mmiocreatechunk; mmiodescend; mmiofourcc; mmiogetinfo; mmioopen; mmioread; mmiosetinfo; mmiowrite; setcursor; winmain


MCIapp: MCI Device Test Application

Click to open or copy the files for the MCIapp sample.

This is a sample application that demonstrates how to use the Media Control Interface (MCI) in Windows. This application is also useful as an MCI device tester.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; appchoosefont; appcreate; appdropfiles; appendsession; appexit; appfilenew; appfileopen; appfilesave; appgetfilename; appgetfiletitle; appgetwindowsversion; apphourglass; appinit; appinitmenupopup; appmsgboxid; appprofilereadbytes; appprofilewritebytes; appqueryendsession; appregisterpenapp; appsetwindowtext; appsetwindowtextid; appsize; apptitle; appwininichanged; appyield; atol; char2nibble; checkmenuitem; choosefont; closehandle; createdialog; createfile; createfontindirect; createwindow; createwindowex; dbgenable; dbginitialize; dbgsetlevel; dbgvprintf; debugbreak; defined; defwindowproc; deletefont; destroywindow; dialogbox; dispatchmessage; dpf; dprintf; dragfinish; dragqueryfile; edit_canundo; edit_getline; edit_getlinecount; edit_getmodify; edit_getselex; edit_limittext; edit_linefromchar; edit_lineindex; edit_replacesel; edit_setmodify; edit_setsel; enablemenuitem; enablewindow; enddialog; flag; forward_wm_close; forward_wm_command; forward_wm_keydown; forward_wm_keyup; get_em_linescroll_mps; get_em_setsel_end; get_em_setsel_mps; get_em_setsel_start; get_wm_activate_fminimized; get_wm_activate_hwnd; get_wm_activate_mps; get_wm_activate_state; get_wm_changecbchain_hwndnext; get_wm_chartoitem_char; get_wm_chartoitem_hwnd; get_wm_chartoitem_mps; get_wm_chartoitem_pos; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; get_wm_command_mps; get_wm_ctlcolor_hdc; get_wm_ctlcolor_hwnd; get_wm_ctlcolor_mps; get_wm_ctlcolor_type; get_wm_hscroll_code; get_wm_hscroll_hwnd; get_wm_hscroll_mps; get_wm_hscroll_pos; get_wm_mdiactivate_factivate; get_wm_mdiactivate_hwndactivate; get_wm_mdiactivate_hwnddeact; get_wm_mdiactivate_mps; get_wm_mdisetmenu_mps; get_wm_menuchar_char; get_wm_menuchar_fmenu; get_wm_menuchar_hmenu; get_wm_menuchar_mps; get_wm_menuselect_cmd; get_wm_menuselect_flags; get_wm_menuselect_hmenu; get_wm_menuselect_mps; get_wm_parentnotify2_mps; get_wm_parentnotify_hwndchild; get_wm_parentnotify_id; get_wm_parentnotify_mps; get_wm_parentnotify_msg; get_wm_parentnotify_x; get_wm_parentnotify_y; get_wm_vkeytoitem_code; get_wm_vkeytoitem_hwnd; get_wm_vkeytoitem_item; get_wm_vkeytoitem_mps; get_wm_vscroll_code; get_wm_vscroll_hwnd; get_wm_vscroll_mps; get_wm_vscroll_pos; getactivewindow; getasynckeystate; getclientrect; getcommandline; getdc; getdesktopwindow; getdlgitem; getdlgitemint; getfilesize; getfocus; getkeystate; getmessage; getobject; getopenfilename; getparent; getprocaddress; getprofileint; getprofileinta; getprofilestring; getsavefilename; getstockfont; getsysteminfo; getsystemmetrics; gettextextentpoint; gettextmetrics; getversion; getwindowfont; getwindowplacement; getwindowrect; getwindowtext; getwindowtexta; getwindowtextlength; getwinflags; globalallocptr; globalfreeptr; handle_wm_close; handle_wm_command; handle_wm_create; handle_wm_endsession; handle_wm_initmenupopup; handle_wm_queryendsession; handle_wm_size; handle_wm_wininichange; invalidaterect; is_eol; is_slash; is_space; is_white; isclipboardformatavailable; isdialogmessage; listbox_addstring; listbox_getcursel; listbox_resetcontent; listbox_setcursel; loadaccelerators; loadcursor; loadicon; loadstring; localalloc; localfree; lstrcat; lstrcata; lstrcmp; lstrcmpi; lstrcpy; lstrlena; makeintresource; makelong; makelparam; mciappchoosefont; mciappclosealldevices; mciappdebuglog; mciappdevicelist; mciappdevicelistupdate; mciappdispatchmessage; mciappenterline; mciappexecute; mciappexit; mciappfilenew; mciappfileopen; mciappfilesave; mciappfilesavemodified; mciappgetline; mciappgetnumdevices; mciapphandlenotify; mciappinit; mciappinternalcommand; mciappresetstatus; mciappsendstring; mciappsettingsrestore; mciappsettingssave; mciappshutdown; mciappsinglestep; mciappupdateoptions; mcigeterrorstring; mcisendcommand; mcisendstring; memset; messagebeep; messagebox; movewindow; nibble2char; notify; openfile; outputdebugstring; outputdebugstringa; parameter; peekmessage; postquitmessage; processor; ptinrect; rcid; readfile; registerclass; releasedc; selectfont; sendmessage; setactivewindow; setcursor; setdlgitemint; setfocus; setwindowfont; setwindowplacement; setwindowredraw; setwindowtext; setwindowtexta; setwindowtextw; showcursor; showwindow; sleep; strtok; switch; text; timegettime; translateaccelerator; translatemessage; updatewindow; va_end; va_start; warning; writefile; writeprofilestring; wsprintf; wvsprintf; wvsprintfa


MCIplay: Simple Video Player

Click to open or copy the files for the MCIplay sample.

MCIplay is an MDI application that demonstrates using the MCIWnd window class to play MCI files.

Building SDK Samples

This sample uses the following keywords:

appabout; appinit; appwndproc; checkmenuitem; createwindow; defframeproc; dialogbox; dispatchmessage; enablemenuitem; enddialog; formatfilterstring; forward_wm_command; forward_wm_initmenupopup; forward_wm_mdicreate; forward_wm_mdigetactive; getmenu; getmenuitemcount; getmenustate; getopenfilename; getsubmenu; getwindow; handle_wm_command; handle_wm_initmenupopup; handle_wm_size; ischecked; loadaccelerators; loadcursor; loadicon; loadstring; makeintresource; mci_oncommand; mci_oninitmenupopup; mci_onsize; mciwndchangestyles; mciwndend; mciwndgetmode; mciwndgetstyles; mciwndhome; mciwndplay; mciwndplayreverse; mciwndregisterclass; mciwndstep; mciwndstop; mdicreateclient; mdicreatedoc; mdifiltersendmessage; mdisendmessage; messagebeep; messagebox; movewindow; peekmessage; postmessage; postquitmessage; registerclass; sendmessage; setfocus; showwindow; switch; translateaccelerator; translatemdisysaccel; translatemessage; videoforwindowsversion; waitmessage; winmain


MCIpuzzl: Play Video Sequence

Click to open or copy the files for the MCIpuzzl sample.

MCIpuzzl is an application that demonstrates the following:

  • Using the MCIWnd window class to play MCI files.

  • Using an installable draw procedure with MCIAVI.

  • Making a 15-square puzzle of a playing video sequence.

Building SDK Samples

This sample uses the following keywords:

adjustwindowrect; appabout; appinit; appwndproc; avidraw; avidrawbegin; avidrawchangepalette; avidrawclose; avidrawend; avidrawgetinfo; avidrawopen; avidrawquery; avidrawsuggestformat; clickpuzzle; clienttoscreen; createwindow; defdriverproc; defwindowproc; dialogbox; dibwidthbytes; dispatchmessage; drawdibbegin; drawdibchangepalette; drawdibclose; drawdibdraw; drawdibgetpalette; drawdibopen; drawdibrealize; enddialog; formatfilterstring; getopenfilename; getwindowlong; getwindowrect; globalallocptr; globalfreeptr; handle_notifymedia; handle_notifysize; handle_wm_command; handle_wm_parentnotify; handle_wm_size; icavidrawproc; icclose; icgetdisplayformat; initpuzzle; invalidaterect; isiconic; loadaccelerators; loadcursor; loadicon; loadstring; makeintresource; mci_oncommand; mci_oninitmenupopup; mci_onparentnotify; mci_onsize; mcisendcommand; mciwndcreate; mciwndgetdest; mciwndgetdeviceid; mciwndopen; mciwndplay; mciwndplayreverse; mem_copy; memcpy; messagebeep; messagebox; mixpicture; mmiofourcc; movewindow; multibytetowidechar; peekmessage; postmessage; postquitmessage; rand; registerclass; screentoclient; sendmessage; setstretchbltmode; setwindowpos; showwindow; srand; switch; timegettime; translateaccelerator; translatemessage; videoforwindowsversion; waitmessage; widthbytes; winmain


MIDImon: WinMain and WndProc Functions

Click to open or copy the files for the MIDImon sample.

MIDImon is a Windows with Multimedia application that records and displays incoming MIDI information. It uses a low-level callback function to get timestamped MIDI input. The callback function puts the incoming MIDI event information (source device, timestamp, and raw MIDI data) in a circular input buffer and notifies the application by posting a MM_MIDIINPUT message. When the application processes the MM_MIDIINPUT message, it removes the MIDI event from the input buffer and puts it in a display buffer. Information in the display buffer is converted to text and displayed in a scrollable window. Incoming MIDI data can be sent to the MIDI Mapper if the user chooses. Filtering is provided for the display buffer, but not for data sent to the Mapper.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; adddisplayevent; alloccallbackinstancedata; alloccircularbuffer; allocdisplaybuffer; beginpaint; checkeventfilter; checkmenuitem; commandmsg; createsolidbrush; createwindow; defwindowproc; deleteobject; dialogbox; dispatchmessage; domenuitemcheck; drawmenubar; enddialog; endpaint; error; fillrect; freecallbackinstancedata; freecircularbuffer; freedisplaybuffer; getclientrect; getdc; getdisplayevent; getdisplaytext; getevent; getmenu; getmessage; getpreferences; getprivateprofileint; getstockobject; getstringres; getsyscolor; getsystemmetrics; gettextextentpoint; gettextmetrics; getwindowrect; globalalloc; globalfree; globallock; globalsmartpagelock; globalsmartpageunlock; globalunlock; initfirstinstance; invalidaterect; lineto; loadcursor; loadicon; loadstring; max; messagebeep; messagebox; midiinclose; midiingetdevcaps; midiingeterrortext; midiingetnumdevs; midiinopen; midiinputhandler; midiinreset; midiinstart; midiinstop; midioutclose; midioutgeterrortext; midioutopen; midioutshortmsg; min; modifymenu; movetoex; postmessage; postquitmessage; putevent; registerclass; releasedc; resetdisplaybuffer; scrollwindow; selectobject; sendmessage; setbkmode; setpreferences; setscrollpos; setscrollrange; setupcustomchecks; showwindow; sprintf; switch; textout; translatemessage; updatewindow; winmain; wndproc; writeprivateprofilestring; wsprintf


MIDIplyr: Sample MIDI Player

Click to open or copy the files for the MIDIplyr sample.

This sample contains initialization code for the polymessage MIDI playback application.

To work correctly, this sample requires Windows® 95.

Building SDK Samples

This sample uses the following keywords:

_fmemset; appendmenu; assert; attemptfileopen; beginpaint; bseg; checkmenuitem; createfontindirect; createscaledfont; createstatuswindow; createtoolbarex; createwindow; d1; d2; d3; d4; dbgenable; dbginitialize; dbgsetlevel; dbgvprintf; debugbreak; declare_handle; defwindowproc; deleteobject; destroywindow; dispatchmessage; dpf; dprintf; dragacceptfiles; dragfinish; dragqueryfile; drawmenubar; dwordswap; embossedtextout; enablemenuitem; endpaint; error; event_ch_b1; event_ch_b2; event_meta_type; event_type; exttextout; forward_wm_command; forward_wm_size; getclientrect; getdc; getdesktopwindow; getmenu; getmenustate; getmessage; getopenfilename; getprofileinta; getstockobject; getsubmenu; gettextextentpoint; gettextextentpoint32; getwindowrect; globalallocptr; globalfreeptr; globalreallocptr; handle_msg; hmemcpy; initapp; initcommoncontrols; initinstance; initstatusbar; inittoolbar; int32x32to64; invalidaterect; isdigit; killtimer; loadcursor; loadicon; loadstring; localalloc; localfree; locallock; localrealloc; localunlock; lstrcata; lstrcpy; lstrlen; lstrlena; makeintresource; max; mcigeterrorstring; messagebox; messagepump; midioutgetdevcaps; midioutgetnumdevs; midioutprepare; midioutprepareheader; midioutreset; midioutstop; midioutunprepareheader; midistreamclose; midistreamopen; midistreamout; midistreampause; midistreamposition; midistreamproperty; midistreamrestart; midistreamstop; min; mmioclose; mmiodescend; mmiofourcc; mmioopen; mmioread; mmioseek; muldiv32; muldivrd; muldivrn; muldivru; mwnd_oncommand; mwnd_oncommandtogglechild; mwnd_oncreate; mwnd_ondestroy; mwnd_ondropfiles; mwnd_onfileopen; mwnd_ongetminmaxinfo; mwnd_onpaint; mwnd_onsize; mwnd_wndproc; outputdebugstringa; pack; painttime; patblt; peekmessage; postmessage; postquitmessage; prerollandwait; registerclass; releasedc; resizestatusbar; rgb; selectobject; sendmessage; seqallocbuffers; seqbufferdone; seqclosefile; seqfreebuffers; seqmidicallback; seqmillisecstoticks; seqopenfile; seqpause; seqpreroll; seqrestart; seqstart; seqstop; seqtickstomillisecs; seqtime; setbkcolor; setbkmode; setoneaction; settextcolor; settimer; setwindowpos; setwindowtext; showwindow; sleep; smfbuildfileindex; smfclosefile; smfgetfileinfo; smfgetnextevent; smfgetstatemaxsize; smfgetvdword; smfinsertparmdata; smfmillisecstoticks; smfopenfile; smfreadevents; smfseek; smftickstomillisecs; switch; syncui; terminateinstance; translatemessage; twnd_oncommand; twnd_oncreate; twnd_ondestroy; twnd_onpaint; twnd_onsize; twnd_ontimer; twnd_wndproc; uint32x32to64; updatewindow; va_end; va_start; warning; winassert; winmain; wordswap; wsprintf; wvsprintfa; xlatsmferr


MixApp: Sample Mixer Application

Click to open or copy the files for the MixApp sample.

This sample is a simple audio mixer.

Building SDK Samples

This sample uses the following keywords:

_based; _segname; appchoosefont; appclose; appcreate; appendsession; appexit; appgetwindowsversion; appinit; appinitmenupopup; appmsgbox; appprofilereadbytes; appprofilewritebytes; appqueryendsession; appsetwindowtext; appsize; appwndproc; atoi; beginpaint; char2nibble; checkdlgbutton; checkmenuitem; choosefont; combobox_addstring; combobox_getcursel; combobox_setcursel; createfontindirect; createwindow; createwindowex; dbgenable; dbggetlevel; dbginitialize; dbgsetlevel; dbgvprintf; debug_qquote; debug_quote; debugbreak; defined; defwindowproc; deletefont; destroywindow; dialogbox; dialogboxparam; dispatchmessage; dpf; dpi; dprintf; edit_getselex; edit_replacesel; edit_setsel; enablemenuitem; enablewindow; enddialog; endpaint; exttextout; field_offset; forward_wm_close; get_em_linescroll_mps; get_em_setsel_end; get_em_setsel_mps; get_em_setsel_start; get_wm_activate_fminimized; get_wm_activate_hwnd; get_wm_activate_mps; get_wm_activate_state; get_wm_changecbchain_hwndnext; get_wm_chartoitem_char; get_wm_chartoitem_hwnd; get_wm_chartoitem_mps; get_wm_chartoitem_pos; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; get_wm_command_mps; get_wm_ctlcolor_hdc; get_wm_ctlcolor_hwnd; get_wm_ctlcolor_mps; get_wm_ctlcolor_type; get_wm_hscroll_code; get_wm_hscroll_hwnd; get_wm_hscroll_mps; get_wm_hscroll_pos; get_wm_mdiactivate_factivate; get_wm_mdiactivate_hwndactivate; get_wm_mdiactivate_hwnddeact; get_wm_mdiactivate_mps; get_wm_mdisetmenu_mps; get_wm_menuchar_char; get_wm_menuchar_fmenu; get_wm_menuchar_hmenu; get_wm_menuchar_mps; get_wm_menuselect_cmd; get_wm_menuselect_flags; get_wm_menuselect_hmenu; get_wm_menuselect_mps; get_wm_parentnotify2_mps; get_wm_parentnotify_hwndchild; get_wm_parentnotify_id; get_wm_parentnotify_mps; get_wm_parentnotify_msg; get_wm_parentnotify_x; get_wm_parentnotify_y; get_wm_vkeytoitem_code; get_wm_vkeytoitem_hwnd; get_wm_vkeytoitem_item; get_wm_vkeytoitem_mps; get_wm_vscroll_code; get_wm_vscroll_hwnd; get_wm_vscroll_mps; get_wm_vscroll_pos; getclientrect; getcommandline; getdc; getdesktopwindow; getdlgctrlid; getdlgitem; getfocus; getkeystate; getmessage; getobject; getparent; getprivateprofilestring; getprofileinta; getrealtextmetrics; getscrollpos; getstockfont; getsyscolor; getsysteminfo; getsystemmetrics; gettextextentpoint; gettextmetrics; getversion; getwindowfont; getwindowinstance; getwindowlong; getwindowplacement; getwindowrect; globalallocptr; globalfreeptr; handle_wm_close; handle_wm_command; handle_wm_create; handle_wm_endsession; handle_wm_initdialog; handle_wm_initmenupopup; handle_wm_paint; handle_wm_queryendsession; handle_wm_size; handle_wm_vscroll; inflaterect; int32x32to64; invalidaterect; isdlgbuttonchecked; killtimer; listbox_addstring; listbox_getcursel; listbox_getitemdata; listbox_resetcontent; listbox_setcursel; listbox_setitemdata; listbox_settabstops; loadaccelerators; loadcursor; loadicon; loadstring; localalloc; localfree; lstrcata; lstrcpy; lstrlen; lstrlena; makeintresource; makelong; makelparam; meditprintf; memcpy; message; messagebox; min; mixappchoosefont; mixappcontrolchange; mixappcontrolchangefader; mixappcontrolchangelist; mixappcontrolchangemeter; mixappcontrolchangeswitch; mixappcontrolsetlist; mixappcontrolsetswitch; mixappdebuglog; mixappdisplaycontrol; mixappdisplaydevcaps; mixappgetcomponentname; mixappgetcontroltypename; mixapplinechange; mixapplinechangefader; mixapplinechangelist; mixapplinechangemeter; mixapplinechangeswitch; mixappnewdevice; mixapprefreshlinelist; mixappsettingsrestore; mixappsettingssave; mixerclose; mixergetcontroldetails; mixergetdevcaps; mixergetid; mixergetlinecontrols; mixergetlineinfo; mixergetnumdevs; mixeropen; mixersetcontroldetails; muldiv; muldiv32; muldivrd; muldivrn; muldivru; nibble2char; optimize; outputdebugstr; outputdebugstring; outputdebugstringa; pack; postquitmessage; processor; ptinrect; rcid; registerclass; regopenkey; releasedc; remind; screentoclient; selectobject; sendmessage; setbkcolor; setcursor; setdlgitemtext; setscrollpos; setscrollrange; settextcolor; settimer; setwindowfont; setwindowlong; setwindowplacement; setwindowpos; setwindowredraw; setwindowtext; showcursor; showwindow; tabbedtextout; text; tlbcreate; tlbdestroy; tlbmove; tlbpaint; tlbrecalctabs; tlbsetfont; tlbsettitleandtabs; translateaccelerator; translatemessage; uint32x32to64; updatewindow; va_end; va_start; warning; writeprivateprofilestring; wsprintf; wvsprintf; wvsprintfa


MmCaps: Show Hardware's Multimedia Capabilities

MmCaps: Show Hardware Multimedia Capabilities

Click to open or copy the files for the MmCaps sample.

This sample tests and shows the multimedia capabilities of the current machine.

Building SDK Samples

This sample uses the following keywords:

_fmemset; appchoosefont; appclose; appcreate; appdialogbox; appendsession; appexit; appgetwindowsversion; appinit; appinitmenupopup; appmeditprintf; appprofilereadbytes; appprofilewritebytes; appqueryendsession; appsize; appwndproc; atoi; auxgetdevcaps; auxgetnumdevs; beginpaint; char2nibble; checkmenuitem; choosefont; createfontindirect; createwindow; createwindowex; dbgenable; dbginitialize; dbgsetlevel; dbgvprintf; debugbreak; defined; defwindowproc; deletefont; destroywindow; dialogboxparam; dispatchmessage; dpf; dprintf; edit_getselex; edit_replacesel; edit_setsel; enddialog; endpaint; exttextout; forward_wm_close; freeprocinstance; get_em_linescroll_mps; get_em_setsel_end; get_em_setsel_mps; get_em_setsel_start; get_wm_activate_fminimized; get_wm_activate_hwnd; get_wm_activate_mps; get_wm_activate_state; get_wm_changecbchain_hwndnext; get_wm_chartoitem_char; get_wm_chartoitem_hwnd; get_wm_chartoitem_mps; get_wm_chartoitem_pos; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; get_wm_command_mps; get_wm_ctlcolor_hdc; get_wm_ctlcolor_hwnd; get_wm_ctlcolor_mps; get_wm_ctlcolor_type; get_wm_hscroll_code; get_wm_hscroll_hwnd; get_wm_hscroll_mps; get_wm_hscroll_pos; get_wm_mdiactivate_factivate; get_wm_mdiactivate_hwndactivate; get_wm_mdiactivate_hwnddeact; get_wm_mdiactivate_mps; get_wm_mdisetmenu_mps; get_wm_menuchar_char; get_wm_menuchar_fmenu; get_wm_menuchar_hmenu; get_wm_menuchar_mps; get_wm_menuselect_cmd; get_wm_menuselect_flags; get_wm_menuselect_hmenu; get_wm_menuselect_mps; get_wm_parentnotify2_mps; get_wm_parentnotify_hwndchild; get_wm_parentnotify_id; get_wm_parentnotify_mps; get_wm_parentnotify_msg; get_wm_parentnotify_x; get_wm_parentnotify_y; get_wm_vkeytoitem_code; get_wm_vkeytoitem_hwnd; get_wm_vkeytoitem_item; get_wm_vkeytoitem_mps; get_wm_vscroll_code; get_wm_vscroll_hwnd; get_wm_vscroll_mps; get_wm_vscroll_pos; getclientrect; getcommandline; getdc; getdesktopwindow; getdlgitem; getkeystate; getmessage; getobject; getparent; getprofileinta; getprofilestring; getrealtextmetrics; getstockfont; getsyscolor; getsysteminfo; getsystemmetrics; gettextextentpoint; gettextmetrics; getversion; getwindowfont; getwindowinstance; getwindowplacement; getwindowrect; getwinflags; globalallocptr; globalfreeptr; handle_wm_close; handle_wm_command; handle_wm_create; handle_wm_endsession; handle_wm_initmenupopup; handle_wm_paint; handle_wm_queryendsession; handle_wm_size; inflaterect; invalidaterect; joygetdevcaps; joygetnumdevs; listbox_addstring; listbox_getcursel; listbox_getitemdata; listbox_resetcontent; listbox_setitemdata; listbox_settabstops; loadaccelerators; loadcursor; loadicon; loadstring; localalloc; localfree; lstrcat; lstrcata; lstrcpy; lstrlen; lstrlena; makeintresource; makelong; makelparam; makeprocinstance; memcpy; messagebox; midiingetdevcaps; midiingetnumdevs; midioutgetdevcaps; midioutgetnumdevs; min; mixergetdevcaps; mixergetnumdevs; mmcapschoosefont; mmcapsdetailacm; mmcapsdetailauxiliary; mmcapsdetailjoystick; mmcapsdetaillowlevel; mmcapsdetailmci; mmcapsdetailmidiin; mmcapsdetailmidiout; mmcapsdetailmixer; mmcapsdetailtimer; mmcapsdetailvideo; mmcapsdetailwavein; mmcapsdetailwaveout; mmcapsenumerateacm; mmcapsenumeratedrivers; mmcapsenumeratelowlevel; mmcapsenumeratemci; mmcapsenumeratevideo; mmcapsmidandpid; mmcapsmidpid_mm_antex; mmcapsmidpid_mm_apps; mmcapsmidpid_mm_artisoft; mmcapsmidpid_mm_ati; mmcapsmidpid_mm_audiofile; mmcapsmidpid_mm_canopus; mmcapsmidpid_mm_cat; mmcapsmidpid_mm_computer_friends; mmcapsmidpid_mm_creative; mmcapsmidpid_mm_digispeech; mmcapsmidpid_mm_dsp_group; mmcapsmidpid_mm_echo; mmcapsmidpid_mm_ess; mmcapsmidpid_mm_everex; mmcapsmidpid_mm_fujitsu; mmcapsmidpid_mm_gravis; mmcapsmidpid_mm_ibm; mmcapsmidpid_mm_icl_ps; mmcapsmidpid_mm_intel; mmcapsmidpid_mm_interactive; mmcapsmidpid_mm_mediavision; mmcapsmidpid_mm_melabs; mmcapsmidpid_mm_microsoft; mmcapsmidpid_mm_motorola; mmcapsmidpid_mm_nec; mmcapsmidpid_mm_roland; mmcapsmidpid_mm_sierra; mmcapsmidpid_mm_tandy; mmcapsmidpid_mm_turtle_beach; mmcapsmidpid_mm_val; mmcapsmidpid_mm_vocaltec; mmcapsmidpid_mm_voyetra; mmcapsmidpid_mm_wanglabs; mmcapsmidpid_mm_yamaha; mmcapsrefreshdriverlist; mmcapssettingsrestore; mmcapssettingssave; muldiv; nibble2char; outputdebugstringa; postquitmessage; processor; ptinrect; rcid; registerclass; releasedc; selectobject; sendmessage; setbkcolor; setcursor; setfocus; settextcolor; setwindowfont; setwindowplacement; setwindowpos; setwindowredraw; setwindowtext; showcursor; showwindow; switch; tabbedtextout; text; timegetdevcaps; tlbcreate; tlbdestroy; tlbmove; tlbpaint; tlbrecalctabs; tlbsetfont; tlbsettitleandtabs; translateaccelerator; translatemessage; updatewindow; va_end; va_start; warning; waveingetdevcaps; waveingetnumdevs; waveoutgetdevcaps; waveoutgetnumdevs; writeprofilestring; wsprintf; wvsprintf; wvsprintfa


Reverse: Using Low-level Waveform Playback Services

Click to open or copy the files for the Reverse sample.

This sample plays a Wave waveform audio file backwards, and illustrates how to use the low-level waveform playback services. It also shows how to use the multimedia file I/O services to read data from a Wave file.

Building SDK Samples

This sample uses the following keywords:

appabout; appendmenu; cleanup; createwindow; dialogbox; dispatchmessage; edit_limittext; enablewindow; enddialog; forward_wm_command; forward_wm_destroy; forward_wm_syscommand; get_wm_command_id; getmessage; getstockbrush; getstringres; getsystemmenu; getwindowtext; globalallocptr; globalfreeptr; handle_msg; interchange; loadcursor; loadicon; loadstring; localalloc; localfree; locallock; localunlock; messagebox; mmioascend; mmioclose; mmiodescend; mmiofourcc; mmioopen; mmioread; mydefproc; postquitmessage; registerclass; reverseoncommand; reverseondestroy; reverseonsyscommand; reverseplay; setfocus; showwindow; translatemessage; waveoutclose; waveoutopen; waveoutprepareheader; waveoutreset; waveoutunprepareheader; waveoutwrite; winmain; wndproc


Soundapp: SndPlaySound API

Click to open or copy the files for the Soundapp sample.

This is a simple application showing the SndPlaySound API.

Building SDK Samples

This sample uses the following keywords:

about_oncommand; about_oninitdialog; aboutdlgproc; aboutdlgproc2; checkdefdlgrecursion; checkmenuitem; createdialog; defdlgprocex; dialogbox; enablemenuitem; enablewindow; enddialog; freeprocinstance; getdlgitem; getmenu; getopenfilename; getprofilestring; getstockobject; getwindowsdirectory; handle_msg; loadstring; makeintresource; makeprocinstance; sendmessage; setdlgmsgresult; setfocus; sndplaysound; soundapp_onactivate; soundapp_oncommand; soundapp_ondestroy; switch; unused; warning


WaveFile: Sample AVIFile File Handler

Click to open or copy the files for the WaveFile sample.

This sample AVIfile is a file handler for waveform audio files. To install it, execute dseqfile.reg and copy the DLL to the system directory. It can be used with AVIedit or AVIview.

Building SDK Samples

This sample uses the following keywords:

_fmemcmp; _fmemset; addref; ansiprev; define_guid; dllcanunloadnow; dllgetclassobject; dllmain; failed; filename; findchunkandkeepextras; getscode; globalallocptr; globalfreeptr; globalreallocptr; hmemcpy; int32x32to64; isequaliid; loadstring; loadunicodestring; lstrlen; max; min; mmioascend; mmioclose; mmiocreatechunk; mmiodescend; mmioflush; mmiofourcc; mmioopen; mmioread; mmioseek; mmiowrite; muldiv32; muldivrd; muldivrn; muldivru; multibytetowidechar; queryinterface; readextra; readintoextra; release; resultfromscode; seterrormode; slash; stdmethodimp_; switch; uint32x32to64; warning; wavefactoryaddref; wavefactorycreate; wavefactorycreateinstance; wavefactorylockserver; wavefactoryqueryinterface; wavefactoryrelease; wavefileaddref; wavefilecreate; wavefilecreatestream; wavefiledeletestream; wavefileendrecord; wavefilegetstream; wavefileinfo; wavefileopen; wavefilequeryinterface; wavefilereaddata; wavefilerelease; wavefilereserved; wavefilesave; wavefilewritedata; wavepersistaddref; wavepersistqueryinterface; wavepersistrelease; wavestreamaddref; wavestreamcreate; wavestreamdelete; wavestreamfindsample; wavestreaminfo; wavestreamqueryinterface; wavestreamread; wavestreamreaddata; wavestreamreadformat; wavestreamrelease; wavestreamreserved; wavestreamsetformat; wavestreamsetinfo; wavestreamwrite; wavestreamwritedata; wavestuff_from_file; wavestuff_from_persist; wavestuff_from_stream; wavestuff_from_unknown; waveunknownaddref; waveunknownqueryinterface; waveunknownrelease; wep; widechartomultibyte; writeextra; wsprintf


Broadcast Architecture Samples

Click to open or copy the files for the Broadcast Architecture samples.

For information on system requirements for Broadcast Architecture, see the Client Hardware Requirements section of the Broadcast Architecture Device-Driver Development Kit (DDK).

For you to get the most value from the Broadcast Architecture samples, you should have the following components installed:

  • Microsoft® Windows® 98, including the optional TV Viewer component.

  • Microsoft Visual Basic. For more information on installing and using Visual Basic, see the Visual Basic documentation.

  • Microsoft Visual C++. For more information on installing and using Visual C++, including the Microsoft Foundation Class (MFC) Library, see the Visual C++ documentation.

For more information, see Introduction to Broadcast Architecture.


SchSamp: Schedule a Show Reminder

Click to open or copy the files for the SchSamp sample.

This sample is a Microsoft® ActiveX component that schedules a Broadcast Architecture show reminder.

The SchSamp sample, SchSamp.dll, is an ActiveX component. It schedules a show reminder using the IScheduledItems interface, TssAdmin.dll, which is available from Television System Services. TV Viewer is used to display the reminder dialog box when the reminder runs.

SchSamp schedules a TV Viewer reminder for a broadcast show. At a specified amount of time before the show starts, the reminder runs, causing TV Viewer to display a dialog box to the user. This dialog box states that the show is about to start and offers the user the option to tune to that channel. You can use this component, for example, on a television enhancement page so users can schedule a reminder for next week's episode.

If you set reminders by any means other than ITVViewer::SetReminder, users cannot view them from the Search page of TV Viewer when a user selects MyReminders from the Categories list. Nor will the user see a reminder icon appear in that program's details list. However, TV Viewer still presents a reminder dialog box when the reminder runs.

Because SchSamp is implemented as an ActiveX component, you can call it from a variety of programming environments, such as VBScript or Microsoft JScript development software on a Web page, Visual Basic, Java, or C++. The other samples under the BA directory use Web-based VBScript to call SchSamp.

For more information about how to write applications that schedule show reminders, see Scheduling Show Reminders in the Broadcast Architecture Programmer's Reference.


TVXsamp: MFC Sample to Control TV Viewer

Click to open or copy the files for the TVXsamp sample.

This sample MFC application demonstrates how to connect to and control TV Viewer.

TVXSamp is a Microsoft Foundation Classes (MFC) application that connects to and controls an instance of TV Viewer. The sample has a single dialog box with buttons you can click to test its functionality. On startup, TVXSamp gets a reference to a running instance of TV Viewer. It uses this reference to call methods of the TV Viewer dispatch interface, ITVViewer.

Building SDK Samples

This sample uses the following keywords:

_t; afxenablecontrolcontainer; afxgetapp; afxmessagebox; afxoleinit; afxolelockapp; afxoleunlockapp; assert_kindof; begin_dispatch_map; begin_interface_map; begin_message_map; canexit; cdialog; channellist; coledispatchdriver; ctvxsampapp; ctvxsampdlg; ctvxsampdlgautoproxy; dc; declare_dispatch_map; declare_dynamic; declare_dyncreate; declare_interface_map; declare_message_map; declare_olecreate; define_guid; defined; deletereminder; dodataexchange; domodal; drawicon; enableautomation; end_dispatch_map; end_interface_map; end_message_map; episodestatuschanged; factory; getactiveobject; getcc; getclientrect; getcurrenttuninginfo; getprevioustuninginfo; getsafehdc; getsystemmetrics; globalendtime; globalstarttime; hasenhancement; hasreminder; height; implement_dynamic; implement_dyncreate; implement_olecreate2; initinstance; interface_part; invokehelper; iscc; ischannelbarup; isiconic; isloaderactive; ismodaldialogup; istvmode; itvcontrol; itvviewer; loadicon; on_bn_clicked; on_command; on_wm_close; on_wm_paint; on_wm_querydragicon; onbutton1; onbutton2; onbutton4; oncancel; onclose; onfinalrelease; onidle; oninitdialog; onok; onpaint; onquerydragicon; onsetreminder; ontvfocus; powerchange; queryinterface; registerall; release; runautomated; runembedded; runtime_class; sendmessage; setcc; seticon; setoutput; setreminder; settvmode; showwindow; succeeded; syncevent; teardown; tune; updateregistryall; viewerid; wantnumkeys; width


UseVideo: ActiveX Video Samples

Click to open or copy the files for the UseVideo sample.

The UseVideo samples demonstrate presenting audio and video in an application, a Web browser, and in a control you create.

The UseVideo sample contains several sample programs.

  • The WebTune sample is a Video Web Page that demonstrates embedding and using the Video ActiveX control in a Web page.

  • The VideoMFC sample has several parts:
    • Video Test Project (VidCntrl) demonstrates a project containing a standard Microsoft Visual Basic form that hosts and manipulates an instance of the Microsoft ActiveX control (the Video ActiveX control).

    • Video Test Control (Vid_Tune) demonstrates creating a control that contains the Video ActiveX control as a constituent control.

    • Video MFC Test describes building an application for Windows with C++ classes from the Microsoft Foundation Class Library (MFC).

In addition to presenting audio and video, these samples show how to embed a Video ActiveX control in your program and how to select different devices to provide input to such a control. If your computer contains a tuner card, these samples show how to tune to a channel.


VideoMFC: Video MFC Control Sample

Click to open or copy the files for the VideoMFC sample.

The VideoMFC sample demonstrates using the Video control. For more information, see the parent topic, UseVideo: ActiveX Video Samples.

Building SDK Samples

This sample uses the following keywords:

_t; aboutbox; addstring; afxenablecontrolcontainer; afxgetapp; afxmessagebox; assert; attachdispatch; begin_message_map; buyitem; cancelitem; cbpcdevicebase; cbpcdevices; cdialog; clear; coledispatchdriver; command; create; createcontrol; cvdmfcapp; cvdmfcdlg; dc; ddx_control; ddx_text; declare_dyncreate; declare_message_map; defined; displayconfigdialog; dodataexchange; domodal; drawicon; enable3dcontrols; enable3dcontrolsstatic; end_message_map; get_name; getaudiofrequency; getaudiosubchannel; getbalance; getchannel; getchannelavailable; getclientrect; getclosedcaption; getclsid; getcolorkey; getcount; getcountrycode; getcurrentposition; getcurrentstate; getcursel; getdebug; getdefaultaudiotype; getdefaultvideotype; getdevicecount; getdevices; getdisplaymode; getduration; getemailmessages; getfilename; getfont; gethasca; gethaschannel; gethasfilename; gethistoryitems; gethwnd; getimagesourceheight; getimagesourcewidth; getinput; getisinput; getisoutput; getitemdetails; getlocaleid; getmoviewindowsetting; getname; getnewenum; getoutput; getoverscan; getpower; getprerolltime; getpriority; getprodname; getproviderepgmask; getproviderrating; getproviderstatus; getrate; getsafehdc; getstarttime; getstatus; getstoptime; getsystemmetrics; gettext; getuserarea; getusername_; getvideofrequency; getvideoon; getvideosubchannel; getvolume; handlecardchaining; height; id; implement_dyncreate; initinstance; invokehelper; isiconic; item; loadicon; login; next; on_bn_clicked; on_command; on_wm_paint; on_wm_querydragicon; oninitdialog; onpaint; onpause; onplay; onquerydragicon; onsetchannel; onsetfile; onsetinput; onsetoutput; onstop; onvideoon; open; pause; queryinterface; refresh; release; resetprovidersystem; run; sendmessage; setaudiosubchannel; setbalance; setchannel; setclosedcaption; setcolorkey; setcountrycode; setcurrentposition; setdebug; setdefaultaudiotype; setdefaultvideotype; setdisplaymode; setfilename; setfont; sethwnd; seticon; setinput; setlcid; setlocaleid; setmoviewindowsetting; setnotify; setoutput; setoverscan; setpower; setprerolltime; setpriority; setrate; setstarttime; setstoptime; setuserarea; setusername; setvideoon; setvideosubchannel; setvolume; stop; str; subclassdlgitem; succeeded; sysfreestring; tsdevicecount; tune; updatedata; verify; width


WebTune: Sample Video Control in an HTML Page

Click to open or copy the files for the WebTune sample.

The WebTune subdirectory contains a Hypertext Markup Language (HTML) document that Internet Explorer uses to display a video control.


DirectAnimation Samples

Click to open or copy the files for the DirectAnimation samples.

DirectAnimation comes with a wide variety of samples that show you how to use DirectAnimation from different host languages. The samples are heavily commented and can be used as an extension to the documentation. The samples come with a pool of media files, including MIDI, 3-D model, image, video, and sound files. These are used by the SDK samples and are available to use in the DirectAnimation content only.

DirectAnimation is released as an integrated component of Internet Explorer 4 minimal installation. This provides unprecedented animation and multimedia capabilities built into a major Internet browser (no special download is needed). Furthermore, DirectAnimation is integrated with DHTML, and hence is especially suitable for adding compact and lightweight animation effects to Web pages.

DirectAnimation is the component of the DirectX family of APIs that provides rich animation and integrated media support for Web pages, CD-ROM titles, and multimedia applications. DirectAnimation provides a unified and comprehensive support for the different media types, including: 2D vector graphics, 3D graphics, sprites, audio, video, and a rich time and event model that applies uniformly across the different media types. DirectAnimation is a COM API and an underlying engine/run time. Different user groups can access it in different ways:

  • HTML authors can integrate animation using the DirectAnimation controls.

  • Visual Basic Scripting Edition (VBScript), JScript™ users, and Java applet writers can program animation for Web pages with integration with DHTML.

  • Java, Visual Basic, and C++ programmers can develop ActiveX controls or full applications with rich media and interactivity.


Help: DirectAnimation Samples and Documentation

Click to open or copy the files for the Help sample.

This directory, with its subdirectories, contains samples and documentation for DirectAnimation.


Art: DirectAnimation Graphics Samples

Click to open or copy the files for the Art sample.

This directory contains GIF and JPG samples.


DA: DirectAnimation Samples and Documentation

Click to open or copy the files for the DA sample.

This directory, with its subdirectories, contains samples and documentation.


DS: DirectShow Samples

Click to open or copy the files for the DS sample.

The Microsoft® DirectShow™ SDK gives developers access to DirectShow services, which provide playback multimedia streams from local files or Internet servers and capture of multimedia streams from devices. Specifically, this enables playback of video and audio content compressed in various formats, including MPEG, Apple® QuickTime®, audio-video interleaved (AVI), and WAV, and both Video for Windows-based capture and WDM-based (Windows Driver Model) capture.

This directory contains HTML and GIF files.


DirectAnimation C++ Samples

Click to open or copy the files for the DirectAnimation C++ samples.


Donut: Text String DirectX Animation

Click to open or copy the files for the Donut sample.

This sample takes the ddraw Donut sample from the DirectX SDK and adds an animated text string to it using DirectX Animation. A direct draw primary surface is created and passed to the DAView object for rendering.

Building SDK Samples

This sample uses the following keywords:

_ftime; _lclose; _lopen; _lread; _t; blt; clienttoscreen; cocreateinstance; coinitialize; colorhslanim; couninitialize; createclipper; createcompatibledc; createdirectdraw; createinstance; createpalette; createsurface; createsurfaces; createwindowex; danumber; ddcolormatch; ddcopybitmap; ddloadbitmap; ddloadpalette; ddreloadbitmap; ddsetcolorkey; defwindowproc; deletedc; deleteobject; destroywindow; dispatchmessage; doinit; dump_com_error; error; errormessage; exclude; findresource; finiobjects; font; getclientrect; getdc; getforegroundwindow; getmessage; getmodulehandle; getobject; getpixel; getstockobject; getsurfacedesc; gettickcount; initdxaviewobj; initfail; isiconic; islost; loadcursor; loadicon; loadimage; loadresource; lock; lockresource; messagebox; mul; outputdebugstring; overlay; peekmessage; postmessage; postquitmessage; recreatesurfaces; redrawwindow; registerclass; release; releasedc; releasesurfaces; rename; rename_namespace; render; resetdxasurfaces; restore; restoreall; rgb; rotate2anim; selectobject; setclipper; setcolorkey; setcooperativelevel; setcursor; sethwnd; setpalette; setpixel; setrect; setviewport; showwindow; sin; solidcolorimage; sprintf; startmodel; startole; stretchblt; stringimage; switch; tick; transform; translate2anim; translatemessage; unlock; updateframe; updatewindow; waitmessage; windowproc; winmain; zeromemory


Pick3: DirectAnimation Direct Draw Sample

Click to open or copy the files for the Pick3 sample.

This sample takes an empty direct draw primary surface, which is created in Pick3.cpp, and passes it to the DAView object for rendering.

Building SDK Samples

This sample uses the following keywords:

_bstr_t; _ftime; _t; _tcscat; _tcscpy; abs; activate; blt; clienttoscreen; cocreateinstance; coinitialize; colorhslanim; colorrgb; compose3; couninitialize; createclipper; createdirectdraw; createinstance; createsurface; createsurfaces; createwindowex; danumber; defwindowproc; destroywindow; diffusecolor; dispatchmessage; div; doinit; dump_com_error; error; errormessage; exclude; finiobjects; geometryimage; getclientrect; getcurrentdirectory; getforegroundwindow; getmessage; getstockobject; gettickcount; importgeometry; initdxaviewobj; initfail; integral; isiconic; islost; loadcursor; loadicon; messagebox; mul; outputdebugstring; overlay; parallelcamera; peekmessage; perspectivecamera; postmessage; postquitmessage; recreatesurfaces; redrawwindow; registerclass; release; releasesurfaces; rename; rename_namespace; render; resetdxasurfaces; restore; restoreall; rotate3anim; scale3anim; scale3uniform; scale3uniformanim; setclipper; setcooperativelevel; setcursor; sethwnd; setrect; setviewport; showwindow; sin; solidcolorimage; sprintf; startmodel; startole; switch; tick; transform; translate3; translatemessage; uniongeometry; until; updateframe; updatewindow; waitmessage; windowproc; winmain


Tile: DirectAnimation Direct Draw Sample

Click to open or copy the files for the Tile sample.

This sample takes an empty direct draw primary surface, which is created in tile.cpp, and passes it to the DAView object for rendering.

Building SDK Samples

This sample uses the following keywords:

_bstr_t; _ftime; _t; _tcscat; _tcscpy; blt; clienttoscreen; cocreateinstance; coinitialize; colorhslanim; cos; couninitialize; createclipper; createdirectdraw; createinstance; createsurface; createsurfaces; createwindowex; crop; danumber; defwindowproc; destroywindow; dispatchmessage; doinit; dump_com_error; error; errormessage; exclude; finiobjects; getclientrect; getcurrentdirectory; getforegroundwindow; getmessage; getstockobject; gettickcount; gradientsquare; importimage; initdxaviewobj; initfail; isiconic; islost; loadcursor; loadicon; messagebox; mul; myrange; outputdebugstring; overlay; peekmessage; point2anim; postmessage; postquitmessage; recreatesurfaces; redrawwindow; registerclass; release; releasesurfaces; rename; rename_namespace; render; resetdxasurfaces; restore; restoreall; scale2uniformanim; setclipper; setcooperativelevel; setcursor; sethwnd; setrect; setviewport; showwindow; sin; solidcolorimage; sprintf; startmodel; startole; switch; tick; tile; transform; translate2anim; translatemessage; updateframe; updatewindow; waitmessage; windowproc; winmain


Union: DirectAnimation Direct Draw Sample

Click to open or copy the files for the Union sample.

This sample takes an empty direct draw primary surface, which is created in union.cpp, and passes it to the DAView object for rendering.

Building SDK Samples

This sample uses the following keywords:

_bstr_t; _ftime; _t; _tcscat; _tcscpy; blt; clienttoscreen; cocreateinstance; coinitialize; colorhslanim; compose3; couninitialize; createclipper; createdirectdraw; createinstance; createsurface; createsurfaces; createwindowex; danumber; defwindowproc; destroywindow; diffusecolor; dispatchmessage; doinit; dump_com_error; error; errormessage; exclude; finiobjects; geometryimage; getclientrect; getcurrentdirectory; getforegroundwindow; getmessage; getstockobject; gettickcount; getxvector3; getyvector3; getzvector3; importgeometry; importsound; initdxaviewobj; initfail; isiconic; islost; loadcursor; loadicon; loop; messagebox; mul; mycolor; outputdebugstring; overlay; peekmessage; perspectivecameraanim; postmessage; postquitmessage; recreatesurfaces; redrawwindow; registerclass; release; releasesurfaces; rename; rename_namespace; render; resetdxasurfaces; restore; restoreall; rotate3anim; scale2uniformanim; scale3uniformanim; setclipper; setcooperativelevel; setcursor; sethwnd; setrect; setviewport; showwindow; sin; solidcolorimage; sprintf; startmodel; startole; switch; tick; transform; translate3anim; translatemessage; uniongeometry; updateframe; updatewindow; waitmessage; windowproc; winmain


Controls: DirectAnimation Samples

Click to open or copy the files for the Controls samples.

This directory includes the following:

  • AniFilt.htm

  • Buttons.htm

  • Clock.htm

  • Complex.htm

  • Count.htm

  • Filter.htm

  • Globe.htm

  • Mega.htm

  • Path.htm

  • Sg-DrawingSurface.htm

  • SG-Preserve.htm

  • SpinIE.htm

  • Textmask.htm

  • Yoyo.htm


WebCD

Click to open or copy the files for the WebCD sample.


DirectAnimation Tutorials and Samples

Click to open or copy the files for the DA sample.

Samples for VB, VBScript, and Java.


DirectX Samples

Download all DirectX Samples

Click to open or copy the files for the DirectX samples.

The Microsoft® DirectX® Programmer's Reference provides a finely tuned set of application programming interfaces (APIs) that provide you with the resources you need to design high-performance, real-time applications. DirectX technology will help build the next generation of computer games and multimedia applications.

For more information, see Introducing DirectX.


Bellhop: DirectPlay Gaming Lobby Client Sample

Click to open or copy the files for the Bellhop sample.

Bellhop is a DirectPlay sample that demonstrates how to write a lobby client application using the DirectPlay API. You can use Bellhop to find other people with whom to play games. By launching Bellhop and connecting to the lobby server, you can navigate through the "rooms" (represented by a door icon) on the lobby server to find other people with whom you can chat. You can create or join "staging areas" (represented by the triangle icon) to launch DirectPlay lobby-aware games.

To use the Bellhop application, a DirectPlay lobby server must be running on a computer on the network.

Visual C++ may include older versions of the DirectX header files and libraries. This sample requires DirectX 5. In order to avoid compile errors, make sure the path to the DirectX 5 header files and libraries is listed BEFORE the Visual C++ header files and libraries on the Directories menu, found under Options on the Tools menu.

Building SDK Samples

This sample uses the following keywords:

_strlwr; addgrouptogroup; addplayertogroup; begindeferwindowpos; beginlabeledit; callwindowproc; cgrouptree; checkaccessrights; closehandle; cocreateguid; cocreateinstance; coinitialize; combobox_addstring; combobox_getcount; combobox_getitemdata; combobox_setcursel; combobox_setitemdata; comparefunc; connect; connectionsettingsdialogproc; connectusingdialog; connectusinglobby; connectwndproc; couninitialize; createdirectplayinterface; createdirectplaylobbyinterface; createevent; creategroup; creategroupingroup; createlobbygroup; createplayer; createthread; deferwindowpos; define_guid; deleteconnectionlist; deletegroupfromgroup; deleteplayerfromgroup; deletesessioninstancelist; destroydirectplayinterface; destroydirectplaylobbyinterface; destroygroup; destroymenu; destroyplayer; dialogboxparam; directplayenumconnectionscallback; docreateroom; docreatetable; dodeleteplayerfromgroup; dodeleteroom; dodeletetable; dogroupconnectionsettings; dolaunch; edit_gettext; editctrlsubproc; editlabel; enabledlgbutton; enablemenuitem; enablewindow; enddeferwindowpos; enddialog; endlabeledit; enumapp; enumgroupplayers; enumgroups; enumgroupsingroup; enumlocalapplications; enumsessions; enumsessionscallback; errorbox; exitthread; failed; finditem; getbranchstructofparent; getclientrect; getcomboboxguid; getcomputername; getconnection; getconnectionsettings; getconnectionspguid; getcursorpos; getdc; getdevicecaps; getdlgitem; getdlgitemint; getdlgitemtext; getdpidofcurrentselection; getdpidofcurrentselectionparent; geteffectiveclientrect; getgroupflags; getgroupname; getlocalappname; getlocalappnamecallback; getmodulehandle; getparent; getplayerflags; getplayername; getsessioninfo; getsubmenu; getsyscolor; getwindowlong; getwindowrect; globalallocptr; globalfreeptr; handleapplicationmessage; handlestartsession; handlesystemmessage; idirectplay2_queryinterface; idirectplay2_release; idirectplay3_close; idirectplay3_creategroup; idirectplay3_creategroupingroup; idirectplay3_createplayer; idirectplay3_deletegroupfromgroup; idirectplay3_deleteplayerfromgroup; idirectplay3_destroygroup; idirectplay3_destroyplayer; idirectplay3_enumconnections; idirectplay3_enumsessions; idirectplay3_getgroupconnectionsettings; idirectplay3_getgroupflags; idirectplay3_getgroupname; idirectplay3_getplayerflags; idirectplay3_getplayername; idirectplay3_initializeconnection; idirectplay3_open; idirectplay3_receive; idirectplay3_release; idirectplay3_secureopen; idirectplay3_sendchatmessage; idirectplay3_setgroupconnectionsettings; idirectplay3_startsession; idirectplaylobby_enumlocalapplications; idirectplaylobby_receivelobbymessage; idirectplaylobby_release; idirectplaylobby_runapplication; imagelist_addicon; imagelist_begindrag; imagelist_create; imagelist_destroy; imagelist_dragenter; imagelist_dragleave; imagelist_dragmove; imagelist_enddrag; imagelist_setbkcolor; initconnectionsettingsdialog; initializelobby; initializelobbygroupwindow; insert; invalidaterect; isequalguid; isiconic; joinsession; killtimer; loadicon; loadmenu; lobbygroupwndproc; lobbywndproc; localalloc; localfree; logstring; lstrcat; lstrcpy; lstrlen; makeintresource; memcpy; memset; messagebox; newchatstring; onbegindrag; ondblclk; onlbuttonup; onmousemove; onrbuttondown; onsize; onwm_notify; postmessage; receivemessage; receivethread; recursiverename; redraw; refresh; release; releasecapture; releasedc; securitycredentialswndproc; selectsessioninstance; sendchatmessage; senddlgitemmessage; setcapture; setconnectionsettings; setdlgitemint; setdlgitemtext; setevent; setgroupconnection; setgroupname; setplayername; settimer; setupconnection; setwindowlong; setwindowtext; showcursor; shutdownconnection; strcmp; succeeded; switch; trackpopupmenuex; treeview_createdragimage; treeview_deleteallitems; treeview_deleteitem; treeview_editlabel; treeview_expand; treeview_getchild; treeview_geteditcontrol; treeview_getindent; treeview_getitem; treeview_getitemrect; treeview_getnextsibling; treeview_getparent; treeview_getroot; treeview_getselection; treeview_hittest; treeview_insertitem; treeview_selectdroptarget; treeview_selectitem; treeview_setimagelist; treeview_setitem; treeview_sortchildrencb; tv_enumplayerscallback; update; updatebuttons; updatelobbydisplay; updatewindow; waitformultipleobjects; waitforrunmsg; waitforsingleobject; winmain; wsprintf; zeromemory


Boids: DirectX Flocking Sample

Click to open or copy the files for the Boids sample.

Click to open or copy the Misc files (required).

Building SDK Samples

This sample uses the following keywords:

addlight; addref; addtoviewport; assert; at; attach; attachviewport; beginscene; bitblt; ceil; changedriverproc; choosetextureformat; clamp; clear; color; copy; cos; createcompatibledc; createlight; creatematerial; createpalette; createsurface; crossproduct; d3dlvertex; d3drgb; d3dscene; d3dtexture; d3dvector; d3dvertex; defined; deletedc; deletelight; deleteobject; detach; detachviewport; directdrawcreate; direction; directionallight; dotproduct; dpf; drawboid; drawindexedprimitive; drawpattern; drawsphere; driverenumcallback; endscene; enumtextureformats; fabs; failed; fatalerr; findtexturecallback; fini; float; floor; freelibrary; from; getalpha; getambient; getattenuation; getbvalue; getcaps; getclipstatus; getcolor; getdc; getdd; getddinterface; getdevicecaps; getdibcolortable; getdiffuse; getdirection; getemissive; getfalloff; getflags; getgvalue; gethandle; getmodulehandle; getobject; getpalette; getpenumbra; getposition; getpower; getprocaddress; getrampsize; getrange; getrendertarget; getrvalue; getspecular; getsurface; getsurfacedesc; getsurfacerect; gettexturehandle; getumbra; getversionex; getviewport; grid_color; identitymatrix; isprimary; isvalid; light; load; loadimage; loadlibrary; lstrlen; lubksb; ludcmp; magnitude; malloc; material; matrixinverse; matrixmult; matrixtranspose; max; max3; memset; min; min3; normalize; offset; outputdebugstring; palettefrombitmap; parallelpointlight; pointlight; projectionmatrix; queryinterface; rand; release; releasedc; removefromviewport; render; reporterr; restore; restoredisplaymode; ret; rgb; rgba_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setbackground; setclipstatus; setcolor; setcooperativelevel; setdiffuse; setdirection; setemissive; setfalloff; setflags; setlight; setlightstate; setmaterial; setpalette; setpenumbra; setposition; setpower; setrampsize; setrange; setrenderstate; setspecular; settexturehandle; settransform; setumbra; sin; spotlight; squaremagnitude; srand; text; time; transformnormal; transformvector; translatematrix; turnvalidinterfaceoff; turnvalidrenderoff; turnvalidviewportoff; up; updateflock; va_end; va_start; validatedevice; view; viewmatrix; winmain; world; wvsprintf; zeromatrix; zeromemory

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


D3dex1: Direct3D Immediate Mode and Execute Buffers Sample

Click to open or copy the files for the D3dex1 sample.

This sample displays a spinning triangle in a window. It uses Direct3D Immediate mode and execute buffers.

This application shows how to determine what Direct3D device to use.

Building SDK Samples

This sample uses the following keywords:

addattachedsurface; addlight; addviewport; animatescene; assert; beginpaint; beginscene; bitdepthtoflags; blt; choosedevice; clear; clienttoscreen; codefromhresult; copymemory; cos; createdevice; createdirect3d; createexecutebuffer; createlight; creatematerial; creatematrix; createpalette; createprimary; createscene; createsurface; createviewport; createwindow; d3dval; defwindowproc; deletematrix; destroywindow; directdrawcreate; directdrawcreateclipper; dispatchmessage; doframe; endpaint; endscene; enumdevicecallback; enumdevices; execute; failed; fatalerror; fillexecutebuffer; flagstobitdepth; getclientrect; getdc; gethandle; getstockobject; getsurfacedesc; getsystempaletteentries; gettextextentpoint32; invalidaterect; loadcursor; loadicon; loadstring; lock; makeintresource; messagebox; offsetrect; onidle; onmove; onpaint; onsize; paintsuspended; peekmessage; postquitmessage; queryinterface; rectangle; registerclass; release; releasedc; releasedevice; releasedirect3d; releaseprimary; releasescene; renderscene; reporterror; restore; restoredevice; restoreprimary; restoresurfaces; rgb; rgba_make; selectobject; setbackground; setbkmode; setclipper; setcooperativelevel; setexecutedata; sethwnd; setlight; setmaterial; setmatrix; setpalette; setperspectiveprojection; setrotationabouty; settextcolor; setviewport; setwindowtext; showwindow; sin; strcpy; succeeded; textout; translatemessage; unlock; updateviewport; updatewindow; use_param; warning; winmain; wndproc; wsprintf; zeromemory


D3dex2: Multi-monitor Direct3D Immediate Mode and Execute Buffers Sample

Click to open or copy the files for the D3dex2 sample.

Click to open or copy the Misc files (required).

This sample is a version of D3dex1 that demonstrates how to handle multiple monitors with a windowed DirectDraw application. This sample shows how just a few changes are needed to work well on a multi-monitor system.

Building SDK Samples

This sample uses the following keywords:

addattachedsurface; addlight; addviewport; animatescene; assert; beginpaint; beginscene; bitdepthtoflags; blt; checkmonitors; choosedevice; clear; clienttoscreen; codefromhresult; copymemory; cos; createdevice; createdirect3d; createexecutebuffer; createlight; creatematerial; creatematrix; createpalette; createprimary; createscene; createsurface; createviewport; createwindow; d3dval; defwindowproc; deletematrix; destroywindow; directdrawcreateclipper; directdrawcreatefromwindow; directdrawdevicefromwindow; dispatchmessage; doframe; endpaint; endscene; enumdevicecallback; enumdevices; execute; failed; fatalerror; fillexecutebuffer; flagstobitdepth; getclientrect; getdc; gethandle; getstockobject; getsurfacedesc; getsystempaletteentries; gettextextentpoint32; invalidaterect; loadcursor; loadicon; loadstring; lock; makeintresource; messagebox; min; offsetrect; onidle; onmove; onpaint; onsize; paintsuspended; peekmessage; postquitmessage; queryinterface; rectangle; registerclass; release; releasedc; releasedevice; releasedirect3d; releaseprimary; releasescene; renderscene; reporterror; restore; restoredevice; restoreprimary; restoresurfaces; rgb; rgba_make; selectobject; setbackground; setbkmode; setclipper; setcooperativelevel; setexecutedata; sethwnd; setlight; setmaterial; setmatrix; setpalette; setperspectiveprojection; setrotationabouty; settextcolor; setviewport; setwindowtext; showwindow; sin; strcpy; succeeded; textout; translatemessage; unlock; updateviewport; updatewindow; use_param; warning; winmain; wndproc; wsprintf; zeromemory

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


DDex1: DirectDraw Back Buffer Sample

Click to open or copy the files for the DDex1 sample.

This sample creates a DirectDraw object and then a primary surface with a back buffer. The sample slowly switches the DirectDraw object between the primary surface and the back buffer.

Building SDK Samples

This sample uses the following keywords:

beginpaint; createsurface; createwindowex; defwindowproc; destroywindow; directdrawcreate; dispatchmessage; doinit; endpaint; finiobjects; flip; getattachedsurface; getclientrect; getdc; getmessage; getsystemmetrics; gettextextentpoint; loadcursor; loadicon; lstrlen; messagebox; postmessage; postquitmessage; registerclass; release; releasedc; restore; rgb; setbkcolor; setcooperativelevel; setcursor; setdisplaymode; settextcolor; settimer; showwindow; switch; textout; translatemessage; updatewindow; windowproc; winmain; wsprintf


DDex2: DirectDraw Back Buffer Enhanced Sample

Click to open or copy the files for the DDex2 sample.

Click to open or copy the Misc files (required).

This DirectDraw sample adds functionality to DDex1. It reads a bitmap file from disk and copies it into the back buffer and then slowly switches between the primary surface and the back buffer. It also changes the video mode to 640x480x8.

Building SDK Samples

This sample uses the following keywords:

createsurface; createwindowex; ddloadpalette; ddreloadbitmap; defwindowproc; destroywindow; directdrawcreate; dispatchmessage; doinit; finiobjects; flip; getattachedsurface; getdc; getmessage; getsystemmetrics; loadcursor; loadicon; lstrlen; messagebox; postquitmessage; registerclass; release; releasedc; restore; rgb; setbkcolor; setcooperativelevel; setcursor; setdisplaymode; setpalette; settextcolor; settimer; showwindow; switch; textout; translatemessage; updatewindow; windowproc; winmain

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


DDex3: DirectDraw Back Buffer BltFast Sample

Click to open or copy the files for the DDex3 sample.

Click to open or copy the Misc files (required).

This DirectDraw sample adds functionality to DDex2. It does the following:

  • Creates two offscreen surfaces in addition to the primary surface and back buffer.

  • Loads a bitmap file into each offscreen surface.

  • Uses BltFast to copy the contents of an offscreen surface to the back buffer and then switches the contents of the buffers and copies the next offscreen surface to the back buffer.

This program requires at least 1.2 MB of video RAM.

Building SDK Samples

This sample uses the following keywords:

bltfast; createsurface; createwindowex; ddcopybitmap; ddloadpalette; defwindowproc; deleteobject; destroywindow; directdrawcreate; dispatchmessage; doinit; finiobjects; flip; getattachedsurface; getmessage; getmodulehandle; getstockobject; getsystemmetrics; initfail; initsurfaces; loadcursor; loadicon; loadimage; messagebox; postmessage; postquitmessage; registerclass; release; restore; restoreall; setcooperativelevel; setcursor; setdisplaymode; setpalette; settimer; showwindow; switch; translatemessage; updatewindow; windowproc; winmain

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


DDex4: DirectDraw Back Buffer BltFast Return-code Sample

Click to open or copy the files for the DDex4 sample.

Click to open or copy the Misc files (required).

This DirectDraw sample illustrates watching the return code from BltFast to prevent tearing. This sample adds functionality to DDex3. It creates a flipping surface and loads a bitmap image into an offscreen surface. It also uses BltFast to copy portions of the offscreen surface to the back buffer to generate an animation.

This program requires 1.2 MB of video RAM.

Building SDK Samples

This sample uses the following keywords:

bltfast; createsurface; createwindowex; ddloadbitmap; ddloadpalette; ddreloadbitmap; ddsetcolorkey; defwindowproc; destroywindow; directdrawcreate; dispatchmessage; doinit; finiobjects; flip; getattachedsurface; getmessage; getstockbrush; getsystemmetrics; gettickcount; initfail; loadcursor; loadicon; messagebox; peekmessage; postmessage; postquitmessage; registerclass; release; restore; restoreall; rgb; setcooperativelevel; setcursor; setdisplaymode; setpalette; showwindow; switch; translatemessage; updateframe; updatewindow; waitmessage; windowproc; winmain

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


DDex5: DirectDraw Back Buffer Palette Sample

Click to open or copy the files for the DDex5 sample.

Click to open or copy the Misc files (required).

This DirectDraw sample adds functionality to DDex4. It uses GetEntries to read a palette, modifies the entries, and then uses SetEntries to update the palette.

This program requires 1.2 MB of video RAM.

Building SDK Samples

This sample uses the following keywords:

bltfast; createsurface; createwindowex; ddloadbitmap; ddloadpalette; ddreloadbitmap; ddsetcolorkey; defwindowproc; destroywindow; directdrawcreate; dispatchmessage; doinit; finiobjects; flip; getattachedsurface; getentries; getmessage; getstockbrush; getsystemmetrics; gettickcount; initfail; loadcursor; loadicon; lock; messagebox; peekmessage; postmessage; postquitmessage; registerclass; release; restore; restoreall; rgb; setcooperativelevel; setcursor; setdisplaymode; setentries; setfocus; setpalette; showwindow; switch; translatemessage; unlock; updateframe; updatewindow; waitmessage; windowproc; winmain

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Diex1: DirectInput Nonexclusive Mouse Input Sample

Click to open or copy the files for the Diex1 sample.

This DirectInput sample demonstrates receiving relative mouse data in nonexclusive mode via a game loop.

Building SDK Samples

This sample uses the following keywords:

acquire; appinit; beginpaint; complain; createdevice; createwindow; defwindowproc; destroywindow; diinit; directinputcreate; dispatchmessage; diterm; endpaint; ex_oneframe; ex_onpaint; ex_syncacquire; ex_wndproc; exttextout; failed; getdevicestate; invalidaterect; loadcursor; loadicon; lstrcmp; lstrcpy; lstrlen; makeintresource; messagebox; peekmessage; postquitmessage; registerclass; release; setcooperativelevel; setdataformat; showwindow; sleep; succeeded; translatemessage; unacquire; waitmessage; winmain; wsprintf


Diex2: DirectInput Exclusive Mouse Input Sample

Click to open or copy the files for the Diex2 sample.

This DirectInput sample demonstrates an application which receives relative mouse data in exclusive mode via a game loop.

Building SDK Samples

This sample uses the following keywords:

acquire; appinit; beginpaint; complain; createdevice; createwindow; defwindowproc; destroywindow; diinit; directinputcreate; dispatchmessage; diterm; endpaint; ex_oneframe; ex_onpaint; ex_syncacquire; ex_wndproc; exttextout; failed; getactivewindow; getdevicestate; invalidaterect; isiconic; iswindow; loadcursor; loadicon; lstrcmp; lstrcpy; lstrlen; makeintresource; messagebox; peekmessage; postmessage; postquitmessage; registerclass; release; setcooperativelevel; setdataformat; showwindow; sleep; succeeded; translatemessage; unacquire; waitmessage; winmain; wsprintf


Diex3: DirectInput Nonexclusive Keyboard Input Sample

Click to open or copy the files for the Diex3 sample.

This DirectInput sample demonstrates an application which receives keyboard data in nonexclusive mode via a game loop.

Building SDK Samples

This sample uses the following keywords:

acquire; appinit; beginpaint; complain; createdevice; createwindow; defwindowproc; destroywindow; diinit; directinputcreate; dispatchmessage; diterm; endpaint; ex_oneframe; ex_onpaint; ex_syncacquire; ex_wndproc; exttextout; failed; getdevicestate; invalidaterect; loadcursor; loadicon; lstrcmp; lstrcpy; lstrlen; makeintresource; messagebox; peekmessage; postquitmessage; registerclass; release; setcooperativelevel; setdataformat; showwindow; sleep; succeeded; translatemessage; unacquire; waitmessage; winmain; wsprintf


Diex4: DirectInput Exclusive Keyboard Input Sample

Click to open or copy the files for the Diex4 sample.

This DirectInput sample demonstrates an application which retrieves buffered keyboard data in exclusive mode via a game loop.

Building SDK Samples

This sample uses the following keywords:

acquire; appinit; beginpaint; complain; createdevice; createwindow; defwindowproc; destroywindow; diinit; directinputcreate; dispatchmessage; diterm; endpaint; ex_oneframe; ex_onpaint; ex_syncacquire; ex_wndproc; exttextout; failed; getdevicedata; invalidaterect; loadcursor; loadicon; lstrcmp; lstrcpy; lstrlen; makeintresource; messagebox; peekmessage; postquitmessage; registerclass; release; setcooperativelevel; setdataformat; setproperty; showwindow; sleep; succeeded; translatemessage; unacquire; waitmessage; winmain; wsprintf


Diff1: DirectInput Force Feedback Sample

Click to open or copy the files for the Diff1 sample.

This sample applies raw forces to a force feedback joystick, illustrating how a simulator-type application can use force feedback to generate forces computed by a physics engine. This application plays a force on the joystick in response to mouse clicks.

The core of the program is the joySetForcesXY function, which accepts two-dimensional force data and sends it to the joystick.

Building SDK Samples

This sample uses the following keywords:

acquire; appinit; beginpaint; complain; createdevice; createeffect; createwindow; defwindowproc; destroywindow; diinit; directinputcreate; dispatchmessage; diterm; ellipse; endpaint; enumdevices; enumffjoystickscallback; ex_coordtoforce; ex_onlbuttondown; ex_onlbuttonup; ex_onmousemove; ex_onpaint; ex_onsize; ex_syncacquire; ex_wndproc; failed; getmessage; getstockbrush; getstockpen; handle_msg; invalidaterect; joysetforcesxy; lineto; loadcursor; loadicon; makeintresource; messagebox; movetoex; muldiv; postquitmessage; queryinterface; registerclass; release; releasecapture; selectbrush; selectpen; setcapture; setcooperativelevel; setdataformat; setparameters; setproperty; showwindow; sqrt; start; translatemessage; unacquire; updatewindow; winmain


Donut: Testing Exclusive and Nonexclusive Interaction

Click to open or copy the files for the Donut sample.

Click to open or copy the Misc files (required).

This program is useful for testing multiple exclusive mode apps interacting with multiple nonexclusive mode apps. The program displays a rotating donut in the upper left corner of the screen. It can be terminated by pressing Esc or F12.

Building SDK Samples

This sample uses the following keywords:

bltfast; createsurface; createwindowex; ddloadbitmap; ddloadpalette; ddreloadbitmap; ddsetcolorkey; defwindowproc; destroywindow; directdrawcreate; dispatchmessage; doinit; finiobjects; getmessage; getstockobject; gettickcount; initfail; loadcursor; loadicon; messagebox; peekmessage; postmessage; postquitmessage; redrawwindow; registerclass; release; restore; restoreall; rgb; setcooperativelevel; setcursor; setdisplaymode; setpalette; showwindow; switch; translatemessage; updateframe; updatewindow; waitmessage; windowproc; winmain

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Donuts: DirectDraw Space Donuts Game Sample

Click to open or copy the files for the Donuts sample.

Click to open or copy the Misc files (required).

This game demonstrates many of the features of DirectDraw. It will take advantage of hardware acceleration if it is supported by the driver.

Roids defaults to 640x480 at 256 colors. You can specify a different resolution and pixel depth on the command line (roids 800x600x16).

This program requires less than 1 MB of video RAM. However, all of its art may not fit in the video RAM on a 1 MB rectangular memory card.

Building SDK Samples

This sample uses the following keywords:

addinputdevice; addobject; apppause; appunpause; beginpaint; blt; bltfast; bltscore; bltsplash; checkforhits; checkmenuitem; checkmenuitems; checkmenuradioitem; checkonemenuitem; cleanupandexit; cleanupinput; createdevice; createsurface; createwindowex; ddcolormatch; ddcopybitmap; ddloadpalette; ddsetcolorkey; defwindowproc; deletefromlist; deleteobject; destroygame; destroysound; destroywindow; directdrawcreate; directinputcreate; directsoundcreate; dispatchmessage; displayframerate; displaylevel; drawdisplaylist; drawmenubar; enablemenuitem; endpaint; enumdevices; erasescreen; flip; flipscreen; fliptogdisurface; get_wm_command_id; getattachedsurface; getdeviceinfo; getdisplaymode; getint; getmenu; getmessage; getmodulehandle; getprofileint; getstockobject; getsubmenu; getsystemmetrics; gettickcount; idirectinputdevice2_poll; idirectinputdevice_acquire; idirectinputdevice_getdevicedata; idirectinputdevice_getdevicestate; idirectinputdevice_release; idirectinputdevice_unacquire; idirectsoundbuffer_play; idirectsoundbuffer_setpan; initapplication; initializegame; initializesound; initinput; initjoystickinput; initkeyboardinput; initlevel; initship; insertmenu; is_num; is_space; isdisplaylistempty; linklastobject; linkobject; loadaccelerators; loadcursor; loadicon; loadimage; localalloc; localfree; mainwndproc; makefontstuff; makeintresource; memset; messagebox; outputdebugstring; peekmessage; pickinputdevice; playpanned; postmessage; postquitmessage; queryinterface; rand; randdouble; randint; reacquireinput; readgameinput; readjoystickinput; readkeyboardinput; redrawwindow; registerclass; release; restore; restoresurfaces; setcooperativelevel; setcursor; setdataformat; setdidwordproperty; setdisplaymode; setpalette; setproperty; setup_game; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; succeeded; switch; timegettime; translateaccelerator; translatemessage; updatedisplaylist; updateframe; updatewindow; waitmessage; winmain; wsprintf

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


DPchat: DirectPlay API Chat Sample

Click to open or copy the files for the DPchat sample.

This is a simple chat program to demonstrate usage of the DirectPlay APIs.

Visual C++ may include older versions of the DirectX header files and libraries. This sample requires DirectX 5. In order to avoid compile errors, make sure the path to the DirectX 5 header files and libraries is listed BEFORE the Visual C++ header files and libraries on the Directories menu, found under Options on the Tools menu.

The Dplaunch or Bellhop sample that is part of the DirectX 5 SDK can be used to exercise the lobby functionality of DPchat.

This sample includes the following files:

File | Description
Dpchat.mak | Visual C++ workspace to compile DPchat.
Lobby.cpp | Sample code for enabling a DirectPlay application to be launched and connected to a session by a lobby.
Dialog.cpp | Sample code for establishing a session connection by asking the user to supply information and make choices.
Dpchat.cpp | The core chat application.
Dpchat.reg | Adds entries to the registry to make DPchat visible to lobby applications.

Building SDK Samples

This sample uses the following keywords:

chatwndproc; closehandle; cocreateinstance; coinitialize; connect; connectusingdialog; connectusinglobby; connectwndproc; couninitialize; createdirectplayinterface; createevent; createplayer; createthread; define_guid; deleteconnectionlist; deletesessioninstancelist; destroydirectplayinterface; destroyplayer; dialogboxparam; directplayenumconnectionscallback; directplaylobbycreate; enabledlgbutton; enablewindow; enddialog; enumconnections; enumsessions; enumsessionscallback; errorbox; exitthread; failed; getchatplayername; getcomputername; getconnection; getconnectionsettings; getdlgitem; getdlgitemtext; getplayername; getsessioninstanceguid; getusername; globalallocptr; globalfreeptr; handleapplicationmessage; handlesystemmessage; hostsession; initializeconnection; isequalguid; joinsession; killtimer; lstrcpy; lstrlen; makeintresource; memcpy; messagebox; newchatstring; open; postmessage; queryinterface; receive; receivemessage; receivethread; release; selectsessioninstance; send; sendchatmessage; senddlgitemmessage; setconnectionsettings; setdlgitemtext; setevent; settimer; setupconnection; shutdownconnection; succeeded; switch; waitformultipleobjects; waitforsingleobject; winmain; wsprintf; zeromemory


DPlaunch: Launching DirectPlay Using IDirectPlayLobby

Click to open or copy the files for the DPlaunch sample.

This sample demonstrates how to launch a DirectPlay application using the IDirectPlayLobby::RunApplication function. You can also use the Bellhop sample lobby client application and the sample lobby server to do this.

Visual C++ may include older versions of the DirectX header files and libraries. This sample requires DirectX 5. In order to avoid compile errors, make sure the path to the DirectX 5 header files and libraries is listed BEFORE the Visual C++ header files and libraries on the Directories menu, found under Options on the Tools menu.

Building SDK Samples

This sample uses the following keywords:

createaddress; createcompoundaddress; define_guid; destroylauncherwindow; dialogboxparam; directplaycreate; directplayenumerate; directplaylobbycreate; enddialog; enumaddress; enumaddresstypes; enumapp; enumlocalapplications; enummodemaddress; enumsp; failed; fillmodemcombobox; getcomboboxguid; getdlgitem; getdlgitemtext; getplayeraddress; globalallocptr; globalfreeptr; initializelauncherwindow; isequalguid; launchdirectplayapplication; launcherwndproc; lstrlen; makeintresource; queryinterface; release; runapplication; senddlgitemmessage; setdlgitemtext; showwindow; switch; updateaddressinfo; winmain; zeromemory


DPslots: DirectPlay Slot Machine Game Sample

Click to open or copy the files for the DPslots sample.

This sample demonstrates how to build a client/server application using DirectPlay.

DPslots is really two applications in one. When you host a session, it acts as a server. The server maintains a simple database of account balances for every user that is allowed to log in. Clients can request their current balance from the server and can request that the server spin the wheels and calculate the amount won or lost.

Visual C++ may include older versions of the DirectX header files and libraries. This sample requires DirectX 5. In order to avoid compile errors, make sure the path to the DirectX 5 header files and libraries is listed BEFORE the Visual C++ header files and libraries on the Directories menu, found under Options on the Tools menu.

Building SDK Samples

This sample uses the following keywords:

_strupr; atoi; bitblt; checkdlgitem; clientapplicationmessage; clientloginwndproc; clientsystemmessage; clientwndproc; closeaccountdb; closehandle; cocreateinstance; coinitialize; connect; connectusingdialog; connectusinglobby; connectwndproc; couninitialize; createcompatibledc; createdirectplayinterface; createevent; createplayer; createthread; define_guid; deleteconnectionlist; deletedc; deleteobject; deletesessioninstancelist; destroydirectplayinterface; destroyplayer; dialogboxparam; directplayenumconnectionscallback; dlgitemischecked; drawwheels; enabledlgbutton; enablewindow; enddialog; enumconnections; enumsessions; enumsessionscallback; errorbox; exitthread; failed; fclose; fgets; fopen; fputs; fseek; getaccountdesc; getamountwonorlost; getclientlogin; getcomputername; getconnection; getconnectionsettings; getdlgitem; getdlgitemtext; getplayeraccount; getplayername; getrecord; getsecureaccountdesc; getserverconfig; getsessiondesc; getsessioninstanceguid; gettickcount; getunsecureaccountdesc; getusername; getwindowdc; getwindowrect; globalallocptr; globalfreeptr; handleapplicationmessage; handlebalancerequest; handlespinrequest; handlesystemmessage; hostsession; initializeclientloginwindow; initializeconnection; initializeserverconfigwindow; isequalguid; joinsession; killtimer; loadbitmap; logrequest; lstrcpy; lstrlen; makeintresource; memcpy; messagebox; offsetrect; openaccountdb; paintbitmap; playsound; postmessage; putrecord; queryaccount; queryinterface; rand; receive; receivemessage; receivethread; rectheight; rectwidth; release; rewind; saveclientlogin; saveserverconfig; secureopen; selectobject; selectsessioninstance; send; sendbalancerequest; senddlgitemmessage; sendflags; sendspinrequest; serverapplicationmessage; serverconfigwndproc; serversystemmessage; serverwndproc; sessionflags; setconnectionsettings; setdlgitemtext; setevent; setrect; settimer; setupconnection; shutdownconnection; spinwheels; sprintf; srand; startspinning; strcpy; stretchblt; strncmp; strtok; succeeded; switch; updateaccount; waitformultipleobjects; waitforsingleobject; winmain; wsprintf; zeromemory


DSshow: DirectSound Mixing Test

Click to open or copy the files for the DSshow sample.

The DSshow application uses the DirectSound APIs and pops up some controls that the user can play with at run time to change the sound frequency, panning, volume, etc. It also has a few other built-in functions.

This application allows the user to play with most of the controls exposed by DirectSoundBuffers, including the mixing of multiple sounds, and changing frequency, pan, and volume of those sounds.

The control bar for each opened WAV file shows the file name, whether the buffer is mixed in software (SW) or hardware (HW), and whether the buffer is playing or stopped. DSshow puts buffers in hardware whenever possible. DSshow also displays the current play and write cursors. There are sliders to control the buffer's frequency, pan, and volume settings. There is a Play/Stop button, a Close button, and a checkbox for Looping.

The DSshow title bar tells you information about the hardware mixing capabilities of your sound card. It displays the number of free hardware mixing channels and hardware memory, if you have an ISA card, which is most common. If both of those numbers are 0, your card does not have hardware mixing.

The Options menu enables you to set the format of the primary buffer. This lists the formats supported by the primary buffer, and let you choose one. Enumerate Drivers, on the Options menu, shows you what objects DirectSoundEnumerate will list for you, and allows you to select an object.

Caution DSshow uses static buffers for its sounds and is therefore designed for short sounds only. If you try to open a file that is very large, you will run out of system memory.

Building SDK Samples

This sample uses the following keywords:

_assert; _based; _segname; acmmetrics; addtolist; appdestroy; appinit; assert; assertfail; assertmessage; batchopenfiles; changeoutputfreq; changeoutputpan; changeoutputvol; charlower; checkmenuitem; classinit; cocreateinstance; coinitialize; combobox_addstring; combobox_findstring; combobox_getcount; combobox_getcursel; combobox_getitemdata; combobox_setcursel; combobox_setitemdata; copymemory; couninitialize; createcontrol; createsoundbuffer; createwindow; dbgenable; dbggetlevel; dbginitialize; dbgsetlevel; defwindowproc; destroywindow; dialogbox; dialogboxparam; directsoundenumerate; dispatchmessage; dlgchecklatency; dlghelpabout; dlgoutputbuffertype; dodsoundenumerate; dpf; dpi; dprintf; dsenumdlgproc; dsenumproc; enddialog; fgettoken; fileopencustomtemplatedlgproc; fmatchtoken; formattoindex; freealllist; getdc; getdlgitem; getformat; getmediastartpath; getmenu; getmessage; getnextcontrolcoords; getnumcontrols; getopenfilename; getprofileint; getstatus; gettextextentpoint32; getwindowsdirectory; globalalloc; globalallocptr; globalfree; globalfreeptr; idirectsound_createsoundbuffer; idirectsound_getcaps; idirectsound_initialize; idirectsound_release; idirectsound_setcooperativelevel; idirectsoundbuffer_getcaps; idirectsoundbuffer_getcurrentposition; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; indextoformat; initcommoncontrols; isvalidwave; killtimer; loadcursor; loadicon; localalloc; localfree; lock; lstrcat; lstrcmp; lstrcpy; lstrlen; makeintresource; makelong; makewparam; memcpy; memset; messagebox; mmioadvance; mmioascend; mmioclose; mmiocreatechunk; mmiodescend; mmiofourcc; mmiogetinfo; mmioopen; mmioread; mmioseek; mmiosetinfo; mmiowrite; newdirectsoundbuffer; openfiledialog; outputdebugstr; parsecommandline; pd_fileopen; play; postmessage; postquitmessage; regclosekey; registerclass; regopenkeyex; regqueryvalueex; release; releasedc; releasedirectsoundbuffer; removefromlist; riffcopychunk; senddlgitemmessage; sendmessage; setalltext; setcurrentposition; setformat; setfrequency; setpan; settimer; setvolume; setwindowtext; showwindow; sprintf; startdsound; stop; stopalldsounds; stopdsound; strcpy; succeeded; switch; text; translatemessage; uimainwindowcmdhandler; uimainwindowhsbhandler; uimainwindowtimerhandler; uimainwindowvsbhandler; unlock; unregisterclass; updatelrvolume; updatemainstatus; updatestatus; warning; waveclosereadfile; waveclosewritefile; wavecopyuselesschunks; wavecreatefile; waveloadfile; waveopenfile; wavereadfile; wavesavefile; wavestartdataread; wavestartdatawrite; wavewritefile; winmain; wndproc; writeprofilestring; wsprintf; zeromemory


DSstream: DirectSound WAV Streaming Test

Click to open or copy the files for the DSstream sample.

This sample is a DirectSound streaming test. It illustrates streaming data from a disk WAVE file to a DirectSound secondary buffer for playback.

This sample illustrates how to play a long sound using a streaming DirectSoundBuffer. Because of this design, it may not work correctly when using very short sounds, such as 1 or 2 seconds long. Those files are more appropriate for static buffers; see DirectSound Mixing Test (DSshow) for examples of how to code such buffers.

There are buttons to play and stop the WAV file, and a check box to indicate whether the file should be looped or not. Regardless of the check box setting, the DirectSoundBuffer will be played with looping since a streaming buffer is being used.

There are sliders to control the sound's frequency, pan, and volume settings. In addition, there is a slider indicating the progress through the sound data.

On the Options menu, you can toggle Enumerate Drivers, to show what objects DirectSoundEnumerate will list for you.

Building SDK Samples

This sample uses the following keywords:

_assert; _based; _segname; assert; assertfail; assertmessage; buildtitlebartext; button_getcheck; button_setcheck; checkmenuitem; closehandle; combobox_addstring; combobox_findstring; combobox_getcount; combobox_getcursel; combobox_getitemdata; combobox_setcursel; combobox_setitemdata; commdlgextendederror; createchildren; createevent; createsoundbuffer; createthread; createwindow; dbgenable; dbggetlevel; dbginitialize; dbgsetlevel; dbgvprintf; debugbreak; defwindowproc; destroywindow; dialogbox; dialogboxparam; directsoundcreate; directsoundenumerate; dispatchmessage; dlg_about; dodsoundenumerate; dpf; dpi; dprintf; drawmenubar; dsenumdlgproc; dsenumproc; enablemenuitem; enablewindow; enddialog; errormessagebox; fatalappexit; filldatabuffer; fillmemory; getactivewindow; getclientrect; getcurrentposition; getdc; getdlgitem; getmediastartpath; getmenu; getmessage; getopenfilename; getprofileint; getprofileinta; getsystemmenu; getsystemmetrics; gettextextentpoint32; getwindowsdirectory; globalalloc; globalallocptr; globalfree; globalfreeptr; handlecommdlgerror; handlefreqscroll; handlenotifications; handlepanscroll; handlevolscroll; idirectsoundnotify_queryinterface; initapp; initcommoncontrols; initinstance; listbox_addstring; loadcursor; loadfromcommandline; loadicon; loadstring; localalloc; localfree; lock; lstrcat; lstrcata; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lstrlena; mainwindowproc; makeintresource; makelong; makelparam; makewparam; memcpy; memset; messagebox; messageboxa; mmioadvance; mmioascend; mmioclose; mmiocreatechunk; mmiodescend; mmiofourcc; mmiogetinfo; mmioopen; mmioread; mmioseek; mmiosetinfo; mmiowrite; outputdebugstr; outputdebugstringa; play; postmessage; postquitmessage; regclosekey; registerclass; regopenkeyex; regqueryvalueex; release; releasedc; resetwaveplayer; riffcopychunk; sendmessage; setcooperativelevel; setcurrentposition; setfrequency; setnotificationpositions; setpan; setupnotifications; setvolume; setwindowtext; showwindow; static_settext; stop; streambuffersetup; switch; text; timefunc; translatemessage; unlock; unregisterclass; updatefromcontrols; updateprogressbar; updatewindow; va_end; va_start; waitformultipleobjects; warning; waveclosereadfile; waveclosewritefile; wavecopyuselesschunks; wavecreatefile; waveloadfile; waveopenfile; wavereadfile; wavesavefile; wavestartdataread; wavestartdatawrite; wavewritefile; winmain; writeprofilestring; wsprintf; wsprintfa; wvsprintf; wvsprintfa


Duel: DirectX Duel Sample Game

Click to open or copy the files for the Duel sample.

Click to open or copy the Misc files (required).

This program requires less than 1 MB of video RAM.

The commands which this game recognizes are listed on the opening screen. These commands include the following:

Key | Action
ESC, F12 | Quit
NUMPAD 4 | Turn left
NUMPAD 6 | Turn right
NUMPAD 5 | Stop moving
NUMPAD 8 | Accelerate forward
NUMPAD 2 | Accelerate backward
SPACEBAR | Fire
ENTER | Start game
F5 | Toggle frame rate display

Also see the Dplaunch example.

To play multiplayer, one machine hosts a game, then others join.

To play using TCP/IP over the Internet, the people who are joining the game must enter the IP address of the machine that hosted the game. You can find out the IP address of your machine by running "winipcfg". If you have a net card and a modem installed, you will need to make sure you read the IP address of the modem connection to the Internet. The modem will show up as a "PPP Adapter". DirectPlay will not work through proxies or firewalls.

Building SDK Samples

This sample uses the following keywords:

_t; _tcscpy; acquire; addblock; addfrag; additemtotree; adjustwindowrectex; ansitowide; beginpaint; blt; bltfast; bltobject; bltscore; bltsplash; cleanupapplication; cleanupcomm; cleanupfonts; cleanupgraphics; cleanupinput; cleanupsfx; clienttoscreen; closehandle; cocreateinstance; coinitialize; convertfield; copymemory; couninitialize; createclipper; createcompatibledc; createdevice; createdialog; createfile; createfontindirect; createpalette; createsurface; createthread; createwindowex; d3dval; ddcolormatch; ddcopybitmap; ddloadbitmap; ddloadpalette; ddreloadbitmap; ddsetcolorkey; debug_out; define_guid; defwindowproc; deletedc; deleteobject; destroygame; destroyship; destroywindow; di_readkeys; directdrawcreate; directinputcreate; directplaylobbycreate; directsoundcreate; dispatchmessage; displayframerate; dlgprocchooseprovider; dlgprochostsession; doapplicationmessage; dosystemmessage; dowizard; dpenumconnectionscallback; dplayclose; dplaycreate; dplaycreateplayer; dplaycreatesession; dplaydestroyplayer; dplayenumplayers; dplayenumsessions; dplaygetplayerdata; dplaygetsessiondesc; dplayopensession; dplayreceive; dplayrelease; dplaysend; dplaysetplayerdata; dplobbyconnect; dplobbycreate; dplobbygetconnectionsettings; dplobbyrelease; dplobbysetconnectionsettings; drawblock; drawbullet; drawfragments; drawscore; drawscreen; drawship; dsfillsoundbuffer; dsgetwaveresource; dsparsewaveresource; dsreloadsoundbuffer; endpaint; enumplayer; enumsession; erasescreen; exitgame; failed; finditemintree; findresource; flip; flipscreen; fliptogdi; fliptogdisurface; free; free_globals; free_sounds; getattachedsurface; getclientrect; getconnection; getdc; getdevicecaps; getdevicestate; getdigit; getdlgitem; getdlgitemtext; getexitcodethread; getmenu; getmessage; getmodulehandle; getobject; getparent; getpixel; getstockobject; getsurfacedesc; getsystemmetrics; gettickcount; getwindowexstyle; getwindowrect; getwindowstyle; globalallocptr; globalfreeptr; globalreallocptr; guidfromstring; idirectdrawsurface_blt; idirectplay2_close; idirectplay2_createplayer; idirectplay2_destroyplayer; idirectplay2_enumplayers; idirectplay2_enumsessions; idirectplay2_getplayerdata; idirectplay2_getsessiondesc; idirectplay2_open; idirectplay2_receive; idirectplay2_release; idirectplay2_send; idirectplay2_setplayerdata; idirectplay3_enumconnections; idirectplay3_initializeconnection; idirectplay3_release; idirectplay_queryinterface; idirectplaylobby_connect; idirectplaylobby_getconnectionsettings; idirectplaylobby_release; idirectplaylobby_setconnectionsettings; idirectsound3dbuffer_release; idirectsound3dbuffer_setposition; idirectsound3dbuffer_setvelocity; idirectsound3dlistener_commitdeferredsettings; idirectsound3dlistener_release; idirectsound3dlistener_setdopplerfactor; idirectsound3dlistener_setposition; idirectsound3dlistener_setrollofffactor; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsound_release; idirectsound_setcooperativelevel; idirectsoundbuffer_getcaps; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_queryinterface; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; imagelist_add; imagelist_create; imagelist_getimagecount; init_globals; init_sounds; initapplication; initfield; initgraphics; initinput; initlocalsounddata; initmessagebuffers; initourship; initplayerlocalsounddata; initsfx; inittreeviewimagelists; isdplay; isequalguid; ishit; isspace; killtimer; launchedbylobby; launchgame; loadbitmap; loadcursor; loadicon; loadimage; loadresource; loadstring; lock; lockresource; m2p; mainwndproc; makeintresource; makelparam; malloc; memcpy; memset; messagebox; mmiofourcc; multibytetowidechar; outputdebugstring; p2m; pack; peekmessage; postmessage; postquitmessage; processsoundflags; processuserinput; propertysheet; propsheet_setwizbuttons; queryinterface; rand; randdouble; randint; reacquireinputdevices; readfile; receivemessages; regcreatekeyex; regget; registerclass; regqueryvalueex; regset; regseta; regsetvalueex; release; releasedc; releaselocaldata; releaseplayerlocaldatacb; releaseplayerlocalsounddata; releasesessiondata; releasespdata; removestalesessions; renderplayercb; resettreerefresh; restore; restoresurfaces; selectobject; senddlgitemmessage; sendgamemessage; sendmessage; sendsync; setblock; setclipper; setcolorkey; setcooperativelevel; setdataformat; setdisplaymode; setdlgitemtext; setfocus; setgamepalette; sethwnd; setpalette; setpixel; setplayerlocalsounddatacb; setrect; settimer; setupfonts; setwindowlong; setwindowpos; setwindowtext; showconnectstatus; showerror; showwindow; srand; stretchblt; stringfromguid; succeeded; switch; systemparametersinfo; text; timegettime; translatemessage; treeview_deleteallitems; treeview_deleteitem; treeview_getchild; treeview_getfirstvisible; treeview_getitem; treeview_getnextitem; treeview_getnextsibling; treeview_getparent; treeview_getroot; treeview_getselection; treeview_selectitem; treeview_setimagelist; unacquire; unlock; updatedisplaystatus; updatefragment; updateframe; updateposition; updatestate; updatetitle; updatewindow; wavefree; wavegetbuffers; waveinit; wavereload; wcslen; widechartomultibyte; widetoansi; winmain; wsprintf; zeromemory

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


DXbug: DirectX Bug Reporting Tool

Click to open or copy the files for the DXbug sample.

This tool is not a sample. It is for reporting DirectX bugs to Microsoft.

DXbug helps you file bug reports. It automatically picks up various useful system information, such as the operating system version, DirectX version, display, sound, and joystick driver information. Then it allows you to enter your name and the bug description and save the bug report as a text file that you can then paste into the mail that you send to Microsoft. DXbug will remember static information such as your name so you don't have to rekey it for subsequent bugs that you file.


DXview: DirectX Capability Viewer

Click to open or copy the files for the DXview sample.

This sample displays the machine's capabilities for DirectDraw, Direct3D, DirectSound, DirectPlay, and DirectInput.

Building SDK Samples

This sample uses the following keywords:

addcapstolv; addcapstotv; addcolstolv; addmorecapstolv; begindeferwindowpos; bitcount; callback; checkmenuitem; closehandle; coinitialize; comment; couninitialize; createfile; createwindowex; d3addcaps; d3addlinecaps; d3addtexf; d3capdef; d3enumcallback; d3hexdef; d3printcaps; d3valdef; ddaddcaps; ddaddvideomodes; ddcapdef; ddcreate; ddenumcallback; ddenumcallback3d; ddfourccformat; ddhexdef; ddprintcaps; ddprintfourccformat; ddprintvideomodes; ddvaldef; deferwindowpos; defwindowproc; destroyicon; destroywindow; di_createdevice; di_createdi; di_filltree; diaddcaps; diaddcapstotarget; diaddeffects; diaddrow; diaddtypes; dialogbox; dicapdef; dienumdevcallback; dienumeffcallback; diprintcaps; diprinteffects; directdrawcreate; directdrawenumerate; directinputcreate; directplaycreate; directplayenumerate; directplaylobbycreatea; directsoundcapturecreate; directsoundcaptureenumerate; directsoundcreate; directsoundenumerate; dispatchmessage; divaldef; dpaddcaps; dpaddlocalapps; dpaddsessions; dpcapdef; dpcreate; dpenumcallback; dpenumlocalappscallback; dpenumlocalappsprintcallback; dphexdef; dpprintcaps; dpprintlocalapps; dpprintsessions; dpvaldef; dsaddcaps; dscaddcaps; dscapdef; dsccapdef; dsccreate; dscenumcallback; dscprintcaps; dscreate; dscvaldef; dsenumcallback; dsprintcaps; dsvaldef; dxview_cleanup; dxview_filltree; dxview_initimagelist; dxview_oncommand; dxview_oncreate; dxview_onlistviewdblclick; dxview_onsize; dxview_ontreeselect; enddeferwindowpos; enddialog; enumdisplaymodescallback; enumdisplaymodescallbackprint; enumlocalapplications; enumsessions; enumtexturecallback; failed; field_offset; freelibrary; freelocalapplist; gen_bltcaps; gen_bltcaps2; gen_caps; gen_caps2; gen_ckcaps; gen_fxcaps; gen_rops; get_didevice_subtype; get_didevice_type; getappname; getcaps; getclientrect; getcres; getdc; getdevicecaps; geteffectiveclientrect; getmenu; getmessage; getprocaddress; getstockobject; getsystemmetrics; getsystempaletteentries; gettextmetrics; getxres; getyres; globalalloc; globalfree; idirect3d2_createdevice; idirect3d2_enumdevices; idirect3d2_release; idirect3ddevice2_enumtextureformats; idirect3ddevice2_release; idirectdraw2_getavailablevidmem; idirectdraw_createpalette; idirectdraw_createsurface; idirectdraw_enumdisplaymodes; idirectdraw_getcaps; idirectdraw_getdisplaymode; idirectdraw_getfourcccodes; idirectdraw_queryinterface; idirectdraw_release; idirectdraw_setcooperativelevel; idirectdrawpalette_release; idirectdrawsurface_getsurfacedesc; idirectdrawsurface_release; idirectdrawsurface_setpalette; idirectinput_createdevice; idirectinput_enumdevices; idirectinput_release; idirectinputdevice2_enumeffects; idirectinputdevice2_release; idirectinputdevice_getcapabilities; idirectinputdevice_queryinterface; idirectinputdevice_release; idirectsound_getcaps; idirectsound_release; idirectsoundcapture_getcaps; idirectsoundcapture_release; imagelist_addicon; imagelist_create; imagelist_destroy; initcommoncontrols; initinstance; invalidaterect; isequalguid; isiconic; killtimer; listview_deleteallitems; listview_deletecolumn; listview_deleteitem; listview_getitem; listview_getitemcount; listview_insertcolumn; listview_insertitem; listview_setitem; loadcursor; loadicon; loadimage; loadlibrary; localalloc; localfree; lstrcat; lstrcpy; lstrlen; lvaddcolumn; lvaddtext; lvdeleteallitems; makeintresource; makemode; makeword; memcpy; memset; messagebox; optimize; postmessage; postquitmessage; printcallback; printcapstodc; printline; printnextline; printtreestats; printvalueline; queryinterface; registerclass; release; releasecapture; releasedc; removestalesessions; resetlistviewrefresh; ropdef; selectobject; sendmessage; setcapture; setcursor; settimer; strcpy; stringfromguid2; strncpy; subtype; succeeded; surfcapdef; surfvaldef; switch; text; translatemessage; treeview_expand; treeview_getitem; treeview_getselection; treeview_insertitem; treeview_selectitem; treeview_setimagelist; tvaddnode; va_end; va_start; vidmem; vidmemprint; wcslen; wcstombs; winmain; wndproc; writefile; wsprintf; wvsprintf; zeromemory


Egg: Create an EGG Frame

Click to open or copy the files for the Egg sample.

Click to open or copy the Misc files (required).

This sample demonstrates loading a simple XOF of a single mesh object.

Building SDK Samples

This sample uses the following keywords:

addlight; addvisual; buildscene; createframe; createlightrgb; createmeshbuilder; d3drmerrortostring; d3dval; failed; load; lstrcpy; msg; overridedefaults; release; setorientation; setposition; setrotation

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Faces: MeshAddFaces

Click to open or copy the files for the Faces sample.

Click to open or copy the Misc files (required).

This sample demonstrates MeshAddFaces; creating mesh objects one face at a time.

Building SDK Samples

This sample uses the following keywords:

addfaces; addlight; addvisual; build_cube1; build_cube2; build_face1; build_face2; buildscene; createframe; createlightrgb; createmesh; createmeshbuilder; d3dval; failed; load; lstrcpy; msg; overridedefaults; release; scale; setcolorrgb; setorientation; setposition; setquality; setrotation

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


FastFile: Access Large Numbers of Files

Click to open or copy the files for the FastFile sample.

This sample provides the ability to create a very fast way to access large numbers of files.

Use Ffcreate.exe to create a single flat file. Just run Ffcreate in the directory that contains all of the files you wish to access. A file will be created at the root (Result.ff) that is the FastFile. (You can specify a filename on the command line to override the default of Result.ff. If you do so, make sure that the result file is NOT generated in the current directory).

Building SDK Samples

This sample uses the following keywords:

_close; _lseek; _open; _read; _stricmp; _write; bsearch; closehandle; compare; createfile; createfilemapping; exit; fastfileclose; fastfilefini; fastfileinit; fastfilelock; fastfileopen; fastfileread; fastfileseek; fastfiletell; fastfileunlock; findclose; findfirstfile; findnextfile; findresource; loadresource; localalloc; localfree; lockresource; malloc; mapviewoffile; memcpy; memset; ods; outputdebugstring; pack; printf; qsort; realloc; strcpy; unmapviewoffile


FDfilter: Full-Duplex Audio Filter Sample

Click to open or copy the files for the FDfilter sample.

Click to open or copy the Misc files (required).

This sample contains audio related routines for full-duplex device usage. This sample enumerates devices and formats, initializes devices and buffers, and uses CALLBACK procedures for dealing with full-duplex filtering.

Building SDK Samples

This sample uses the following keywords:

_assert; _based; _segname; aboutdlgproc; assert; assert_hwnd; beginpaint; button_enable; button_getcheck; button_setcheck; cancelwarningdlgproc; cgargle; cleardsdevicelist; closedscdevice; closedsdevice; closehandle; combobox_addstring; combobox_getcursel; combobox_getitemdata; combobox_insertstring; combobox_setcursel; combobox_setitemdata; copymemory; createcapturebuffer; createdialog; createevent; createsoundbuffer; createthread; dbgdumpwfx; dbgenable; dbggetlevel; dbginitialize; dbgsetlevel; dbgvprintf; debugbreak; defined; deletecriticalsection; destroybuffers; destroyinstance; destroywindow; dialogbox; dialogboxparam; directsoundcapturecreate; directsoundcaptureenumerate; directsoundcreate; directsoundenumerate; disableformatcode; dispatchmessage; dpf; dpi; dprintf; dpwfx; dsenumproc; enablemenuitem; enddialog; endpaint; entercriticalsection; enumdscdevices; enumdsdevices; failed; fatalappexit; fc_getbits; fc_getchannels; fc_getfreqcode; filldevicecombo; fillformatlistbox; fillmemory; formatcodetotext; formatcodetowfx; freelibrary; getcurrentposition; getcursor; getdlgitem; getmessage; getprocaddress; getprofileinta; getstatus; getsystemmenu; initbuffers; initcommoncontrols; initializecriticalsection; initinputdevice; initinstance; initprimarysoundbuffer; initsounddata; initsounddevices; interlockedexchange; invalidaterect; isdialogmessage; isdsdeviceinlist; iswindow; leavecriticalsection; listbox_addstring; listbox_finditemdata; listbox_getcount; listbox_getcursel; listbox_getitemdata; listbox_resetcontent; listbox_setcursel; listbox_setitemdata; loadcursor; loadlibrary; lock; lstrcata; lstrcpy; lstrlen; lstrlena; maindlgproc; makeintresource; max; messagebox; messageboxa; messitabout; outputdebugstr; outputdebugstringa; play; postmessage; postquitmessage; processinput; queryinterface; release; reopensounddevices; restore; resultfromscode; scanavailabledscformats; scanavailabledsformats; selectdevicesdlgproc; selectformatsdlgproc; setcooperativelevel; setcurrentposition; setcursor; setevent; setformat; setnotificationpositions; showwindow; start; startbuffers; static_settext; stop; stopbuffers; succeeded; switch; text; threadprocessinput; transform; translatedserror; translatemessage; unlock; updatewindow; va_end; va_start; waitformultipleobjects; waitforsingleobject; warning; winmain; writesilencetooutput; wsprintf; wsprintfa; wvsprintf; wvsprintfa; zeromemory

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


FFdonuts: DirectInput Force Feedback Sample

Click to open or copy the files for the FFdonuts sample.

Click to open or copy the Misc files (required).

This sample demonstrates DirectInput Force Feedback.

Building SDK Samples

This sample uses the following keywords:

acquire; addobject; beginpaint; blt; bltfast; bltscore; bltsplash; checkforhits; checkradiobutton; cleanupandexit; createdevice; createeffect; createsurface; createwindowex; ddcolormatch; ddcopybitmap; ddloadpalette; ddsetcolorkey; defwindowproc; deletefromlist; deleteobject; destroygame; destroysound; destroywindow; dialogbox; directdrawcreate; directinputcreate; directsoundcreate; dispatchmessage; displayframerate; displaylevel; drawdisplaylist; enddialog; endpaint; enumdevices; enumeffects; erasescreen; failed; flip; flipscreen; getattachedsurface; getcapabilities; getdevicestate; getdisplaymode; getint; getmessage; getmodulehandle; getprofileint; getstockobject; getsystemmetrics; gettickcount; idirectsoundbuffer_play; idirectsoundbuffer_setpan; initapplication; initializegame; initializesound; initlevel; initship; inputacquiredevices; inputcleanupdirectinput; inputcreateeffect; inputcreateeffects; inputenumdeviceproc; inputenumeffecttypeproc; inputforceleveldlgproc; inputinitdirectinput; inputplayeffect; inputpreparedevice; inputprocessdeviceinput; is_num; is_space; isdisplaylistempty; isdlgbuttonchecked; linklastobject; linkobject; loadcursor; loadicon; loadimage; localalloc; localfree; mainwndproc; makefontstuff; makeintresource; memset; messagebox; outputdebugstring; peekmessage; playpanned; poll; postmessage; postquitmessage; queryinterface; rand; randdouble; randint; registerclass; release; restore; restoresurfaces; setcooperativelevel; setcursor; setdataformat; setdisplaymode; setpalette; setparameters; setproperty; setup_game; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; start; succeeded; switch; text; timegettime; translatemessage; unacquire; updatedisplaylist; updateframe; updatewindow; waitmessage; winmain; wsprintf; zeromemory

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Flip2d: Spinning Cube for DirectDraw

Click to open or copy the files for the Flip2d sample.

This sample is a basic page flipping application. The cube renders to the back buffer and flips.

Building SDK Samples

This sample uses the following keywords:

acquire; adjustwindowrectex; appabout; appendmenu; appidle; appinit; appinitmenupopup; apppause; appwndproc; blt; checkmenuitem; concatenatexrotation; concatenatextranslation; concatenateyrotation; concatenateytranslation; concatenatezrotation; concatenateztranslation; cos; createdevice; createfont; createmouse; createpalette; createpopupmenu; createsolidbrush; createsurface; createwindowex; crossproduct; ddinit; ddsetmode; ddterm; defined; defwindowproc; deleteobject; dialogbox; directdrawcreate; directinputcreate; dispatchmessage; dotproduct; double; drawmenubar; enddialog; enumdisplaymodes; fillscan8; fixed; fixed_div; fixed_mul; flip; fliptogdisurface; frac; getattachedsurface; getcaps; getclientrect; getdc; getdevicecaps; getdevicestate; getelement; getmenu; getmenuitemcount; getmenuiteminfo; getmenuitemrect; getstockobject; getstockpen; getsystemmetrics; getsystempaletteentries; getw; getx; gety; getz; homogenize; initdinput; isiconic; islost; loadaccelerators; loadcursor; loadicon; lock; magnifycube; makemenuitemdata; matrix_4x4; memcpy; messagebox; modecallback; muldiv; normalize; peekmessage; point_4; polygon; postmessage; postquitmessage; pow; projectanddrawcube; quadruple; redrawwindow; registerclass; release; releasedc; renderframe; restore; rgb; selectbrush; selectobject; selectpen; setbkmode; setcooperativelevel; setcursor; setdataformat; setdisplaymode; setelement; setmenuiteminfo; setpalette; setrect; settextcolor; setw; setwindowpos; setx; sety; setz; showwindow; sin; sprintf; sqrt; swap; swappt; switch; textout; timegettime; transformcube; translateaccelerator; translatemessage; triangle8; unacquire; unlock; up; updatewindow; vector_4; view; view_transform; viewpoint; waitmessage; winmain; wsprintf; zeromemory


Flip3d: Direct3D Immediate Mode (DrawPrimitive) Sample

Click to open or copy the files for the Flip3d sample.

Click to open or copy the Misc files (required).

This is a small, self-contained DrawPrimitive sample with the following features.

  • It does its own transform and lighting, so uses D3DTLVERTEX data only in its DrawPrimitive calls.

  • It is full-screen only, which simplifies the code.

  • It illustrates how to use GDI to do color conversion into texture surfaces. See the D3DTexture class in texture.h and texture.cpp.

Building SDK Samples

This sample uses the following keywords:

addref; addviewport; adjustwindowrectex; appabout; appendmenu; appidle; appinit; appinitmenupopup; apppause; appwndproc; beginscene; bitblt; blt; builddevicemenu; builddevicemenucallback; buildmodemenu; buildmodemenucallback; checkmenuitem; choosetextureformat; clearframe; concatenatexrotation; concatenatextranslation; concatenateyrotation; concatenateytranslation; concatenatezrotation; concatenateztranslation; copy; cos; createcompatibledc; createdevice; createfont; creatematerial; createpalette; createpopupmenu; createsurface; createviewport; createwindowex; crossproduct; d3dtexture; ddinit; ddsetmode; ddterm; defined; defwindowproc; deletedc; deletemenu; deleteobject; dialogbox; directdrawcreate; directdrawenumerate; dispatchmessage; dotproduct; dpf; drawmenubar; drawprimitive; enddialog; endscene; enumdisplaymodes; enumtextureformats; finddevicecallback; findtexturecallback; flip; fliptogdisurface; getasynckeystate; getattachedsurface; getbvalue; getcaps; getclientrect; getdc; getdd; getddinterface; getdibcolortable; getelement; getgvalue; gethandle; getkeystate; getmenu; getmenuitemcount; getmenuiteminfo; getmenuitemrect; getmenustring; getmodulehandle; getobject; getpalette; getpaletteentries; getprofilestring; getrendertarget; getrvalue; getstockobject; getsurface; getsurfacedesc; getsystemmetrics; getw; getx; gety; getz; homogenize; init3d; init3dstate; isiconic; islost; load; loadaccelerators; loadcursor; loadicon; loadimage; lstrcmpi; magnifycube; makemenuitemdata; matrix_4x4; memcpy; memset; messagebox; normalize; outputdebugstring; palettefrombitmap; peekmessage; point_4; postmessage; postquitmessage; pow; projectanddrawcube; quadruple; queryinterface; redrawwindow; registerclass; release; releasedc; renderframe; restore; rgb; rgb_make; selectobject; setbkmode; setcooperativelevel; setcurrentviewport; setcursor; setdisplaymode; setelement; setlightstate; setmaterial; setmenuiteminfo; setpalette; setrect; setrenderstate; settextcolor; setviewport2; setw; setwindowpos; setwindowtext; setx; sety; setz; showwindow; sin; sprintf; sqrt; switch; textout; timegettime; transformcube; translateaccelerator; translatemessage; up; updatewindow; va_end; va_start; vector_4; view; view_transform; viewpoint; waitmessage; winmain; writeprofilestring; wsprintf; wvsprintf; zeromemory

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Fly: Landscape Fly-by

Click to open or copy the files for the Fly sample.

Click to open or copy the Misc files (required).

This sample flies a plane through a small landscape, followed by a camera. This sample uses animations to set the position of a spaceship along a curved path; the paths are spline curves.

Building SDK Samples

This sample uses the following keywords:

adddestroycallback; addlight; addmovecallback; addpositionkey; addvisual; buildscene; cleanupobjects; createanimation; createframe; createlightrgb; createmesh; createmeshbuilder; d3ddivide; d3drmcreatecolorrgba; d3drmerrortostring; d3dval; failed; free; getbox; getelement; getfaces; getorientation; getscene; getsize; getvertexcount; getvertices; load; lookat; lstrcpy; malloc; movecamera; msg; overridedefaults; release; scale; setcolor; setcolorrgb; setdither; setfield; setfogenable; setfogparams; setframe; setmaterialmode; setoptions; setorientation; setposition; setquality; settime

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


FoxBear: Fox and Bear Game Sample

Click to open or copy the files for the FoxBear sample.

Click to open or copy the Misc files (required).

Click to open or copy the Fastfile directory (required).

This simple game demonstrates many basics.

Commands for using FoxBear are as follows:

Key | Action
NUMPAD 2 | Crouch
NUMPAD 3 | Throw an apple
NUMPAD 4 | Move right (hold down to run faster)
NUMPAD 5 | Stop
NUMPAD 6 | Move left (hold down to run faster)
NUMPAD 7 | Jump
F12 | Quit

Run FoxBear from the FoxBear directory for it to find all of its files.

Building SDK Samples

This sample uses the following keywords:

_lclose; _lopen; _lread; abs; adjustwindowrectex; advancespritebitmap; beginpaint; bitbltsprite; changespritedirection; clienttoscreen; cmemalloc; createfont; createplane; createposlist; createsprite; createsurfacelist; createtiles; createwindowex; ddclear; ddcolormatch; ddcreateflippingsurface; ddcreatesurface; dddisable; ddenable; ddenumcallback; ddinit; defwindowproc; deleteobject; destroybuffer; destroygame; destroyplane; destroyposlist; destroysound; destroysprite; destroytiles; directdrawcreate; directdrawenumerate; directsoundcreate; dispatchmessage; displayframerate; displayplane; displaysprite; dsdisable; dsenable; dsloadsoundbuffer; dsreloadsoundbuffer; endpaint; enumdisplaymodescallback; errormessage; exit; exitgame; exttextout; fastfileclose; fastfilefini; fastfileinit; fastfilelock; fastfileopen; findresource; getclientrect; getdata; getdc; getdevicecaps; getforegroundwindow; getinput; getint; getlasterror; getmenu; getmessage; getpixel; getplanex; getplaney; getprofileint; getspriteaccx; getspriteaccy; getspriteaction; getspriteactive; getspritebitmap; getspritedirection; getspriteswitchdone; getspriteswitchforward; getspriteswitchtype; getspritevelx; getspritevely; getspritex; getspritey; getstockobject; getsurface; getsystemmetrics; gettextextentpoint; getversionex; getwindowexstyle; getwindowrect; getwindowstyle; gfxbegin; gfxblt; gfxcreatesolidcolorbitmap; gfxcreatevrambitmap; gfxdestroybitmap; gfxend; gfxfillback; gfxflip; gfxloadbitmap; gfxrestore; gfxrestoreall; gfxstretchbackbuffer; gfxswapbuffers; gfxupdatewindow; idirectdraw2_setdisplaymode; idirectdraw_createclipper; idirectdraw_createpalette; idirectdraw_createsurface; idirectdraw_enumdisplaymodes; idirectdraw_fliptogdisurface; idirectdraw_getcaps; idirectdraw_queryinterface; idirectdraw_release; idirectdraw_setcooperativelevel; idirectdraw_setdisplaymode; idirectdrawclipper_release; idirectdrawclipper_sethwnd; idirectdrawsurface_addref; idirectdrawsurface_blt; idirectdrawsurface_bltfast; idirectdrawsurface_flip; idirectdrawsurface_getattachedsurface; idirectdrawsurface_getcaps; idirectdrawsurface_getdc; idirectdrawsurface_getpixelformat; idirectdrawsurface_getsurfacedesc; idirectdrawsurface_islost; idirectdrawsurface_lock; idirectdrawsurface_release; idirectdrawsurface_releasedc; idirectdrawsurface_restore; idirectdrawsurface_setclipper; idirectdrawsurface_setcolorkey; idirectdrawsurface_setpalette; idirectdrawsurface_unlock; idirectsound_createsoundbuffer; idirectsound_release; idirectsound_setcooperativelevel; idirectsoundbuffer_getcaps; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; incrementspriteswitch; initapple; initapplication; initbear; initbuffer; initfox; initgame; initializegame; initnumsurface; initplane; initsound; initsurface; inittiles; invalidaterect; is_num; is_space; isiconic; loadbitmaps; loadcursor; loadicon; loadresource; localalloc; localfree; lockresource; lstrcat; lstrcpy; lstrcpyn; lstrlen; mainwndproc; makefontstuff; makeintatom; mapdx; mapdy; maprx; mapry; mapx; mapy; memalloc; memfree; memset; messagebox; msg; newgameframe; outputdebugstring; pausegame; peekmessage; postmessage; postquitmessage; preinitializegame; processfox; processinput; qquote; quote; readpalfile; registerclass; releasedc; reloadtiles; remind; restoregame; rgb; scrollplane; selectobject; setbkcolor; setbkmode; setcursor; setfocus; setpixel; setplaneincremx; setplaneslidex; setplanevelx; setplanex; setplaney; setrect; setspriteaccx; setspriteaccy; setspriteaction; setspriteactive; setspritebitmap; setspriteswitch; setspriteswitchdone; setspriteswitchforward; setspriteswitchtype; setspritevelx; setspritevely; setspritex; setspritey; setstretchbltmode; setsurface; settextcolor; setwindowlong; setwindowpos; setwindowtext; sounddestroyeffect; soundloadeffect; soundplayeffect; soundstopeffect; splash; stretchblt; stretchdibits; succeeded; surfaceplane; switch; systemparametersinfo; textout; tileplane; timegettime; translatemessage; unpausegame; updatewindow; va_start; waitmessage; winmain; wsprintf; wvsprintf; zeromemory

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Globe: XOF of a Mesh Object and Textures

Click to open or copy the files for the Globe sample.

Click to open or copy the Misc files (required).

This sample flies a camera around a globe. The path taken is defined by a spline curve. This sample demonstrates loading a simple XOF of a single mesh object with textures.

Building SDK Samples

This sample uses the following keywords:

adddestroycallback; addlight; addmovecallback; addpositionkey; addvisual; apply; buildscene; cleanuppath; createanimation; createframe; createlightrgb; creatematerial; createmeshbuilder; d3ddivide; d3drmerrortostring; d3dval; failed; getbox; getscene; load; loadtexture; lookat; lstrcpy; movecamera; msg; overridedefaults; release; run_world_scene; scale; setcolorrgb; setframe; setmaterial; setoptions; setorientation; setposition; setquality; setrotation; setshades; settexture; settime

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Hier1: Frame Hierarchy Sample

Click to open or copy the files for the Hier1 sample.

Click to open or copy the Misc files (required).

Click to open or copy the Media files (required).

This sample is a simple hierarchy of two meshes, demonstrating the concept of frames.

Building SDK Samples

This sample uses the following keywords:

addlight; addvisual; apply; buildscene; createframe; createlightrgb; createmesh; createmeshbuilder; createwrap; d3ddivide; d3drmerrortostring; d3dval; failed; getbox; load; loadtexture; lstrcpy; msg; overridedefaults; release; setcolors; setgroupcolorrgb; setgrouptexture; setposition; setquality; setrotation; setshades

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Hier2: Frame Hierarchy

Click to open or copy the files for the Hier2 sample.

Click to open or copy the Misc files (required).

Click to open or copy the Media files (required).

This sample demonstrates a simple hierarchy of four meshes.

Building SDK Samples

This sample uses the following keywords:

addlight; addvisual; buildscene; createframe; createlightrgb; createmesh; createmeshbuilder; d3dval; failed; load; lstrcpy; msg; overridedefaults; release; scale; setcolorrgb; setposition; setquality; setrotation; setshades

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Media Files for DirectX Samples

Click to open or copy the files for the Media sample.

The Media files include BMP, X, WAV, and PPM files. These are used by some of the DirectX samples in the sibling directories.


Misc: DirectX Samples Helper Directory

Click to open or copy the files for the Misc sample.

This is not a sample, but is used by some DirectX samples.

D3dutils.h, D3dutils.inl and D3dutils.cpp implement a set of helper functions for the following tasks:

Task or File | Description
D3DTexture | D3dtex.h and D3dtex.cpp implement the D3DTexture class, which simplifies texture management. See Boids and Flip3d for examples of how to use D3DTexture.
GetDXVersion | Getdxver.cpp implements sample code showing how to detect which version of DirectX is currently running (1.0, 2.0, ..., 5.0). See Boids and Flip3d for examples of how to use GetDXVersion.
Light Classes | Several classes are derived from Light. This is basically to simplify construction, since some elements of D3DLIGHT2 are not relevant to certain light types. The light classes are:, DirectionalLight, ParallelPointLight, PointLight, SpotLight.
Light management | The Set*/Get* functions enable the application to update the light's properties with single function calls. The Set* functions set the dirty bit so the light will be updated when necessary. You can get/set the following: Color, Position, Direction, Attenuation, Range, Falloff, Umbra, Penumbra, Flags.
Material management | The Material class simplifies dealing with Direct3D materials. See Boids and Pplane for examples of how to use the Material class.
Matrix construction | D3DMATRIX ZeroMatrix D3DMATRIX IdentityMatrix D3DMATRIX ProjectionMatrix
Rmdemo.h | Because the samples do not create and manage all DirectDraw and Direct3D objects themselves, the source is much simpler than the immediate mode samples, but they can only run in a window. Optionally, the D3DRM samples can be linked to D3DApp via another harness. This will allow them to enter fullscreen modes. Fly is linked to these files.
Rmfull.cpp | Main source file, which includes WinMain and the message handler. Uses D3DApp to set up rendering.
RMMain | Uses D3DRM to setup a window for rendering, asks the sample to build its scene and then renders the scene.
Rmmain.cpp | Includes WinMain and message handler. Creates D3DRM, uses it to setup the window for rendering and then asks the sample to build its scene.

Building SDK Samples

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Morph: DirectX Interpolators Sample

Click to open or copy the files for the Morph sample.

Click to open or copy the Misc files (required).

This Direct3D Retained Mode sample demonstrates the use of interpolators.

Building SDK Samples

This sample uses the following keywords:

addchild; adddestroycallback; addgroup; addlight; addmovecallback; addvisual; attachobject; bck; btm; buildscene; cbbl; cbbr; cbtl; cbtr; cfbl; cfbr; cftl; cftr; create; createobject; d3drmvectorcrossproduct; d3drmvectornormalize; d3drmvectorsubtract; d3dtry; d3dval; destroyinterp; failed; frt; generate_normals; interpolate; lft; lstrcpy; msg; overridedefaults; queryinterface; release; rgt; setcolorrgb; setgroupcolorrgb; setgroupquality; setindex; setorientation; setposition; setrotation; setscenebackgroundrgb; settype; setvertices; top

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Mosquito: DirectDraw Overlays Sample

Click to open or copy the files for the Mosquito sample.

Mosquito is a simple application to demonstrate the use of overlays in DirectDraw. To run the application, you must have a display adapter and driver which support overlays.

On a machine with overlay support, the application creates a big flapping mosquito which flies around the screen. If your card doesn't support "Source Color Keying" of overlays, you'll see an ugly black rectangular background around the mosquito.

Some cards have better overlay support in certain resolutions that others. If you know your card has overlay support through DirectDraw, but Mosquito is having problems creating or displaying the overlay, try running the application in a lower screen resolution or color depth.

Building SDK Samples

This sample uses the following keywords:

areoverlayssupported; bitblt; copybitmaptoyuvsurface; createcompatibledc; createoverlay; createprimarysurface; createsurface; deletedc; deleteobject; destroyoverlay; dialogbox; directdrawcreate; displayerror; displayoverlay; enddialog; enumattachedcallback; enumattachedsurfaces; failed; flip; freedirectdraw; getbvalue; getcaps; getdc; getgvalue; getmodulehandle; getpixel; getrvalue; getsurfacedesc; getsystemmetrics; init_directdraw_struct; initdirectdraw; killtimer; loadimage; loadimageontosurface; lock; maindialogproc; makefourcc; makeintresource; messageboxindirect; moveoverlaytimercallback; queryinterface; rand; rand_int; random_velocity; release; releasedc; restore; restoreallsurfaces; selectobject; setcooperativelevel; setoverlayposition; settimer; unlock; updateoverlay; winmain; zeromemory


Override: Overriding DirectPlay Service Provider Dialogs

Click to open or copy the files for the Override sample.

Sample application to demonstrate how to override the DirectPlay service provider dialogs.

Visual C++ may include older versions of the DirectX header files and libraries. This sample requires DirectX 5. In order to avoid compile errors, make sure the path to the DirectX 5 header files and libraries is listed BEFORE the Visual C++ header files and libraries on the Directories menu, found under Options on the Tools menu.

Once the user has selected which service provider to use, the application displays a custom dialog to collect the information needed for that service provider.

If the user selected an unknown service provider, then the dialog (if any) cannot be overidden and the application must prepare for a dialog to be displayed.

Once the information has been collected from the user, it must be formatted into a DirectPlay Address which can be used to initialize the service provider.

EnumSessions must be called with the DPENUMSESSIONS_RETURNSTATUS flag and Open must be called with the DPOPEN_RETURNSTATUS flag to supress any status dialogs that may pop up to show to progress of the connection.

Building SDK Samples

This sample uses the following keywords:

cocreateinstance; coinitialize; couninitialize; createcompoundaddress; createserviceprovideraddress; define_guid; deleteserviceprovidercombo; deletesessioninstancelist; destroyoverridewindow; dialogboxparam; directplaycreate; directplayenumerate; directplayenumeratecallback; directplaylobbycreate; dlgitemischecked; dohostorjoin; enabledlgbutton; enablewindow; enddialog; enumaddress; enummodemaddress; enumsessions; enumsessionscallback; failed; fillmodemcombobox; getdlgitem; getdlgitemtext; getplayeraddress; getserviceproviderguid; getsessioninstanceguid; globalallocptr; globalfreeptr; initializeconnection; initializeoverridewindow; isequalguid; killtimer; lstrcpy; lstrlen; makeintresource; open; overridewndproc; queryinterface; release; selectsessioninstance; senddlgitemmessage; sessionswndproc; setdlgitemtext; settimer; showwindow; succeeded; switch; updateaddressinfo; winmain; zeromemory


Palette: DirectDraw Palettes Sample

Click to open or copy the files for the Palette sample.

Click to open or copy the Misc files (required).

This is a basic example to show how to use DirectDraw palettes. Four separate DirectDrawPalette objects are created, and they can be attached to the primary surface just by selecting a menu item. Any given palette can be cycled through its red values. You can create the palettes in exclusive mode or not.

See also the GDI Palette sample.

Building SDK Samples

This sample uses the following keywords:

beginpaint; checkmenuitem; createpalette; createsurface; createwindow; defwindowproc; destroywindow; directdrawcreate; dispatchmessage; doattach; docycle; dodetach; doinit; endpaint; failed; getentries; getmessage; getstockobject; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; loadcursor; loadicon; localalloc; localfree; makeintresource; postquitmessage; registerclass; release; resetexclusiveandpalettes; restore; setcooperativelevel; setentries; setpalette; showwindow; switch; translatemessage; updatewindow; windowproc; winmain

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Pplane: Paper Plane D3dlvertex, DrawPrimitive, and SetTransform Sample

Click to open or copy the files for the Pplane sample.

Click to open or copy the Misc files (required).

The Paper Plane sample demonstrates D3dlvertex, DrawPrimitive, and SetTransform. The sample has the following files:

File | Description
PPlane.cpp | Paper plane sample to demonstrate D3DLVERTEX, DrawPrimitive, and SetTransform.
WinMain.cpp | D3D sample showing DrawPrimitive functionality.
D3DUtils.cpp | Various D3D utility functions.
D3DWin.cpp | Shows how to set up a windowed D3D framework.
Debug.cpp | Example debug code for D3D sample.
DrvMgr.cpp | Implements DD/D3D Driver/Device enumeration.
GetDXVer.cpp | Demonstrates how applications can detect what version of DirectX is installed.
WinProc.cpp | A sample windows proc for supporting D3D.

Building SDK Samples

This sample uses the following keywords:

_d3dvertex; addlight; addtoviewport; assert; changedriverproc; clamp; cos; createlight; creatematerial; createsurface; crossproduct; d3dval; d3dvector; d3dvertex; deletelight; directdrawcreate; directionallight; driverenumcallback; fabs; failed; fatalerr; float; freelibrary; getalpha; getambient; getattenuation; getcolor; getdevicecaps; getdiffuse; getdirection; getemissive; getfalloff; getflags; gethandle; getmodulehandle; getpenumbra; getposition; getpower; getprocaddress; getrampsize; getrange; getspecular; getsurfacedesc; gettexturehandle; getumbra; getversionex; identitymatrix; ispaused; isprimary; isvalid; light; loadlibrary; lstrlen; lubksb; ludcmp; material; matrixinverse; matrixmult; matrixtranspose; max; max3; memset; min; min3; normalize; outputdebugstring; parallelpointlight; pointlight; projectionmatrix; queryinterface; rand; release; removefromviewport; reporterr; ret; rgb; rgba_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setbackground; setcolor; setcooperativelevel; setdiffuse; setdirection; setemissive; setfalloff; setflags; setlight; setlightstate; setmaterial; setpenumbra; setposition; setpower; setrampsize; setrange; setrenderstate; setspecular; settexturehandle; setumbra; sin; spotlight; text; transformnormal; transformvector; translatematrix; turncalcrectsoff; turnpaintoff; turnvalidinterfaceoff; turnvalidrenderoff; turnvalidviewportoff; up; va_end; va_start; validatedevice; view; viewmatrix; winmain; zeromatrix; zeromemory

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Quat: Retained Mode Sample, Quaternions for Orientation

Click to open or copy the files for the Quat sample.

Click to open or copy the Misc files (required).

Click to open or copy the Media files (required).

This Direct3D Retained Mode sample demonstrates using quaternions to interpolate between two vectors in space.

Building SDK Samples

This sample uses the following keywords:

addlight; addmovecallback; addtransform; addvisual; buildscene; createframe; createlightrgb; createmesh; createmeshbuilder; d3ddivide; d3dmultiply; d3drmerrortostring; d3drmmatrixfromquaternion; d3drmquaternionfromrotation; d3drmquaternionmultiply; d3drmquaternionslerp; d3dval; failed; follow; getheight; getscene; getwidth; load; lstrcpy; msg; overridedefaults; readmouse; release; scale; setorientation; setposition; setquality; usercontrol

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Rockem: Robot Boxing Sample (DirectSound 3D, DirectDraw)

Click to open or copy the files for the Rockem sample.

This sample demonstrates many of the features of DirectX, including DirectDraw, Direct 3D and DirectSound. It also demonstrates DirectSound3D.

This game is not optimized for raw speed. It is meant to give a clear demonstration of how the DirectX technologies can be used.

When you build this sample, it will create a Rockem3d.exe file in either the retail or debug subdirectories, depending on which version you built. However, you must then copy the EXE up one directory to the Rockem sample root (such as c:\dxsdk\sdk\samples\rockem). This is because Rockem also needs to find its WAV files and other resources from that directory.

Building SDK Samples

This sample uses the following keywords:

abs; addattachedsurface; adddebris; addlight; addmovecallback; addpositionkey; addvisual; blt; checkinputandupdate; cleanup; clear; commitdeferredsettings; createanimation; createanimationset; createbufferfromwavefile; createdevicefromd3d; createframe; createlightrgb; createmeshbuilder; createpalette; createsoundbuffer; createsoundbuffer3d; createsurface; createviewport; createwindowex; d3denumdevicecallback; d3dval; ddenumcallback; ddenumdisplaymodescallback; defwindowproc; deletevisual; destroywindow; direct3drmcreate; directdrawcreate; directdrawenumerate; directsoundcreate; dispatchmessage; dosplashscreen; enterhighestvideomode; enterlowestvideomode; enternextvideomode; enterprevvideomode; entervideomode; entervideomodewhbd; enumdevices; enumdisplaymodes; failed; fclose; finddevice; flip; fopen; forceupdate; fread; fseek; getasynckeystate; getattachedsurface; getcaps; getdc; getdisplaymode; getnamedobject; getposition; getstatus; getstockobject; getsystemmetrics; gettextmetrics; initclass; initd3ddevice; initdirectx; initscene; initwindow; iskeydown; islost; load; loadaccelerators; loadcursor; loadicon; loadtexture; loadtextures; lock; lookat; makeintresource; mcisendstring; memcpy; memset; move; outputdebugstring; pack; pausemidi; peekmessage; play; player1animationcallback; player2animationcallback; playmidi; playrandomwave; playsoundds; positioncamera; postmessage; postquitmessage; queryinterface; rand; readdata; recalcpowerbars; reentercurrentvideomode; regerror; registerclass; release; releasedc; releasesplashscreen; render; renderscene; replaymidi; restore; restoredisplaymode; restoresurfaces; resumemidi; rgb; runintro; setback; setbkmode; setbuffercount; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdirectdrawexclusivemode; setdisplaymode; setdither; setenableframe; setframe; setoptions; setorientation; setpalette; setperspective; setposition; setquality; setrollofffactor; setrotation; setshades; settextcolor; settexturequality; settime; settimer; setzbuffermode; showcursor; showwindow; softwareguid; sortdisplaymodes; sprintf; stop; stopallsounds; stopmidi; strcmp; strcpy; switch; termdirectx; termscene; textout; timegettime; traceerrord3d; traceerrord3drm; traceerrordd; traceerrords; transitioncamera; translateaccelerator; translatemessage; try_d3d; try_d3drm; try_dd; try_ds; unlock; update; updatedebris; updateopponent; updatewindow; winmain; wndproc; wsprintf; zeromemory


Scrawl: DirectInput Exclusive Mouse Sample

Click to open or copy the files for the Scrawl sample.

Basic demonstration of DirectInput exclusive mouse usage. Lets you draw on the screen with the mouse, and shows how the calls are made. Right-click to display a menu of options.

This sample demonstrates the following:

  • Creating interfaces to DirectInputDevice objects.

  • Acquiring and unacquiring devices.

  • Reading buffered device data.

  • Event notifications for device activity.

  • Restricting the mouse to an arbitrary region.

  • Scaling raw mouse coordinates before using them.

  • Use of relative axis mode.

Building SDK Samples

This sample uses the following keywords:

acquire; adjustwindowrectex; appendmenu; appinit; beginpaint; bitblt; checkmenuitem; clienttoscreen; closehandle; complain; createbitmap; createcompatibledc; createdevice; createevent; createwindowex; defwindowproc; deletedc; deleteobject; destroywindow; diinit; directinputcreate; dispatchmessage; diterm; drawicon; enablemenuitem; endpaint; failed; get_wm_command_id; getactivewindow; getdc; getdevicedata; geticoninfo; getlasterror; getobject; getstockobject; getsystemmenu; handle_msg; invalidatecursorrect; invalidaterect; isiconic; iswindow; lineto; loadcursor; loadicon; loadmenu; makeintresource; messagebox; movetoex; msgwaitformultipleobjects; patblt; peekmessage; postmessage; postquitmessage; registerclass; release; releasedc; scrawl_onbutton0down; scrawl_onbutton0down_flushmotion; scrawl_onbutton1up; scrawl_onclear; scrawl_oncreate; scrawl_oninitmenupopup; scrawl_onkeydown; scrawl_onmouseinput; scrawl_onpaint; scrawl_syncacquire; scrawlwndproc; selectobject; setcooperativelevel; setcursorpos; setdataformat; seteventnotification; setproperty; showcursor; showwindow; size; trackpopupmenuex; translatemessage; unacquire; updatecursorposition; updatewindow; va_end; va_start; winmain; wsprintf


Setup: DirectSetup API Game Setup Sample

Click to open or copy the files for the Setup sample.

This sample is an example of how to use the DirectSetup API to install DirectX subsystem and DirectX drivers. It also serves as a working template for ISV's to install a game.

For more information about DirectSetup, see DirectSetup in DirectX 5.

For this program to run, the redist directory (on the CD) must be copied into the same directory as setup.exe. The entire Redist directory and all its subdirectories must be copied for setup to work correctly, with the exception of the driver directories (discussed below).

The driver directories (contained in \redist\directx\drivers) contain localized versions of Microsoft-provided display and audio drivers. You may omit any number of these driver directories from your redistributable to omit support for driver upgrades for those languages. If you choose to omit driver support for a particular language, you must omit the entire directory and its contents. Likewise, if you choose to include driver support for a particular language, you must include the entire directory and its contents. Setup will not function properly otherwise.

Do not add, remove, rename or modify any files or directories in the redist directory tree (except for omitting language directories). Setup will not function properly if any of the contents are altered.

Building SDK Samples

This sample uses the following keywords:

_lclose; _lcreat; _lwrite; _shfree; ansinext; catpath; deleteobject; dialogbox; directxsetup; directxsetupgetversion; enablewindow; enddialog; exitwindowsex; free; getdlgitem; getmodulefilename; getmodulehandle; getshortpathname; getwindowsdirectory; getwindowtext; loadcursor; loadimage; loadstrfromres; lstrcat; lstrcpy; lstrlen; makelong; makeshortcut; masterdlgproc; messagebox; release; senddlgitemmessage; sendmessage; setbitmap; setcursor; setdlgitemtext; setfileattributes; setfocus; setinfotext; setwindowtext; shbrowseforfolder; shfileoperation; shgetmalloc; shgetpathfromidlist; showwindow; sprintf; switch; winexec; winmain; wsprintf; wvsprintf


Shadow: Direct3D Retained Mode Sample

Click to open or copy the files for the Shadow sample.

Click to open or copy the Misc files (required).

Click to open or copy the Media files (required).

This sample demonstrates creating a shadow of a mesh object.

Building SDK Samples

This sample uses the following keywords:

addlight; addvisual; buildscene; createframe; createlightrgb; createmesh; createmeshbuilder; createshadow; d3dval; failed; load; lstrcpy; msg; overridedefaults; release; setorientation; setposition; setquality; setrotation; setscenebackgroundrgb

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Stretch: Clipped Blting and Stretched Clipped Blting

Click to open or copy the files for the Stretch sample.

Click to open or copy the Misc files (required).

This sample demonstrates clipped blting and stretched clipped blting. It is a nonexclusive mode application that displays a rotating donut in a window. Clipped blting can be demonstrated by moving another window partially or completely in front of the stretch window. The rotating donut does not overwrite the clipping window.

The size of the rotating donut can be changed with menu selections. Any size other than 1x1 demonstrates stretch blting. The window can also be resized by grabbing any one of the corners with the mouse.

Another menu command changes the rate of rotation of the donut.

Since this is not an exclusive mode application, it is unable to set the display mode. Therefore, it must be run on an 8 bit per pixel display. It will not work correctly with other pixel depths.

Building SDK Samples

This sample uses the following keywords:

adjustwindowrectex; blt; clienttoscreen; createclipper; createsurface; createwindowex; ddloadbitmap; ddloadpalette; ddreloadbitmap; defwindowproc; destroywindow; directdrawcreate; dispatchmessage; doinit; finiobjects; getclientrect; getmenu; getmessage; gettickcount; getwindowlong; initfail; loadcursor; loadicon; makeintresource; messagebox; offsetrect; peekmessage; postmessage; postquitmessage; registerclass; release; restore; restoreall; setclipper; setcooperativelevel; sethwnd; setpalette; setrect; setwindowpos; showwindow; switch; translatemessage; updateframe; updatewindow; windowproc; winmain

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Stretch2: Handling Multiple Monitors with DirectDraw

Click to open or copy the files for the Stretch2 sample.

Click to open or copy the Misc files (required).

This is a version of Stretch that demonstrates handling multiple monitors with DirectDraw applications.

Stretch.cpp demonstrates:

  • Using the routines in Ddmm.cpp.

  • Using WM_MOVE to detect when the window moves monitors.

  • Converting from a window client cordinate to a device cordinate

Ddmm.cpp contains generic directdraw multimonitor helper routines:
DirectDrawCreateFromDevice
DirectDrawCreateFromWindow
DirectDrawDeviceFromWindow

Multimon.h contains stub multimon functions that use GetProcAddress. It is used by Ddmm.cpp, so Stretch can still run on Win95 or NT4.

Building SDK Samples

This sample uses the following keywords:

adjustwindowrectex; blt; clienttoscreen; createclipper; createsurface; createwindowex; ddinit; ddloadbitmap; ddloadpalette; ddreloadbitmap; defwindowproc; destroywindow; directdrawcreatefromwindow; directdrawdevicefromwindow; dispatchmessage; doinit; finiobjects; getclientrect; getmenu; getmessage; gettickcount; getwindowlong; initfail; loadcursor; loadicon; lstrcpy; messagebox; offsetrect; peekmessage; postmessage; postquitmessage; registerclass; release; restore; restoreall; setclipper; setcooperativelevel; sethwnd; setpalette; setrect; setwindowpos; setwindowtext; showwindow; switch; translatemessage; updateframe; updatewindow; windowproc; winmain; wsprintf

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Stretch3: Handling Multiple Monitors with DirectDraw

Click to open or copy the files for the Stretch3 sample.

Click to open or copy the Misc files (required).

This is a version of Stretch that demonstrates how to handle multiple monitors in a windowed DirectDraw application.

Stretch.cpp demonstrates:

  • Using the routines in Ddmm.cpp.

  • Using WM_MOVE to detect when the window moves monitors.

  • Converting from a window client coordinate to a device coordinate.

  • Sharing artwork between DirectDraw objects.

DDmm.cpp contains generic DirectDraw multimonitor helper routines:
DirectDrawCreateFromDevice
DirectDrawCreateFromWindow
DirectDrawDeviceFromWindow

Multimon.h contains stub multimon functions that use GetProcAddress. It is used by Ddmm.cpp, so Stretch can still run on Win95 or NT4.

Building SDK Samples

This sample uses the following keywords:

adjustwindowrectex; blt; clienttoscreen; createclipper; createsurface; createthread; createwindowex; ddinit; ddinit1; ddinitartwork; ddloadbitmap2; ddloadpalette2; declare_handle; defined; defwindowproc; destroywindow; directdrawcreate; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; dispatchmessage; doinit; doinit1; enumdisplaymonitors; finddevicecallback; finiobjects; finiobjects1; getclientrect; getclipbox; getmenu; getmessage; getmodulehandle; getmonitorinfo; getprocaddress; getsurfacedesc; getsystemmetrics; gettickcount; getwindowlong; getwindowrect; globalalloc; initfail; initmultiplemonitorstubs; intersectrect; loadcursor; loadicon; lpfnenumproc; lstrcmpi; lstrcpy; mapwindowpoints; memset; messagebox; offsetrect; onemonitorcallback; onemonitorfromwindow; outputdebugstring; peekmessage; postmessage; postquitmessage; queryinterface; registerclass; release; restore; restoreall; setclipper; setcooperativelevel; sethwnd; setpalette; setrect; setrectempty; setsurfacedesc; setwindowpos; setwindowtext; showwindow; switch; systemparametersinfo; text; translatemessage; updateframe; updateframe1; updatewindow; waitformultipleobjects; windowfromdc; windowproc; winmain; wsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromemory

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Tex1: Texture Mapping Using a Cylindrical Mapping

Click to open or copy the files for the Tex1 sample.

Click to open or copy the Misc files (required).

Click to open or copy the Media files (required).

This Direct3D Retained Mode sample demonstrates loading a simple texture mapped mesh object.

Building SDK Samples

This sample uses the following keywords:

addlight; addvisual; apply; buildscene; createframe; createlightrgb; creatematerial; createmesh; createmeshbuilder; createwrap; d3ddivide; d3drmerrortostring; d3dval; failed; getbox; load; loadtexture; lstrcpy; msg; overridedefaults; release; setcolorrgb; setmaterial; setorientation; setposition; setrotation; settexture

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Tex3: Texture Mapping with Spherical Mapping

Click to open or copy the files for the Tex3 sample.

Click to open or copy the Misc files (required).

Click to open or copy the Media files (required).

This Direct3D Retained Mode sample demonstrates using texture wraps for special effects.

This sample illustrates texture mapping using spherical mapping relative to a frame.

Building SDK Samples

This sample uses the following keywords:

adddestroycallback; addlight; addmovecallback; addvisual; applyrelative; applywrap; buildscene; cleanupwrap; createframe; createlightrgb; createmesh; createmeshbuilder; createwrap; d3drmerrortostring; d3dval; failed; getelement; getsize; getvisuals; load; loadtexture; lstrcpy; msg; overridedefaults; queryinterface; release; scale; setcolors; setdecalorigin; setdecalscale; setorientation; setposition; setquality; setrotation; settexture; succeeded

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Tex4: Texture Mapping Sample

Click to open or copy the files for the Tex4 sample.

Click to open or copy the Misc files (required).

Click to open or copy the Media files (required).

This Direct3D Retained Mode sample demonstrates using texture wraps for special effects.

Tex4 is a texture mapping example using a spherical mapping relative to the camera. The texture is also used as a background for the scene.

Building SDK Samples

This sample uses the following keywords:

adddestroycallback; addlight; addmovecallback; addvisual; applyrelative; applywrap; buildscene; cleanupwrap; createframe; createlightrgb; createmesh; createmeshbuilder; createwrap; d3dval; failed; getelement; getsize; getvisuals; load; loadtexture; lstrcpy; msg; overridedefaults; queryinterface; release; scale; setcolors; setdecalorigin; setdecalscale; setorientation; setposition; setquality; setrotation; setscenebackgroundimage; settexture; succeeded

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Tex5: Texture Mapping Sample

Click to open or copy the files for the Tex5 sample.

Click to open or copy the Misc files (required).

Click to open or copy the Media files (required).

This Direct3D Retained Mode sample is a texture mapping example showing the use of chrome mapping and decals. It uses a wrap for chrome mapping and a texture map as a decal.

Building SDK Samples

This sample uses the following keywords:

adddestroycallback; addlight; addmovecallback; addvisual; applyrelative; applywrap; buildscene; cleanupwrap; createframe; createlightrgb; createmesh; createmeshbuilder; d3dval; failed; getdecalscale; getelement; getsize; getvisuals; load; loadtexture; lstrcpy; msg; overridedefaults; release; setcolors; setdecalorigin; setdecalscale; setgroupcolorrgb; setorientation; setposition; setquality; setrotation; setscenebackgroundimage; setshades; settexture; toggledecalscale

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Trans: Transparency Direct3DRM Sample

Click to open or copy the files for the Trans sample.

Click to open or copy the Misc files (required).

Click to open or copy the Media files (required).

This Direct3D Retained Mode sample demonstrates using transparent texture maps in various ways.

Building SDK Samples

This sample uses the following keywords:

addlight; addmovecallback; addvisual; apply; buildscene; changed; createframe; createlightrgb; creatematerial; createmesh; createmeshbuilder; createtexture; createwrap; d3ddivide; d3drgb; d3dval; failed; getbox; load; loadtexture; lstrcpy; msg; mutatetexture; overridedefaults; release; setcolors; setdecalorigin; setdecalscale; setdecalsize; setdecaltransparency; setgroupmapping; setgroupmaterial; setgrouptexture; setorientation; setperspective; setposition; setrotation; setscenebackground

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Tri3: Triangle D3D Sample

Click to open or copy the files for the Tri3 sample.

Click to open or copy the Misc files (required).

This sample (Tri3 or D3DApp) is a collection of helper functions for Direct3D applications. D3DApp consists of the following files:

File | Description
D3dmain.cpp | Each of the Direct3D samples must be linked with this file. It contains the code which allows them to run in the Windows environment. A window is created using D3dmain.res which allows the user to select the Direct3D driver to use and change the render options. The D3DApp collection of functions is used to initialize DirectDraw, Direct3D and keep surfaces and D3D devices available for rendering.
D3dapp.c | Top level D3DApp functions and internal global variables.
D3dapp.h | Main D3DApp header to be included by application
D3dappi.h | Internal header
D3dapp.c | D3DApp functions seen by application.
Ddcalls.c | All calls to DirectDraw objects except textures. Manages DirectDraw objects needed for rendering.
D3dcalls.c | All calls to Direct3D objects except textures. Calls to Direct3D objects needed for rendering.
Texture.c | Texture loading and managing texture list. Loads and manages textures.
Misc.c | Miscellaneous calls. Miscellaneous functions not involving DD and D3D.
Stats.cpp | Functions to Blt frame rate and a screen mode information buffer to the screen.

Each sample is executed through the functions InitScene, InitView, RenderScene, ReleaseView, ReleaseScene and OverrideDefaults, as described in D3ddemo.h. Samples can also read mouse and keyboard input via SetMouseCallback and SetKeyboardCallback.

Building SDK Samples

This sample uses the following keywords:

addattachedsurface; addviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; beginscene; blt; bltfast; calculateframerate; ceil; checkmenuitem; checksurf; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; createclipper; created3dapp; createdevice; createfont; creategridstrip; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindowex; d3dappaddtexture; d3dappchangedriver; d3dappchangetextureformat; d3dappcheckforlostsurfaces; d3dappclearbackbuffer; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappdisabletextures; d3dapperrortostring; d3dappfullscreen; d3dappgetrenderstate; d3dappiaddpathlist; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreated3d; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdevices; d3dappienumdisplaymodes; d3dappienumtextureformats; d3dappifilterdisplaymodes; d3dappifilterdrivers; d3dappifindfile; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappiinitialisepathlist; d3dappiloadalltextures; d3dappiloadsurface; d3dappiloadtexturesurf; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappireleasealltextures; d3dappireleasepathlist; d3dappireleasetexture; d3dappireloadtexturesurf; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappisetdispmode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterror; d3dapplasterrorstring; d3dapppause; d3dapprenderextents; d3dappsetrenderstate; d3dappshowbackbuffer; d3dappswaptextures; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3dmatrixinvert; d3dmatrixsetrotation; d3dval; d3dvectorcrossproduct; d3dvectornormalise; defwindowproc; deletemenu; deleteobject; destroywindow; dialogbox; directdrawcreate; directdrawenumerate; dispatchmessage; displayframerate; dpf; drawmenubar; drawprimitive; enablemenuitem; enddialog; endpaint; endscene; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumtextureformats; enumtextureformatscallback; exttextout; failed; fclose; flip; fliptogdisurface; floor; fopen; fread; free; fseek; generatesphere; getattachedsurface; getc; getcaps; getclientrect; getclipstatus; getdc; getdisplaymode; getentries; getenv; gethandle; getmenu; getstats; getstockobject; getsubmenu; getsurfacedesc; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; getwindowlong; getwindowrect; initfontandtextbuffers; initglobals; initscene; initview; insertmenu; isdigit; islost; isspace; line_list_data; load; loadaccelerators; loadcursor; loadicon; loadppmheader; lock; lstrcat; lstrchr; lstrcmp; lstrcpy; lstrcpyn; lstrlen; lstrrchr; make_matrix; malloc; matrix_multiply_data; max; memcpy; memset; merge; messagebox; min; msg; multiplyd3dmatrix; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; outputdebugstring; overridedefaults; peekmessage; postquitmessage; ppm_getbyte; ppm_getint; processvertices_data; putd3dinstruction; qsort; queryinterface; qword_aligned; redrawwindow; regclosekey; registerclass; regopenkeyex; regqueryvalueex; release; releasedc; releasefontandtextbuffers; releasescene; releaseview; renderloop; renderscene; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; rgb; rgb_getblue; rgb_getgreen; rgb_getred; rgb_make; rgba_make; selectobject; sendmessage; setbackground; setbkcolor; setbkmode; setclipper; setclipstatus; setcolorkey; setcooperativelevel; setcurrentviewport; setcursor; setdisplaymode; setentries; sethwnd; setkeyboardcallback; setlightstate; setmaterial; setmatrix; setmousecallback; setpalette; setrect; setrenderstate; settextcolor; setviewport2; setwindowpos; setwindowtext; showwindow; spline; state_data; strtok; swaptexturehandles; switch; translateaccelerator; translatemessage; triangle_list_data; unlock; updatewindow; va_end; va_start; vertex_data; waitmessage; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; zeromem

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Uvis: User Visual Direct3DRM Sample

Click to open or copy the files for the Uvis sample.

Click to open or copy the Misc files (required).

Click to open or copy the Media files (required).

This is an important example demonstrating how Direct3D can be used with Direct3D Retained Mode. It demonstrates how a D3D immediate-mode execute buffer can be used as a visual in a D3D retained-mode scene.

Building SDK Samples

This sample uses the following keywords:

adddestroycallback; addlight; addvisual; buildscene; cleanupfireobjects; createexecutebuffer; createfire; createfireobjects; createframe; createlightrgb; creatematerial; createuservisual; d3ddivide; d3dmultiply; d3drmvectoradd; d3drmvectorcrossproduct; d3drmvectornormalise; d3drmvectorrandom; d3drmvectorrotate; d3drmvectorscale; d3drmvectorsubtract; d3dval; deletedestroycallback; destroyfire; execute; failed; firecallback; forceupdate; free; getdirect3d; getdirect3ddevice; getdirect3dviewport; getexecutedata; gethandle; initflame; lock; lstrcpy; malloc; memset; msg; op_exit; op_process_vertices; op_set_status; op_state_light; op_state_render; op_triangle_list; overridedefaults; processvertices_data; rand; release; renderfire; setexecutedata; setmaterial; setorientation; setposition; setquality; setrotation; sqrt; state_data; unlock; updateflame

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Viewer: Object Viewer Sample for Direct3D Retained Mode

Click to open or copy the files for the Viewer sample.

Click to open or copy the Misc files (required).

Click to open or copy the Media files (required).

This is a standalone D3DRM sample application that allows you to load and view 3D objects.

The initial scene has a light source in the top right. To see this the view can be moved backwards and forwards using the T and R keys. Additional objects can be loaded from the file menu, and new light sources can be added from the lights menu. Objects can be rotated with the left mouse button and dragged with the right.

The device quality can be altered using the Renderer menu. Using this menu the type of device used can also be switched from ramp to RGB. When using the RGB device the color of lights in the scene can be changed in the same way as you change the color of objects.

Building SDK Samples

This sample uses the following keywords:

addchild; addcone; addfaces; addframe; addlight; addmovecallback; addref; addrod; addscale; addvisual; animationcallback; anyinstance; beginpaint; bpptoddbd; cchookproc; checkmenuitem; choosecolor; choosenewcolor; clear; clearclipboard; clone; copyvisual; createanimationset; createdevice; createdevicefromclipper; createframe; createlight; createlightrgb; creatematerial; createmesh; createmeshbuilder; createprogressivemesh; createscene; createsurface; createviewport; cutvisual; d3ddivide; d3dmultiply; d3drmcolorgetalpha; d3drmcolorgetblue; d3drmcolorgetgreen; d3drmcolorgetred; d3drmcreatecolorrgb; d3drmloadxafasframe; d3drmloadxafaslist; d3drmvectorcrossproduct; d3drmvectornormalise; d3dval; defwindowproc; deletechild; deletevisual; deselectvisual; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; dispatchmessage; enablescrollbar; enddialog; endpaint; failed; fillmodetomenuitem; findandselectvisual; finddevice; firstinstance; freelibrary; getalphafromdialog; getbox; getbvalue; getclientrect; getcolor; getdc; getdetail; getdevicecaps; getdither; getdxversion; getelement; getfacecount; getfaces; getgvalue; getheight; getlights; getmenu; getopenfilename; getorientation; getparent; getpick; getposition; getprocaddress; getquality; getrvalue; getshades; getsize; getstockobject; getsubmenu; gettexturequality; getupdaterect; getversionex; getwidth; getwindowlong; getwindowword; handleactivate; handlepaint; idle; inversetransform; load; loadaccelerators; loadanimationset; loadcursor; loadframehierarchy; loadicon; loadlibrary; loadtexture; loadtextures; lstrcat; lstrcpy; lstrrchr; makebox; malloc; memset; messagebox; move; msg; myerrortostring; opennewfile; outputdebugstring; pastevisual; peekmessage; pick; placemesh; postquitmessage; queryinterface; rebuilddevice; registerclass; release; releasecapture; releasedc; render; resizeviewport; rgb; scale; scalescene; selectedframe; selectedlight; selectedvisual; selectpm; selectvisual; senddlgitemmessage; setalphadialog; setanimationcallback; setback; setcapture; setcolor; setcolorrgb; setcooperativelevel; setcursor; setdefaulttexturecolors; setdefaulttextureshades; setdetail; setdither; setfillmode; sethwnd; setmaterial; setmodel; setorientation; setposition; setquality; setrendermode; setrotation; setscrollinfo; setscrollpos; setshademode; setshades; settexturequality; settime; setvelocity; setwindowlong; shademodetomenuitem; showboxes; showwindow; sign_extend; sqrt; strtoul; succeeded; switch; toggleboxes; toggledither; togglelighting; toggletexturefiltering; transform; translateaccelerator; translatemessage; update; updatewindow; va_end; va_start; waitmessage; windowproc; wsprintf; wvsprintf; zeromemory

The Misc files demonstrate the following keywords:

_lclose; _lopen; _lread; addattachedsurface; addlight; addtoviewport; adjustwindowrectex; afterdevicecreated; appabout; appendmenu; appinit; apppause; attempt; beforedevicedestroyed; beginpaint; blt; bltfast; bpptoddbd; buildscene; calculateframerate; checkmenuitem; cleanupandpostquit; clear; clienttoscreen; clock; comparemodes; copymemory; cos; createclipper; createcompatibledc; created3dapp; created3drm; createdevandview; createdevicefromclipper; createdevicefromd3d; createfont; createframe; createlight; creatematerial; creatematrix; createpalette; createsurface; createviewport; createwindow; createwindowex; crossproduct; d3dappchangedriver; d3dappcheckforlostsurfaces; d3dappcreatefromhwnd; d3dappcreatesurface; d3dappdestroy; d3dappenumeratedddevices; d3dapperrortostring; d3dappfullscreen; d3dappibpptoddbd; d3dappicalldevicecreatecallback; d3dappicalldevicedestroycallback; d3dappicheckforpalettized; d3dappiclearbuffers; d3dappicopyrectlist; d3dappicreatebuffers; d3dappicreatedd; d3dappicreatedevice; d3dappicreatesurface; d3dappicreatezbuffer; d3dappiddenumcallback; d3dappienumdddevices; d3dappienumdisplaymodes; d3dappifilterdisplaymodes; d3dappigetclientwin; d3dappigetsurfdesc; d3dappigettexturehandle; d3dappihandlewm_size; d3dappimergerectlists; d3dappipickdisplaymode; d3dappipickdriver; d3dappirememberwindowsmode; d3dappirestoredispmode; d3dappisetclientsize; d3dappisetcooplevel; d3dappisetdefaults; d3dappisetdisplaymode; d3dappiseterrorstring; d3dappisetrenderstate; d3dappivalidatedirtyrects; d3dappiverifydriverandmode; d3dapplasterrorstring; d3dapppause; d3dappshowbackbuffer; d3dapptotalvideomemory; d3dappwindow; d3dappwindowproc; d3drmerrortostring; d3dval; ddcolormatch; ddcolormatch2; ddcopybitmap; ddcopybitmap2; ddloadbitmap; ddloadbitmap2; ddloadpalette; ddloadpalette2; ddreloadbitmap; ddreloadbitmap2; ddsetcolorkey; ddsetcolorkey2; declare_handle; declare_handle32; defined; defwindowproc; deletedc; deletelight; deletemenu; deleteobject; destroyd3dapp; destroywindow; dialogbox; direct3drmcreate; directdrawcreate; directdrawcreateclipper; directdrawcreatefromdevice; directdrawcreatefromwindow; directdrawdevicefromwindow; directdrawenumerate; directionallight; dispatchmessage; displayframerate; dpf; dsfillsoundbuffer; dsgetwaveresource; dsloadsoundbuffer; dsparsewaveresource; dsreloadsoundbuffer; enablemenuitem; enddialog; endpaint; enumdevicefunc; enumdevices; enumdisplaymodes; enumdisplaymodescallback; enumdisplaymonitors; exttextout; fabs; failed; finddevicecallback; findresource; float; forceupdate; free; freelibrary; getalpha; getambient; getattachedsurface; getattenuation; getcaps; getclientrect; getclipbox; getcolor; getdc; getdevicecaps; getdiffuse; getdirection; getdisplaymode; getdither; getdxversion; getemissive; geterrorstring; getfalloff; getflags; gethandle; getheight; getmenu; getmodulehandle; getmonitorinfo; getobject; getpenumbra; getpixel; getposition; getpower; getprocaddress; getquality; getrampsize; getrange; getspecular; getstockobject; getsubmenu; getsurfacedesc; getsystemmetrics; getsystempaletteentries; gettextextentpoint; gettextextentpoint32; gettexturehandle; gettexturequality; gettrianglesdrawn; getumbra; getupdaterect; getversionex; getwidth; getwindowinstance; getwindowlong; getwindowrect; handleactivate; handlepaint; identitymatrix; idirectsound_createsoundbuffer; idirectsound_duplicatesoundbuffer; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_setcurrentposition; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; initapp; initfontandtextbuffers; initglobals; initmultiplemonitorstubs; insertmenu; intersectrect; islost; lbclear; lbcreate; lbprintf; lbprintfddrc; lbsize; light; line_list_data; loadaccelerators; loadcursor; loadicon; loadimage; loadlibrary; loadresource; localalloc; localfree; lock; lockresource; lpfnenumproc; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lubksb; ludcmp; make_matrix; malloc; mapwindowpoints; material; matrix_multiply_data; matrixinverse; matrixmult; matrixtranspose; memcpy; memset; merge; messagebox; mmiofourcc; move; movewindow; msg; normalize; onemonitorcallback; onemonitorfromwindow; op_branch_forward; op_exit; op_line_list; op_matrix_multiply; op_nop; op_point_list; op_process_vertices; op_set_status; op_span_list; op_state_light; op_state_render; op_state_transform; op_triangle_list; op_triangleex_list; outputdebugstring; overridedefaults; parallelpointlight; peekmessage; pointlight; postquitmessage; processvertices_data; projectionmatrix; putd3dinstruction; qsort; queryinterface; qword_aligned; rand; readmouse; registerclass; release; releasedc; releasefontandtextbuffers; removefromviewport; render; renderloop; reportd3dapperror; resetframerate; restore; restoredisplaymode; restoresurfaces; ret; rgb; rgb_make; rnd; rotatexmatrix; rotateymatrix; rotatezmatrix; scalematrix; selectobject; sendmessage; set; setalpha; setambient; setasbackground; setascurrent; setattenuation; setback; setbackground; setbkcolor; setbkmode; setbuffercount; setclipper; setcolor; setcolorkey; setcooperativelevel; setdefaulttexturecolors; setdefaulttextureshades; setdiffuse; setdirection; setdisplaymode; setdither; setemissive; setfalloff; setflags; sethwnd; setlight; setlightstate; setmaterial; setmatrix; setpalette; setpenumbra; setpixel; setposition; setpower; setquality; setrampsize; setrange; setrect; setrectempty; setrenderstate; setshades; setspecular; settextcolor; settexturehandle; settexturequality; setumbra; setwindowpos; showwindow; sin; sndobjcreate; sndobjdestroy; sndobjgetfreebuffer; sndobjplay; sndobjstop; spotlight; state_data; stretchblt; strtok; succeeded; switch; systemparametersinfo; text; transformnormal; transformvector; translateaccelerator; translatematrix; translatemessage; triangle_list_data; triangleex_list_data; unlock; update; updatewindow; va_end; va_start; vertex_data; view; viewmatrix; waitmessage; windowfromdc; windowproc; winmain; writeframeratebuffer; writeinfobuffer; wsprintf; wvsprintf; xenumdisplaymonitors; xgetmonitorinfo; xgetsystemmetrics; xmonitorfrompoint; xmonitorfromrect; xmonitorfromwindow; zeromatrix; zeromem; zeromemory


Wormhole: 3D Palette Animation

Click to open or copy the files for the Wormhole sample.

This effect uses palette animation.

Suppose we have a 4x4 display using 4 colors. We could set the colors up to look something like this:
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4

Now we can cycle all of the colors in each row to the right. (The one on the right will wrap-around to the left.)
4 1 2 3
4 1 2 3
4 1 2 3
4 1 2 3

If we continue this cycling we would get animated lines moving to the right. The same can be done to animate the lines going down.

Now if we expand our palette to 16 colors, we can combine moving down and right at the same time.

If we tile these 4x4 blocks end to end and cycle the colors as above, we get a moving checkerboard.

The Wormhole sample does the same thing, except it uses 15x15 blocks (225 colors) and instead of tiling the blocks end to end on a flat plane, it tiles them in 3D, converging at the center of the wormhole.

The sample code generates the 3D wormhole using the aforementioned 15x15 grids.

After loading the bitmap to a direct draw surface, all that is left to do is rotate the colors, to produce a wormhole.

Building SDK Samples

This sample uses the following keywords:

blt; clienttoscreen; createpalette; createsurface; createwindowex; cyclepalette; defwindowproc; destroywindow; directdrawcreate; dispatchmessage; doinit; findresource; finiobjects; freeresource; getclientrect; getentries; getmessage; getsystemmetrics; initfail; loadcursor; loadicon; loadresource; lock; lockresource; memcpy; messagebox; offsetrect; peekmessage; postmessage; postquitmessage; readbmpintosurfaces; registerclass; release; restore; restoreall; setcooperativelevel; setcursor; setdisplaymode; setentries; setpalette; showwindow; switch; translatemessage; unlock; updateframe; updatewindow; waitforverticalblank; waitmessage; windowproc; winmain


GDI Samples

Click to open or copy the files for the GDI samples.

For more information about GDI, see Graphic Objects in the Visual C++ Programmer's Guide.


ComplexScript: International Language Display Sample

Click to open or copy the files for the ComplexScript sample.

This sample application shows how to accept keyboard input and display it to the screen, so that complex scripts such as Arabic, Hebrew, Thai, and Indic are displayed correctly.

Building SDK Samples

This sample uses the following keywords:

defwindowproc; getdc; getstockobject; gettextextentpoint32; lstrcpy; lstrlen; makeintresource; makelparam; message; rcmessagebox; registerclass; releasedc; selectobject; settextalign; text


Fonts Samples

Click to open or copy the files for the Fonts samples.


FontView: Font Usage

Click to open or copy the files for the FontView sample.

The FontView sample demonstrates several programming aspects. As a stand-alone application, it allows you to experiment with the various parameters of the CreateFont function, as well as examine the fonts and metrics returned by the call.

Building SDK Samples

This sample uses the following keywords:

_moveto; abs; circleblt; cos; createdlgproc; createfont; createsolidbrush; defined; deleteobject; destroywindow; dialogbox; dialogboxparam; enddialog; enumdlgproc; exttextout; fabs; freeprocinstance; getdc; getdlgitemtext; getfocus; getmenu; getstockobject; getsubmenu; getsyscolor; getsystemmenu; getwindowlong; getwindowtext; lstrcmp; lstrcpy; lstrlen; makeprocinstance; max; messagebeep; metricsdlgproc; min; moveto; movetoex; radian; releasedc; selectobject; sendmessage; setbkcolor; setdlgitemtext; settextcolor; setwindowtext; simpledlgproc; sin; updatepositions; warning; windowfrompoint; winmain


GridFont: Displaying Font Codepoints

Click to open or copy the files for the GridFont sample.

The GridFont sample, written in C++, displays a grid containing Unicode codepoints. The user is able to select a font, and then see which codepoints are covered by the font.

Note There is a font distributed with the Win32® SDK that covers more than 1,000 Unicode characters. In order to use this application to its full potential, install that font by using Fonts in the Control Panel. The font is named l_10646.TTF.

Building SDK Samples

This sample uses the following keywords:

_alias; _block; _bxf; _canvas; _cblock; _ccol; _char; _code; _cols; _crow; _cx; _cy; _fontalias; _fontblock; _fontctype; _fpagemode; _fuformat; _hdc; _hdevnames; _hinst; _hwnd; _icol; _ipage; _irow; _line; _macpage; _pf; _pt; _size; abortproc; alertbox; alpha; brush; buttondown; buttonup; bxf; cancelled; cannextpage; cannextsection; canprevpage; canprevsection; canvas; cblackpen; cblockformat; cblockframe; cbox; cboxformat; cbrush; ccanvas; ccharblock; cchargrid; ccodegrid; cctypeset; cfont; cfontselect; cfontset; cframeformat; cgridit; char; choose; choosefont; circle; clinegrid; cmodel; code; col; combining; command; countucsegments; cpage; cpageformat; cpoint; cprintcanvas; cprintrequest; create; createbrushindirect; createfont; createfontindirect; createpen; cscrollableview; ctextfield; ctextgrid; ctype; cview; cwindow; cx; cy; decomp; deletedc; deleteobject; destroy; dialogbox; done; dptolp; draw; drawelement; enddialog; enddoc; endpage; endpaint; error; fillrect; foldstring; fontdecomp; freeprocinstance; fs; getclientrect; getdevicecaps; getextent; getfont; getfontdata; getformat; getlinesize; getmaxpage; getmaxsection; getmenu; getobject; getpage; getpagedata; getpagemode; getrect; getscale; getscrollpos; getsize; getstockbrush; getstringtypeex; getstringtypew; gettextextentpoint; globalfree; hdc; hfont; hittest; hscroll; hwnd; in; initpage; invalidate; invalidaterect; ismodelpageused; ispageused; it; job; keydown; keyup; line; loadstring; localalloc; localfree; localhandle; lptodp; lstrcpy; lstrlen; makeprocinstance; max; memset; min; muldiv; nextpage; nextsection; offsetrect; page; paint; pen; postquitmessage; prevpage; prevsection; print; printdlg; rctext; rectangle; releasecapture; rgb; row; scale; scanvas; scroll; scrollwindow; selectbrush; selectfont; selectpen; senddlgitemmessage; setabortproc; setchartable; setcset; setfont; setfontrange; setformat; sethscrollpos; setpage; setpagemode; setscale; setscrollpos; setscrollrange; setsize; setstyle; settextalign; settextcolor; settextorg; setvscrollpos; setweight; setwindoworgex; size; startpage; switch; text; textalign; update; updatewindow; view; vscroll; wsprintf


TTfonts: Demonstration of the Font Functions

Click to open or copy the files for the TTfonts sample.

The TTfonts sample is an easy-to-use, powerful utility that allows you to explore the font system. There is a toolbar on top of the main frame window with buttons that allow the following actions:

  • Enumerating all of the fonts installed for the display.

  • Getting TEXTMETRIC and OUTLINETEXTMETRIC information.

  • Creating a font based on an arbitrary LOGFONT structure.

  • Getting font data by using the GetFontData function.

  • Enumerating all of the fonts available to the default printer.

Building SDK Samples

This sample uses the following keywords:

allfontswndproc; beginpaint; bitblt; buildfontlist; buttonleft; checkmenuitem; childleft; choosefont; createcompatibledc; createmdiwindow; createwindow; defframeproc; defmdichildproc; defwindowproc; deletedc; dispatchmessage; displaywndproc; enum; flywinwin; fontdatawndproc; getdc; getmenu; getmessage; getprinterdc; getstockobject; initallfont; initdisplay; initdlg; inittb; loadcursor; loadicon; logfontwndproc; lstrlen; mainwndproc; myenumcopy; myenumcount; myenumfaces; postquitmessage; registerclass; rgb; selectobject; setrop2; showwindow; text; toolbarwndproc; translateaccelerator; translatemessage; unreferenced_parameter; updatewindow; winhelp; winmain


GDIdemo: GDI Sample Application

Click to open or copy the files for the GDIdemo sample.

The GDIdemo sample contains several examples of using GDI calls to generate graphics.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; allocwindowinfo; ballbounce; ballcreate; balldestroy; ballgetdimensions; ballgetdirection; ballgetposition; ballsetdimensions; ballsetdirection; ballsetposition; beginpaint; bitblt; bouncecommandproc; bouncecreateproc; bouncedestroyproc; bounceobjects; bouncepaintproc; bounceproc; bouncerefresh; checkedgeposition; chord; combinergn; commandproc; createappwindow; createbouncewindow; createcolorscalepalette; createdrawwindow; createellipticrgn; createmazewindow; createmdiclientwindow; createpalette; createpen; createpolywindow; createproc; createrectrgn; createsolidbrush; createwindow; createxformwindow; debugout; defframeproc; defined; defmdichildproc; deleteobject; destroyproc; dialogboxparam; dispatchmessage; displaydialogbox; drawcommandproc; drawcreateproc; drawdestroyproc; drawmaze; drawobject; drawpaintproc; drawproc; drawxform; ellipse; enddialog; endpaint; fillrect; fillrgn; freeprocinstance; freewindowinfo; getclassbrush; getclasslong; getclassword; getclientrect; getdc; getdevicecaps; getdlgitem; getinstance; getmessage; getstockobject; getwindowlong; getwindowword; getworldtransform; globalalloc; globalfree; globallock; globalunlock; invalidaterect; killtimer; loadcursor; loadicon; localalloc; localfree; locallock; localunlock; lockwindowinfo; lrandom; makeintresource; makeprocinstance; mazecommandproc; mazecreateproc; mazedestroyproc; mazepaintproc; mazeproc; modifyworldtransform; outputdebugstring; paintproc; paintwindow; paletteindex; pie; polybezier; polycommandproc; polycreateproc; polydestroyproc; polydrawbez; polyinitpoints; polyline; polynewvel; polypaintproc; polyproc; polyredraw; postmessage; postquitmessage; realizepalette; rectangle; registerappclass; registerclass; releasedc; resetxform; rgb; roundrect; selectobject; selectpalette; sendmessage; setfocus; setmapmode; setrect; setrop2; settimer; setviewportextex; setviewportorgex; setwindowextex; setwindowlong; setworldtransform; showwindow; switch; translatemdisysaccel; translatemessage; unlockwindowinfo; unregisterappclass; unregisterclass; updatewindow; winmain; wndproc; wsprintf; xformclear; xformcommandproc; xformcreateproc; xformdestroyproc; xformpaintproc; xformpoint; xformproc; xformscale; xformtrans


Mandel: Mandelbrot Fractal Engine

Click to open or copy the files for the Mandel sample.

This Mandelbrot Dream sample demonstrates GDI and USER functions by working with fractals. This sample demonstrates the following:

  • Drawing the Mandelbrot set and the corresponding Julia set.

  • Zooming into any of the sets.

  • MDI fractal drawing windows.

  • Floating point math and fixed point math.

  • Shifting color table entries.

  • Changing palette entries and animating palette (color cycling).

  • Loading and saving bitmaps created with special effects.

  • Changing bitmap colors with flood fill.

  • Boundary tracing and creating a clip region for special effects.

  • Enumerating printers.

  • Loading RLE (or converting BMP files to RLE) for playing in viewer.

  • Saving the RLE in memory to disk.

Building SDK Samples

This sample uses the following keywords:

_lclose; _lwrite; animatepalette; atan; bboundaryscanfix; bchangedibcolor; bcheckmutexmenuitem; bcleanupprinter; bcolor2bw; bcolor2mono; bcolorcycle; bcolorreplace; bcolorshift; bcycle; bdirtopt; bdrawdib; beginpaint; beginpath; bescape; bfreerlefile; binitinfo; binitprinter; bitblt; bitmap; bplayrle; bplayrlecont; bplayrlecont2; bprintbmp; breleaseinfodata; bresetglobal; bsaverlefile; bselectdibpal; bstorerlefile; bvalidmode; checkmenuitem; childwndproc; choosecolor; closehandle; copypalette; cos; createbitmap; createcompatiblebitmap; createcompatibledc; createdc; createdibitmap; createdibsection; createevent; createfile; createfilemapping; createfontindirect; createhalftonepalette; createpalette; createpatternbrush; createpen; createsolidbrush; createthread; createwindow; createwindowex; defframeproc; defmdichildproc; defwindowproc; deletedc; deleteobject; dialogbox; dibfromddb; dispatchmessage; dptolp; drawbitmap; drawmenubar; dwgetnextboundarypoint; dwshift; enablemenuitem; enddialog; enddoc; endpage; endpaint; endpath; enumchildwindows; enumprinters; errorout; escape; exitthread; extfloodfill; exttextout; getclassname; getclientrect; getcurrentdirectory; getdc; getdevicecaps; getdibits; getfilesize; getfocus; getlasterror; getmapmode; getmessage; getmodulehandle; getobject; getopenfilename; getpaletteentries; getparent; getpixel; getsavefilename; getstockobject; getstringres; getsubmenu; getsyscolor; getsystemdirectory; getsystemmetrics; getsystempaletteentries; gettextmetrics; gettickcount; getwindowlong; getwindowrect; getwindowtext; globalalloc; globalfree; hbrcreatebrush; icreatepenfrpal; initializeapp; insertmenu; invalidaterect; ldiv; lineto; lmul; loadbitmapfile; loadcursor; loadicon; loadmenu; localalloc; localfree; locallock; localunlock; mainwndproc; makeintresource; mapviewoffile; memset; messagebox; movetoex; movewindow; openfile; outputdebugstring; paletteindex; patblt; pathtoregion; peekmessage; pgetinfodata; polyline; postmessage; postquitmessage; ppttrace; realizepalette; registerclass; releasecapture; releasedc; removemenu; resetevent; resumethread; rgb; savebitmap; savebitmapfile; selectclippath; selectcliprgn; selectobject; selectpalette; sendmessage; setbkcolor; setbkmode; setcapture; setcursor; setdibits; setdibitstodevice; setevent; setfocus; setmapmode; setpixel; setrop2; setstretchbltmode; settextcolor; setthreadpriority; setwindowlong; setwindowpos; setwindowtext; sin; sleep; sprintf; sqrt; startdoc; startdraw; startdraw2; startdrawfix; startmandelbrot; startmandelbrotfix; startpage; strcat; strcmp; strcpy; stretchblt; stretchdibits; strokepath; suspendthread; switch; systemparametersinfo; terminatethread; translateaccelerator; translatemdisysaccel; translatemessage; unmapviewoffile; unreferenced_parameter; updatecolors; updatewindow; vchkmenuitem; viewerwndproc; waitforsingleobject; winmain; wsprintf; xform; xform2; xformfix; xy


Metafile GDI Sample

Click to open or copy the files for the Metafile sample.


Palette: GDI DirectDraw Palettes Sample

Click to open or copy the files for the Palette sample.

Palette is a basic example that shows how to use DirectDraw palettes. Four separate DirectDrawPalette objects are created, and they can be attached to the primary surface just by selecting a menu item. Any given palette can be cycled through its red values. You can create the palettes in exclusive mode or not.

See also the DirectX Palette sample.

Building SDK Samples

This sample uses the following keywords:

beginpaint; clienttoscreen; endpaint; getclientrect; getdc; getdevicecaps; getpixel; getwindowrect; loadicon; long2point; messagebeep; messagebox; paletteindex; patblt; releasedc; setwindowpos; showcolor; unreferenced_parameter; winmain; wndproc


Printer: Printing Sample

Click to open or copy the files for the Printer sample.

The Printer sample shows how to print using both the CreateDC and the PrinterDlg methods for acquiring a printer HDC. The user is allowed to print different graphical objects, as well as a complete device font set. An "Abort" dialog box is also implemented.

The Printer sample also does the following:

  • Provides complete device capabilities for all printers and the display.

  • Provides information (levels 1 and 2) returned by a call to EnumPrinters.

  • Shows how to enumerate fonts for a particular DC.

  • Illustrates differences among the various mapping modes.

  • Demonstrates GDI features.

Building SDK Samples

This sample uses the following keywords:

createdc; deletedc; errmsgbox; getlasterror; getstringres; getstringres2; isdbcsleadbyte; mainwndproc; makeintresource; my_mbslen; outnum; outstr; outstr2; outstr3; printdlg; printthread; registerclass; strcat; winmain; wsprintf


Reversi: Sample Game

Click to open or copy the files for the Reversi sample.

This sample includes the following functions:

Function | Description
UpdateCursor | Updates the cursor position
Checkdepth | Updates Skill menu items
Clearboard | Clears board and sets starting pieces
RevCreate | Creates Reversi; called on WM_CREATE messages
Printboard | Draws game pieces on board
ClearMessageTop | Clears message bar
ShowMessageTop | Displays string in message bar
Drawboard | Draws game board
RevPaint | Paints Reversi; called on WM_PAINT messages
FlashMessageTop | Sets up system timer for callback procedure
RevMessage | Outputs flashing message at top of window
Flashsqr | Flashes game piece
RevMouseMove | Updates cursor to show legality of move
ShowBestMove | Updates cursor and mouse position to show best move
Gameover | Finds a human reply to the computer's move
Paintmove | Makes a move and shows the results
RevMenu | Handles menu selections; called on WM_COMMAND messages
RevInit | Initializes window data and registers window
RevMouseClick | Handles mouse click or keyboard space or CR
Next | Finds next square
Previous | Finds previous square
ShowNextMove | Shows next legal move
RevChar | Handles keystrokes; called on WM_KEYDOWN messages
InverseMessage | Callback; inverts message bitmap or kills timer
ReversiWndProc | Processes messages for Reversi window
AboutDlgProc | Processes messages for About dialog box
WinMain | Calls initialization function, processes message loop
Finalscore | Calculates final score
Legalcheck | Returns 1 if move legal, else returns 0
Makemove | Handles capturing of enemy pieces
Score | Calculates the value of board
Minmax | Plays human move then recursively plays computer move

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; beginpaint; checkdepth; checkmenuitem; clearboard; clearmessagetop; clienttoscreen; createsolidbrush; createwindow; defwindowproc; deleteobject; dialogbox; dispatchmessage; drawboard; ellipse; enablemenuitem; enddialog; endpaint; finalscore; flashmessagetop; flashsqr; gameover; get_wm_activate_hwnd; get_wm_activate_state; get_wm_command_id; getclientrect; getdc; getdevicecaps; getinstancedata; getkeystate; getmenu; getmessage; getstockobject; getsystemmetrics; gettextextentpoint; gettextmetrics; inversemessage; isiconic; killtimer; legalcheck; lineto; loadaccelerators; loadcursor; loadicon; loadstring; localalloc; localfree; long2point; lstrlen; makeintresource; makemove; makempoint; makepoint; makeprocinstance; messagebox; minmax; movetoex; next; paintmove; patblt; postmessage; postquitmessage; previous; printboard; registerclass; releasecapture; releasedc; revchar; revcreate; reversiwndproc; revinit; revmenu; revmessage; revmouseclick; revmousemove; revpaint; rgb; score; selectobject; setbkmode; setcapture; setcursor; setcursorpos; setfocus; settimer; setwindowtext; showbestmove; showcursor; showmessagetop; shownextmove; showwindow; textout; translateaccelerator; translatemessage; unreferenced_parameter; updatecursor; updatewindow; width; winmain


SetDisp: Dynamically Changing the Display Settings

Click to open or copy the files for the SetDisp sample.

The SetDisp sample creates a taskbar notification icon that you can use to dynamically change your display settings. You can change resolution, color depth, and refresh rate.

Building SDK Samples

This sample uses the following keywords:

createmenu; destroyicon; destroymenu; dialogbox; enddialog; free; get_wm_command_id; getmenu; getversionex; isnt; killtimer; loadimage; lstrcpyn; makeintresource; messagebox; notifyadd; notifydelete; outputdebugstring; qsort; sendmessage; setmenudefaultitem; setmenuitembitmaps; settimer; shell_notifyicon; showwindow; switch; text; traymessage; trc; unreferenced_parameter; verifydlgproc; verifytimerproc; wsprintf


ShowDIB: Opening/Displaying Device Independent Bitmaps

Click to open or copy the files for the ShowDIB sample.

The ShowDib sample illustrates how to deal with Device Independent Bitmaps (DIBs), and implement proper palette management.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; _lwrite; abortdoc; addext; alignulong; animatepalette; appabout; apppaint; beginpaint; bitblt; bitmapfromdib; bound; charnext; charprev; charupper; checkdlgbutton; checkmenuitem; closeclipboard; copypalette; createbipalette; createbitmap; createcompatibledc; createdibitmap; createdibpalette; createpalette; createwindow; deletedc; deleteobject; destroywindow; dibfrombitmap; dibinfo; dibnumcolors; dlgcheckokenable; dlgdirselectex; dlgfnopen; drawselect; enablemenuitem; enablewindow; enddoc; endpage; endpaint; endwait; errmsg; escape; fid; filllistbox; fillrect; freedib; freeprocinstance; fsearchspec; get_em_setsel_mps; get_wm_activate_state; get_wm_command_cmd; get_wm_hscroll_code; get_wm_hscroll_pos; get_wm_vscroll_code; get_wm_vscroll_pos; getclientrect; getclipboarddata; getcurrentdirectory; getdc; getdevicecaps; getdibits; getdlgitem; getmenu; getobject; getpaletteentries; getprinterdc; getprinterdc1; getprofilestring; getscrollpos; getstockobject; gettextextentpoint; getwindowrect; getwindowtext; globalalloc; globalfree; globallock; globalrealloc; globalunlock; idf; initdib; initprinting; invalidaterect; isclipboardformatavailable; isdbcsleadbyte; isdialogmessage; isdib; isrectempty; killtimer; loadcursor; loadicon; loadstring; localalloc; localfree; lread; lstrcpy; lstrlen; lwrite; makeintresource; makelong; makempoint; memset; menucommand; messagebeep; messagebox; min; normalizerect; openclipboard; opendib; openfile; palettesize; patblt; peekmessage; postmessage; postquitmessage; printdib; printdlg; readbitmapfileheaderandconverttodwordalign; readdibbitmapinfo; realizedibformat; realizepalette; releasecapture; releasedc; renderformat; selectobject; selectpalette; sendmessage; setabortproc; setcapture; setclipboarddata; setcursor; setdlgitemtext; setpaletteentries; setrectempty; setscrollranges; settimer; setwindoworgex; sizewindow; sprintf; startdoc; startpage; startwait; strcpy; swap; termprinting; unreferenced_parameter; va_start; waitmessage; widthbytes; winmain; writedib; writemapfileheaderandconvertfromdwordaligntopacked; writeprofilestring


TextFX: TextFX Template for Windows Applications

Click to open or copy the files for the TextFX sample.

This sample has the following files and functions.

FX.c - Functions for rendering text with special effects:

Function | Description
FillOut | Converts an array of line segments into an array of all the points in the segments.
RenderPathPoints | Renders the outline of points returned from GetPath.
RenderAndFillPath | Renders the points returned from GetPath as a filled polygon.
TextEffect | Draws a string of text between two guide lines.

Guide.c - Routines for handling guide lines:

Function | Description
GetGuideLine | Retrieves a guide line from the user. A guide line is just an array of line segments.
ShowGuide | Displays a guide line into a DC.

TextFX.c - TextFX template for Windows applications:

Function | Description
GetLastErrorBox | Reports GetLastError values as text.
WinMain | Calls the initialization function and processes the message loop.
InitApplication | Initializes window data and registers window.
InitInstance | Saves instance handle and creates main window.
WndProc | Processes messages.
CenterWindow | Centers the About dialog box over the application window.
About | Processes messages for the About dialog box.

Building SDK Samples

This sample uses the following keywords:

addsegment; beginpaint; beginpath; checkmenuitem; choosefont; closefigure; countpoints; createfontindirect; createpen; createsolidbrush; createwindow; defwindowproc; deleteobject; dialogbox; dispatchmessage; ellipse; enddialog; endpaint; endpath; fillout; fillpath; formatmessage; getclientrect; getdc; getguideline; getlasterror; getlasterrorbox; getmenu; getmessage; getpath; getrealtextextent; getstockobject; gettextextentpoint32; globalalloc; globalfree; initapplication; initinstance; invalidaterect; linedda; lineto; loadcursor; localfree; makelangid; memset; messagebox; movetoex; patblt; peekmessage; polybezierto; polydraw95; polyline; postquitmessage; rand; randfloat; random; registerclass; releasecapture; releasedc; renderandfillpath; renderpathpoints; rgb; selectobject; setbkmode; setcapture; setlasterror; setrop2; showguide; showwindow; srand; strcpy; strokepath; texteffect; textout; time; translatemessage; unreferenced_parameter; updatewindow; waitmessage; winmain; wndproc; zeromemory


WinNT

Click to open or copy the files for the WinNT samples.


PlgBlt: Parallelogram Blt Demonstration

Click to open or copy the files for the PlgBlt sample.

The PlgBlt function can copy a bit image onto an arbitrary parallelogram. Applications can use this function to easily rotate or shear bitmaps. The PlgBlt sample is an easy-to-use demonstration of how this can be done.

Building SDK Samples

This sample uses the following keywords:

beginpaint; bitblt; checkmenuitem; createcompatibledc; createwindow; defwindowproc; deletedc; deleteobject; dispatchmessage; dlgproc; dotrackobject; fabs; gdiflush; getdlgitemint; getmenustate; getmessage; getstockobject; getworldtransform; iswindow; loadcursor; loadicon; mainwndproc; memset; mousemove; postquitmessage; primarylangid; registerclass; releasecapture; selectobject; setcapture; setdlgitemint; setdlgitemtext; setrop2; setworldtransform; showwindow; sqrt; translateaccelerator; unreferenced_parameter; winmain


Wxform: World Coordinate Transformation

Click to open or copy the files for the Wxform sample.

The Wxform sample provides a demonstration of the new world coordinate transformation. This sample displays a rectangle in world coordinates and a matrix containing the transform values. Users can directly manipulate the rectangle and see the effect on the transformation, or they can set the transformation and see the effect on the rectangle.

Building SDK Samples

This sample uses the following keywords:

beginpaint; createdialog; createwindow; defwindowproc; deleteobject; dispatchmessage; dotrackobject; getdc; getdlgitemtext; getmessage; getstockobject; getviewportorgex; getworldtransform; loadcursor; loadicon; mainwndproc; mousedlgproc; mousemove; offsetrect; postquitmessage; registerclass; releasecapture; selectobject; setcapture; setdlgitemtext; setrop2; setworldtransform; showwindow; sqrt; transformdlgproc; translatemessage; unreferenced_parameter; updatewindow; winmain


Image Color Management (ICM) Samples

Click to open or copy the files for the ICM20 sample.

For more information about ICM, see Color Management in the Platform SDK.


ICMView: ICM-Capable Image Viewer Sample

Click to open or copy the files for the ICMView sample.

It is recommended that you download from the parent level (ICM20), to get the general ICM Readme file.

This sample is an ICM-capable image viewer. This application uses ICM both inside and outside the DC ICM functions to manipulate the display and printing of Windows BMP and DIB format images. Typically, an application would just use one or the other; the preferred and encouraged method is outside the DC.

To run the application, type "ICMVIEW". Choose Open from the File menu to open images, then use the secondary mouse button to bring up the properties of the selected image.

ICMView includes the following files:

File | Purpose
Appinit.c | Initialization
Cderr.h | Error handling
Child.c | Child windows
Debug.c | Debug routines
Dialogs.c | Dialog boxes
Dibinfo.c | DIB information
Dibs.c | DIB handling
Icmview.c | Entry point
Print.c | Printing routines
Regutil.c | Registry utilities

The ICMView sample requires the BITMAPV5HEADER structure, to compile. This structure should be defined in the Wingdi.h file used in the compilation process. If this structure is not defined, you will need to obtain an updated version of the Win32 or Windows Platform SDK.

Building SDK Samples

This sample uses the following keywords:

_assert; _stprintf; _tcschr; _tcscmp; _tcscpy; _tcslen; _tsplitpath; abortdoc; abs; addrecentfile; applycolorsettings; assert; bitcount; bitmapbluemask; bitmapclrimportant; bitmapclrused; bitmapcompression; bitmapcstype; bitmapgreenmask; bitmapheight; bitmapimagesize; bitmapintent; bitmapredmask; bitmapsize; bitmapwidth; centerwindow; check_dwflag; checkdlgbutton; checkmenuitem; checkradiobutton; childwndpaint; childwndproc; clear_dwflag; clienttoscreen; closecolorprofile; closehandle; colormatchtotarget; colormatchui; colorsetupapply; commdlgextendederror; convertintent; copydibinfo; copyrect; copystring; createcolortransform; createdc; createdialog; createdialogparam; createdibinfo; createdibpalette; createdibpropsheet; createfile; createfilea; createfont; createglobaldibinfo; createnewimagewindow; createwindowex; debugbreak; debugmsg; defframeproc; defmdichildproc; deletecolortransform; deletedc; deletefile; destroymenu; destroywindow; dialogbox; dibheight; dispatchmessage; display_lasterror; dlgdibinfopaint; dlgdibpropsheet; dlgseticmoptionsfordevice; documentproperties; dumpbitmapfileheader; dumpbmpheader; dumpcolormatchsetup; dumpdibinfo; dumplogcolorspace; dumpmemory; dumpprofile; dumprectangle; enable_dwflag; enablemenuitem; enablewindow; end_wait_cursor; enddialog; enddoc; endpage; enumicmprofilecallback; enumprinter; enumprinters; errmsg; fduplicatedibinfo; fduplicateicminfo; ffreedibinfo; files; findcolortable; finddibbits; fopennewimage; formatlasterror; formatmessage; freaddibinfo; freememory; getbasefilename; getclientrect; getcolordirectory; getcolorprofilefromhandle; getcolorspacefrombitmap; getcurrentmdiwnd; getdc; getdefaulticminfo; getdefaulticmprofile; getdefaultprinterdc; getdefaultprinterdevmode; getdefaultprintername; getdevicecaps; getdibhandlefromdibinfo; getdibinfohandle; getdibinfoptr; getdlgitem; getdlgitemstring; getdlgitemtext; getfileversioninfo; getfileversioninfosize; geticmprofile; getlasterror; getmemory; getmenu; getmenuitemcount; getmenuiteminfo; getmessage; getobject; getopenfilename; getopenimagename; getparent; getprinterdc; getprofiledata; getprofilesavename; getprofilestring; getprop; getregistrystring; getsavefilename; getsavefilenamea; getscrollinfo; getscrollpos; getsettings; getstandardcolorspaceprofile; getsubmenu; getsystemmetrics; gettempfilename; gettemppath; gettickcount; getversion; getwindowlong; getwindowplacement; globalalloc; globalflags; globalfree; globalhandle; globallock; globalrealloc; globalsize; globalunlock; images; initapplication; initcommoncontrols; initdibinfo; initializescrollbars; initimagemenu; initinstance; initprinting; insertmenuitem; invalidaterect; is_bitmapcoreheader; is_bitmapinfoheader; is_bitmapv4header; is_bitmapv5header; is_win30_dib; iscolorprofilevalid; isdialogmessage; isdib; isdlgbuttonchecked; iswindow; iszoomed; labs; ldexp; loadaccelerators; loadcursor; loadicon; loadmenu; loadstring; lstrcat; lstrcmpi; lstrcpy; lstrcpyn; lstrlen; makeintresource; makelangid; makelong; memcpy; memset; messagebeep; messagebox; numcolorsindib; opencolorprofile; opencolorprofilefromfile; outputdebugstring; outputdebugstringa; palettesize; populateprintercombobox; postmessage; postquitmessage; printdialog; printdialogproc; printdib; printdlg; printimage; processcderror; profilesize; propertysheet; readdibfile; readdibfromfile; readfile; rectheight; rectwidth; regclosekey; regcreatekeyex; registerclassex; registercmmproc; registericmviewclasses; regopenkey; regopenkeyex; regqueryvalueex; regsetvalueex; releasedc; removeprop; safefree; safelock; safeunlock; savedibinfodlgpage; savedibtofile; savedibtofiledialog; scrollchildwindow; scrollwindowex; selectprinter; senddlgitemmessage; sendmessage; set_dwflag; setabortproc; setcolormatchuiflags; setcursor; setdlgitemtext; setdlgmsgresult; setdwflags; setfilepointer; setfocus; seticmmode; seticmprofile; setlasterror; setmenuiteminfo; setprop; setrect; setscrollinfo; setsettings; setupcolormatching; setupdc; setwindowlong; setwindowpos; setwindowtext; showwindow; sizescrollbars; spl_enumprinters; start_wait_cursor; startdoc; startpage; stretchdibits; support_gamma_ramps; swap; systemparametersinfo; termprinting; toggle_boolean; transformdiboutsidedc; transformprogress; transformprogressproc; translatebitmapbits; translatecolors; translatecolortable; translatemessage; updaterecentfiles; updatestring; updatewindow; va_end; va_start; verqueryvalue; warning; widthbytes; winmain; wndproc; writefile; wsprintf; wsprintfa; wvsprintf; wvsprintfa


Input Sample

Click to open or copy the files for the Input sample.


Joytoy: Sample Joystick Application

Click to open or copy the files for the Joytoy sample.

Joytoy is a Windows with Multimedia application that illustrates how to use the joystick services. When run, it presents the user with a crosshair cursor. When the joystick or the mouse is moved, the cursor follows. When a joystick button is pressed, Joytoy produces a sound and draws a bullet hole icon onto the screen.

To work correctly, this sample requires Windows® 95.

Building SDK Samples

This sample uses the following keywords:

createwindow; defwindowproc; dispatchmessage; drawhole; drawicon; drawsight; findresource; freeresource; getcursorpos; getdc; getmessage; getstockobject; getsystemmetrics; initjoytoy; joygetnumdevs; joyreleasecapture; joysetcapture; loadcursor; loadicon; loadresource; lockresource; messagebeep; messagebox; postmessage; postquitmessage; registerclass; releasedc; setcursorpos; sndplaysound; switch; translatemessage; unlockresource; winmain; wndproc


Video Samples

Click to open or copy the files for the Video samples.

Sample | Description
AVIedit | Simple AVI editing application using the editing APIs in AVIfile.
AVIview | Simple AVI viewing application using the read/write APIs in AVIfile.
CAPtest | Sample capture application that uses the AVICap capture window class.
DSEQfile | AVIfile file handler for DIB sequences. Implemented in C++. To install, execute dseqfile.reg and copy dll to system dir. Can be used with AVIedit or AVIview.
LangPlay | Plays back multi-audio stream AVI files. Multilng.avi is an example file found on the CD.
MovPlay | Simple application for playing movies using MCI. Builds two versions, one using mciSendCommand and another using mciSendString.
Mplay | Simple AVI playback application. Includes a subset of the features in Media Player and uses the MCIWnd window class.
PalMap | Stream handler that translates video streams into new streams of a different bit depth--for example, it can translate from 24-bit to 8-bit. Copy dll to system directory and use with AVIview, 'Find Optimal Palette' menu item.
TextOut | Text stream draw renderer for rendering text data in AVI files. To install on Win95, copy dll to system dir and add the following line to [drivers32] section of system.ini: txts.draw=txtout32.dll. On NT, install from control panel, drivers applet, pointing to the sample directory. Example text stream is in Output.avi, created by the WRITEAVI sample.
VidCap | Full-featured video capture application.
WriteAVI | Example showing how to use the AVIfile interface to write files such as those that AVIview reads.

The following video-related samples are in the Audio Samples section:

MCIplay | Simple video playback application. Uses MCIWnd.
MCIpuzzl | Application lets you make a 15-square puzzle of a playing video sequence. Shows how to use installable draw procedures.
MMcaps | Sample that shows the multimedia capabilities of the hardware.


AVIedit: Editing APIs in AVIfile

Click to open or copy the files for the AVIedit sample.

This sample is a simple AVI editing application using the editing APIs in AVIfile.

Building SDK Samples

This sample uses the following keywords:

_fmemset; aboutdlgproc; app_oncommand; app_oncreate; app_ondestroy; app_ondropfiles; app_onendsession; app_onhscroll; app_oninitmenu; app_onkey; app_onlbuttondown; app_onlbuttonup; app_onpalettechanged; app_onrbuttondown; app_onsize; app_onvscroll; appinit; appwndproc; aviaudioclosedevice; aviaudioifillbuffers; aviaudiomessage; aviaudioopendevice; aviaudioplay; aviaudiostop; aviaudiotime; avibuildfilter; aviclearclipboard; avifileexit; avifilegetstream; avifileinit; avifileopen; avifilerelease; avigetfromclipboard; avimakefilefromstreams; aviputfileonclipboard; avisaveoptions; avisaveoptionsfree; avisavev; avistreamend; avistreamendtime; avistreamformatsize; avistreamgetframe; avistreamgetframeclose; avistreamgetframeopen; avistreaminfo; avistreamlength; avistreamread; avistreamreadformat; avistreamrelease; avistreamsamplesize; avistreamsampletosample; avistreamsampletotime; avistreamstart; avistreamstarttime; avistreamtimetosample; beginpaint; callwindowproc; checkdefdlgrecursion; checkmenuitem; closeclipboard; createeditablestream; createsolidbrush; createwindow; defdlgprocex; defwindowproc; deleteobject; destroywindow; dialogbox; dispatchmessage; dlg_defproc; dodataexchange; dragacceptfiles; dragfinish; dragqueryfile; drawdibclose; drawdibdraw; drawdibopen; drawdibrealize; dropavi; edit_setsel; editdone; editpaste; editstreamclone; editstreamcopy; editstreamcut; editstreamname; editstreampaste; editstreamsetinfo; editstreamsetname; emptyclipboard; enablemenuitem; enddialog; endpaint; endwait; errmsg; excludecliprect; exttextout; fixscrollbars; fixwindowtitle; forward_wm_command; forward_wm_hscroll; forward_wm_vscroll; framerect; framevideo; freeavi; freedrawstuff; getasynckeystate; getbkcolor; getclientrect; getclipboardowner; getdc; getdlgitemlong; getdlgitemtext; getopenfilenamepreview; getparent; getsavefilename; getscrollpos; getscrolltime; getstockobject; getsyscolor; getwindowlong; getwindowtext; globalallocptr; globalfreeptr; globalptrhandle; globalreallocptr; globalsize; globalsizeptr; handle_msg; handle_wm_command; handle_wm_create; handle_wm_destroy; handle_wm_dropfiles; handle_wm_endsession; handle_wm_hscroll; handle_wm_initmenu; handle_wm_keydown; handle_wm_lbuttondblclk; handle_wm_lbuttondown; handle_wm_lbuttonup; handle_wm_palettechanged; handle_wm_rbuttondown; handle_wm_size; handle_wm_vscroll; inflaterect; infodlg_oncommand; infodlg_oninitdialog; initavi; initstreams; insertavifile; int32x32to64; invalidaterect; loadaccelerators; loadcursor; loadicon; loadstring; lstrcpy; lstrlen; makeintatom; makeintresource; max; menuhandler; messagebeep; messagebox; min; modifymenu; muldiv; muldiv32; muldivrd; muldivrn; muldivru; neweditproc; nukeavistream; openclipboard; paintaudio; paintstuff; paintvideo; patblt; peekmessage; postmessage; postquitmessage; registerclass; releasedc; rgb; savecallback; selectobject; selectstream; senddlgitemmessage; setactivewindow; setbkcolor; setcursor; setdlgitemlong; setdlgitemtext; setdlgmsgresult; setfocus; setinfodlgproc; setinfonewdlgproc; setscrollpos; setscrollrange; setscrolltime; setstreaminfo; setwindowlong; setwindowtext; showwindow; sndplaysound; startwait; switch; textout; timegettime; translateaccelerator; translatemessage; uint32x32to64; updatewindow; va_end; va_start; videoforwindowsversion; waitmessage; warning; waveoutclose; waveoutgetposition; waveoutopen; waveoutpause; waveoutprepareheader; waveoutreset; waveoutrestart; waveoutunprepareheader; waveoutwrite; winmain; winyield; wsprintf; yield


AVIview: Read/Write APIs in AVIfile

Click to open or copy the files for the AVIview sample.

This sample is a simple AVI viewing application using the read/write APIs in AVIfile.

The sample contains an AVIstream handler for a bouncing ball. This code demonstrates how to write a custom stream handler so an application can deal with your custom file or data by using the standard AVIstream functions.

Building SDK Samples

This sample uses the following keywords:

_fmemcmp; _fmemcpy; _fmemset; _stdclassimplementations; aboutdlgproc; addref; alignulong; appcommand; appinit; appwndproc; aviaudioclosedevice; aviaudioifillbuffers; aviaudiomessage; aviaudioopendevice; aviaudioplay; aviaudiostop; aviaudiotime; aviballaddref; aviballcreate; aviballinfo; aviballqueryinterface; aviballrelease; avibuildfilter; avifileexit; avifilegetstream; avifileinit; avifileopen; avifilerelease; avisaveoptions; avisaveoptionsfree; avisavev; avistreamend; avistreamendtime; avistreamfindsample; avistreamformatsize; avistreamgetframe; avistreamgetframeclose; avistreamgetframeopen; avistreaminfo; avistreamlength; avistreamlengthtime; avistreamread; avistreamreadformat; avistreamrelease; avistreamsamplesize; avistreamsampletotime; avistreamstart; avistreamstarttime; avistreamtimetosample; beginpaint; bit; cappcf; checkmenuitem; copymemory; coregisterclassobject; corevokeclassobject; create; createinstance; createpalette; createsolidbrush; createwindowex; crunchdib; defwindowproc; deleteobject; dialogbox; dialogboxparam; dibptr; dibwidthbytes; dispatchmessage; dprintf; drawdibbegin; drawdibclose; drawdibdraw; drawdibopen; drawdibrealize; enablemenuitem; enddialog; endpaint; endwait; errmsg; excludecliprect; exttextout; failed; fixcc; fixscrollbars; fixwindowtitle; forward_wm_command; framerect; freeavi; freedrawstuff; freelibrary; get_wm_command_id; get_wm_hscroll_code; get_wm_hscroll_pos; get_wm_vscroll_code; get_wm_vscroll_pos; getbvalue; getclientrect; getcommandline; getdc; getdlgitem; getdlgitemint; getgvalue; getnearestpaletteindex; getnumberofcolors; getnumberofcolorsdlgproc; getopenfilenamepreview; getprocaddress; getrvalue; getsavefilename; getscode; getscrollpos; getscrolltime; getstockobject; getsyscolor; gettextmetrics; globalallocptr; globalfreeptr; globalptrhandle; globalreallocptr; globalsize; globalsizeptr; inflaterect; initavi; initball; initstreams; insertavifile; int32x32to64; invalidaterect; isequalclsid; loadaccelerators; loadcursor; loadicon; loadlibrary; lockserver; lstrcpy; lstrlen; makeinst; makeintatom; makeintresource; mapvga; max; messagebox; min; mmiofourcc; muldiv32; muldivrd; muldivrn; muldivru; newball; paintaudio; paintstuff; paintvideo; patblt; peekmessage; pel; pel1; pel16; pel24; pel4; pel8; pf1; pf2; pf3; pf4; pf5; pf6; pf7; pf8; pf9; postmessage; postquitmessage; print; queryinterface; registerclass; registerobjects; release; releasedc; resultfromscode; revokeobjects; rgb; rgb16; rgb16b; rgb16g; rgb16r; savecallback; selectobject; setbkcolor; setcursor; setdlgitemint; setscrollpos; setscrollrange; setscrolltime; setwindowtext; showwindow; sndplaysound; startwait; stdmethodimp_; summono; sumrgb; switch; text; textout; timegettime; translateaccelerator; translatemessage; uint32x32to64; updatewindow; va_end; va_start; waitmessage; warning; waveoutclose; waveoutgetposition; waveoutopen; waveoutpause; waveoutprepareheader; waveoutreset; waveoutrestart; waveoutunprepareheader; waveoutwrite; widthbytes; winmain; winyield; wsprintf; yield


CapTest: AVICap Capture Window Class

Click to open or copy the files for the CapTest sample.

This sample is a capture application that uses the AVICap capture window class.

Building SDK Samples

This sample uses the following keywords:

_based; _fmemset; _segname; aboutproc; acmformatchoose; acmmetrics; alloccapfileproc; appendmenu; atol; audioformatproc; beginpaint; capcapturegetsetup; capcapturesequence; capcapturesetsetup; capcreatecapturewindow; capdlgvideocompression; capdlgvideodisplay; capdlgvideoformat; capdlgvideosource; capdriverconnect; capdrivergetcaps; capeditcopy; capfilealloc; capfilegetcapturefile; capfilesaveas; capfilesetcapturefile; capgetaudioformat; capgetdriverdescription; capgetstatus; capgrabframenostop; capoverlay; cappaletteauto; cappalettepaste; cappreview; cappreviewrate; capsetaudioformat; capsetcallbackonerror; capsetcallbackonframe; capsetcallbackonstatus; capsetcallbackonvideostream; capsetmcidevicename; capsetupproc; centercapturewindow; checkdlgbutton; checkmenuitem; checkradiobutton; closehandle; countmcidevices; createfile; createwindowex; defwindowproc; destroywindow; dialogbox; dispatchmessage; drawmenubar; enablemenuitem; enablewindow; enddialog; endpaint; errorcallbackproc; field_offset; framecallbackproc; freeprocinstance; get_wm_command_id; getclientrect; getdiskfreespace; getdlgitem; getdlgitemint; getdlgitemtext; getfilesize; getfreediskspace; getfreediskspaceinkb; getfullpathname; getmenu; getmessage; getopenfilename; getsavefilename; getstockobject; getsubmenu; globalallocptr; globalfreeptr; height; ischaralpha; ischaralphanumeric; isclipboardformatavailable; isdlgbuttonchecked; isdriverindex; loadaccelerators; loadcursor; loadicon; loadstring; lstrcpy; lstrlen; mainwndproc; makeintresource; makepaletteproc; makeprocinstance; max; mcisendcommand; menuproc; messagebeep; messagebox; movewindow; postmessage; postquitmessage; registerclass; selectorof; setbkmode; setdlgitemint; setdlgitemtext; setfocus; setwindowpos; setwindowtext; showwindow; sizeofacmstr; startnewvideochannel; statuscallbackproc; text; translateaccelerator; translatemessage; updatewindow; videocallbackproc; wcstol; width; winmain; wsprintf


DseqFile: AVIfile File Handler for DIB Sequences

Click to open or copy the files for the DseqFile sample.

This sample is an AVIfile file handler for DIB sequences. It is implemented in C++. To install, execute Dseqfile.reg and copy the DLL to the system directory. This sample can be used with AVIedit or AVIview.

Building SDK Samples

This sample uses the following keywords:

_fmemset; _stdclassimplementations; addref; ansiprev; cavifile; cavifilecf; cavifileimpl; cavistreamimpl; cfactoryimpl; cmarshalimpl; cogetstandardmarshal; cpersistfileimpl; create; createinstance; createstream; cunknownimpl; define_aviguid; delete; deletestream; dibwidthbytes; dllcanunloadnow; dllgetclassobject; dllmain; dpf; dprintf; dseqparsefilename; endrecord; failed; filename; findsample; getmarshalsizemax; getprofileinta; getscode; getstream; getunmarshalclass; globalallocptr; globalfreeptr; hmemcpy; info; libmain; loadframe; loadstring; lockserver; lstrcpya; lstrlen; marshalinterface; max; min; mmioclose; mmioflush; mmioopen; mmioread; mmiowrite; openfile; outputdebugstringa; queryinterface; readdata; readformat; release; resultfromscode; seterrormode; setformat; setinfo; setrect; slash; stdmethodimp_; switch; va_end; va_start; warning; wep; widthbytes; writedata; writeframe; wsprintf; wsprintfw; wvsprintfa


LangPlay: Play Multi-Audio Stream AVI Files

Click to open or copy the files for the LangPlay sample.

LangPlay is a sample Windows application to play AVI movies (multi-audio stream) using MCIWnd. It handles multiple language track movies and lets the user select the track to listen to at playback. Multing.avi is an example file found on the CD.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; adjustwindowrect; appendmenu; avifileclose; avifileexit; avifilegetstream; avifileinfo; avifileinit; avifileopen; avistreamclose; avistreaminfo; beginpaint; buildlangmenu; checkmenuitem; createwindow; defwindowproc; deletemenu; destroywindow; dialogbox; dispatchmessage; drawmenubar; enablemenuitem; enddialog; endpaint; enumlangs; fileopenmovie; getmenu; getmenuitemcount; getmessage; getopenfilename; getsubmenu; getsystemmetrics; getwindowinstance; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; initapp; invalidaterect; isiconic; lstrcpy; makeintresource; mciwndclose; mciwndcreate; mciwnddestroy; mciwndopen; mciwndsendstring; memset; menubarupdate; messagebeep; messagebox; movewindow; postmessage; postquitmessage; registerclass; sendmessage; setwindowpos; setwindowtext; showwindow; switchlang; titlebarupdate; translatemessage; updatewindow; videoforwindowsversion; wndproc; wsprintf


MovPlay: Playing Movies Using MCI

Click to open or copy the files for the MovPlay sample.

This is a simple application for playing movies using MCI. It builds two versions, one using mciSendCommand and another using mciSendString.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; atoi; checkmenuitem; copyrect; createwindow; defwindowproc; dialogbox; dispatchmessage; drawmenubar; enablemenuitem; enddialog; fileclosemovie; fileopenmovie; formatfilterstring; getclientrect; getmenu; getmessage; getopenfilename; handle_wm_command; handle_wm_destroy; handle_wm_initmenupopup; handle_wm_size; initapp; initavi; invalidaterect; loadaccelerators; loadstring; lstrcpy; makeintresource; makelong; mcigetdeviceid; mcigeterrorstring; mcisendcommand; mcisendstring; memset; menubarupdate; messagebox; movewindow; movplay_oncommand; movplay_ondestroy; movplay_oninitmenupopup; movplay_onsize; playmovie; positionmovie; postmessage; postquitmessage; registerclass; seekmovie; setrectempty; setwindowtext; showwindow; stepmovie; switch; termavi; titlebarupdate; translateaccelerator; translatemessage; updatewindow; winmain; wndproc; wsprintf


Mplay: Simple AVI Playback Application

Click to open or copy the files for the Mplay sample.

This is a simple AVI playback application that includes a subset of the features in Media Player and uses the MCIWnd window class.

Building SDK Samples

This sample uses the following keywords:

dispatchmessage; getmessage; iswindow; loadstring; mciwndcreate; messagebeep; messagebox; postquitmessage; setwindowtext; translatemessage; videoforwindowsversion; winmain


PalMap: Video Stream Handler

Click to open or copy the files for the PalMap sample.

This sample is a stream handler that translates video streams into new streams of a different bit depth—for example, it can translate from 24-bit to 8-bit. To use it, copy the DLL to the system directory and use it with the AVIview Find Optimal Palette menu item.

Building SDK Samples

This sample uses the following keywords:

addaxisvariance; avicreatemappedstream; avistreamaddref; avistreamclose; avistreamgetframe; avistreamgetframeclose; avistreamgetframeopen; avistreaminfo; avistreamlength; avistreammakepalette; avistreamstart; check_axis; computepalette; createpalette; define_oleguid; deleteboxes; deletepalette; determinerepresentative; dibhistogram; dibreduce; dllmain; findsplitaxis; freehistogram; getbvalue; getdc; getdevicecaps; getgvalue; gethistogram; getobject; getpaletteentries; getrvalue; getscode; getsystempaletteentries; globalallocptr; globalfreeptr; hist; histogram1; histogram16; histogram24; histogram4; histogram8; histogrampalette; hmemcpy; inchistogram; initboxes; inithistogram; isequaliid; loadstring; localalloc; localfree; locallock; localunlock; lstrcpyn; max; memcopy; memfill; min; palmapstreamaddref; palmapstreamcreate; palmapstreamdelete; palmapstreamfindkeyframe; palmapstreaminfo; palmapstreamqueryinterface; palmapstreamread; palmapstreamreaddata; palmapstreamreadformat; palmapstreamrelease; palmapstreamsetformat; palmapstreamsetinfo; palmapstreamwrite; palmapstreamwritedata; reduce1; reduce16; reduce24; reduce4; reduce8; releasedc; resultfromscode; rgb; rgb16; shrinkbox; sortboxes; splitbox; splitboxaxis; switch; text; usehistogram; wep; wsprintf


TextOut: Rendering Text Data in AVI Files

Click to open or copy the files for the TextOut sample.

This sample is a text stream draw renderer for rendering text data in AVI files. To install it on Windows® 95, copy the DLL to the system directory and add the following line to [drivers32] section of System.ini:

txts.draw=txtout32.dll

On Windows® NT, install the sample from the Drivers applet in Control Panel, pointing to the sample directory. The example text stream is in Output.avi, created by the WriteAVI sample.

Building SDK Samples

This sample uses the following keywords:

_fstrlen; configure; configuredlgproc; defdriverproc; dialogboxparam; dllmain; dpf2; dprintf; dprintf2; draw; drawbegin; drawend; drawquery; driverproc; enddialog; exttextout; free; getinfo; getprofileint; getstate; getstockfont; hmemcpy; load; loadstring; localalloc; localfree; lstrcat; lstrcpy; mbstowcs; messagebox; min; mmiofourcc; open; outputdebugstring; queryabout; queryconfigure; selectfont; setrect; setstate; switch; va_end; va_start; wvsprintf


VidCap: Full-Featured Video Capture Application

Click to open or copy the files for the Vidcap sample.

This sample is a full-featured video capture application. VidCap is a data-capture application that lets you capture video sequences onto your computer system. With VidCap, you can capture individual images or entire video sequences from a VCR, a videodisc player, or a video camera and microphone. VidCap focuses on data collection; the VidEdit application, also included with Video for Windows, supports functions such as editing, compression, and formatting.

This sample includes an HLP (Help) file.

VidCap uses the following source files:

File | Description
Arrow.c | Arrow control window.
Dialogs.c | Dialog box processing.
Help.c | Help system interface. Supports F1 key help in the application and in dialog boxes by installing a hook, keeping track of which dialog box is currently displayed.
Profile.c | Stores profile information in the Registry. Win32/win16 utility functions to read and write profile items for multimedia tools.
Rlmeter.c | Audio recording level window. This window class acts as a VU Meter showing the current and peak volume. Set the volume via the WMRL_SETLEVEL message (lParam is the new level). The control tracks the peak level by means of a 2-second timer.
Status.c | Status bar window.
Toolbar.c | Toolbar control window.
Vidcap.c | WinMain and command processing.
Vidframe.c | Frame for the capture window. Window class that provides a frame for the AVICAP window in the VidCap capture tool. Responsible for positioning within the parent window, handling scrolling and painting a size border if there is room.

Building SDK Samples

This sample uses the following keywords:

_close; _fmemset; _fstrncpy; _fstrrchr; _lseek; _open; aboutproc; acmformatchoose; acmmetrics; addmcidevicenames; alloc_text; alloccapfileproc; arrowcontrolproc; arroweditchange; arrowinit; arrowtimerproc; atof; atoi; atol; audioformatproc; beginpaint; bitblt; callnexthookex; capcapturegetsetup; capcapturesequence; capcapturesetsetup; capcapturesingleframe; capcapturesingleframeclose; capcapturesingleframeopen; capcreatecapturewindow; capdlgvideocompression; capdlgvideodisplay; capdlgvideoformat; capdlgvideosource; capdriverconnect; capdrivergetcaps; capeditcopy; capfilealloc; capfilegetcapturefile; capfilesaveas; capfilesavedib; capfilesetcapturefile; capframesproc; capgetaudioformat; capgetdriverdescription; capgetstatus; capgetvideoformat; capgetvideoformatsize; capgrabframenostop; capoverlay; cappaletteopen; cappalettepaste; cappalettesave; cappreview; cappreviewrate; capsetaudioformat; capsetcallbackonerror; capsetcallbackonstatus; capsetcallbackonyield; capsetmcidevicename; capsetscrollpos; capsetupproc; checkdlgbutton; checkmenuitem; checkradiobutton; clienttoscreen; closestream; cmdloadpalette; cmdsavedib; cmdsavepalette; cmdsavevideoas; cmdsetcapturefile; copymemory; copyrect; countmcidevices; createcompatibledc; createfont; createpen; createsolidbrush; createwindow; createwindowex; defhookproc; defwindowproc; deletedc; deleteobject; destroywindow; dialogbox; dialogboxparam; dispatchmessage; dodialog; drawmenubar; enablemenuitem; enablewindow; enddialog; endpaint; errorcallbackproc; exttextout; fillrect; findresource; fntext; fps_to_ms; freeprocinstance; freeresource; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; get_wm_command_mps; get_wm_ctlcolor_hdc; get_wm_ctlcolor_hwnd; get_wm_hscroll_code; get_wm_hscroll_pos; get_wm_menuselect_cmd; get_wm_menuselect_flags; get_wm_menuselect_hmenu; get_wm_vscroll_code; get_wm_vscroll_pos; getarraybutt; getasynckeystate; getbmphandle; getbmpint; getbuttonsize; getbvalue; getcapture; getclientrect; getcurrentthreadid; getdc; getdiskfreespace; getdlgctrlid; getdlgitem; getdlgitemint; getdlgitemtext; getfocus; getfreediskspaceinkb; getfullpathname; getgvalue; gethinst; getkeypressed; getkeystate; getmenu; getmenuitemcount; getmessage; getmessagepos; getmodulefilename; getnumbuttons; getopenfilename; getparent; getpressed; getprivateprofileint; getprivateprofilestring; getrvalue; getsavefilename; getscrollpos; getscrollrange; getshifted; getstockobject; getsubmenu; getsyscolor; getsystemmetrics; gettextmetrics; getwhich; getwindowinstance; getwindowlong; getwindowplacement; getwindowrect; getwindowtext; getwindowuint; getwindowword; globalalloc; globalallocptr; globalfree; globalfreeptr; globalhandle; globallock; globalrealloc; globalsize; globalunlock; gwid; helpcontents; helpinit; helpmsghook; helpshutdown; initmenupopup; intersectrect; invalidaterect; invertarrow; invertrect; ischaralpha; ischaralphanumeric; isclipboardformatavailable; isdigit; isdlgbuttonchecked; isdriverindex; ishelpkey; iswindowenabled; killtimer; limitrange; lineto; loadaccelerators; loadcursor; loadicon; loadresource; loadstring; loaduibitmap; localalloc; localfree; lockresource; long2point; lstrcat; lstrcmp; lstrcpy; lstrlen; mainwndproc; makeintresource; makelong; makepaletteproc; makeprocinstance; mapwindowpoints; max; mcideviceclose; mcisendcommand; mcisendstring; mcisetupproc; menuproc; menuselect; messagebeep; messagebox; messageboxid; microsectostringrate; millisecvararroweditchange; min; mmgetprofilebinary; mmgetprofileflag; mmgetprofileint; mmgetprofilestring; mmwriteprofilebinary; mmwriteprofileflag; mmwriteprofileint; mmwriteprofilestring; movetoex; movewindow; nohardwaredlgproc; notifyparent; offsetrect; openfile; openstream; painttext; patblt; peekmessage; polygon; postmessage; postquitmessage; prefsdlgproc; ptinrect; rectheight; rectwidth; regclosekey; regcreatekey; registerclass; regopenkey; regqueryvalueex; regsetvalueex; releasecapture; releasedc; rgb; rgbq; rlmeter_register; rlmeterproc; screentoclient; scrollmsg; selectobject; senddlgitemmessage; sendmessage; sendscroll; setarraybutt; setbkcolor; setbkmode; setbmphandle; setbmpint; setbrushorg; setbuttonsize; setcapture; setclasslong; setclassword; setcurrenthelpcontext; setcursor; setdlgitemint; setdlgitemtext; setfocus; sethinst; setkeypressed; setmapmode; setnumbuttons; setpressed; setrect; setscrollpos; setscrollrange; setshifted; settextcolor; settimer; setviewportextex; setviewportorgex; setwhich; setwindowextex; setwindowlong; setwindoworgex; setwindowpos; setwindowshook; setwindowshookex; setwindowtext; setwindowuint; setwindowword; shellabout; showlevelproc; showwindow; smartwindowposition; sprintf; statuscallbackproc; statuscreatetools; statusdeletetools; statusgetheight; statusinit; statusupdatestatus; statuswndproc; strchr; streamdata; stringratetomicrosec; strrchr; switch; text; tmpstring; toolbaractivityfrombutton; toolbaraddtool; toolbarbuttonfromindex; toolbarcommand; toolbarexclusiveradio; toolbarfixfocus; toolbarfullstatefrombutton; toolbargetnumbuttons; toolbarindexfrombutton; toolbarindexfrompoint; toolbarinit; toolbarmodifyactivity; toolbarmodifyprevstate; toolbarmodifystate; toolbarmodifystring; toolbarmovefocus; toolbarpaintcontrol; toolbarprevstatefrombutton; toolbarrectfromindex; toolbarremovetool; toolbarretrievetool; toolbarsetbitmap; toolbarsetfocus; toolbarstatefrombutton; toolbarstringfromindex; toolbartypefromindex; toolbarwndproc; translateaccelerator; translatemessage; unhookwindowshook; unhookwindowshookex; unlockresource; unrealizeobject; updatewindow; upordown; validaterect; vidcapcreatewindows; vidcapenumeratedrivers; vidcapinithardware; vidcaplayout; vidcapreadprofile; vidcapreadsettingsprofile; vidcapregisterclasses; vidcapsetcapturefile; vidcapsetlive; vidcapsetoverlay; vidcapwriteprofile; vidcapwritesettingsprofile; vidframecreate; vidframecreatetools; vidframedeletetools; vidframehscroll; vidframelayout; vidframepaint; vidframeproc; vidframesetbrush; vidframevscroll; waveinaddbuffer; waveinclose; waveinopen; waveinprepareheader; waveinreset; waveinstart; waveinstop; waveinunprepareheader; winexec; winhelp; winmain; writeprivateprofilestring; wsprintf; yieldcallbackproc


WriteAVI: AVIfile Interface Sample

Click to open or copy the files for the WriteAVI sample.

This example shows how to use the AVIfile interface to write files such as those that AVIview reads. It creates the file Output.avi, an AVI file consisting of a rotating clock face.

This is a stripped-down example; a real application would have a user interface and check for errors.

Building SDK Samples

This sample uses the following keywords:

_fmemset; avifileclose; avifilecreatestream; avifileexit; avifileinit; avifileopen; avimakecompressedstream; avisaveoptions; avistreamclose; avistreamsetformat; avistreamwrite; createcompatiblebitmap; createcompatibledc; createfont; createpen; createsolidbrush; deletebitmap; deletebrush; deletedc; deletefont; deleteobject; deletepen; ellipse; exttextout; fillrect; freeframes; getdc; getdevicecaps; getdibits; getobject; getstockbrush; globalalloc; globalfreeptr; globallock; globalunlock; lineto; loadstring; makedib; makeframes; messagebeep; messagebox; mmiofourcc; movetoex; releasedc; rgb; selectbitmap; selectbrush; selectfont; selectpen; setbkcolor; setrect; settextcolor; videoforwindowsversion; winmain; wsprintf


Internet Samples

Click to open or copy the files for the Internet samples.

These samples (written in C/C++) demonstrate different Internet- or intranet-related technologies. See also the netds samples for additional networking sample code. The main Internet samples categories are the following:

Index | Programmatic access to the Content Indexing catalogs.
Scripting | ActiveX scripting.
WebPost | APIs for updating content on Web sites.


Content Indexing Catalog Samples

Click to open or copy the files for the Index samples.

The sample in this category demonstrates programmatic access to the Content Indexing catalogs. Content Indexing is a service in Windows NT version 5 that provides very fast full text search over material that has been indexed (typically files or Web pages) at the expense of disk space (for storing the catalogs).

The programmatic interface to the index server is via OLE DB.

The index server relies on "filters" (registered implementations of the IFilter interface) to parse different file formats. The following sample shows how such a filter DLL is built.

Ifilter Implementation of the IFilter interface for HTML files.

See Also

IFilter Implementation in COM and ActiveX Object Services

The "Index Server" section in the SDK documentation


IFilter: Sample of Indexing Document Content

Click to open or copy the files for the IFilter sample.

The IFilter interface was designed primarily to provide a uniform mechanism to extract character streams from formatted data. The goal was to provide ISVs with an interface that extracts text as the initial step in content indexing document data. IFilter can be implemented over any document format and the ISV can choose any API or interface to read the data format. For example, a content filter can be written that reads data using the Win32 file APIs or uses the OLE storage interfaces.

Any software author who stores textual data should consider implementing a content filter for the document format to allow content indexing systems to extract text.

The sample filter in this directory will extract text and properties from HTML pages. In addition to raw content, headings (levels 1 to 6), title and anchors are emitted as pseudo-properties. Title is also published as a full property available via IFilter::GetValue.

Building SDK Samples

This sample uses the following keywords:

_buf; _bytesreadfrommmbuffer; _cattributes; _cb; _ccharsreadahead; _charsreadfromtranslatedbuffer; _chrefchars; _chrefcharsfiltered; _clsidmetainfo; _clsidscriptinfo; _cpropchars; _cpropcharsfiltered; _ctagcharsread; _ctextchars; _cvaluechars; _cvaluecharsfiltered; _cwctranslatedbuffer; _dbginfo; _estate; _etoktype; _etoktypenext; _ffiltercontent; _ffiltermetatag; _ffilterscripttag; _fnomoretext; _fnonhtmlfile; _fungotchar; _fwrite; _guidpropset; _hfile; _hkey; _hmap; _htmlelementbag; _htmlifilter; _idchunk; _lerror; _locale; _pattributes; _pcurchar; _phashentrynext; _phtmlelement; _pmmstream; _propspec; _pstream; _pwchrefbuf; _pwcpropbuf; _pwcvaluebuf; _pwszfilename; _scanner; _serialstream; _set_se_translator; _ucursize; _ulchunkid; _ulcodepage; _ulenhrefbuf; _ulenpropbuf; _ulentagbuf; _ulidcontentchunk; _umaxsize; _wch; _wcsicmp; _wcsnicmp; _wcspath; addelement; addref; bindregion; canchortag; casttostruct; catch; cexception; cfullpropspec; changestate; chtmlelembagentry; chtmlelement; chtmlelementbag; chtmlifilter; chtmlifilterbase; chtmlifiltercf; chtmlscanner; cimagetag; cinputtag; closehandle; cmemorymappedinputstream; cmetatag; cmmstream; cmmstreambuf; cmmstreamconsecbuf; commonpageround; comp##inlinedebugout; concatenateproperty; cotaskmemalloc; cotaskmemfree; cpropertytag; createfile; createfilea; createfilemapping; createfilemappinga; createinstance; cregaccess; cscripttag; cserialstream; cspecialcharhashentry; cspecialcharhashtable; cstartoffileelement; ctextelement; ctitletag; debugbreak; declare_debug; declare_infolevel; defined; delete; disablethreadlibrarycalls; dllcanunloadnow; dllgetclassobject; dllmain; eatblanks; eattag; eattext; eof; ffiltercontent; flush; get; getblockofchars; getchar; getchunk; getclassid; getcurfile; getcurhtmlelement; geterrorcode; gethtmlelement; getinfo; getlasterror; getlocale; getlocaleinfoa; getlocaleinfow; getname; getnextchunkid; getnexthashentry; getoleerror; getosversion; getpropertyname; getpropertypropid; getpropset; getpropspec; getsystemdefaultlcid; gettext; gettokentype; getvalue; getversionexa; getwidechar; growtagbuffer; hash; hresult_from_win32; htmldebugout; ifilter_addref; ifilter_bindregion; ifilter_bindregion_proxy; ifilter_bindregion_stub; ifilter_getchunk; ifilter_getchunk_proxy; ifilter_getchunk_stub; ifilter_gettext; ifilter_gettext_proxy; ifilter_gettext_stub; ifilter_getvalue; ifilter_getvalue_proxy; ifilter_getvalue_stub; ifilter_init; ifilter_init_proxy; ifilter_init_stub; ifilter_queryinterface; ifilter_release; initfilterregion; initosversion; initstatchunk; interlockeddecrement; interlockedincrement; iscreateexisting; isdirty; isempty; ismatchproperty; isnonhtmlfile; isoleerror; ispropertyname; ispropertypropid; isstarttoken; isstoptoken; isunicodenumber; isvalid; iswdigit; iswritable; iswspace; llfromuls; load; localetocodepage; lockserver; lookup; map; mbstowcs; memcmp; memcpy; memset; midl_user_allocate; midl_user_free; multibytetowidechar; newk; ok; open; outputdebugstringa; psheading1; psheading2; psheading3; psheading4; psheading5; psheading6; pstitle; queryelement; queryhtmlelement; queryinterface; readtagintobuffer; regclosekey; regmetainfo; regopenkey; regopenkeya; regqueryvalueex; regqueryvalueexa; regscriptinfo; release; rewind; rtlcopymemory; save; savecompleted; scantag; scantagbuffer; set; setbuf; setendoffile; sethtmlelement; setinfo; setlasterrorex; setlocale; setnexthashentry; setproperty; setpropid; setpropset; setsize; setstarttokenflag; settokentype; shrinkfromfront; size; sizehigh; sizelow; skipcharsuntilnextrelevanttoken; skipremainingtextandgotonextchunk; sprintf; stringtoclsid; succeeded; switch; switchtonexthtmlelement; systemexceptiontranslator; tagnametotoken; throw; towlower; ungetchar; unmap; unmapviewoffile; va_end; va_start; vsprintf; wcscpy; wcslen; wcsncmp; wcstombs; wcstoul; win4assert; win4assertex


Scripting

Click to open or copy the files for the Scripting sample.

These samples demonstrate ActiveX scripting.


Spruuids: Sprite Game for Sample ActiveX VB Scripting Host

Click to open or copy the files for the Spruuids sample.

This sample is a sample ActiveX Scripting host, which hosts VB Script.

This sample includes the following main files:

File | Description
ActivScp.h | ActiveX scripting header file, used by Game.cpp
App.cpp | Implements Main App window via a dialog. CApp is responsible for creating the CMsgLoop object, and CGame object.
CompMgr.h | Component Manager interfaces, used by App.cpp and MsgLoop.cpp
DispIDs.h | Defines the DISPIDs used for events.
Game.cpp | Orchestrates the show, responsible for creating and coordinating CScore, CDisplay (from Spr.cpp), and CSpriteClass's. Handles high-level game behaviors, such as starting and ending games, the menus, and creating, loading, and managing VB Script through ActiveX scripting.
GameOA.cpp | OLE Automation implementation for "Game" object in object model.
Guids.cpp | Simple file to get all necessary GUIDs to the linker.
Helpers.h | Implements some obligatory ANSI/Unicode helpers.
Main.h | Main include file included by everyone.
MsgLoop.cpp | Implements EXE's message loop via IOleComponentManager. CApp acts as a client to the ComponentManager, implementing IOleComponent.
OleAuto.cpp | Small framework for creating OLE Automation objects which have dual interfaces.
Score.cpp | Tracks score, level, and number of ships left.
Spr.cpp | Core "sprite" engine. Implements CDisplay, CSpriteClass, and CSprite. CDisplay implements the display surface on which the sprites are drawn, and handles drawing the sprites, updating their positions on timer ticks, and tracking collisions between the sprites. CSpriteClass implements a set of functionality shared between common kinds of sprites, such as the starting image used, how sprites of this class interact with the border, etc. CSprite implements a "sprite" which is basically a repository for position, velocity, image, etc.
SprOA.cpp | Implements the "SpriteClass" and "Sprite" OLE Automation interfaces for the CSpriteClass and CSprite classes, respectively.
SpruuidP.h | Helper file that tells the sprite engine about the graphics found within the main sprite bitmap, Spruuids.bmp.
Spruuids.odl | Declares the object model for the Spruuids.exe application.
VBSGuids.h | Defines CLSID for VB Script, used by Game.cpp.

Building SDK Samples

This sample uses the following keywords:

_erase; _fdraw; _link; _stat; _unlink; _wcsicmp; aboutdlgproc; addfuncdesc; addimpltype; addnameditem; addpix; addpixlast; addref; addreftypeinfo; addtypelib; appdlgproc; appevt_dlgproc; appevt_fqueryterminate; appevt_newgame; appevt_pause; appevt_pswndproc; argsz; assert; beginpaint; bitblt; buildtypeinfo; capp; causepause; cdisplay; cgame; cgameoa; check; check_pointer; check_signature; checkcl; checkos; checksz; checktypeinfo; clienttoscreen; closegame; clsidfromstring; cmsgloop; cocreateguid; cocreateinstance; coinitialize; couninitialize; create; createapp; createbrushindirect; createcompatiblebitmap; createcompatibledc; createdialog; creategame; createscore; createscriptengine; createtypeinfo; createtypelib; cscore; csprite; cspriteclass; declare_interface_; declare_signature; declare_standard_dispatch; define_guid; defwindowproc; deletedc; deleteobject; destroy_signature; destroyall; destroywindow; dialogbox; dialogboxparam; dispatchmessage; displayassert; displayscripterror; dlgproc; doidle; doidleprocessing; domoveat; drawedge; drawicon; drawtext; enablewindow; enddialog; endpaint; exit; fail; failed; fclose; fcontinuemessageloop; fdoidle; feof; findtoken; fireborder; firecollide; fireinit; firekeydown; firekeypress; firekeyup; firelastterm; firemousedown; firemousemove; firemouseup; firenewgame; firenewlevel; firenewship; fireterm; firetick; fixed; floatoffull; foncomponentexitstate; fopen; fpretranslatemessage; fpushmessageloop; fqueryterminate; fread; fregistercomponent; frevokecomponent; fulloffloat; fwrite; gameover; getbuffer; getclassinfo; getclientrect; getcship; getdc; getdispatch; getdlgitem; getexceptioninfo; getidsofnames; getinfoofindex; getlevel; getmodulefilename; getmultitypeinfocount; getobject; getprimary; getreftypeinfo; getreftypeofimpltype; getscore; getsize; getsourcelinetext; getsourceposition; getstockobject; getsystemmetrics; gettinfoclsaddr; gettinfointaddr; gettypeattr; gettypeinfo; gettypeinfocount; gettypeinfoofguid; gettypelibinfo; getunknown; getwindowrect; getwindowtext; getwindowtextlength; ignoremove; inflaterect; init_signature; initnew; invalidaterect; invoke; invokeevent; is_extender_dispid; isbadwriteptr; isdialogmessage; isiconic; killtimer; layout; loadbitmap; loadcursor; loadgame; loadicon; loadregtypelib; loadtypeinfo; loadtypelib; lstrlen; lstrlenw; mainmsgloop; make_ansiptr_fromwide; make_wideptr_fromansi; makeintresource; makelparam; markfree; memcpy; memset; messagebox; messageloop; movebyfull; movetofull; movewindow; multibytetowidechar; myrand; newgame; newlevel; nextlevel; normalize_i4; oncomponentactivate; oncomponententerstate; paint; parsecmdline; parsefile; parsescripttext; patblt; pause; peekmessage; pgameoa; playback; postquitmessage; processmessage; psprmutate; pswndproc; pumpmessage; puserderef; queryinterface; rand; record; refresh; registerclass; release; releasecapture; releaseptr; releaseptrtype; releasetypeattr; remove; scofcp; screentoclient; selectobject; senddlgitemmessage; sendmessage; setbackcolor; setbaseobject; setbkmode; setcship; seterrorinfo; setfocus; setfuncandparamnames; setguid; setimpltypeflags; setlcid; setlevel; setname; setscore; setscriptsite; setscriptstate; setstatustext; settimer; setversion; setwindowtext; shipkilled; showwindow; size; skipwhite; spriteofi; srand; stdmethod; stdmethod_; stdmethodimp_; strncmp; succeeded; switch; sysallocstringlen; sysfreestring; tempbuffer; terminate; tickofsec; timer; translateaccelerator; translatemessage; unicode_from_ansi; variantclear; variantcopy; variantinit; waitmessage; warning; wcscmp; widechartomultibyte; winexec; wsprintf; xcp


WebPost: APIs for Updating and Uploading Content

Click to open or copy the files for the WebPost sample.

This sample demonstrates APIs for updating content on Web sites.

If you are authoring an application which will use the Web Publishing API or SPI, then go to the BIN directory of the Internet Client SDK and run Wpsdk.exe to install the necessary DLLs on your system. Then consult the API-usage sample in WBPOST.

If you are authoring a Web Publishing Service Provider for use with the Web Publishing API, you should install the complete Web Publishing Wizard so that you can test your provider (this SDK only contains the DLLs required by authors writing to the Web Publishing API).

This SDK includes the source code for a stubbed Service Provider. This code is ready to be compiled, and, when registered with REGSVR32, will install an "empty" provider on your system called "Web Publishing Service Provider Stub". All you need to do to implement your own provider is fill in the implementations of the Service Provider methods.


WbPost: WebPost API Sample

Click to open or copy the files for the WbPost sample.

This sample application shows the usage of WebPost APIs. This example demonstrates calling WpPost for simple usage as well as calling WpBindToSite to get a pointer to the provider interface and calling the functions in the Web post provider.

Run the Webpost.exe to install the WebPost components before using this sample code.

Usage is as follows:

Task Usage
Show usage
wbpost -?
List sites
wbpost -l
Call the wizard
wbpost
Call the wizard, showing a filename selected
wbpost filename
Post filename to site
wbpost -s site filename

Building SDK Samples

This sample uses the following keywords:

_tprintf; _wpspi_check_iid; _wpspi_iid_lookup; addref; addwizardpages; advancedwebpost; commit; data_seg; declspec_uuid; defined; deletefile; dlldata_routines; enumproviders; exit; extern_proxy_file; failed; findclose; findfirstfile; findnextfile; geterror; geterrorstring; getparam; getsiteinfo; hresult_code; iid_generic_check_iid; iwpprovider_addref; iwpprovider_addwizardpages; iwpprovider_commit; iwpprovider_deletefile; iwpprovider_findclose; iwpprovider_findfirstfile; iwpprovider_findnextfile; iwpprovider_geterror; iwpprovider_getparam; iwpprovider_getsiteinfo; iwpprovider_networkconnect; iwpprovider_networkdisconnect; iwpprovider_postfiles; iwpprovider_queryinterface; iwpprovider_release; iwpprovider_serverlogin; iwpprovider_serverlogout; iwpprovider_setparam; iwpprovider_setprogressupdateproc; iwpprovider_setprogressupdateproc_proxy; iwpprovider_setprogressupdateproc_stub; iwpsitew_addref; iwpsitew_addwizardpages; iwpsitew_addwizardpages_proxy; iwpsitew_addwizardpages_stub; iwpsitew_commit; iwpsitew_commit_proxy; iwpsitew_commit_stub; iwpsitew_deletefile; iwpsitew_deletefile_proxy; iwpsitew_deletefile_stub; iwpsitew_findclose; iwpsitew_findclose_proxy; iwpsitew_findclose_stub; iwpsitew_findfirstfile; iwpsitew_findfirstfile_proxy; iwpsitew_findfirstfile_stub; iwpsitew_findnextfile; iwpsitew_findnextfile_proxy; iwpsitew_findnextfile_stub; iwpsitew_geterror; iwpsitew_geterror_proxy; iwpsitew_geterror_stub; iwpsitew_getparam; iwpsitew_getparam_proxy; iwpsitew_getparam_stub; iwpsitew_getsiteinfo; iwpsitew_getsiteinfo_proxy; iwpsitew_getsiteinfo_stub; iwpsitew_networkconnect; iwpsitew_networkconnect_proxy; iwpsitew_networkconnect_stub; iwpsitew_networkdisconnect; iwpsitew_networkdisconnect_proxy; iwpsitew_networkdisconnect_stub; iwpsitew_postfiles; iwpsitew_postfiles_proxy; iwpsitew_postfiles_stub; iwpsitew_queryinterface; iwpsitew_release; iwpsitew_serverlogin; iwpsitew_serverlogin_proxy; iwpsitew_serverlogin_stub; iwpsitew_serverlogout; iwpsitew_serverlogout_proxy; iwpsitew_serverlogout_stub; iwpsitew_setparam; iwpsitew_setparam_proxy; iwpsitew_setparam_stub; listsites; lstrlena; midl_user_allocate; midl_user_free; multibytetowidechar; networkconnect; networkdisconnect; postfiles; printf; queryinterface; reference_proxy_file; release; serverlogin; serverlogout; setparam; setprogressupdateproc; simplewebpost; usage; wpbindtosite; wpenumproviders; wpgeterrorstring; wplistsites; wppost; wprintf


NetDS Samples

Click to open or copy the files for the NetDS samples.


ADSI Samples: Active Directory Services Interfaces

Click to open or copy the files for the ADSI samples.

For more information, see ADSI Example Provider Component in Active Directory Services Interfaces.


SampApp

Click to open or copy the files for the SampApp samples.

It is recommended that you download from this level, rather than a lower level, to get the Makefile and the Include directory, which is used by the samples.


ADScmd: Active Directory Service Command-Line Sample

Click to open or copy the files for the ADScmd sample.

This simple command-line program shows how to use the Active Directory Service Interfaces to browse and display objects of any Directory Service.

Usage

adscmd [list|dump] <ADsPath>

Examples

On a Windows NT system, the following will dump the properties of SomeUser in MYDOMAIN:

   adscmd dump WinNT://MYDOMAIN/SomeUser

On an NDS system, the following will list the top of the MYTREE tree:

   adscmd list NDS://MYTREE

The namespace (such as "WinNT" or "NDS") is case-sensitive.

Files

This sample has the following main files:

File | Description
Main.cxx | Main program
Dump.cxx | Functions to dump properties of an object
Enum.cxx | Functions to enumerate children of a container
Util.cxx | Helper functions

Building SDK Samples

This sample uses the following keywords:

_stricmp; adsbuildenumerator; adsbuildvararraystr; adsenumeratenext; adsgetobject; allocateunicodestring; ansitounicodestring; bail_on_failure; bail_on_null; coinitialize; dodump; dolist; dumpobject; enumobject; exit; failed; free_bstr; free_interface; freeunicodestring; get; get_class; get_mandatoryproperties; get_name; get_schema; getpropertylist; localalloc; localfree; memset; multibytetowidechar; printf; printlongformat; printproperty; printusage; printvariant; printvariantarray; put_filter; queryinterface; release; safearrayaccessdata; safearraydestroy; safearraygetelement; safearraygetlbound; safearraygetubound; safearrayunaccessdata; strcpy; sysfreestring; unicodetoansistring; varbstrfromdate; variantclear; variantinit; wcslen; widechartomultibyte; zeromemory


DSbrowse: Sample for Viewing Directory Services

Click to open or copy the files for the DSbrowse sample.

It is recommended that you download this sample from (SampApp).

This sample demonstrates how VB application developers can quickly and easily put together utilities for viewing and managing Directory Services.

DSBrowse can enumerate through multiple namespaces (each corresponding to a Directory Service). For each object found in a Directory Service hierarchy, it provides a brief description of the object. Double-clicking on an object (container) will result in enumerating objects within that container.

DSBrowse reads and writes properties on the DS object. Clicking on the Properties button allows you to display the properties of an object. You can select a specific property and update it by clicking the Set button.

You must have Microsoft Visual Basic 4.0a Professional or Enterprise Edition installed on your machine. Microsoft Visual Basic 4.0a Professional or Enterprise Edition is available only on x86 platforms.

Main Files

File | Description
Dsbrowse.vbp | Visual Basic Project File
Main.frm | Form for browsing Directory Service namespaces
Property.frm | Form for getting and setting properties
VbADs.bas | Visual Basic source code
DsVw.res | Resource file for the project (x86 only)
DsBrowse.exe | Visual Basic Executable (x86 only)


Include Files for Directory Services Samples

Click to open or copy the Include files.

It is recommended that you download this sample from (SampApp).

This directory contains Adsconst.bas only. This file contains error codes, status codes, class names and schema definitions for ADSI.


VJ: Active Directory Java Support

Click to open or copy the files for the VJ sample.

This level has only a Readme for Java support in Active Directory, and the subdirectory has DSconn.mak.


SampProv: Active Directory Service Provider Sample

Click to open or copy the files for the SampProv sample.

This sample is a demonstration of an Active Directory Service provider.

Main Files

File | Description
CDispMgr.c | Dispatch Manager implementation.
CEnumNS.c | Sample Provider Namespace Enumerator Code.
CEnumObj.c | Generic Object Enumeration CodeStandard IClassFactory implementation.
CEnumSch.cpp | Sample Provider Enum Schema functionality.
CEnumVar.cpp | Base Implementation for xxxEnumVariant derived classes.
CGenObj.cpp | Microsoft ADs DS Provider Generic Object.
CNamCF.h | Class factory for standard Namespace object.
CNameSp.cpp | Sample Namespace Object.
Common.cpp | Contains routines and properties that are common to all tshirt objects. Tshirt objects get the routines and properties through C++ inheritance.
Common.h | Contains Sample Provider routines and properties that are common to all objects. Objects get the routines and properties through C++ inheritance.
Core.cpp | CCoreADsObject Implementation.
Core.h | Core ADS Obect.
CProps.cpp | Property Cache functionality.
CProps.h | Property Cache Object.
CProv.cpp | ADsSampleDS Provider Object.
CProv.h | Provides Moniker support for OLE DS GetObject.
CProvCF.cpp | ADs Provider Object Class Factory Code.
CProvCf.h | Class Factory for Provider Object.
CPrpObj.h | Sample Provider GetObject functionality.
Formtrck.hxx | This file defines facilities for a standard implementation of reference-counted objects, incorporating mechanisms for tracking the usage history of the objects.
GetObj.cpp | Sample Provider GetObject functionality.
Guid.cpp | Sample CLSIDS.
Guid.h | Extern references for Sample Guids.
IntF.cpp | Interface for ADS.
LibMain.cpp | LibMain for ADsSmp.dll.
Memory.cpp | This module provides all the memory management functions for all Sample Provider components.
Object.cpp | ObjectTypeList class.
Parse.cpp | DS Pathname Parser. The Pathname Parser is a key component in ADs providers. It checks for syntactic validity of an ADs pathname that has been passed to this provider. If the syntax is valid, then an OBJECTINFO structure is constructed.
RegDSAPI.cpp | Sample Provider Registry DS APIs.
SmpOper.cpp | SampleDS DataType Operation routines.
SmpTypes.h | Definitions for Sample DS Data Types and structures used by the SampleDS Regsitry APIs to exchange data.
StdFact.cpp | Standard IClassFactory implementation.
Util.h | Utilities.

Building SDK Samples

This sample uses the following keywords:

_adsclass; _adsguid; _adspath; _assert; _bstradspath; _bstrname; _bstrsampledstreename; _bstrsyntax; _buffer; _cb; _dwendofstring; _dwlasttoken; _dwlasttokenlength; _dwmaxproperties; _dwnumberofmandatoryattributes; _dwobjectstate; _lpclassname; _lpmandatoryattributes; _name; _parent; _pcoreadsobject; _pdispmgr; _pobjlist; _pproperties; _ptr; _schema; _ulrefs; _wcsicmp; addcomponent; addproperty; addprovidername; addref; addrootrdn; addtypeinfo; adsassert; adsdecrement; adsincrement; adsobject; allocateclassobject; allocategenobject; allocatenamespaceobject; allocatepropertyobject; allocateschema; allocprovmem; allocprovstr; appendcomponent; array_size; bail_if_error; bail_on_failure; bail_on_success; buildadsguid; buildadsparentpath; buildadspath; buildadspathfromdspath; builddefaultobjectarray; builddsfilterarray; builddsparentpathfromdspath; builddspathfromadspath; builddspathfromdsparentpath; builddstreenamefromadspath; buildobjectarray; buildsampledsrootrdnfromadspath; buildschemapath; ccoreadsobject; cdispatchmgr; cdynamiccf; checkandreturnresult; checkresult; clexer; clone; cls; cocreateinstance; component; containing_record; continue_on_failure; convertsafearraytovariantarray; copyhere; copysampleds1tosampledssynid1; copysampleds2tosampledssynid2; copysampledssynid1tosampleds1; copysampledssynid2tosampleds2; copysampledssynidtosampleds; copysampledstosampledssynid; cpropertycache; create; createandappendfilterentry; createclass; creategenericobject; createinstance; createnamespace; createobjecttypelist; createpointermoniker; createproperty; createpropertycache; createpropertyentry; createpropertylist; createschema; createtokenlist; csampledsclass; csampledsenumvariant; csampledsgenobject; csampledsgenobjectenum; csampledsnamespace; csampledsnamespaceenum; csampledsproperty; csampledsprovider; csampledsschema; csampledsschemaenum; debugbreak; dec_object_count; declare_ads_compound_iunknown; declare_ads_delegating_iunknown; declare_ads_private_iunknown; declare_ads_standard_iunknown; declare_ads_subobject_iunknown; define_contained_iads_implementation; define_guid; define_iads_implementation; define_idispatch_implementation; define_idispatch_implementation_unimplemented; delete; detach; dispgetidsofnames; dispinvoke; dllcanunloadnow; dllgetclassobject; dllmain; dspathname; dump_tracking_info; dump_tracking_info_delete; dump_tracking_info_keep; dumptrackinginfo; dword_align_up; enlist_tracking; enumclasses; enumgenericobjects; enumobjects; enumproperties; failed; fetchnextobject; fetchobjects; findproperty; findtypeinfo; findtypeinfoentry; freefilterlist; freelist; freepropertyentry; freeprovmem; freeprovstr; generate_newids; gentypeinfoid; get; get__newenum; get_abstract; get_adspath; get_auxderivedfrom; get_auxiliary; get_bstr_property; get_class; get_clsid; get_container; get_containment; get_coreadsclass; get_coreadspath; get_coreguid; get_corename; get_coreparent; get_coreschema; get_count; get_date_property; get_derivedfrom; get_filter; get_guid; get_helpfilecontext; get_helpfilename; get_hints; get_long_property; get_mandatoryproperties; get_maxrange; get_minrange; get_multivalued; get_name; get_namingproperties; get_object_count; get_oid; get_optionalproperties; get_parent; get_possiblesuperiors; get_primaryinterface; get_schema; get_syntax; get_variant_bool_property; get_variant_property; getclassobject; getcurrentobject; getdispid; getex; getgenobject; getidsofnames; getinfo; getinfoex; getinterfaceptr; getlasterror; getnamespaceobject; getnexttoken; getobject; getobjectstate; getproperty; getpropertyobject; getschemaobject; gettypeinfo; gettypeinfocount; gettypeinfoid; gettypeinfoofguid; hresult_from_win32; implement_ads_compound_iunknown; implement_ads_private_iunknown; implement_ads_subobject_iunknown; inc_object_count; initializecoreobject; instantiatederivedobject; interlockeddecrement; interlockedincrement; invoke; isclasstracking; iscompatibleoleversion; isequalclsid; isequaliid; iskeyword; isvaliddsfilter; isvalidfilter; lexer; libmain; loadregtypelib; loadtypeinfo; loadtypeinfoentry; localalloc; localfree; lpregds_enum; makeuncname; makevariantfromproplist; mapsyntaxidtoadssyntax; mapsyntaxidtosampledssyntax; markasnewenum; marshallproperty; marshallsampledssynidtosampleds; memcpy; memset; min; movehere; my##cls; my##parent_cls; next; nextchar; nexttoken; no_copy; notok; objecttracker; objecttypelist; ok; olebuildversion; packdateinvariant; packlonginvariant; packstringinvariant; packvariant_boolinvariant; packvariantinvariant; parsedisplayname; passivate; pathname; prepbuffer; printhresult; printiid; privateunknown; property_flags; property_name; property_numvalues; property_sampledsobject; property_syntax; property_values; provallocstring; provfreestring; providername; pushbackchar; pushbacktoken; put; put_abstract; put_auxderivedfrom; put_auxiliary; put_bstr_property; put_clsid; put_container; put_containment; put_date_property; put_derivedfrom; put_filter; put_helpfilecontext; put_helpfilename; put_hints; put_long_property; put_mandatoryproperties; put_maxrange; put_minrange; put_multivalued; put_namingproperties; put_oid; put_optionalproperties; put_possiblesuperiors; put_syntax; put_variant_bool_property; put_variant_property; putex; putproperty; qualifiers; query_interface; queryinterface; reallocprovmem; reallocprovstr; regclosekey; regcreatekey; regdeleteallkeys; regdeletekey; regenumkey; regenumkeyex; regenumvalue; regopenkey; regopenkeyex; regqueryinfokey; regqueryvalueex; regsetvalueex; relativegetobject; release; reset; resolvepathname; resultfromscode; rreturn; rreturn1; rreturn2; rreturn3; rreturn_enum_status; safearraycreate; safearraydestroy; safearraygetelement; safearraygetlbound; safearraygetubound; safearrayputelement; sampledsaddobject; sampledscloseobject; sampledscreatebuffer; sampledscreateobject; sampledsfreebuffer; sampledsfreeclassdefinition; sampledsfreeenum; sampledsfreepropertydefinition; sampledsgetclassdefinition; sampledsgetclassinfo; sampledsgetpropertydefinition; sampledsgetpropertyinfo; sampledsgettype; sampledsgettypetext; sampledsmarshallproperties; sampledsmodifyobject; sampledsnextrdn; sampledsobject; sampledsopenobject; sampledsrdnenum; sampledsreadobject; sampledsremoveobject; sampledssetobject; sampledstypeclear; sampledstypecopy; sampledstypecopyconstruct; sampledstypecopysampledssynid1; sampledstypecopysampledssynid2; sampledstypefreesampledsobjects; sampledstypefreesampledssynid1; sampledstypefreesampledssynid2; sampledstypetovartypecopy; sampledstypetovartypecopyconstruct; sampledstypetovartypecopysampledssynid1; sampledstypetovartypecopysampledssynid2; sampledsunmarshallproperties; schemacomponent; schemapathname; setinfo; setlasterror; setobjectstate; settype; skip; sreturn; stdaddref; stdapi_; stdclassfactory; stdmethod; stdmethod_; stdmethodimp_; stdrelease; stringfromguid2; subaddref; subrelease; succeeded; switch; sysallocstring; sysfreestring; text; tracehresult; traceiid; track_class; trackclass; trackclassname; treturn; type; typeinfoinvoke; unboundgetproperty; unmarshallproperty; unmarshallsampledstosampledssynid; unpackdatefromvariant; unpacklongfromvariant; unpackstringfromvariant; unpackvariant_boolfromvariant; unpackvariantfromvariant; updateproperty; validate_ptr; validatenamespaceobject; validateobjecttype; validateoutparameter; validateprovider; validateschemaobject; variantclear; variantcopy; variantinit; vartypefreevarobjects; vartypetosampledstypecopy; vartypetosampledstypecopyconstruct; vartypetosampledstypecopysampledssynid1; vartypetosampledstypecopysampledssynid2; warn_error; watchinterface; wcscat; wcschr; wcscmp; wcscpy; wcslen; word_align_down; wsprintf; xx_put_bstr; xx_put_date; xx_put_long; xx_put_variant; xx_put_variant_bool


DLC: Simplex Sample of Single-Threaded DLC Program

Click to open or copy the files for the DLC sample.

This sample is a single-threaded DLC program. You need two instances of this application: one to send and one to receive. This is the typical DLC situation: simplex or half-duplex. By default, both sides use SAP 4.

Building SDK Samples

This sample uses the following keywords:

acslan; acslandebugprint; acslandebugprintstring; adapter_status; array_elements; atoi; calloc; char_to_number; check_keyboard; close_adapter; closehandle; connect_station; create_buffer; createevent; defaultparametertabledump; dispatch_read_events; do_receive; do_transmit; dumpbuffercreateparms; dumpbufferfreeparms; dumpbuffergetparms; dumpccb; dumpdata; dumpdirinitializeparms; dumpdiropenadapterparms; dumpdiropendirectparms; dumpdirreadlogparms; dumpdirsetexceptionflagsparms; dumpdirsetfunctionaladdressparms; dumpdirsetgroupaddressparms; dumpdirstatusparms; dumpdirtimercancelgroupparms; dumpdirtimercancelparms; dumpdirtimersetparms; dumpdlcclosesapparms; dumpdlcclosestationparms; dumpdlcconnectstationparms; dumpdlcflowcontrolparms; dumpdlcmodifyparms; dumpdlcopensapparms; dumpdlcopenstationparms; dumpdlcreallocateparms; dumpdlcresetparms; dumpdlcsetthresholdparms; dumpdlcstatisticsparms; dumpparametertableheader; dumpparms; dumpreadcancelparms; dumpreadparms; dumpreceivecancelparms; dumpreceivedatabuffer; dumpreceivemodifyparms; dumpreceiveparms; dumptransmitdirframeparms; dumptransmitframesparms; dumptransmitiframeparms; dumptransmitparms; dumptransmitqueue; dumptransmittestcmdparms; dumptransmituiframeparms; dumptransmitxidcmdparms; dumptransmitxidrespfinalparms; dumptransmitxidrespnotfinalparms; except; exit; flow_control; fopen; fputs; free; free_buffer; get_buffer; get_funky_number; getacslandebugflags; getch; getenv; getlasterror; getsystemtime; gettickcount; handle_command_complete; handle_ctrl_c; handle_receive_data; handle_status_change; handle_transmit_complete; hex_to_num; if_debug; is_arg; is_radical_digit; isdigit; islower; isxdigit; kbhit; last_element; malloc; mapadaptertype; mapccbretcode; mapdlcstatus; mapethernettype; mapflowcontrol; maplogtype; mapmessagetype; mapoptionindicator; maprcvreadoption; mapreadevent; mapreceiveoptions; mapxmitreadoption; max; memcpy; memset; min; my_calloc; my_free; my_malloc; mydbgprint; nice_num; open_adapter; open_sap; open_station; post_read; post_receive; printf; put; putchar; puts; rand; resetevent; setacslandebugflags; signal; sleep; slush; sprintf; strcat; strchr; strcpy; strncpy; strnicmp; strupr; swap_bits; terminate; tolower; toupper; twiddle_bits; tx_i_frame; usage; va_start; vsprintf; waitforsingleobject; xtou; zap


Remote Access Service API Samples

Click to open or copy the files for the RAS samples.


RASberry: Demonstation of the RAS API

Click to open or copy the files for the RASberry sample.

This sample demonstrates the Remote Access Service (RAS) API set. RASberry allows the user to enumerate current RAS connections, display the status of a selected connection, dial entries from the default phone book, and hang up an active connection.

Building SDK Samples

This sample uses the following keywords:

_ffree; _fmalloc; _frealloc; authdlg; centerwindow; checkdlgbutton; cmdabout; cmdaboutdone; cmdauthdlgcancel; cmdauthdlgok; cmdconnnotify; cmddialdlgcancel; cmdexit; cmdhangup; cmdphbkdlg; cmdphbkdlgcancel; cmdphbkdlgdial; cmdphbkdlgentry; cmdrefresh; cmdstatdlg; cmdstatdlgok; cmdstatdlgrefresh; createfont; createwindow; defdlgproc; defframeproc; defmdichildproc; defwindowproc; deleteobject; destroywindow; dialdlg; dialogbox; dispatchmessage; dispcommand; dispdefault; dispmessage; enablemenuitem; enablewindow; enddialog; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getclientrect; getdc; getdevicecaps; getdlgitem; getdlgitemtext; getfileversioninfo; getfileversioninfosize; getmenu; getmessage; getmodulefilename; getparent; getrasconnstate; getuserdefaultlangid; getwindow; getwindowrect; globalalloc; globalfree; globallock; globalunlock; initapplication; initinstance; isdlgbuttonchecked; loadaccelerators; loadcursor; loadicon; loadstring; lstrcpy; lstrlen; messagebox; movewindow; msgaboutcommand; msgaboutinit; msgauthdlgcommand; msgauthdlginit; msgcommand; msgcreate; msgdestroy; msgdialdlgcommand; msgdialdlgevent; msgdialdlginit; msgphbkdlgcommand; msgphbkdlginit; msgsetfocus; msgsize; msgstatdlgcommand; msgstatdlginit; muldiv; pfncmd; pfnmsg; phbkdlg; postmessage; postquitmessage; primarylangid; rasdial; rasdialfunc; rasenumconnections; rasenumentries; rasgetconnectstatus; rasgeterrorstring; rashangup; registerclass; registerwindowmessage; releasedc; senddlgitemmessage; sendmessage; setdlgitemtext; setwindowpos; setwindowtext; showwindow; sleep; statdlg; switch; translateaccelerator; translatemessage; updatewindow; verqueryvalue; winmain; wndproc; wsprintf


RAShost: AppleTalk PAP Protocol Sample

Click to open or copy the files for the RAShost sample.

This sample demonstrates how an ISV can build a DLL to provide security services to the RAS server.

Building SDK Samples

This sample uses the following keywords:

getlasterror; getprocessheap; rassecuritydialogbegin; rassecuritydialogcomplete; rassecuritydialogend; rassecuritydialoggetinfo; rassecuritydialogreceive; rassecuritydialogsend; text


RASSAPI: RAS Server API

Click to open or copy the files for the RASSAPI sample.

This sample shows how to use the RAS Server API.

Main Files

File | Description
Admapit.c | Sample program demonstrating the use of different RasAdmin API. RasAdmin expects \\Servername as an argument. RasAdminGetErrorString API returns an error string. However, this API may return an Error 87 (Invalid Parameter) for the Non-RAS Error codes. This API is design for only RAS-related error codes. This sample uses this API for all the errors, but it's a good idea to print the error codes before calling this API.
Admindll.c | Sample program demonstrating the use of RasAdmin CallOut APIs.

Building SDK Samples

This sample uses the following keywords:

_getch; closehandle; createfile; ctime; dbgprint; debug_print; exit; file_print; flushfilebuffers; free; init1; init2; istextunicode; lstrcat; lstrcmp; lstrcpy; malloc; mbstowcs; memcmp; memcpy; multibytetowidechar; printclearstats; printf; printgetstringerror; printpriv; rasadminacceptnewconnection; rasadmincleardisc; rasadminconnectionhangupnotification; rasadminfreebuffer; rasadmingeterrorstring; rasadmingetipaddressforuser; rasadmingetuseraccountserver; rasadminportclearstatistics; rasadminportdisconnect; rasadminportenum; rasadminreleaseipaddress; rasadminservergetinfo; rasadminusergetinfo; rasadminusersetinfo; scanf; servergetinfo; sleep; sprintf; strdupwfroma; strncpy; text; toupper; userprivilege; waitforsingleobject; wcscmp; wcscpy; writefile


RPC

Click to open or copy the files for the RPC samples.

For more information about RPC, see Microsoft RPC Model in Networking and Distributed Services.

RPC Samples Directory Tree

The RPC directory contains several sample RPC distributed applications.

Sample (Directory) | Description
Callback | Fibonacci number implemented as static callback.
Cluuid | Manager entry point vector sample.
Data\DUnion | Discriminated union.
Data\InOut | Directional attributes.
Data\RepAs | Represent As attribute.
Data\Xmit | Transmit As attribute.
Dict | Client-server transaction processing.
Doctor | RPC version of Eliza-like therapist program.
Dynept | Dynamic Endpoint demonstration.
DynOut | Client managing connection via dynamic endpoints.
Handles\Auto | Auto handles.
Handles\CxHndl | Context handles.
Handles\UsrDef | User-defined handles.
Hello | Print a string "Hello, World" on the server.
Interop | Demonstrates OSF DCE RPC and MS RPC interoperbility.
Mandel | Mandelbrot set Windows sample.
Mazelord | Networked 3-D maze game.
NS\CDS | Gateway protocol for DCE CDS name service.
NS\NHello | Classic "Hello, World" sample using name service.
Pickle\PicklP | Procedure serialization (a.k.a. pickling).
Pickle\PicklT | Data type serialization (a.k.a. pickling).
Pipes | Use of the [pipe] attribute.
RPCssm | RPCss/m memory package sample.
RPCsvc | A Windows NT system service which uses RPC.
StrOut | Dynamically allocated strings with [out] attribute.
WHello | Windows version of "Hello, World" sample.
Wintyp | A client-server bitmap processor.
Yield | Demonstrate yield capability for MS Windows 3.x.

Source File Naming Conventions

The source files within each directory (with the exception of the Windows samples) follow this naming convention:

Filename Pattern | Description
Readme.txt | Instructions to build, run the sample
<dirname>.idl | Interface definition language file
<dirname>.acf | Application configuration file
<dirname>c.c | Client main program
<dirname>s.c | Server main program
<dirname>p.c | Remote procedures
Makefile | Nmake file to build Windows NT or Windows 95 version
Makefile.dos | Nmake file to build MS-DOS version
Makefile.win | Nmake file to build Win 3.x version

The Microsoft Windows sample programs use several additional files and do not conform to this naming convention. See the Readme.txt file in each directory for specific information about the files.

DOS and Win3.x Builds

When building client applications on MS-DOS or Windows 3.x, you first need to install the Microsoft Visual C/C++ version 1.5 development environment and the 16-bit RPC SDK on your Windows NT or Windows 95 machine.

There are two different versions of RPC.h for MS-DOS and WIN 3.x. Please add the proper path to your INCLUDE environment variable.


Callback: Fibonacci Number Implemented as Static Callback

Click to open or copy the files for the Callback sample.

This sample demonstrates the use of the callback attribute to allow a server application to execute code on a client application. The distributed program generates a Fibonacci number with a static callback.

Main Files

File | Description
Call.idl | Interface definition language file
Call.acf | Application configuration file
Callc.c | Client main program
Calls.c | Server main program
Callp.c | Remote procedures
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

atoi; callback_fibonacci; callback_fibonacci2; callback_shutdown; defined; exit; fibonacci; fibonacci2; fprintf; free; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconvert; ndrfreebuffer; ndrgetbuffer; ndrsendreceive; ndrserverinitializenew; printf; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; shutdown; tolower; usage


Cluuid: Manager Entry Point Vector Sample

Click to open or copy the files for the Cluuid sample.

This sample demonstrates how to supply multiple implementations of the remote procedure specified in the interface. It also demonstrates how the client selects among the implementations by providing a client object uuid.

The server calls RpcObjectSetType to associate a client object uuid with the object uuid in the Object Registry Table. The server initializes a manager entry point vector (manager epv) and then calls RpcRegisterIf to associate the interface uuid and the object uuid with the manager epv in the Interface Registry Table.

When the client makes a remote procedure call, the client object uuid is mapped to the object uuid in the Object Registry Table. The resulting object uuid and the interface uuid are mapped to a manager entry point vector in the Interface Registry Table.

By default, in this example, the server registers two implementations of the "Hello, World" function HelloProc and HelloProc2. The HelloProc2 implementation is associated with the object uuid "11111111-1111-1111-1111-111111111111". When the client makes a procedure call with a null uuid, the client's request is mapped to the original HelloProc. When the client makes a procedure call with the client object uuid "11111111-1111-1111-1111-11111111111", the client's request is mapped to HelloProc2 (which prints the string in reverse).

Main Files

The directory Samples\Rpc\Cluuid contains the following files for building the sample distributed application Cluuid:

File | Description
Cluuid.idl | Interface definition language file
Cluuid.acf | Attribute configuration file
Cluuidc.c | Client main program
Cluuids.c | Server main program
Cluuidp.c | Remote procedures
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

atoi; cluuid_helloproc; cluuid_shutdown; defined; exit; fprintf; free; helloproc; helloproc2; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrsendreceive; ndrserverinitializenew; printf; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcobjectsettype; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; shutdown; strrev; tolower; usage; uuidfromstring


Data

Click to open or copy the files for the Data samples.


DUnion: Discriminated Unions Sample

Click to open or copy the files for the DUnion sample.

This sample illustrates discriminated unions.

Main Files

File | Description
Dunion.idl | Interface definition language file
Dunion.acf | Attribute configuration file
Dunionc.c | Client main program
Dunions.c | Server main program
Dunionp.c | Remote procedures
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

atof; atoi; defined; displayunionvalue; dunion_shutdown; dunion_unionparamproc; dunion_unionstructproc; exit; fprintf; free; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrcomplexstructbuffersize; ndrcomplexstructmarshall; ndrcomplexstructunmarshall; ndrconvert; ndrfclong; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrnonencapsulatedunionbuffersize; ndrnonencapsulatedunionmarshall; ndrnonencapsulatedunionunmarshall; ndrpointerfree; ndrsendreceive; ndrserverinitializenew; printf; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; shutdown; switch; tolower; unionparamproc; unionstructproc; usage


InOut: Directional Attributes [in,out] Parameters Sample

Click to open or copy the files for the InOut sample.

This sample demonstrates the use of [in,out] parameters.

Main Files

File | Description
Readme.txt | Readme file for the INOUT sample
Inout.idl | Interface definition language file
Inout.acf | Attribute configuration file
Inoutc.c | Client main program
Inouts.c | Server main program
Inoutp.c | Remote procedures
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

atof; atoi; defined; exit; fprintf; free; inout_inoutproc; inout_shutdown; inoutproc; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrsendreceive; ndrserverinitializenew; printf; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; shutdown; tolower; usage


RepAs: represent_as ACF Attribute Sample

Click to open or copy the files for the RepAs sample.

This sample demonstrates the represent_as ACF attribute.

Main Files

File | Description
Repas.idl | Interface definition language file
Repasc.acf | Client version of Attribute configuration file
Repass.acf | Server version of Attribute configuration file
Repasc.c | Client main program
Repass.c | Server main program
Repasp.c | Remote procedures
Repascu.c | Client Utility functions
Repassu.c | Server Utility functions
Makefile | Nmake file to build for Windows NT or Windows 95

Building SDK Samples

This sample uses the following keywords:

atoi; char_string_free_inst; char_string_free_local; char_string_from_local; char_string_repasfreeinst; char_string_repasfreelocal; char_string_repastranslatefromlocal; char_string_repastranslatetolocal; char_string_to_local; defined; exit; fprintf; free; malloc; mbstowcs; midl_user_allocate; midl_user_free; modifymystring; modifymywstring; ndrclientinitializenew; ndrconvert; ndrfcshort; ndrfixedarraymarshall; ndrfixedarrayunmarshall; ndrfreebuffer; ndrgetbuffer; ndrpointerfree; ndrsendreceive; ndrserverinitializenew; ndrxmitorrepasmarshall; ndrxmitorrepasunmarshall; printf; repas_modifymystring; repas_modifymywstring; repas_shutdown; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; shutdown; strcpy; tolower; usage; wchar_string_free_inst; wchar_string_free_local; wchar_string_from_local; wchar_string_repasfreeinst; wchar_string_repasfreelocal; wchar_string_repastranslatefromlocal; wchar_string_repastranslatetolocal; wchar_string_to_local; wcscpy; wcstombs; wprintf


Xmit: transmit_as Attribute Sample

Click to open or copy the files for the Xmit sample.

This sample demonstrates the type-conversion attribute transmit_as.

Main Files

File | Description
Xmit.idl | Interface definition language file
Xmit.acf | Attribute configuration file
Xmitc.c | Client main program
Xmits.c | Server main program
Xmitp.c | Remote procedures
Xmitu.c | Utility functions for client, server
Xmitu.h | Utility function prototypes
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

arraywalkproc; atoi; defined; double_link_type_free_inst; double_link_type_free_xmit; double_link_type_from_xmit; double_link_type_to_xmit; double_link_type_xmitfreeinst; double_link_type_xmitfreexmit; double_link_type_xmittranslatefromxmit; double_link_type_xmittranslatetoxmit; exit; fprintf; free; insertnewnode; listwalkproc; malloc; midl_user_allocate; midl_user_free; modifylistproc; ndrclientinitializenew; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrpointerfree; ndrsendreceive; ndrserverinitializenew; ndrxmitorrepasbuffersize; ndrxmitorrepasmarshall; ndrxmitorrepasunmarshall; printf; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; shutdown; tolower; usage; xmit_modifylistproc; xmit_shutdown


Dict: Client-Server Transaction Processing

Click to open or copy the files for the Dict sample.

This sample demonstrates use of the implicit_handle, context_handle, in, and out attributes. This sample program is an example of a nontrivial local application converted to a distributed RPC application.

The local program is a character-oriented "play" program, which lets a user insert, delete, and iterate over a dictionary. The dictionary is based on splay trees.

The basic program was remoted by taking the interface to the dictionary (given in dict0.h) and creating an interface to a remote dictionary, (given in replay.idl) which is remoted using RPC. Following the local dictionary interface, which is minimal and uniform, the remote interface is also uniform. However, since the local dictionary is generic (can store any item type, using void* pointers to items), the interface had to be changed to deal with predefined (Record) type items in order to be remoted using the Microsoft RPC system. Also, since the local implementation allows a "peek" at the root of the tree using a DICT_CURR_ITEM macro, the whole interface had to be changed.

Main Files

File | Description
Client.c | Client main program. This is the driver for the client side remote dictionary (splay trees based) demo.
Play.c | Simple interactive loop of calls to the dictionary.
Replay.acf | Attribute configuration file
Replay.idl | Interface definition language file
Server.c | Server main program. This is the driver for the server side remote dictionary, which is based on splay trees.
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

allocate_state; clnt_dict_print; comp; defined; dict_curr_item; dict_delete; dict_empty; dict_find; dict_insert; dict_new; dict_new_dict; dict_next; dict_prev; dict_print; dict_vdict_curr_delete; dict_vdict_curr_item; dict_vdict_curr_next; dict_vdict_curr_prev; dict_vdict_delete; dict_vdict_find; dict_vdict_get_dict; dict_vdict_i_dict; dict_vdict_insert; dict_vdict_new; dict_vdict_next; dict_vdict_prev; dict_vdict_x_dict; dictstate_duplicate; exit; free; free_state; freerecord; gets; init_dict; itemcopy; itemduplicate; linprintree; main_dict; makenode; makerecord; malloc; midl_user_allocate; midl_user_free; ndrccontextbinding; ndrclientcontextmarshall; ndrclientcontextunmarshall; ndrclientinitializenew; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrpointerbuffersize; ndrpointerfree; ndrpointermarshall; ndrpointerunmarshall; ndrscontextunmarshall; ndrscontextvalue; ndrsendreceive; ndrservercontextmarshall; ndrservercontextunmarshall; ndrserverinitializenew; ndrsimplestructbuffersize; ndrsimplestructmarshall; ndrsimplestructunmarshall; ndrsimpletypemarshall; ndrsimpletypeunmarshall; print_tree_sat; printf; printrecord; printree; rdict_curr_record; rdict_duplicate; rdict_free_dict; rdict_ref_count; rdict_state; recordtreefree; recordtreenodefree; revprintree; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; splay; sscanf; strcmp; strcpy; tdsplay; tdsplayleft; tdsplayright; testloop; tolower; tree_duplicate; treenode_duplicate; treenode_new; usage; usage_msg; vdict_curr_delete; vdict_curr_item; vdict_curr_next; vdict_curr_prev; vdict_delete; vdict_find; vdict_get_dict; vdict_i_dict; vdict_insert; vdict_new; vdict_next; vdict_prev; vdict_print; vdict_rundown; vdict_x_dict


Doctor: RPC Version of Eliza-like Conversation Program

Click to open or copy the files for the Doctor sample.

This sample is an RPC psychotherapy conversation application that demonstrates arrays, strings, and the size_is attribute.

Main Files

File | Description
Doctor.idl | Interface definition language file
Doctor.acf | Attribute configuration file
Doctorc.c | Client main program
Doctors.c | Server main program
Doctorp.c | Remote procedures
Makefile | Nmake file to build for NT
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

analyze; atoi; defined; doctor_analyze; doctor_shutdown; exit; fprintf; free; gets; isdigit; isprint; malloc; match; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrpointerfree; ndrsendreceive; ndrserverinitializenew; printf; rand; respond; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; shutdown; sprintf; strcat; strcmp; strcpy; strmember; strncmp; strtok; synonyms; tolower; toupper; usage


DynEpt: Dynamic Endpoints

Click to open or copy the files for the DynEpt sample.

This sample demonstrates a client application managing its connection to the server through dynamic endpoints.

Main Files

File | Description
Readme.txt | Readme file for the DYNEPT sample
Dynept.idl | Interface definition language file
Dynept.acf | Attribute configuration file
Dyneptc.c | Client main program
Dynepts.c | Server main program
Dyneptp.c | Remote procedures
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

atoi; defined; dynept_helloproc; dynept_shutdown; exit; fprintf; free; helloproc; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrsendreceive; ndrserverinitializenew; printf; rpcbindingfree; rpcbindingfromstringbinding; rpcbindingvectorfree; rpcepregister; rpcepunregister; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcserverinqbindings; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseq; rpcstringbindingcompose; rpcstringfree; shutdown; tolower; usage


DynOut: Client Managing Connection via Dynamic Endpoints

Click to open or copy the files for the DynOut sample.

This sample demonstrates a client application managing its connection to the server through dynamic endpoints. This sample demonstrates how to allocate memory at a server for an n-byte object and pass it back to the client as an [out]-only parameter. The client then frees the memory. This technique allows the stub to call the server without knowing in advance how much data will be returned.

Main Files

File | Description
Readme.txt | Notes about the DynOut sample
Dynout.idl | Interface definition language file
Dynout.acf | Attribute configuration file
Dynoutc.c | Client main program
Dynouts.c | Server main program
Dynoutp.c | Remote procedure
Xx_midl.bat | Separate MIDL build file
Makefile | Nmake file to build 32-bit client and server applications

NMAKE builds the executable programs DYNOUT.EXE (client) and DYNOUTS.EXE (server).

Building SDK Samples

This sample uses the following keywords:

check_status; defined; exit; free; grabchunk; malloc; memset; memstuff_grabchunk; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconvert; ndrfcshort; ndrfreebuffer; ndrnsgetbuffer; ndrnssendreceive; ndrpointerbuffersize; ndrpointerfree; ndrpointermarshall; ndrpointerunmarshall; ndrserverinitializenew; printf; puts; rand; rpcbindingvectorfree; rpcepregister; rpcexcept; rpcexceptioncode; rpcnsbindingexport; rpcraiseexception; rpcserverinqbindings; rpcserverlisten; rpcserverregisterif; rpcserveruseallprotseqs; trace


Handles

Click to open or copy the files for the Handles samples.


Auto: ACF Auto Handle Sample

Click to open or copy the files for the Auto sample.

This sample demonstrates the use of the ACF attribute auto_handle in a distributed application that generates a time stamp.

Main Files

File | Description
Readme.txt | Readme file for the AUTO sample
Auto.idl | Interface definition language file
Auto.acf | Attribute configuration file
Autoc.c | Client main program
Autos.c | Server main program
Autop.c | Remote procedures
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

atoi; autoh_gettime; autoh_shutdown; ctime; defined; exit; fprintf; free; gettime; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconvert; ndrfcshort; ndrfreebuffer; ndrnsgetbuffer; ndrnssendreceive; ndrserverinitializenew; printf; rpcexcept; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcnsbindingexport; rpcraiseexception; rpcserverinqbindings; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; shutdown; time; tolower; usage


CxHndl: Context Handle Attribute Sample

Click to open or copy the files for the CxHndl sample.

This sample demonstrates the use of the context_handle attribute.

Main Files

File | Description
Readme.txt | Readme file for the CXHNDL sample
Cxhndl.idl | Interface definition language file
Cxhndl.acf | Attribute configuration file
Cxhndlc.c | Client main program
Cxhndls.c | Server main program
Cxhndlp.c | Remote procedures
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

atoi; cxhndl_remoteclose; cxhndl_remoteopen; cxhndl_remoteread; cxhndl_shutdown; defined; exit; fclose; fopen; fprintf; fread; free; malloc; midl_user_allocate; midl_user_free; ndrccontextbinding; ndrclientcontextmarshall; ndrclientcontextunmarshall; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfixedarraymarshall; ndrfixedarrayunmarshall; ndrfreebuffer; ndrgetbuffer; ndrscontextunmarshall; ndrscontextvalue; ndrsendreceive; ndrservercontextmarshall; ndrservercontextunmarshall; ndrserverinitializenew; pcontext_handle_type_rundown; printf; putchar; remoteclose; remoteopen; remoteread; rpcbindingfree; rpcbindingfromstringbinding; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; shutdown; strcpy; tolower; usage


UsrDef: User-Defined Context Handles

Click to open or copy the files for the UsrDef sample.

This sample demonstrates the use of user-defined handles.

Main Files

File | Description
Readme.txt | Readme file for the USRDEF sample
Usrdef.idl | Interface definition language file
Usrdef.acf | Attribute configuration file
Usrdefc.c | Client main program
Usrdefs.c | Server main program
Usrdefp.c | Remote procedures
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

atoi; data_handle_type_bind; data_handle_type_unbind; defined; exit; fprintf; free; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrpointerfree; ndrsendreceive; ndrserverinitializenew; ndrsimplestructbuffersize; ndrsimplestructmarshall; ndrsimplestructunmarshall; printf; rpcbindingfree; rpcbindingfromstringbinding; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; shutdown; tolower; usage; usrdef_shutdown; usrdef_usrdefproc; usrdefproc


Hello: Sample Using RPC

Click to open or copy the files for the Hello sample.

This sample is a client/server implementation of the classic "Hello, World" program. It prints "Hello, World" at the Server.

Main Files

File | Description
Readme.txt | Readme file for the HELLO sample
Hello.idl | Interface definition language file
Hello.acf | Attribute configuration file
Helloc.c | Client main program
Hellos.c | Server main program
Hellop.c | Remote procedures
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

atoi; defined; exit; fprintf; free; hello_helloproc; hello_shutdown; helloproc; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrsendreceive; ndrserverinitializenew; printf; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; shutdown; tolower; usage


Interop: OSF DCE RPC and MS RPC Interoperbility

Interop: OSF DCE RPC and MS RPC Interoperability

Click to open or copy the files for the Interop sample.

This sample demonstrates portability between OSF DCE RPC and Microsoft RPC. This program sends simple messages (strings) from the client to the server. The most important part of INTEROP is the header file Dceport.h. This header file maps OSF DCE RPC APIs and data structures to the Microsoft RPC equivalents.

Main Files

File | Description
Readme.txt | Readme file for the INTEROP sample
Msg.idl | Interface definition language file
Msg.acf | Attribute configuration file
Dceport.h | Maps OSF APIs and structures to Microsoft RPC equivalents
Client.c | Client main program
Server.c | Server main program
Midluser.c | Memory management routines for Microsoft RPC
Manager.c | Client-side utility routines
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS
Makefile.dos | Makefile to build for DCE platform

Building SDK Samples

This sample uses the following keywords:

clientmessage; defined; exit; free; interop_clientmessage; interop_shutdownserver; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrsendreceive; ndrserverinitializenew; printf; raise; rpc_binding_copy; rpc_binding_free; rpc_binding_from_string_binding; rpc_binding_inq_auth_client; rpc_binding_inq_auth_info; rpc_binding_inq_object; rpc_binding_reset; rpc_binding_server_from_client; rpc_binding_set_auth_info; rpc_binding_set_object; rpc_binding_to_string_binding; rpc_binding_vector_free; rpc_ep_register; rpc_ep_register_no_replace; rpc_ep_resolve_binding; rpc_ep_unregister; rpc_if_id_vector_free; rpc_if_inq_id; rpc_if_register_auth_info; rpc_mgmt_ep_elt_inq_begin; rpc_mgmt_ep_elt_inq_done; rpc_mgmt_ep_elt_inq_next; rpc_mgmt_ep_unregister; rpc_mgmt_inq_com_timeout; rpc_mgmt_inq_dflt_protect_level; rpc_mgmt_inq_if_ids; rpc_mgmt_inq_server_princ_name; rpc_mgmt_inq_stats; rpc_mgmt_is_server_listening; rpc_mgmt_set_authorization_fn; rpc_mgmt_set_cancel_timeout; rpc_mgmt_set_com_timeout; rpc_mgmt_set_server_stack_size; rpc_mgmt_stats_vector_free; rpc_mgmt_stop_server_listening; rpc_network_inq_protseqs; rpc_network_is_protseq_valid; rpc_ns_binding_export; rpc_ns_binding_import_begin; rpc_ns_binding_import_done; rpc_ns_binding_import_next; rpc_ns_binding_inq_entry_name; rpc_ns_binding_lookup_begin; rpc_ns_binding_lookup_done; rpc_ns_binding_lookup_next; rpc_ns_binding_select; rpc_ns_binding_unexport; rpc_ns_entry_expand_name; rpc_ns_entry_object_inq_begin; rpc_ns_entry_object_inq_done; rpc_ns_entry_object_inq_next; rpc_ns_group_delete; rpc_ns_group_mbr_add; rpc_ns_group_mbr_inq_begin; rpc_ns_group_mbr_inq_done; rpc_ns_group_mbr_inq_next; rpc_ns_group_mbr_remove; rpc_ns_mgmt_binding_unexport; rpc_ns_mgmt_entry_create; rpc_ns_mgmt_entry_delete; rpc_ns_mgmt_entry_inq_if_ids; rpc_ns_mgmt_handle_set_exp_age; rpc_ns_mgmt_inq_exp_age; rpc_ns_mgmt_set_exp_age; rpc_ns_profile_delete; rpc_ns_profile_elt_add; rpc_ns_profile_elt_inq_begin; rpc_ns_profile_elt_inq_done; rpc_ns_profile_elt_inq_next; rpc_ns_profile_elt_remove; rpc_object_inq_type; rpc_object_set_inq_fn; rpc_object_set_type; rpc_protseq_vector_free; rpc_server_inq_bindings; rpc_server_inq_if; rpc_server_listen; rpc_server_register_auth_info; rpc_server_register_if; rpc_server_unregister_if; rpc_server_use_all_protseqs; rpc_server_use_all_protseqs_if; rpc_server_use_protseq; rpc_server_use_protseq_ep; rpc_server_use_protseq_if; rpc_sm_alloce; rpc_sm_client_free; rpc_sm_destroy_client_context; rpc_sm_disable_allocate; rpc_sm_enable_allocate; rpc_sm_free; rpc_sm_get_thread_handle; rpc_sm_set_client_alloc_free; rpc_sm_set_thread_handle; rpc_sm_swap_client_alloc_free; rpc_string_binding_compose; rpc_string_binding_parse; rpc_string_free; rpcbindingcopy; rpcbindingfree; rpcbindingfromstringbinding; rpcbindinginqauthclient; rpcbindinginqauthinfo; rpcbindinginqobject; rpcbindingreset; rpcbindingserverfromclient; rpcbindingsetauthinfo; rpcbindingsetobject; rpcbindingtostringbinding; rpcbindingvectorfree; rpcepregister; rpcepregisternoreplace; rpcepresolvebinding; rpcepunregister; rpcexceptioncode; rpcifidvectorfree; rpcifinqid; rpcifregisterauthinfo; rpcleaveexception; rpcmgmtepeltinqbegin; rpcmgmtepeltinqdone; rpcmgmtepeltinqnext; rpcmgmtepunregister; rpcmgmtinqcomtimeout; rpcmgmtinqdefaultprotectlevel; rpcmgmtinqifids; rpcmgmtinqserverprincname; rpcmgmtinqstats; rpcmgmtisserverlistening; rpcmgmtsetauthorizathionfn; rpcmgmtsetcanceltimeout; rpcmgmtsetcomtimeout; rpcmgmtsetserverstacksize; rpcmgmtstatsvectorfree; rpcmgmtstopserverlistening; rpcnetworkinqprotseqs; rpcnetworkisprotseqvalid; rpcnsbindingexport; rpcnsbindingimportbegin; rpcnsbindingimportdone; rpcnsbindingimportnext; rpcnsbindinginqentryname; rpcnsbindinglookupbegin; rpcnsbindinglookupdone; rpcnsbindinglookupnext; rpcnsbindingselect; rpcnsbindingunexport; rpcnsentryexpandname; rpcnsentryobjectinqbegin; rpcnsentryobjectinqdone; rpcnsentryobjectinqnext; rpcnsgroupdelete; rpcnsgroupmbradd; rpcnsgroupmbrinqbegin; rpcnsgroupmbrinqdone; rpcnsgroupmbrinqnext; rpcnsgroupmbrremove; rpcnsmgmtbindingunexport; rpcnsmgmtentrycreate; rpcnsmgmtentrydelete; rpcnsmgmtentryinqifids; rpcnsmgmthandlesetexpage; rpcnsmgmtinqexpage; rpcnsmgmtsetexpage; rpcnsprofiledelete; rpcnsprofileeltadd; rpcnsprofileeltinqbegin; rpcnsprofileeltinqdone; rpcnsprofileeltinqnext; rpcnsprofileeltremove; rpcobjectinqtype; rpcobjectsetinqfn; rpcobjectsettype; rpcprotseqvectorfree; rpcraiseexception; rpcserverinqbindings; rpcserverinqif; rpcserverlisten; rpcserverregisterauthinfo; rpcserverregisterif; rpcserverunregisterif; rpcserveruseallprotseqs; rpcserveruseallprotseqsif; rpcserveruseprotseq; rpcserveruseprotseqep; rpcserveruseprotseqif; rpcsetexception; rpcsmallocate; rpcsmclientfree; rpcsmdestroyclientcontext; rpcsmdisableallocate; rpcsmenableallocate; rpcsmfree; rpcsmgetthreadhandle; rpcsmsetclientallocfree; rpcsmsetthreadhandle; rpcsmswapclientallocfree; rpcstringbindingcompose; rpcstringbindingparse; rpcstringfree; shutdownserver; tolower; usage; uuid_compare; uuid_create; uuid_create_nil; uuid_equal; uuid_from_string; uuid_hash; uuid_is_nil; uuid_to_string; uuidcompare; uuidcreate; uuidcreatenil; uuidequal; uuidfromstring; uuidhash; uuidisnil; uuidtostring


Mandel: Mandelbrot Set Windows Sample

Click to open or copy the files for the Mandel sample.

This sample is a distributed fractal drawing application that uses reference pointers, the implicit_handle attribute and handl_t primitive types.

Main Files

File | Description
Readme.txt | Notes about this sample
Mdlrpc.idl | Interface definition language file
Mdlrpc.acf | Attribute configuration file
Mandel.c | Client main program
Mandel.h | Client global data
Remote.c | Client code that calls remote procedures
Rpc.ico | Client icon
Mandel.def | Client module definition file
Mandel.rc | Client resource script file
Server.c | Server main program
Calc.c | Remote procedures
Makefile | Nmake utility for Windows NT or Windows 95
Makefile.win | Nmake utility for Win 3.x

Building SDK Samples

This sample uses the following keywords:

atoi; beginpaint; bind; bitblt; calchistogram; calcmand; calcthreshold; checkdrawingid; checkdrawstatus; checkmenuitem; counthistogram; createcompatiblebitmap; createcompatibledc; createwindow; defined; defwindowproc; deletedc; deleteobject; destroywindow; dialogbox; dispatchmessage; dosomework; drawrect; enablemenuitem; enddialog; endpaint; endpoint; exit; fillrect; fprintf; free; freedrawbuffer; freeprocinstance; getdc; getdlgitemtext; getmenu; getmessage; getstockobject; getwindowrect; incpictureid; initapplication; inithistogram; initinstance; initremote; invalidaterect; killtimer; loadcursor; loadicon; localalloc; localfree; locallock; localunlock; lockdrawbuffer; mainwndproc; makeprocinstance; malloc; mandelcalc; mapcolor; mdlrpc_mandelcalc; messagebox; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconvert; ndrfcshort; ndrfixedarraymarshall; ndrfixedarrayunmarshall; ndrfreebuffer; ndrgetbuffer; ndrpointerfree; ndrsendreceive; ndrserverinitializenew; ndrsimplestructbuffersize; ndrsimplestructmarshall; ndrsimplestructunmarshall; paintline; postmessage; postquitmessage; printf; protseq; querythreshold; registerclass; releasecapture; releasedc; resetpictureid; returndrawbuffer; rgb; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtwaitserverlisten; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; selectobject; sendmessage; server; setcapture; setdlgitemtext; setnewcalc; setpixel; settimer; showwindow; sprintf; strcpy; switch; takedrawbuffer; tolower; translatemessage; unlockdrawbuffer; unreferenced_parameter; updatewindow; usage; winmain


Mazelord: 3-D Maze Game

Click to open or copy the files for the Mazelord sample.

This sample is a 3-D maze game. The objective is to get as high a score as possible by zapping other players and by destroying automated drones which wander around the maze. When there are no other players, zapping drones still makes an interesting game in itself.

Mazelord is a networked or nonnetworked game, depending upon how it is invoked. In both versions, the player is placed in a room of sanctuary in a palace. In this room, players may not shoot, and drones cannot hurt players. Once outside of its 3x3 confines, however, anything goes. Your task is to hunt down drones and other players and zap them. Zapped players are teleported back to the sanctuary, and zapped drones are teleported to a random location in the maze.

See the Readme file for full instructions on how to play.

Building SDK Samples

This sample uses the following keywords:

aboutdlg; abs2offx; abs2offy; addpic; adj_x; adj_y; back_to_abs; beginpaint; bitblt; calc3dmaze; checkforplayers; checkmenuitem; clienttoscreen; closehandle; createcompatiblebitmap; createcompatibledc; createfile; createmailslot; createpen; createthread; createwindow; cwcenter; defwindowproc; deletedc; deletefullpic; deleteobject; deleteplayer; delhole; delpic; delplayerdraw; delscoretype; destroywindow; dialogbox; dispatchmessage; drawclippedpic; drawfoundplayers; drawmaze; drawplayers; drawrect; drawscore; drawtopview; dronedlg; eachtimeinit; eachtimeshutdown; enablemenuitem; enddialog; endpaint; exit; fadepic; findresource; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getclientrect; getcurrentprocessid; getdc; getdlgitemint; getdlgitemtext; getmailslotinfo; getmenu; getmessage; getstockobject; getstringres; getstringres2; gettextmetrics; getupdaterect; getusername; getwindowrect; globalalloc; globalfree; globalhandle; globallock; globalunlock; greaterof; initdrones; initgrid; initmaze; initnetwork; insanctuary; insertsubgrid; intonedlg; invalidaterect; killself; killtimer; left_to_abs; lesserof; lineto; loadbitmap; loadcursor; loadicon; loadresource; loadstring; lockresource; lstrcpy; lstrdup; lstrlen; mailwatchthread; makelong; maskblt; maskrop; maskrop2; mazewndproc; mc_to_sc; memcrc; memset; messagebeep; messagebox; movedrone; movetoex; movewindow; newfullpic; newhole; newplayer; newplayerdraw; newscoretype; onetimeinit; onetimeshutdown; playerdlg; playsound; polybezierto; polydraw95; postmessage; postquitmessage; printtextline; processnewmail; rand; randrange; readfile; readsubgrids; rectangle; rectdepth; rectwidth; refreshtext; registerclass; registerclasses; regopenkeyex; regqueryvalueex; releasedc; right_to_abs; scorewndproc; scrollwindow; selectobject; selectorof; senddlgitemmessage; sendmessage; sendnetmessage; setbkmode; setcursor; setdlgitemint; setdlgitemtext; settextalign; settimer; setwindowtext; showwindow; sleep; sndplaysound; sprintf; startdemo; stopdemo; strcpy; stretchbitmaps; stretchblt; subgrid_to_x; subgrid_to_y; switch; textout; textwndproc; topviewwndproc; translatemessage; unregisterclass; unregisterclasses; updatewindow; validaterect; winmain; wndproc; writefile


Name Service Samples

Click to open or copy the files for the Name Service samples.


CDS: Cell Directory Service

Click to open or copy the files for the CDS sample.

These files describe the gateway protocol to the DCE Cell Directory Service (CDS). This is not a sample, but is used by the NHello sample.

Main Files

File | Description
Nsiclt.idl[acf] | Client-side interface
Nsisvr.idl[acf] | Server-side interface
Nsicom.idl[acf] | Interface common to client and server
Nsimgm.idl[acf] | Interface for management

The OSF DCE environment uses the DCE Cell Directory Service (CDS) for its RPC name service. However, the OSF has not yet released a specification of the protocol used to access the CDS. To allow interoperation between DCE computers and RPC client applications that call RPC name service API functions, you must use a gateway to the DCE CDS.

To help you develop such a gateway, Microsoft defines an interface for a gateway protocol in the files Nsiclt.idl, Nssvr.idl, and Nsicom.idl, and provides the client-side implementation of this gateway protocol in Rpcns.dll. One such implementation of the server side gateway is currently available in the Digital Equipment Corporation DCE Starter Kit.


NHello: "Hello" Sample Using Name Service

Click to open or copy the files for the NHello sample.

This sample demonstrates using RPC Name Service.

Main Files

File | Description
Nhello.idl | Interface definition language file
Nhelloc.c | Client main program
Nhellos.c | Server main program
Nhellop.c | Remote procedures
Nsserv.c | NT Service program
Service.c | Service Control Manager interface
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

_stprintf; _stricmp; _tprintf; addtomessagelog; atoi; closeservicehandle; cmddebugservice; cmdinstallservice; cmdremoveservice; commandlinetoargvw; controlservice; createservice; defined; deleteservice; deregistereventsource; exit; formatmessage; fprintf; free; getcommandlinew; getlasterror; getlasterrortext; getmodulefilename; helloproc; localfree; lstrlen; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrsendreceive; ndrserverinitializenew; nhello_helloproc; nhello_shutdown; openscmanager; openservice; printf; queryservicestatus; registereventsource; registerservicectrlhandler; reportevent; reportstatustoscmgr; rpcbindingfree; rpcbindingtostringbinding; rpcbindingvectorfree; rpcepregister; rpcepunregister; rpcexcept; rpcexceptioncode; rpcmgmtisserverlistening; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcnsbindingexport; rpcnsbindingimportbegin; rpcnsbindingimportdone; rpcnsbindingimportnext; rpcnsbindingunexport; rpcserverinqbindings; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseallprotseqs; rpcstringfree; service_ctrl; service_main; servicestart; servicestop; setconsolectrlhandler; setservicestatus; shutdown; sleep; startservicectrldispatcher; switch; text; tolower; usage


Pickling (Serialization) Samples

Click to open or copy the files for the Pickle samples.

The RPC\Pickle directory has 2 subdirectories with pickling samples:

Sample | Description
PicklP | Procedure pickling sample
PicklT | Type pickling sample

Each sample demonstrates a fixed buffer style pickling and an incremental style pickling depending on the switches being used.

The implicit primitive handle is used as the pickling handle. With default switches, both samples encode data to a file. To decode data from the file, use -d switch.


PicklP: Procedure Serialization (a.k.a. pickling)

Click to open or copy the files for the PicklP sample.

This sample demonstrates data procedure serialization. The program demonstrates a fixed buffer style pickling and an incremental style pickling depending on the switches being used.

The implicit_handle primitive is used as the pickling handle.

With default switches, the program encodes data to a file. To decode data from the file, use -d switch.

Main Files

File | Description
Readme.txt | Readme file for the PICKLE sample
Picklp.idl | Interface definition language file
Picklp.acf | Attribute configuration file
Picklpc.c | Client main program
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

align_to8; defined; dumpdata; exit; fclose; fopen; fprintf; fread; free; fwrite; malloc; memset; mesdecodebufferhandlecreate; mesdecodeincrementalhandlecreate; mesencodefixedbufferhandlecreate; mesencodeincrementalhandlecreate; meshandlefree; midl_user_allocate; midl_user_free; ndrfcshort; ndrmesprocencodedecode; picalloc; picread; picwrite; printf; procpickle; readdatafromfile; tolower; usage; va_start; writedatatofile


PicklT: Data Type Serialization (a.k.a. pickling)

Click to open or copy the files for the PicklT sample.

This sample demonstrates data type serialization. The program demonstrates a fixed buffer style pickling and an incremental style pickling depending on the switches being used.

The implicit_handle primitive is used as the pickling handle.

With default switches, the program encodes data to a file. To decode data from the file, use -d switch.

Main Files

File | Description
Picklt.idl | Interface definition language file
Picklt.acf | Attribute configuration file
Pickltc.c | Client application for type pickling
Makefile | Nmake file to build for Windows NT or Windows 95
Makefile.dos | Nmake file to build for MS-DOS

Building SDK Samples

This sample uses the following keywords:

align_to8; defined; dumpdata; exit; fclose; fopen; fprintf; fread; free; fwrite; malloc; memset; mesdecodebufferhandlecreate; mesdecodeincrementalhandlecreate; mesencodefixedbufferhandlecreate; mesencodeincrementalhandlecreate; meshandlefree; midl_user_allocate; midl_user_free; ndrfcshort; ndrmestypealignsize; ndrmestypedecode; ndrmestypeencode; object2_alignsize; object2_decode; object2_encode; picalloc; picread; picwrite; printf; readdatafromfile; tolower; usage; writedatatofile


Pipes: Sample of Client/Server Pipes

Click to open or copy the files for the Pipes sample.

This sample demonstrates how to write a program that uses pipes for transferring data between the client and the server. The client sends a file to the server using pipes. The server then "encodes" the data by adding 1 to every element in the file, and then sends the file back using pipes. The pipe used in this sample program is a in/out pipe.

This program also allows the user to compile either for UNICIODE or ANSI.

Main Files

File | Description
Pipe.idl | Interface definition language file
Pipe.acf | Attribute configuration file
Pipec.c | Client main program
Pipes.c | Server main program
Common.h | Common header file for all the files
Pipeproc.c | Remote procedures
Makefile | Nmake file to build 32-bit client and server application for ANSI characters.
Makefile.uni | Nmake file to build 32-bit client and server application for UNICODE characters.

Building SDK Samples

This sample uses the following keywords:

_tcsclen; _tcscmp; _tcscpy; _tfopen; _tprintf; cleanupserver; commandlinetoargvw; defined; exit; exit_if_fail; fclose; fread; free; fseek; fwrite; getcommandline; malloc; midl_user_allocate; midl_user_free; ndrclientcall2; ndrclientinitializenew; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrsendreceive; ndrserverinitializenew; pipe_sample_shutdown; pipealloc; pipepull; pipepush; pull; push; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; scramblefile; shutdown; text; usage; va_start


RPCSSM: RPCSS/M Memory Package Sample

Click to open or copy the files for the RPCSSM sample.

This sample demonstrates the RPCSS memory management model.

Main Files

File | Description
Rpcssm.idl | Interface definition language file
Rpcssm.acf | Attribute configuration file
Rpcssmc.c | Client main program
Rpcssms.c | Server main program
Rpcssmp.c | Remote procedures
Makefile | Nmake file to build for Windows NT or Windows 95

Building SDK Samples

This sample uses the following keywords:

allocatelist; allocatesmlist; atoi; defined; exit; fprintf; free; freelist; initlist; inoutlist; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrpointerbuffersize; ndrpointermarshall; ndrpointerunmarshall; ndrrpcssdisableallocate; ndrrpcssenableallocate; ndrsendreceive; ndrserverinitializenew; printf; printlist; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcsmallocate; rpcsmdisableallocate; rpcsmenableallocate; rpcssallocate; rpcssm_free_wrapper; rpcssm_inoutlist; rpcssm_malloc_wrapper; rpcssm_shutdown; rpcstringbindingcompose; rpcstringfree; shutdown; tolower; usage


RPCsvc: Windows NT System Service That Uses RPC

Click to open or copy the files for the RPCsvc sample.

This sample demonstrates how to implement an NT system service that uses RPC.

This particular RPC service is designed to show the performance effects of various parameters to RPC APIs and interface design.

The service can be started and stopped from either the Services control panel, the net start/stop command line, or by using the Service Controller utility (see below).

The service also provides command-line parameters which install, remove, or run (debug) the service as a console application.

This sample (and service.c) is based on the win32\service sample.

Main Files

File | Description
Rpcsvc.idl | Interface definition language file
Rpcsvc.acf | Attribute configuration file
Client.c | Client main program
Server.c | Server main program
Service.c | Service APIs
Makefile | Nmake file to build for Windows NT or Windows 95

Building SDK Samples

This sample uses the following keywords:

_stprintf; _stricmp; _tprintf; addtomessagelog; atoi; bufferin1; bufferin2; bufferin3; bufferout1; bufferout2; bufferout3; bufferout4; checksecurity; closeservicehandle; cmddebugservice; cmdinstallservice; cmdremoveservice; commandlinetoargvw; controlservice; createservice; defined; deleteservice; deregistereventsource; dotimings; endtime; exit; formatmessage; free; getcommandlinew; getlasterror; getlasterrortext; getmodulefilename; getprocessheap; heapalloc; heapfree; listin; listout1; listout2; localfree; lstrlen; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrcomplexarraybuffersize; ndrcomplexarrayfree; ndrcomplexarraymarshall; ndrcomplexarrayunmarshall; ndrcomplexstructbuffersize; ndrcomplexstructmarshall; ndrcomplexstructunmarshall; ndrconformantarraybuffersize; ndrconformantarraymarshall; ndrconformantarrayunmarshall; ndrconformantvaryingarraybuffersize; ndrconformantvaryingarraymarshall; ndrconformantvaryingarrayunmarshall; ndrconvert; ndrfclong; ndrfcshort; ndrfixedarraybuffersize; ndrfixedarraymarshall; ndrfixedarrayunmarshall; ndrfreebuffer; ndrgetbuffer; ndrmapcommandfaultstatus; ndrpointerbuffersize; ndrpointerfree; ndrpointermarshall; ndrpointerunmarshall; ndrrpcssdisableallocate; ndrrpcssenableallocate; ndrsendreceive; ndrserverinitializenew; ndrsimplestructbuffersize; ndrsimplestructmarshall; ndrsimplestructunmarshall; ndrvaryingarraybuffersize; ndrvaryingarraymarshall; ndrvaryingarrayunmarshall; openscmanager; openservice; pfnallocate; pfnfree; ping; printf; queryperformancecounter; queryperformancefrequency; queryservicestatus; registereventsource; registerservicectrlhandler; reportevent; reportstatustoscmgr; rpcbindingfree; rpcbindingfromstringbinding; rpcbindingsetauthinfo; rpcbindingvectorfree; rpcepregister; rpcepunregister; rpcexcept; rpcexceptioncode; rpcimpersonateclient; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcraiseexception; rpcreverttoself; rpcserverinqbindings; rpcserverlisten; rpcserverregisterauthinfo; rpcserverregisterif; rpcserveruseprotseq; rpcservicesample_bufferin1; rpcservicesample_bufferin2; rpcservicesample_bufferin3; rpcservicesample_bufferout1; rpcservicesample_bufferout2; rpcservicesample_bufferout3; rpcservicesample_bufferout4; rpcservicesample_checksecurity; rpcservicesample_free_wrapper; rpcservicesample_listin; rpcservicesample_listout1; rpcservicesample_listout2; rpcservicesample_malloc_wrapper; rpcservicesample_ping; rpcservicesample_structsin1; rpcservicesample_structsin2; rpcservicesample_structsin3; rpcservicesample_unioncall1; rpcservicesample_unioncall2; rpcssallocate; rpcstringbindingcompose; rpcstringfree; service_ctrl; service_main; servicestart; servicestop; setconsolectrlhandler; setservicestatus; sleep; startservicectrldispatcher; starttime; structsin1; structsin2; structsin3; switch; text; unioncall1; unioncall2; usage


StrOut: Dynamically Allocated Strings with [out] Attribute

Click to open or copy the files for the StrOut sample.

This sample demonstrates how to allocate memory at a server for a two-dimensional object (an array of pointers) and pass it back to the client as an [out]-only parameter. The client then frees the memory. This technique allows the stub to call the server without knowing in advance how much data will be returned.

This program also allows the user to compile either for UNICODE or ANSI.

Main Files

File | Description
Strout.idl | Interface definition language file
Strout.acf | Attribute configuration file
Client.c | Client main program
Server.c | Server main program
Common.h | Common header file for all the files
Remote.c | Remote procedures
Makefile | Nmake file to build 32-bit client and server applications, for ANSI characters
Makefile.uni | Nmake file to build 32-bit client and server applications, for UNICODE characters

Building SDK Samples

This sample uses the following keywords:

_tcscmp; _tcscpy; _tcslen; _tprintf; cleanupserver; commandlinetoargvw; defined; exit; exit_if_fail; free; getcommandline; getenvironmentstrings; getremoteenv; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrpointerbuffersize; ndrpointerfree; ndrpointermarshall; ndrpointerunmarshall; ndrsendreceive; ndrserverinitializenew; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; shutdown; strout_sample_getremoteenv; strout_sample_shutdown; text; usage


WHello: Windows Version of "Hello, World" Sample

Click to open or copy the files for the WHello sample.

This sample is a client/server implementation of "Hello, World". The client and server applications can run on the same Windows NT® workstation.

Main Files

File | Description
Whello.idl | Interface definition language file
Whello.acf | Attribute configuration file
Whelloc.c | Client main program
Whello.rc | Client resource file
Whello.dlg | Client dialog box definitions
Whello.def | Client module definition file
Whellos.c | Server main program
Whellop.c | Remote procedures
Makefile | Nmake file for Windows NT or Windows 95
Makefile.win | Nmake file for Win 3.x

Building SDK Samples

This sample uses the following keywords:

atoi; bind; createwindow; defined; defwindowproc; destroywindow; dialogbox; dispatchmessage; enddialog; endpoint; exit; fprintf; free; freeprocinstance; getdlgitemtext; getmessage; getstockobject; helloproc; initapplication; initinstance; loadcursor; loadicon; mainwndproc; makeprocinstance; malloc; messagebox; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconformantstringbuffersize; ndrconformantstringmarshall; ndrconformantstringunmarshall; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrsendreceive; ndrserverinitializenew; postmessage; postquitmessage; printf; protseq; registerclass; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; send; server; setcursor; setdlgitemtext; showwindow; shutdown; sprintf; strcpy; switch; tolower; translatemessage; unreferenced_parameter; updatewindow; usage; whello_helloproc; whello_shutdown; winmain


WinTyp: Client-Server Bitmap Processor Sample

Click to open or copy the files for the WinTyp sample.

This sample demonstrates how to write a program that uses RPC calls to transfer windows datatypes between the client and the server. The client reads in a bitmap and when the user selects to modify the image, the bitmap is sent to the server, where the server is doing the modification. The bitmap is then sent back to the client, where the new bitmap is displayed.

There are two choices for manipulating the images, either to flip it or to find the edges in it. The find edge procedure will only work when the screen resolution is set to 256 colors. The reason for this is that the algorithm used in the remote procedures only works with 8 bits per pixel.

This program also allows the user to compile either for UNICODE or ANSI.

Main Files

File | Description
Wintyp.idl | Interface definition language file
Wintyp.acf | Attribute configuration file
Client.c | Client main program
Client.h | Header file specific for the client side
Client.rc | Resource file for the client application
Clires.h | Resource header file
Server.c | Server main program
Common.h | Common header file for all the files
Remote.c | Remote procedures
Makefile | Nmake file to build 32-bit client and server application, for ANSI characters
Makefile.uni | Nmake file to build 32-bit client and server application, for UNICODE characters

Building SDK Samples

This sample uses the following keywords:

_stprintf; _tcscmp; _tcscpy; _tprintf; aboutdlgproc; abs; beginpaint; bind; bindingdlgproc; bitblt; changebitmapremote; cleanup; cleanupserver; clientproc; clientwindowproc; closehandle; commandlinetoargvw; createcompatibledc; createfile; createpalette; createwindowex; defined; defwindowproc; deletedc; deleteobject; destroywindow; dialogbox; dispatchmessage; enablemenuitem; enddialog; endpaint; exit; exit_if_fail; fillrect; findedges; flipimage; free; get2dpointer; getbitmapbits; getbitmapfilename; getclientrect; getcommandline; getdc; getdevicecaps; getdlgitemtext; getmapmode; getmenu; getmessage; getobject; getopenfilename; getstockobject; getsystemmetrics; getwindowrect; globalalloc; globalfree; globallock; globalunlock; hbitmap_userfree; hbitmap_usermarshal; hbitmap_usersize; hbitmap_userunmarshal; invalidaterect; loadaccelerators; loadcursor; loadicon; loadimage; loadpalettefromfile; makeintresource; malloc; messagebox; midl_user_allocate; midl_user_free; movewindow; ndrclientinitializenew; ndrconvert; ndrfclong; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrpointerfree; ndrsendreceive; ndrserverinitializenew; ndrusermarshalbuffersize; ndrusermarshalmarshall; ndrusermarshalunmarshall; postmessage; postquitmessage; print; readbitmapfromfile; readfile; realizepalette; redrawclientarea; registerclass; releasedc; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; selectpalette; setbitmapbits; setdlgitemtext; setfilepointer; showwindow; shutdown; switch; text; translateaccelerator; translatemessage; updatewindow; usage; winmain; wintyp_sample_changebitmapremote; wintyp_sample_shutdown


Yield: Demonstrate Yield Capability for MS Windows 3.x

Click to open or copy the files for the Yield sample.

This sample demonstrates use of the RpcWinSetYieldInfo function to prevent a distributed application from blocking during lengthy remote procedure calls.

Main Files

File | Description
Yield.idl | Interface definition language file
Yield.acf | Attribute configuration file
Yieldc.c | Client main program
Yieldc.rc | Client resource file
Yieldc.dlg | Client dialog box definitions
Yieldc.def | Client module definition file
Yields.c | Server main program
Yieldp.c | Remote procedures
Makefile | Nmake file for Windows NT or Windows 95
Makefile.win | Nmake file for Win 3.x

Building SDK Samples

This sample uses the following keywords:

atoi; bind; checkradiobutton; createwindow; customyield; defined; defwindowproc; destroywindow; dialogbox; dispatchmessage; enddialog; exit; findresource; fprintf; free; freeprocinstance; getbindinfo; getdlgitemint; getdlgitemtext; getmessage; getstockobject; getwaitinfo; getyieldinfo; initapplication; initinstance; loadcursor; loadicon; loadresource; mainwndproc; makeprocinstance; malloc; messagebox; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconvert; ndrfreebuffer; ndrgetbuffer; ndrsendreceive; ndrserverinitializenew; postmessage; postquitmessage; printf; registerclass; rpcbindingfree; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcmgmtwaitserverlisten; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; rpcstringfree; rpcwinsetyieldinfo; senddlgitemmessage; setcursor; setdlgitemint; setdlgitemtext; setwindowtext; showwindow; shutdown; sleep; sprintf; strcpy; switch; tolower; translatemessage; unreferenced_parameter; updatewindow; usage; winmain; yield_shutdown; yield_yieldproc; yieldproc


RRas Samples

Click to open or copy the files for the RRas samples.


EAP: Sample for RAS Extensible Authentication Protocol

Click to open or copy the files for the EAP sample.

This sample is a demonstration of using the RAS Extensible Authentication Protocol.

Here is an diagram of the EAP sample protocol:

AUTHENTICATOR      AUTHENTICATEE

Step 1:

        "Send Password"
    ---------------------->
          EAP Request

Step 2:

         <password>
    <----------------------
         EAP Response

Step 3:

    ---------------------->
       Success/Failure

Building SDK Samples

This sample uses the following keywords:

authenticateuser; cmakemessage; copymemory; disablethreadlibrarycalls; eapbegin; eapend; eapmakemessage; getlasterror; getpasswordfromresponse; hosttowireformat16; localalloc; localfree; makerequestmessage; makeresponsemessage; makeresultmessage; raseapdllentry; smakemessage; strcpy; switch; wiretohostformat16; zeromemory


Lookup: RRas Sample

Click to open or copy the files for the Lookup sample.

Building SDK Samples

This sample uses the following keywords:

allocatenode; assert; closestkey; closestsubtrie; complementposition; createnode; distpos; getclosestkey; getclosestsubtrie; getkey; getkeybyposition; getlasterror; getrelevantbit; getsubtrie; getsubtriebyposition; heapalloc; index; insertinorabove; insertkey; insertwithemptysubtrie; insertwithnonemptysubtrie; isleafnode; issinglekeyleafnode; issinglekeynode; leftkey; leftsubtrie; lefttrie; lenght; length; max; min; parent; printf; rightkey; rightsubtrie; righttrie; width


SNA Samples

Click to open or copy the files for the SNA samples.

For more information, see Sample APPC TPs in the SDK in the APPC Programmer's Guide and Sample CPI-C TPs in the SDK in Microsoft SNA Server.


APing: APPC Ping Sample for Testing Connectivity

Click to open or copy the files for the APing sample.

Click to open or copy the Shared directory (required).

The sample code for APing and APingD is ported from code on the IBM APPC/CPI-C disk. They are end-to-end connectivity testers; they simply show that the configuration is correct by exchanging bytes of data across the link. APing is the invoking (local) half and attempts to contact APingD, which is written here as a Windows NT service so it can be installed as an invokable TP on the remote computer.

For more information, see APING and APINGD in Microsoft SNA Server.

Aping.c performs an echo test to a specified destination. APING can be used when you are first installing APPC on your computer to make sure you can connect to another computer in the network. APING can also be used to get an estimate of the delay time or throughput to another computer in the network.

ApingD echos whatever is sent by APING. Keep receiving until you get permission to send. Send the same number of same size records

There is a Snaenv.bat file to set environment variables, available via the SNA Samples topic.

Building SDK Samples

This sample uses the following keywords:

alloc_cpic_buffer; atol; cmaccp; cmallc; cmcfmd; cmdeal; cmepln; cmsdt; cmsend; cmsltp; cmsptr; cmssl; cmsst; cmwait; controlhandler; cpicerr_destroy; cpicerr_exchange_version; cpicerr_exchange_version_plus; cpicerr_handle_rc; cpicerr_new; cpicerr_set_conv_id; cpicerr_set_log_file_name; cpicerr_set_log_file_path; cpicerr_set_major_version; cpicerr_set_minor_version; cpicerr_set_program_info; cpicerr_set_program_name; cpicinit_default_mode_name; cpicinit_default_sym_dest_name; cpicinit_default_tp_name; cpicinit_destroy; cpicinit_get_password; cpicinit_new; cpicinit_query_password_needed; cpicinit_set_destination; cpicinit_set_mode_name; cpicinit_set_password; cpicinit_set_security_type; cpicinit_set_tp_name; cpicinit_set_userid; cpicinit_setup_conversation; debugbreak; defined; do_aping; do_exit; fclose; fopen; get_time; getlasterror; getopt; memset; process_arguments; registerservicectrlhandler; servicemain; setbuf; setservicestatus; show_info; startservicectrldispatcher; tpstart; wincpicstartup; write_error; write_log; write_output


APPC: Sample for Bulk Send and Receive TPs

Click to open or copy the files for the APPC sample.

This sample demonstrates TPs for bulk send and receive.

Main Files

TP Name | Description
SENDRECV | Contains the main routines for a simple bulk data sending and receiving TPs Sendtp and Recvtp.
SENDTP | Simple command line TP which simply allocates, does the specified number of send_data and then deallocates. Done via a while loop. For DOS and OS/2.
RECVTP | As SENDTP, but it receive_allocates, then receive_and_waits until it gets deallocated. Repeat this NumConversation times.
NT and Win16 | Simple windows apps which use the async verbs and control operation via the window proc of a minimized window. This proc makes calls to IssueNextVerb on receipt of an async_complete message. To decide what to issue next, IssueNextVerb uses the opcode of the verb which just completed, and calls the appropriate do_ routine to fill in the vcb. It then calls the appropriate APPC entry point.

For more information, see APPC Send and Receive TPs in Microsoft SNA Server.

There is a Snaenv.bat file to set environment variables, available via the SNA Samples topic.

Building SDK Samples

This sample uses the following keywords:

_fmemchr; _fmemset; _fstricmp; _fstrncpy; _fstrupr; acssvc_c; appc; atoi; build_mc_allocate; build_mc_confirm; build_mc_confirmed; build_mc_deallocate; build_mc_receive_and_wait; build_mc_send_conversation; build_mc_send_data; build_receive_allocate; build_tp_ended; build_tp_started; conv_a_to_e; conv_e_to_a; createwindow; debugbreak; defined; defwindowproc; dispatchmessage; dosallocseg; dosfreeseg; fclose; fopen; fprintf; free; generatedata; get_run_details; getc; getmessage; getmodulefilename; getstockobject; gettickcount; globalalloc; globalfree; globalhandle; globallock; globalunlock; initialisemain; initialisewinmain; issuenextverb; loadcursor; loadicon; lstrcpy; makep; malloc; memchr; memcpy; memset; newconversation; outputresults; padstring; postmessage; postquitmessage; printf; processreturns; readconfig; readstring; registerclass; registerwindowmessage; selectorof; send_run_details; setwindowtext; showwindow; sprintf; strcmpi; strcpy; strncpy; strtok; strupr; tpwndproc; translatemessage; winappccleanup; winappcstartup; winasyncappc; winmain


Aremote: SNA Sample

Click to open or copy the files for the Aremote sample.

This sample has the following parts:

Main Files

File | Description
Remote.c | This module contains the main entry point for Remote. Calls the Server or the Client depending on the first parameter.
APPC Remote Installer | This program brings up a dialog box that prompts for TP configuration information. The information is then placed in the registry under Windows NT, and in the Win.ini file under Windows. The WIN32 compiler flag specifies the NT version, while the WINDOWS flag specifies the Windows version.
Client.c | The Client component of Remote. Connects to the remote server using named pipes. It sends its stdin to the server and outputs everything from the server to its stdout.
Server.c | The server component of Remote. It spawns a child process and redirects the stdin/stdout/stderr of child to itself. Waits for connections from clients, passing the output of child process to client and the input from clients to child process.

There is a Snaenv.bat file to set environment variables, available via the SNA Samples topic.

Building SDK Samples

This sample uses the following keywords:

_wcslwr; _wcsupr; acssvc_c; addtoq; appc_flipi; appc_flipl; appcclose; appcconnect; appcdbg; appcdestroy; appcerror; appcinit; appclisten; appcread; appcvalid; appcwrite; asyncappc; atoi; atol; callappc; calloc; callwindowproc; clearvcb; client; closeclient; closehandle; closeservicehandle; cmdstring; controlhandler; conv_a_to_e; convsecwndproc; createevent; createfile; createkeys; createmysecuritydescriptor; createpipe; createsemaphore; createservice; createthread; dbgprint; debugbreak; deletefile; deletelistitem; displayclienthlp; displayerror; displayinfo; displayserverhlp; do_confirm; do_deallocate; do_get_fqplu_name; do_mc_allocate; do_prepare_to_receive; do_receive_and_wait; do_send_data; do_tp_ended; do_tp_started; enablewindow; enddialog; entercriticalsection; errorexit; errormsg; establishsession; exit; exitprocess; exitthread; filterclientinp; filtercommand; findfirstfile; finitewndproc; forkchildprocess; free; freeprocinstance; generateconsolectrlevent; get_wm_command_id; getactivewindow; getappcreturncode; getchldoutput; getclientinput; getcolornum; getcommandline; getcomputername; getconsolescreenbufferinfo; getconsoletitle; getcurrentdirectory; getcurrentprocess; getdlgitem; getdlgitemtext; getenvironmentstrings; getenvironmentvariable; getfilesize; getfullpathname; getlasterror; getlengthsid; getlocaltime; getopenfilename; getserverout; getstdhandle; getsystemdirectory; gettempfilename; gettickcount; getversion; getwindowlong; infinitewndproc; initclientlist; initializecriticalsection; installcallback; installservicent; installwindows; interlockeddecrement; interlockedincrement; isdlgbuttonchecked; leavecriticalsection; listenforsession; listenthread; loadstring; localalloc; localfree; locallock; localsession; localunlock; lockservicedatabase; lstrcat; lstrcmp; lstrcpy; lstrlen; makeprocinstance; makevalidluname; malloc; maximum; mbstowcs; memalloc; memcmp; memcpy; memcpya2e; memcpypad; memfree; memset; messagebox; minimum; movememory; mych; newq; newsession; openscmanager; parsecreateerror; postquitmessage; printf; readconsole; readfile; readfixbytes; readstring; regcreatekeyex; registerservicectrlhandler; regsetvalueex; releasesemaphore; remote_main; remoteinfo; remotesession; removeheadfromq; removeinpmark; removeqnodefromq; sendmessage; sendmyinfo; sendserverinp; sendstatus; server; servicemain; servicewndproc; setcolor; setconsolectrlhandler; setconsoletextattribute; setdlgitemtext; setevent; setfilepointer; setlasterror; setservicestatus; setwindowlong; showpopup; sleep; sprintf; srvctrlhand; startservicectrldispatcher; stdinthread; stdoutthread; strcat; strcpy; switch; terminateprocess; terminatethread; text; tolower; toupper; transferfiletoclient; unlockservicedatabase; unreferenced_parameter; validatefield; validatefieldappc; validatefieldint; waitformultipleobjects; waitforsingleobject; wcscpy; wcsstr; wcstombs; winappccancelasyncrequest; winappccleanup; winappcstartup; winasyncappcex; writeconsole; writef; writefile; writekeynt; writekeywindows; writeprofilestring; wsprintf; zeromemory


ARexec: Sample of APPC Remote Execution of Commands

Click to open or copy the files for the ARexec sample.

Click to open or copy the Shared directory (required).

This sample executes a command on a remote workstation and displays the output from the command (both stdout and stderr) on the requesting workstation.

Usage: arexec destination command

The destination may be either a partner LU alias (up to eight characters) or a fully qualified LU name (3-17 characters separated by a period).

The Arexecd.c module is the server side of ARexec. This module will execute a specified command and route the output back to the ARexec transaction program.

For more information, see AREXEC and AREXECD in Microsoft SNA Server.

There is a Snaenv.bat file to set environment variables, available via the SNA Samples topic.

Building SDK Samples

This sample uses the following keywords:

cmaccp; cmallc; cmdeal; cmepln; cmrcv; cmsdt; cmsend; cmsltp; cmssl; cmsst; cmwait; controlhandler; convert_from_ascii; convert_to_ascii; cpicerr_destroy; cpicerr_exchange_version; cpicerr_exchange_version_plus; cpicerr_handle_rc; cpicerr_new; cpicerr_set_conv_id; cpicerr_set_log_file_name; cpicerr_set_log_file_path; cpicerr_set_major_version; cpicerr_set_minor_version; cpicerr_set_program_info; cpicerr_set_program_name; cpicinit_default_mode_name; cpicinit_default_sym_dest_name; cpicinit_default_tp_name; cpicinit_destroy; cpicinit_get_password; cpicinit_new; cpicinit_query_password_needed; cpicinit_set_destination; cpicinit_set_mode_name; cpicinit_set_password; cpicinit_set_security_type; cpicinit_set_tp_name; cpicinit_set_userid; cpicinit_setup_conversation; debugbreak; defined; execute_and_send_output; exit; fwrite; getlasterror; getopt; process_arguments; registerservicectrlhandler; servicemain; setbuf; setservicestatus; show_info; startservicectrldispatcher; strcat; tpstart; wincpicstartup; write_error; write_output


CPIC: CPI-C TP Sample for Asynchronous CPI-C Calls

Click to open or copy the files for the CPIC sample.

This sample is a simple CPI-C TP that illustrates the use of asynchronous CPI-C calls.

For more information, see Sample CPI-C TPs in the SDK in CPI-C Programmer's Guide.

The file CPICSR contains the main routines for CPI-C versions of the sending and receiving TPs SENDTP and RECVTP.

There is a Snaenv.bat file to set environment variables, available via the SNA Samples topic.

Building SDK Samples

This sample uses the following keywords:

atoi; build_tp_ended; cmaccp; cmallc; cmcfm; cmcfmd; cmdeal; cminit; cmrcv; cmsend; cmsltp; cmspm; cmssl; cmwait; createwindow; debugbreak; defined; defwindowproc; dispatchmessage; do_cmaccp; do_cmallc; do_cmcfm; do_cmcfmd; do_cmdeal; do_cminit; do_cmrcv; do_cmsend; fclose; fopen; fprintf; generatedata; getc; getmessage; getmodulefilename; getstockobject; gettickcount; initialisemain; initialisewinmain; issuenextverb; loadcursor; loadicon; lstrcpy; malloc; newconversation; outputresults; padstring; postmessage; postquitmessage; processreturns; readconfig; readstring; registerclass; registerwindowmessage; setwindowtext; showwindow; sprintf; strcmpi; strcpy; strncpy; strtok; strupr; tpwndproc; translatemessage; wincpiccleanup; wincpicstartup; winmain; xchwnd


MPing: LU Ping Tester Sample

Click to open or copy the files for the MPing sample.

Click to open or copy the Shared directory (required).

Performs an echo test to a specified LU. APing can be used when you are first installing APPC on your computer to make sure you can connect to another computer in the network. APing can also be used to get an estimate of the delay time or throughput to another computer in the network.

APingD echos whatever is sent by APing. Keep receiving until you get permission to send. Send the same number of same size records.

There is a Snaenv.bat file to set environment variables, available via the SNA Samples topic.

Building SDK Samples

This sample uses the following keywords:

alloc_cpic_buffer; closehandle; cmaccp; cmcfmd; cmepln; cmsend; cmsltp; cmsptr; cmsst; cmwait; controlhandler; cpicerr_destroy; cpicerr_exchange_version; cpicerr_handle_rc; cpicerr_new; cpicerr_set_conv_id; cpicerr_set_log_file_name; cpicerr_set_log_file_path; cpicerr_set_major_version; cpicerr_set_minor_version; cpicerr_set_program_info; cpicerr_set_program_name; createevent; createthread; debugbreak; do_exit; free_cpic_buffer; getlasterror; registerservicectrlhandler; servicemain; setevent; setservicestatus; startservicectrldispatcher; threadstart; tpstart; waitforsingleobject; wincpiccleanup; wincpicstartup; write_output


MSendRcv: Multi-threaded APPC Calls with Event Completion

Click to open or copy the files for the MSendRcv sample.

This sample demonstrates multi-threaded APPC calls with event completion. It includes the following three files.

Mrcv.c - RECEIVE using event completion

This file contains the routines for a multi-threaded routine which uses asynchronous APPC calls with event completion to receive data. It runs with either the single-threaded or the multi-threaded version of send (msend or sendtp). This is a Windows NT application which runs in a minimized window.

This program is compatible with the single-threaded versions of send, which can be run, for example, on WIN16 clients.

Msend.c - SEND using event completion

This file contains the routines for a multi-threaded routine which uses asynchronous APPC calls with event completion to send data. It runs with either the single-threaded or the multi-threaded version of receive (mrcv or recvtp).

This program is compatible with the single-threaded version of receive, which can be run, for example, on WIN16 clients.

Msendrcv.c - SEND and RECEIVE using event completion

This file contains the routines for a multi-threaded routine which uses asynchronous APPC calls with event completion to send and receive data. It requires another copy of itself on another machine to run or it can send and receive to itself.

Each conversation issues MC_RECEIVE_AND_WAIT verbs to receive data. If confirmation is requested, an MC_CONFIRM verb is issued.

This program is compatible with the single-threaded versions of send and receive, which can be run, for example, on WIN16 clients.

For more information, see Multithreaded APINGD in Microsoft SNA Server.

There is a Snaenv.bat file to set environment variables, available via the SNA Samples topic.

Building SDK Samples

This sample uses the following keywords:

acssvc_c; appc_flipi; appc_flipl; atoi; build_mc_allocate; build_mc_confirm; build_mc_confirmed; build_mc_deallocate; build_mc_receive_and_wait; build_mc_send_conversation; build_mc_send_data; build_receive_allocate; build_tp_ended; build_tp_started; closehandle; conv_a_to_e; conv_e_to_a; createevent; createthread; createwindow; debugbreak; defwindowproc; deletecriticalsection; dispatchmessage; endconversation; entercriticalsection; fclose; fflush; fopen; fprintf; generatedata; getc; getlasterror; getlocaltime; getmessage; getmodulefilename; getstockobject; getthreadpriority; gettickcount; initializecriticalsection; initializemain; initializewinmain; issuercvverb; issuesendverb; leavecriticalsection; loadcursor; loadicon; lstrcpy; malloc; memchr; memcpy; memset; outputresults; padstring; postmessage; postquitmessage; processreturns; rcvallocthread; readconfig; readstring; receivethread; registerclass; sendthread; setthreadpriority; setwindowtext; showwindow; sprintf; srtrace; srtrclose; srtrflush; srtropen; startconversation; strcmpi; strcpy; strncpy; strtok; strupr; tpwndproc; translatemessage; waitformultipleobjects; waitforsingleobject; winappccleanup; winappcstartup; winasyncappcex; winmain


Rui3270: 3270 Emulator with RUI API for SSCP and LU Sessions

Click to open or copy the files for the Rui3270 sample.

For more information, see LUA Code Samples in the SDK in the LUA Programmer's Guide.

This sample program is a simple 3270 emulator. It uses the RUI API to access both the SSCP and LU sessions. Outbound data from the host is displayed on the screen unformatted. Both SSCP and LU data are shown.

If the outbound data is an RQD request, an automatic positive response is sent. Inbound data can be entered at the keyboard and is sent on the current session. This current session can be toggled between the SSCP and LU sessions by pressing the [ key (the left square-bracket key), followed by <cr> (carriage return), although it switches automatically on receipt of BIND or UNBIND.

The program is invoked with a single parameter - the name of the LUA LU to use. This is converted to upper case and must match an LUA LU in the configuration file. This LU should be configured for a 327? on the host.

This program works with TSO, provided that complex formatted logon screens are not used.

There is a Snaenv.bat file to set environment variables, available via the SNA Samples topic.

Building SDK Samples

This sample uses the following keywords:

_fstrlen; acssvc_c; closedown; createwindow; csv_init; definemuxsemlist; defwindowproc; dispatchmessage; do_write; endpaint; exit; getch; getdc; getfmireturncode; getlasterror; getmessage; getstockobject; getsystemmetrics; issue_init; issue_read; issue_rpq; issue_rsp; issue_verb; kbhit; loadcursor; loadicon; memcpy; memset; other_done; postquitmessage; printf; read_done; registerclass; registerwindowmessage; releasedc; rui; showwindow; textout; translatemessage; updatewindow; wait_active_status; waitforsingleobject; winmain; winrui; winruicleanup; winruigetlastinitstatus; wndproc


Shared: Shared Files for SNA Samples

Click to open or copy the files for the Shared sample.

The Shared directory contains the following files.

Cpicerr.c

Contains procedures to be called for handling unexpected CPI-C return codes. Contains procedures to be called for handling the CPI-C error information cpicerr.

Cpicinit.c

Provides procedures to be used in programs to help them set up all of the partner program information for CPI-C. All of the information is stored in a CPICINIT structure. The information is stored in the structure using default and set calls.

Cpicport.c

Contains procedures that may have to be rewritten for different environments.

This file is the home of all operating-system-specific functions.

Getopt.c

The getopt function is a command-line parser. It returns the next option character in argv that matches an option character in opstring.

The argv argument points to an array of argc+1 elements containing argc pointers to character strings followed by a null pointer.

There is a Snaenv.bat file to set environment variables, available via the SNA Samples topic.

Building SDK Samples

This sample uses the following keywords:

_next_char; alloc_cpic_buffer; appc; ascii_to_ebcdic_field; asctime; blank_string; calloc; clear_vcb; closehandle; cmcfmd; cmdeal; cmecs; cmect; cmemn; cmepln; cmesl; cminit; cmptr; cmsdt; cmsend; cmserr; cmsmn; cmspln; cmsptr; cmsst; cmstpn; convert_from_ascii; convert_long_from_network; convert_long_to_network; convert_short_from_network; convert_short_to_network; convert_to_ascii; cpicerr_build_reply_image; cpicerr_classify_rc; cpicerr_create_reply; cpicerr_destroy; cpicerr_destroy_reply; cpicerr_exchange_version; cpicerr_exchange_version_plus; cpicerr_extract_reply_image; cpicerr_get_message; cpicerr_handle_rc; cpicerr_handle_rc_extended; cpicerr_log_cpicerr; cpicerr_log_rc; cpicerr_new; cpicerr_os2_appc_allocate; cpicerr_recv_appl_error; cpicerr_send_appl_error; cpicerr_set_conv_id; cpicerr_set_error_reply; cpicerr_set_exit_level; cpicerr_set_log_file_name; cpicerr_set_log_file_path; cpicerr_set_log_level; cpicerr_set_major_version; cpicerr_set_minor_version; cpicerr_set_program_info; cpicerr_set_program_name; cpicerr_set_rc_info; cpicerr_set_show_level; cpicerr_show_product_info; cpicerr_show_rc; cpicerr_show_reply; cpicinit_default_mode_name; cpicinit_default_sym_dest_name; cpicinit_default_tp_name; cpicinit_destroy; cpicinit_get_password; cpicinit_mode_valid; cpicinit_new; cpicinit_pln_valid; cpicinit_query_password_needed; cpicinit_set_destination; cpicinit_set_mode_name; cpicinit_set_password; cpicinit_set_security_type; cpicinit_set_tp_name; cpicinit_set_userid; cpicinit_setup_conversation; createfile; createnamedpipe; createprocess; ctime; datetime; defined; display_message; do_exit; ebcdic_to_ascii_field; execute_and_send_output; exit; exitthread; fclose; fgets; fopen; free; free_cpic_buffer; get_machine_mode; get_password; get_time; getenv; getlasterror; getopt; gettickcount; localtime; malloc; max; memcpy; memset; min; parse_destination; peeknamedpipe; printf; readfile; set_echo; show_info; sna2string; strcat; strchr; strcmp; strcpy; strupr; swap2; swap4; time; toupper; toupper_string; va_end; va_start; vfprintf; waitforsingleobject; wincpiccleanup; write_error; write_log; write_output; xcscsp; xcscst; xcscsu


Sli3270: 3270 Emulator Sample with SLI API for LU-LU Session

Click to open or copy the files for the Sli3270 sample.

This sample is a simple 3270 emulator. It uses the SLI API to access the LU-LU session. Outbound data from the host is displayed on the screen unformatted.

If the outbound data is an RQD request an automatic positive response is sent. Inbound data can be entered at the keyboard and is sent on the current session.

The program is invoked with two parameters: the name of the LUA LU to use and a logon string. This is converted to upper case and must match an LUA LU in the configuration file. This LU should be configured for a 327? on the host.

There is a Snaenv.bat file to set environment variables, available via the SNA Samples topic.

Building SDK Samples

This sample uses the following keywords:

_fstrlen; acssvc_c; closedown; createwindow; csv_init; definemuxsemlist; defwindowproc; dispatchmessage; do_write; endpaint; exit; getdc; getlasterror; getmessage; getstockobject; getsystemmetrics; issue_close; issue_init; issue_read; issue_rpq; issue_rsp; issue_verb; kbhit; loadcursor; loadicon; memcpy; memset; other_done; postquitmessage; printf; read_done; recv_done; registerclass; registerwindowmessage; releasedc; showwindow; sli; textout; translatemessage; updatewindow; waitforsingleobject; winmain; winsli; winslicleanup; wndproc


TpSetup: Sample of Installer for Autostarted Invokable TPs

Click to open or copy the files for the TpSetup sample.

This sample is an installation program, demonstrating an interface that assists in the configuring of autostarted invokable TPs. This program brings up a dialog box that prompts for TP configuration information. The information is then placed in the registry under Windows NT, and in the Win.ini file under Windows. The WIN32 compiler flag specifies the NT version, while the WINDOWS flag specifies the Windows version.

There is a Snaenv.bat file to set environment variables, available via the SNA Samples topic.

Building SDK Samples

This sample uses the following keywords:

atol; callwindowproc; checkdlgbutton; checkradiobutton; closehandle; closeservicehandle; convsecwndproc; createkeys; createservice; deletelistitem; displayerror; displayinfo; enablewindow; enddialog; finitewndproc; free; freeprocinstance; get_wm_command_id; getdlgitem; getdlgitemtext; getlasterror; getversion; getwindowlong; infinitewndproc; installcallback; installservicent; installwindows; isdlgbuttonchecked; iswin95client; loadstring; localalloc; localfree; locallock; localunlock; lockservicedatabase; lstrcat; lstrcmp; lstrcpy; makeprocinstance; malloc; messagebox; openevent; openscmanager; parsecreateerror; postquitmessage; readstring; regclosekey; regcreatekeyex; regopenkeyex; regqueryvalueex; regsetvalueex; sendmessage; servicewndproc; setdlgitemint; setevent; setwindowlong; sprintf; strcat; strchr; strcpy; stricmp; strstr; switch; text; unlockservicedatabase; unreferenced_parameter; validatefield; validatefieldappc; validatefieldint; writekeynt; writekeywindows; writeprofilestring


SNMP Samples

Click to open or copy the files for the SNMP samples.

The SNMP sample has two parts: SnmpUtil and Testdll.

The SnmpUtil sample demonstrates how to use the SNMP API to build SNMP manager applications on Windows NT®. This is a command-line utility that lets you retrieve information from any SNMP agent in your network.

The Testdll sample demonstrates how to build an extension agent DLL that works with the extendible SNMP agent. This DLL implements the toaster MIB and shows how new MIBs can be added to the agent through a DLL.


SnmpUtil: Sample SNMP Management API

Click to open or copy the files for the SnmpUtil sample.

This file is an example of how to code management applications using the SNMP Management API for Windows® NT. It is similar in operation to the other commonly available SNMP command line utilities.

Extensive comments have been included to describe its structure and operation. See also "Microsoft Windows/NT SNMP Programmer's Reference".

The SnmpUtil sample demonstrates how to use the SNMP API to build SNMP manager applications on Windows NT. This is a command-line utility that lets you retrieve information from any SNMP agent in your network.

Building SDK Samples

This sample uses the following keywords:

getlasterror; printf; resetevent; snmp_free; snmp_malloc; snmp_realloc; snmpmgrclose; snmpmgrgettrap; snmpmgroidtostr; snmpmgropen; snmpmgrrequest; snmpmgrstrtooid; snmpmgrtraplisten; snmputiloidcpy; snmputiloidfree; snmputiloidncmp; snmputilprintasnany; snmputilvarbindfree; snmputilvarbindlistfree; strcmp; strcpy; waitforsingleobject


Testdll: Sample SNMP Extension Agent

Click to open or copy the files for the Testdll sample.

These files (Testdll.c, Testmib.c, and Testmib.h) provide an example of how to structure an Extension Agent DLL which works in conjunction with the SNMP Extendible Agent for Windows NT.

The Testdll sample demonstrates how to build an extension agent DLL that works with the extendible SNMP agent. This DLL implements the toaster MIB and shows how new MIBs can be added to the agent through a DLL.

Extensive comments have been included to describe its structure and operation. See also "Microsoft Windows NT SNMP Programmer's Reference".

Building SDK Samples

This sample uses the following keywords:

createevent; dllentry; getcurrenttime; memcpy; mib_control_func; mib_doneness_func; mib_leaf_func; mib_toasttype_func; oid_sizeof; resolvevarbind; setevent; snmpextensioninit; snmpextensionquery; snmpextensiontrap; snmputilmemalloc; snmputiloidappend; snmputiloidcmp; snmputiloidcpy; snmputiloidfree; switch


NetAPI Samples

Click to open or copy the files for the NetAPI samples.

The NetAPI samples include a number of Windows NT® Networking (Lan Manager) API related samples. These samples illustrate user, group, and share management, in addition to other networking related activities.


ChngPass: LAN Manager Change Password Sample

Click to open or copy the files for the ChngPass sample.

This sample changes the password for an arbitrary user on an arbitrary target machine. When targetting a domain controller for account update operations, target the primary domain controller for the domain. The account settings are replicated by the primary domain controller to each backup domain controller as appropriate. The NetGetDCName Lan Manager API call can be used to get the primary domain controller computer name from a domain name.

Admin or account operator privilege is required on the target machine unless argv[4] is present and represents the correct current password.

NetUserSetInfo at info-level 1003 is appropriate for administrative override of an existing password.

NetUserChangePassword allows for an arbitrary user to override an existing password, provided that the current password is confirmed.

Building SDK Samples

This sample uses the following keywords:

displayerrortext; formatmessagea; fprintf; freelibrary; getstdhandle; loadlibraryex; localfree; makelangid; netapibufferfree; netgetdcname; netuserchangepassword; netusersetinfo; text; wmain; writefile


NetMsg Sample: Displaying Error Text

Click to open or copy the files for the NetMsg sample.

This sample illustrates how to display error text associated with networking-related error codes, in addition to displaying error text associated with system related error codes.

If the supplied error number is in a specific range, the Netmsg.dll message module is loaded and used to look up the specified error number with the FormatMessage Win32 API.

Building SDK Samples

This sample uses the following keywords:

atoi; displayerrortext; formatmessagea; fprintf; freelibrary; getstdhandle; loadlibraryex; localfree; makelangid; text; writefile


NetShare Sample: Creating a Share

Click to open or copy the files for the NetShare sample.

This sample illustrates how to use the Windows NT® Lan Manager API in conjunction with the Win32® security API to create a new share on an arbitrary machine with permissions that grant an arbitrary user/group Full Access to the share.

Building SDK Samples

This sample uses the following keywords:

addaccessallowedace; fprintf; getlasterror; getlengthsid; getprocessheap; heapalloc; heapfree; heaprealloc; initializeacl; initializesecuritydescriptor; lookupaccountnamew; netshareadd; printf; setsecuritydescriptordacl; wmain


NetSmple: Creating a User and Local Group

Click to open or copy the files for the NetSmple sample.

This sample demonstrates how to create a user and a local group and add the user to the local group under Windows NT®.

The functions used include the ported LAN Manager functions NetGetDCName, NetUserAdd, NetLocalGroupAdd, and NetLocalGroupAddMembers.

Building SDK Samples

This sample uses the following keywords:

netapibufferfree; netgetdcname; netlocalgroupadd; netlocalgroupaddmembers; netsample; netuseradd; printf; text


NullSess Sample: Using Null Session for Access Problems

Click to open or copy the files for the NullSess sample.

This sample illustrates how to use a Null session to overcome access problems during network related query operations.

Building SDK Samples

This sample uses the following keywords:

establishnullsession; getlasterror; lstrcatw; lstrlenw; netuseadd; netusedel; printf; setlasterror; wmain; zeromemory


Winsock: Windows Sockets Samples

Click to open or copy the files for the Winsock samples.

The following samples are provided.

Sample | Description
AppleTalk | Using the AppleTalk PAP protocol.
Bcast | Broadcast over UDP or IPX with SO_BROADCAST.
Dt_dll | Debug Trace feature of checked build of Ws2_32.dll.
Globchat | Client/server chat program.
Iocomplt | Demonstrate the use of I/O Completion ports.
Ipxchat | GUI chat sample showing Windows Sockets over IPX.
Nullprov | NULL service provider, and sample install code.
Nwlink | Using sockets over SPX.
Overlap | Overlapped I/O + AcceptEx.
Ping | Demonstrates raw sockets.
Rnr | Registration and name resolution.
Simple | Simple client, server, and IOCTL example.
Sockspx | Simple IPX sample, including enumeration of local adapters.
Tp4 | Using the OSI tp4 protocol, requires special run-time setup.
Ws2chat | Windows Sockets 2 sample chat application.
Wsock | GUID tutorial, includes demonstration of AcceptEx.

Several of the samples demonstrate Windows Sockets 1 functionality. They are included here because they show good, general-purpose techniques, and because they demonstrate that building a Windows Sockets 2 application is often as simple as recompiling and relinking.


AppleTalk PAP Protocol Sample

Click to open or copy the files for the AppleTalk sample.

This sample is a Windows Socket application that demonstrates how to use the AppleTalk PAP Protocol. Both a server and a client application are included in the source for this sample. The client application reads a file and sends the contents to the server application. The server writes the bytes received to another file.

Building SDK Samples

This sample uses the following keywords:

accept; atoi; bind; checkforrecv; checkforsend; closesocket; connect; createthread; doclient; doserver; exit; fd_set; fd_zero; fprintf; getlasterror; getlocaltime; getsockopt; ioctlsocket; listen; localalloc; localfree; locallock; localsize; lstrlen; memcmp; memcpy; opensocketregisterandlisten; perfthread; printf; rand; select; send; setsockopt; socket; strcpy; stricmp; switch; tolower; usage; wsacleanup; wsagetlasterror; wsarecvex; wsastartup


Bcast: Win32 Winsock and Mailslot APIs

Click to open or copy the files for the Bcast sample.

This sample illustrates the Win32® Winsock and Mailslot APIs to do a generic broadcast over IPX, UDP, and Mailslot protocols.

Building SDK Samples

This sample uses the following keywords:

getlasterror; printerror; routine; wsagetlasterror


Dt_dll: Debug/Trace Sample for Client/Server

Click to open or copy the files for the Dt_dll sample.

For documentation of the debug/trace feature, as well as this Dt_dll sample source code, consult Dbgspec.doc in this directory.

WinSock 2 Debug and Trace Facilities

Dbgspec.doc (WinSock 2 Debug and Trace Facilities) describes the functionality, design, and implementation of the default debug/trace DLL (named Dt_dll.dll), which is supplied in source-code form with the WinSock 2 SDK. Developers may find that the default debug/trace DLL supplies all the necessary functionality for their purposes. However, they are also free to modify the code to provide additional debugging functionality, or they may start from scratch and build a new debug/trace DLL. In the latter case, only the interface definition portion of this document may be relevant, and the reader can skip the section describing the default DLL. The default DLL does contain hooks, however, which allow it to be extended for all but the most complex types of debugging and tracing.

Developers of WinSock 2 applications and service providers need to be able to isolate bugs to one of the following:

  • The client application

  • The WinSock 2 DLL

  • The service provider (transport or name space)

The WinSock 2 debug/trace layer addresses this problem. It allows all procedure calls across the WinSock 2 API or SPI to be monitored, and to some extent controlled.

Developers can use this mechanism to trace the procedure calls, procedure returns, parameter values, and return values. You can alter parameter values and returns on procedure-call or procedure-return. If desired, you can even prevent or redirect a procedure-call. With access to this level of information and control, it should be easy for you to isolate any problem to the application, WinSock 2 DLL or service provider.

The debug/trace layer is supported only by a specially instrumented version of the WinSock 2 DLL. The SDK license terms do not allow redistribution of this instrumented WinSock 2 DLL in order to prevent inappropriate use of the debug hooks in production systems.

The debug/trace feature of Windows Sockets 2 will only work with the debug version of Ws2_32.dll.

Building SDK Samples

This sample uses the following keywords:

abortandclose; accept; back; bind; callwindowproc; cgetcounter; closehandle; closesocket; connect; cpop; cpush; createevent; createfile; createthread; createwindow; cstack_c; debugdlgproc; defwindowproc; deletecriticalsection; dialogbox; dispatchmessage; dllmain; dteditwndproc; dthandler___wsafdisset; dthandler_accept; dthandler_bind; dthandler_closesocket; dthandler_connect; dthandler_gethostbyaddr; dthandler_gethostbyname; dthandler_gethostname; dthandler_getpeername; dthandler_getprotobyname; dthandler_getprotobynumber; dthandler_getservbyname; dthandler_getservbyport; dthandler_getsockname; dthandler_getsockopt; dthandler_htonl; dthandler_htons; dthandler_inet_addr; dthandler_inet_ntoa; dthandler_ioctlsocket; dthandler_listen; dthandler_nspaddresstostring; dthandler_nspcleanup; dthandler_nspgetaddressbyname; dthandler_nspgetserviceclassinfo; dthandler_nspgetserviceclassnamebyclassid; dthandler_nspinstallserviceclass; dthandler_nsplookupservicebegin; dthandler_nsplookupserviceend; dthandler_nsplookupservicenext; dthandler_nspremoveserviceclass; dthandler_nspsetservice; dthandler_nspstringtoaddress; dthandler_ntohl; dthandler_ntohs; dthandler_recv; dthandler_recvfrom; dthandler_select; dthandler_send; dthandler_sendto; dthandler_setsockopt; dthandler_shutdown; dthandler_socket; dthandler_wpucloseevent; dthandler_wpuclosesockethandle; dthandler_wpucreateevent; dthandler_wpucreatesockethandle; dthandler_wpufdisset; dthandler_wpugetproviderpath; dthandler_wpumodifyifshandle; dthandler_wpupostmessage; dthandler_wpuqueryblockingcallback; dthandler_wpuquerysockethandlecontext; dthandler_wpuqueueapc; dthandler_wpuresetevent; dthandler_wpusetevent; dthandler_wsaaccept; dthandler_wsaaddresstostringa; dthandler_wsaaddresstostringw; dthandler_wsaasyncgethostbyaddr; dthandler_wsaasyncgethostbyname; dthandler_wsaasyncgetprotobyname; dthandler_wsaasyncgetprotobynumber; dthandler_wsaasyncgetservbyname; dthandler_wsaasyncgetservbyport; dthandler_wsaasyncselect; dthandler_wsacancelasyncrequest; dthandler_wsacancelblockingcall; dthandler_wsacleanup; dthandler_wsacloseevent; dthandler_wsaconnect; dthandler_wsacreateevent; dthandler_wsaduplicatesocketa; dthandler_wsaduplicatesocketw; dthandler_wsaenumnamespaceprovidersa; dthandler_wsaenumnamespaceprovidersw; dthandler_wsaenumnetworkevents; dthandler_wsaenumprotocolsa; dthandler_wsaenumprotocolsw; dthandler_wsaeventselect; dthandler_wsagetaddressbynamea; dthandler_wsagetaddressbynamew; dthandler_wsagetlasterror; dthandler_wsagetoverlappedresult; dthandler_wsagetqosbyname; dthandler_wsagetserviceclassinfoa; dthandler_wsagetserviceclassinfow; dthandler_wsagetserviceclassnamebyclassida; dthandler_wsagetserviceclassnamebyclassidw; dthandler_wsahtonl; dthandler_wsahtons; dthandler_wsainstallserviceclassa; dthandler_wsainstallserviceclassw; dthandler_wsaioctl; dthandler_wsaisblocking; dthandler_wsajoinleaf; dthandler_wsalookupservicebegina; dthandler_wsalookupservicebeginw; dthandler_wsalookupserviceend; dthandler_wsalookupservicenexta; dthandler_wsalookupservicenextw; dthandler_wsantohl; dthandler_wsantohs; dthandler_wsarecv; dthandler_wsarecvdisconnect; dthandler_wsarecvfrom; dthandler_wsaremoveserviceclass; dthandler_wsaresetevent; dthandler_wsasend; dthandler_wsasenddisconnect; dthandler_wsasendto; dthandler_wsasetblockinghook; dthandler_wsasetevent; dthandler_wsasetlasterror; dthandler_wsasetservicea; dthandler_wsasetservicew; dthandler_wsasocketa; dthandler_wsasocketw; dthandler_wsastartup; dthandler_wsastringtoaddressa; dthandler_wsastringtoaddressw; dthandler_wsaunhookblockinghook; dthandler_wsawaitformultipleevents; dthandler_wscdeinstallprovider; dthandler_wscenumprotocols; dthandler_wscinstallprovider; dthandler_wspaccept; dthandler_wspasyncselect; dthandler_wspbind; dthandler_wspcancelblockingcall; dthandler_wspcleanup; dthandler_wspclosesocket; dthandler_wspconnect; dthandler_wspduplicatesocket; dthandler_wspenumnetworkevents; dthandler_wspeventselect; dthandler_wspgetoverlappedresult; dthandler_wspgetpeername; dthandler_wspgetqosbyname; dthandler_wspgetsockname; dthandler_wspgetsockopt; dthandler_wspioctl; dthandler_wspjoinleaf; dthandler_wsplisten; dthandler_wsprecv; dthandler_wsprecvdisconnect; dthandler_wsprecvfrom; dthandler_wspselect; dthandler_wspsend; dthandler_wspsenddisconnect; dthandler_wspsendto; dthandler_wspsetsockopt; dthandler_wspshutdown; dthandler_wspsocket; dthandler_wspstartup; dthandlerinit; dtmainwndproc; dttextout; enddialog; entercriticalsection; fillmemory; first; getclientrect; getcurrent; getcurrentdirectory; getcurrentprocessid; getcurrentthreadid; getfile; getfromback; getfromfront; gethostbyaddr; gethostbyname; gethostname; getlasterror; getlocaltime; getmessage; getnideque; getpeername; getprotobyname; getprotobynumber; getsavefilename; getservbyname; getservbyport; getsockname; getsockopt; getstockobject; getwindowtextlength; htonl; htons; hugetlasterror; huprinterror; husetlasterror; inet_addr; inet_ntoa; initialize; initializecriticalsection; insertintoback; insertintofront; ioctlsocket; isdlgbuttonchecked; isempty; last; leavecriticalsection; listen; loadcursor; loadicon; localalloc; localfree; makeintresource; makelparam; memset; messagebox; movewindow; next; nideque_c; nidequeiter_c; nilnode_c; nspaddresstostring; nspgetaddressbyname; nspgetserviceclassinfo; nspgetserviceclassnamebyclassid; nspinstallserviceclass; nsplookupservicebegin; nsplookupserviceend; nsplookupservicenext; nspremoveserviceclass; nspsetservice; nspstringtoaddress; ntohl; ntohs; outputdebugstring; pop; postquitmessage; printf; push; recv; recvfrom; registerclass; remove; removedata; removefromback; removefromfront; replace; select; send; sendmessage; sendto; setevent; setlasterror; setsockopt; setwindowlong; shutdown; socket; stack_c; strcpy; switch; tlsalloc; tlsfree; tlsgetvalue; tlssetvalue; translatemessage; va_arg; va_start; waitforsingleobject; warning; windowthreadfunc; wpucloseevent; wpuclosesockethandle; wpucreateevent; wpucreatesockethandle; wpufdisset; wpugetproviderpath; wpumodifyifshandle; wpupostmessage; wpuqueryblockingcallback; wpuquerysockethandlecontext; wpuqueueapc; wpuresetevent; wpusetevent; writefile; wsaaccept; wsaaddresstostringa; wsaaddresstostringw; wsaasyncgethostbyaddr; wsaasyncgethostbyname; wsaasyncgetprotobyname; wsaasyncgetprotobynumber; wsaasyncgetservbyname; wsaasyncgetservbyport; wsaasyncselect; wsacancelasyncrequest; wsacancelblockingcall; wsacleanup; wsacloseevent; wsaconnect; wsacreateevent; wsaduplicatesocketa; wsaduplicatesocketw; wsaenumnamespaceprovidersa; wsaenumnamespaceprovidersw; wsaenumnetworkevents; wsaenumprotocolsa; wsaenumprotocolsw; wsaeventselect; wsaexceptionnotify; wsagetaddressbynamea; wsagetaddressbynamew; wsagetlasterror; wsagetoverlappedresult; wsagetqosbyname; wsagetserviceclassinfoa; wsagetserviceclassinfow; wsagetserviceclassnamebyclassida; wsagetserviceclassnamebyclassidw; wsahtonl; wsahtons; wsainstallserviceclassa; wsainstallserviceclassw; wsaioctl; wsaisblocking; wsajoinleaf; wsalookupservicebegina; wsalookupservicebeginw; wsalookupserviceend; wsalookupservicenexta; wsalookupservicenextw; wsantohl; wsantohs; wsapostapinotify; wsapreapinotify; wsarecv; wsarecvdisconnect; wsarecvfrom; wsaremoveserviceclass; wsaresetevent; wsasend; wsasenddisconnect; wsasendto; wsasetblockinghook; wsasetevent; wsasetlasterror; wsasetservicea; wsasetservicew; wsasocketa; wsasocketw; wsastartup; wsastringtoaddressa; wsastringtoaddressw; wsaunhookblockinghook; wsawaitformultipleevents; wscdeinstallprovider; wscenumprotocols; wscinstallprovider; wspaccept; wspasyncselect; wspbind; wspcancelblockingcall; wspcleanup; wspclosesocket; wspconnect; wspduplicatesocket; wspenumnetworkevents; wspeventselect; wspgetoverlappedresult; wspgetpeername; wspgetqosbyname; wspgetsockname; wspgetsockopt; wspioctl; wspjoinleaf; wsplisten; wsprecv; wsprecvdisconnect; wsprecvfrom; wsprintf; wspselect; wspsend; wspsenddisconnect; wspsendto; wspsetsockopt; wspshutdown; wspsocket; wspstartup


GlobChat: Global Chat Samples

GlobChat: Download Global Chat Samples

Click to open or copy the files for the GlobChat samples.

This sample is a global chat application for Windows sockets. It allows two clients to carry on a conversation using a server as the intermediary. By using the Name Resolution and Registration functions, the clients need not even have the same transport protocols loaded. The server acts as a gateway between the two clients, forwarding messages over the appropriate Windows Sockets interface.


Client: Chat Client Sample

Click to open or copy the files for the Client sample.

The GlobChat client includes the following source files and functions.

About.c

Displays the About dialog box.

Function | Description
CmdAbout | Displays the About dialog box
About | Processes messages for the About dialog box
MsgAboutInit | Initializes the About dialog box with version information from resources
MsgAboutCommand | Processes the WM_COMMAND message sent to the About box
CmdAboutDone | Frees the About box and related data

Connect.c

Displays the Connect dialog box.

Function | Description
CmdConnect | Displays the Connect dialog box
Connect | Processes messages for the Connect dialog box
MsgConnectInit | Initializes edit controls
MsgConnectReadyForWrite | Sends name registration message when connection established with server
MsgConnectCommand | Process a WM_COMMAND message sent to the Connect box
CmdConnectDone | Frees the Connect box and related data
CmdConnectNow | Establishes connection to server
CmdConnectEnableOK | Enables or disables OK button when input data is valid or invalid

Dispatch.c

Implements the generic message and command dispatchers.

Function | Description
DispMessage | Calls the function associated with a message
DispCommand | Calls the function associated with a command
DispDefault | Calls the appropriate default window procedure

Globcl.c

Implements the windows procedure for the main application windows. Also implements the generic message and command dispatchers.

Function | Description
WndProc | Processes messages for the main window
MsgCreate | Initializes Edit Controls for text input/output
MsgSize | Adjusts size of Edit Controls when window is resized
MsgSetfocus | Keeps window focus on edit control instead of parent
MsgDataready | Reads data from incoming IPC mechanism
MsgRefreshdisplay | Refills Inbox edit control text contents
MsgDisconnected | Cleans up connection killed by other side
MsgCommand | Handles the WM_COMMAND messages for the main window
MsgDestroy | Handles the WM_DESTROY message by calling PostQuitMessage
CmdOutbox | Handles messages from Outbox edit control
CmdDisconnected | Disconnects current connection
CmdEndChat | Ends Peer to Peer session
CmdExit | Handles the file exit command by calling DestroyWindow on the main window

Init.c

Performs application and instance specific initialization.

Function | Description
InitApplication | Initializes window data and registers window

Misc.c

Contains all helper functions "global" to the application.

Function | Description
CenterWindow | Centers one window over another
ReceiveInBox | Reads incoming socket data
SendOutBox | Writes outgoing socket data
AtoH | Converts ascii string to network order hex
BtoH | Converts ascii byte to hex
senddatamessage | Sends a message to the server
recvdatamessage | Receives a message from the server

Select.c

Displays the Select dialog box.

Function | Description
CmdSelect | Displays the Select dialog box
Select | Processes messages for the Select dialog box
MsgSelectInit | Sets up event message notification for socket
MsgSelectDataReady | Processes socket event message notifications
MsgSelectCommand | Processes WM_COMMAND message sent to the Select box
CmdSelectDone | Frees the select box and related data
CmdSelectOK | Requests Peer session
CmdSelectList | Enables/disables OK button

Winmain.c

Calls initialization functions and processes the message loop.

Function | Description
WinMain | Calls initialization functions, processes message loop

Building SDK Samples

This sample uses the following keywords:

atoh; btoh; centerwindow; cleanup; closesocket; cmdabout; cmdaboutdone; cmdconnect; cmdconnectdone; cmdconnectenableok; cmdconnectnow; cmddisconnect; cmdendchat; cmdexit; cmdoutbox; cmdselect; cmdselectdone; cmdselectlist; cmdselectok; connect; createfont; createwindow; defdlgproc; defframeproc; defmdichildproc; defwindowproc; deleteobject; destroywindow; dialogbox; dispatchmessage; dispcommand; dispdefault; dispmessage; enablemenuitem; enablewindow; enddialog; enumprotocols; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getaddressbyname; getaddrstring; getdc; getdevicecaps; getdlgitem; getdlgitemtext; getfileversioninfo; getfileversioninfosize; getmenu; getmessage; getmodulefilename; getparent; getstringres; getwindow; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; htoa; htob; initapplication; loadaccelerators; loadcursor; loadstring; lstrcat; lstrcpy; lstrlen; makelong; makelparam; makeword; messagebox; movewindow; msgaboutcommand; msgaboutinit; msgcommand; msgconnectcommand; msgconnectinit; msgconnectreadyforwrite; msgcreate; msgdataready; msgdestroy; msgdisconnected; msgrefreshdisplay; msgselectcommand; msgselectdataready; msgselectinit; msgsetfocus; msgsize; muldiv; peekmessage; pfncmd; pfnmsg; postmessage; postquitmessage; reallen; receiveinbox; recv; recvdatamessage; registerclass; releasedc; select; send; senddatamessage; senddlgitemmessage; sendmessage; sendoutbox; set_netbios_sockaddr; setdlgitemtext; setfocus; setwindowpos; setwindowtext; showwindow; socket; svcid_netware; svcid_tcp; switch; translateaccelerator; translatemessage; updatewindow; verqueryvalue; virtualalloc; winmain; wndproc; wsaasyncselect; wsacleanup; wsagetlasterror; wsastartup; wsprintf


Server: Chat Server Sample

Click to open or copy the files for the Server sample.

The GlobChat server includes the following source files and functions.

About.c

Displays the About dialog box.

Function | Description
CmdAbout | Displays the About dialog box
About | Processes messages for About dialog box
MsgAboutInit | Initializes the About box with version information from resources
MsgAboutCommand | Processes WM_COMMAND message sent to the About box
CmdAboutDone | Frees the About box and related data

Dispatch.c

Implements the generic message and command dispatchers.

Function | Description
DispMessage | Calls the function associated with a message
DispCommand | Calls the function associated with a command
DispDefault | Calls the appropriate default window procedure

Generic.c

Implement the windows procedure for the main application windows. Also implements the generic message and command dispatchers.

Function | Description
WndProc | Processes messages for the main window
MsgCreate | Handles the WM_CREATE message. Sets up Display and initializes listening sockets. Also advertises the service.
MsgSize | Resizes the listboxes to fit nicely in main window
MsgTimer | Handles the WM_TIMER messages which alerts you to the fact that it's time to send a SAP packet
MsgConnected | Handles new connection notifications
MsgDataready | Handles recv data notifications and close socket notifications
MsgCommand | Handle the WM_COMMAND messages for the main window
MsgDestroy | Handles the WM_DESTROY message by calling PostQuitMessage
CmdExit | Handles the file exit command by calling destroy window on the main window

Init.c

Performs application and instance specific initialization.

Function | Description
InitApplication | Initializes window data and registers window

Misc.c

Contains all helper functions "global" to the application.

Function | Description
CenterWindow | Centers one window over another
AtoH | Converts ascii to network order hex
BtoH | Converts ascii byte to numeric
deregistername | Notifies "Available" peers of clients nonavailability
senddatamessage | Sends a message to a client node
recvdatamessage | Reads an entire message
UpdateClientList | Updates Client Status listbox
MakeServSock | Attempts to initialize socket for listening

Winmain.c

Calls initialization functions and processes the message loop.

Function | Description
WinMain | Calls initialization functions, processes message loop

Building SDK Samples

This sample uses the following keywords:

accept; atoh; bind; btoh; centerwindow; closesocket; cmdabout; cmdaboutdone; cmdexit; createfont; createwindow; defdlgproc; defframeproc; defmdichildproc; defwindowproc; deleteobject; deregistername; destroywindow; dialogbox; dispatchmessage; dispcommand; dispdefault; dispmessage; enddialog; enumprotocols; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getaddressbyname; getdc; getdevicecaps; getdlgitemtext; getfileversioninfo; getfileversioninfosize; getmessage; getmodulefilename; getsockname; getstringres; getwindow; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; heapalloc; heapcreate; initapplication; listen; loadaccelerators; loadcursor; loadstring; lstrcmp; lstrcpy; lstrlen; makeservsock; makeword; memcpy; movewindow; msgaboutcommand; msgaboutinit; msgcommand; msgconnected; msgcreate; msgdataready; msgdestroy; msgsize; msgtimer; muldiv; pfncmd; pfnmsg; postquitmessage; reallen; recv; recvdatamessage; registerclass; releasedc; send; senddatamessage; senddlgitemmessage; sendmessage; sendto; set_netbios_sockaddr; setdlgitemtext; setsockopt; settimer; setwindowpos; showwindow; socket; strcpy; svcid_netware; svcid_tcp; switch; translateaccelerator; translatemessage; updateclientlist; updatewindow; verqueryvalue; virtualalloc; winmain; wndproc; wsaasyncselect; wsagetlasterror; wsastartup; wsprintf


IoComplt: Win32 Winsock and Mailslot APIs

Click to open or copy the files for the IoComplt sample.

This sample illustrates the Win32® Winsock and Mailslot APIs to do a generic broadcast over IPX, UDP and Mailslot protocols.

The Sockets sample contains a simple Windows NT server that uses Windows sockets. It demonstrates overlapped I/O using I/O completion ports to receive ReadFile completion notification. An I/O completion port is the most efficient form of overlapped I/O. I/O completion ports were introduced in Windows NT 3.5.

CreateIoCompletionPort, as used in the server half of this sample, is only supported on Windows NT.

Building SDK Samples

This sample uses the following keywords:

completebenchmark; createnetconnections; createworkers; parseswitch; setsockopt; showusage; sortthebuffer; workerthread; wsastartup


IpxChat: Windows Sockets to Communicate with IPX/SPX

Click to open or copy the files for the IpxChat sample.

This sample demonstrates the use of Windows Sockets to communicate over the IPX/SPX protocol.

Building SDK Samples

This sample uses the following keywords:

accept; atoh; bind; btoh; centerwindow; cleanup; closesocket; cmdabout; cmdaboutdone; cmdconnect; cmdconnectdone; cmdconnectnow; cmddisconnect; cmdexit; cmdlisten; cmdlistendone; cmdlistennow; cmdoutbox; connect; createfont; createwindow; defdlgproc; defframeproc; defmdichildproc; defwindowproc; deleteobject; destroywindow; dialogbox; dispatchmessage; dispcommand; dispdefault; dispmessage; enablemenuitem; enablewindow; enddialog; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getaddrstring; getdc; getdevicecaps; getdlgitem; getdlgitemtext; getfileversioninfo; getfileversioninfosize; getmenu; getmessage; getmodulefilename; getsocketname; getsockname; getwindow; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; htoa; htob; initapplication; listen; loadaccelerators; loadcursor; loadstring; lstrcat; lstrcpy; lstrlen; makeword; memset; messagebox; movewindow; msgaboutcommand; msgaboutinit; msgcommand; msgconnectcommand; msgconnectinit; msgcreate; msgdataready; msgdestroy; msgdisconnected; msglistencommand; msglistenconnected; msglisteninit; msgrefreshdisplay; msgsetfocus; msgsize; muldiv; peekmessage; pfncmd; pfnmsg; postmessage; postquitmessage; receiveinbox; recv; registerclass; releasedc; send; senddlgitemmessage; sendmessage; sendoutbox; setdlgitemtext; setfocus; setwindowpos; setwindowtext; showwindow; socket; sprintf; translateaccelerator; translatemessage; updatewindow; verqueryvalue; winmain; wndproc; wsaasyncselect; wsacleanup; wsagetlasterror; wsastartup


NullProv: Null Provider for Starting Service Provider

Click to open or copy the files for the NullProv sample.

This sample provides a "null" provider for the purpose of demonstrating how to get a service provider installed and started. The provider simply pretends to send and receive data.

Building SDK Samples

This sample uses the following keywords:

closesocket; create_test_socket; destroy_test_socket; establish_provider; getlasterror; makeword; memcpy; test_send; wsacleanup; wsasend; wsasocket; wsastartup; wscenumprotocols; wscinstallprovider; wspaccept; wspaddresstostring; wspasyncselect; wspbind; wspcancelblockingcall; wspcleanup; wspclosesocket; wspconnect; wspduplicatesocket; wspenumnetworkevents; wspeventselect; wspgetoverlappedresult; wspgetpeername; wspgetqosbyname; wspgetsockname; wspgetsockopt; wspioctl; wspjoinleaf; wsplisten; wsprecv; wsprecvdisconnect; wsprecvfrom; wspselect; wspsend; wspsenddisconnect; wspsendto; wspsetsockopt; wspshutdown; wspsocket; wspstartup; wspstringtoaddress


NWLink Samples

Click to open or copy the files for the NWLink samples.

The NWLink sample suite includes the following samples:

Sample | Description
Connect | A simple example of using SPX commands
DGRecv | Opens a socket, binds to the socket, and waits for a datagram packet
DGSend | Opens a socket, binds to the socket, and sends a packet repeatedly
Listen | Opens an SPX socket, binds to the socket, and listens for a connection
Ping | Opens a socket, binds to the socket, receives a packet, and sends that packet back to the original sender


Connect: Using SPX Commands

Click to open or copy the files for the Connect sample.

Click to open or copy the Testlib directory (required).

This sample is a simple demonstration of using SPX connect and NWLink.

Building SDK Samples

This sample uses the following keywords:

bind; closesocket; connect; do_send_receive; dos_net_perror; free; getpeername; getsockname; make_connection; makeword; malloc; mem_check; memcpy; memset; net_init; parse_cmd_line; print_netaddr; print_wsa; printf; recv; send; sleep; socket; wsastartup


DGrecv: Receive Packet

Click to open or copy the files for the DGrecv sample.

Click to open or copy the Testlib directory (required).

This sample opens a socket, binds to the socket, and waits for a datagram packet.

Building SDK Samples

This sample uses the following keywords:

bind; closesocket; dg_recv; dos_net_perror; exit; free; getsockname; makeword; malloc; memcpy; net_init; parse_cmd_line; print_netaddr; print_saddr; print_wsa; printf; recvfrom; setsockopt; socket; wsastartup


DGsend: Send Packet Repeatedly

Click to open or copy the files for the DGsend sample.

Click to open or copy the Testlib directory (required).

This sample opens a socket, binds to the socket, and sends a packet repeatedly.

Building SDK Samples

This sample uses the following keywords:

bind; build_dest_addr; closesocket; dg_send; dos_net_perror; enable_broadcasts; exit; free; getsockname; makeword; malloc; memcpy; memset; net_init; parse_cmd_line; print_netaddr; print_saddr; print_wsa; printf; sendto; setsockopt; sleep; socket; strncpy; wsastartup


Listen Samples

Click to open or copy the files for the Listen sample.

Click to open or copy the Testlib directory (required).

The Listen sample has two versions, in two subdirectories: Block, and Nonblock.

This sample demonstrates NWLink. It is a simple example of opening a SPX socket, binding to the socket, and listening for a connection.

Building SDK Samples

This sample uses the following keywords:

accept; bind; closesocket; do_listen; do_recv_send; dos_net_perror; exit; free; getsockname; listen; makeword; malloc; memcpy; net_init; parse_cmd_line; print_netaddr; print_saddr; print_wsa; printf; recv; send; socket; wait_for_connection; wsastartup; accept; bind; closesocket; do_listen; do_recv_send; dos_net_perror; exit; free; getsockname; ioctlsocket; listen; makeword; malloc; memcpy; net_init; parse_cmd_line; print_netaddr; print_saddr; print_wsa; printf; recv; send; sleep; socket; wait_for_connection; wsastartup


Ping: Returns Packet

Click to open or copy the files for the Ping sample.

Click to open or copy the Testlib directory (required).

This sample opens a socket, binds to the socket, receives a packet, and sends that packet back to the original sender.

The DOS subdirectory contains DosPing.c.

Building SDK Samples

This sample uses the following keywords:

bind; closesocket; do_ping; dos_net_perror; exit; free; getsockname; makeword; malloc; memcpy; net_init; parse_cmd_line; print_netaddr; print_saddr; print_wsa; printf; recvfrom; sendto; setsockopt; socket; wsastartup


TestLib: Windows Socket API

Click to open or copy the files for the TestLib sample.

This library sample demonstrates basic sockets programming with the Windows Sockets API using the NWLink transport.

This library is used by all the NWlink samples.

Building SDK Samples

This sample uses the following keywords:

atoi; dos_net_perror; dos_net_strerror; dump_defaults; exit; get_error_text; get_hex_byte; get_hex_string; get_network_number; get_node_number; get_socket_family; get_socket_number; mem_check; memcpy; memset; messagebox; parse_cmd_line; print_netaddr; print_network_num; print_node_num; print_saddr; print_socket_num; print_wsa; printf; sprintf; stricmp; strnicmp; strupr; usage; win_net_perror; wsastartup


Overlap: AcceptEx and Overlapped I/O

Click to open or copy the files for the Overlap sample.

This TCP sample demonstrates the use of AcceptEx and overlapped I/O to multiplex different client connections in a single-threaded Win32 application.

AcceptEx is a Microsoft-specific extension to Windows Sockets. It is not part of the Windows Sockets specification. If you use this function, you will limit your application to implementations of Windows Sockets that support AcceptEx — some implementations do not.

The server uses AcceptEx to handle a number of asynchronous connection requests effectively. When a connection is received, it is added to an array of handles being monitored in a wait function. The server multiplexes between the listening socket and the various client connections.

When a connection is first established, the server queues an overlapped ReadFile operation on the socket. On subsequent notification that this operation has completed, the server queues a WriteFile. Thus, the server alternately reads and writes the socket until the client closes the connection.

Building SDK Samples

This sample uses the following keywords:

acceptex; atoi; bind; closesocket; createevent; dowait; exit; exitprocess; fprintf; getlasterror; getoverlappedresult; getprocessheap; handleevent; heapalloc; heapfree; htons; listen; printf; readfile; socket; switch; tolower; usage; waitformultipleobjects; writefile; wsacleanup; wsagetlasterror; wsastartup; xfree; xmalloc


Ping: SOCK_RAW in Winsock 2.0

Click to open or copy the files for the Ping sample.

This sample illustrates the use of SOCK_RAW in Winsock 2.0 on Windows NT® in order to write an ICMP_ECHO utility (commonly seen in the 'ping' program on various systems).

Building SDK Samples

This sample uses the following keywords:

atoi; checksum; decode_resp; exitprocess; fill_icmp_data; fprintf; getcurrentprocessid; gethostbyname; getlasterror; getprocessheap; gettickcount; heapalloc; inet_addr; inet_ntoa; makeword; memcpy; memset; pack; printf; recvfrom; sendto; setsockopt; sleep; usage; wsagetlasterror; wsasocket; wsastartup; xfree; xmalloc


RNR: Sample Service Registration and Name Resolution API

Click to open or copy the files for the RNR samples.


RNRclnt: Sample RNR Client for Protocol-Independent WinSock

Click to open or copy the files for the RNRclnt sample.

This sample is a client for the RNR (service Registration and Name Resolution) APIs. This is a simple client application designed to show the basic principles involved in using the RNR APIs to write a protocol-independent Windows Sockets client application.

This client works by examining the protocols loaded on the machine, looking for protocols which are reliable and stream-oriented. Then it attempts to locate and connect to the service on these protocols. When is has successfully connected to the service, it exchanges several messages with the service and then terminates the connection.

The OpenConnection routine implemented herein is intended to be a demonstration of RNR functionality commonly used in protocol-independent clients. Application writers are encouraged to leverage this code to assist them in writing protocol-independent applications on top of the Windows Sockets API.

Building SDK Samples

This sample uses the following keywords:

_strnicmp; atoi; bind; closesocket; connect; doecho; enumprotocols; exit; getaddressbyname; getlasterror; getnamebytype; gettickcount; gettypebyname; localalloc; localfree; malloc; openconnection; printf; recv; rnr20_getaddressbyname; rtlcopymemory; rtlzeromemory; send; setlasterror; socket; strcmp; wsagetlasterror; wsalookupservicebegin; wsalookupserviceend; wsalookupservicenext; wsastartup


RNRsetup: RNR EchoExample Sample Installer

Click to open or copy the files for the RNRsetup sample.

This sample is a setup program for installing or removing the EchoExample service.

Building SDK Samples

This sample uses the following keywords:

_strnicmp; closeservicehandle; createservice; doservicesetup; exit; getlasterror; openscmanager; printf; regclosekey; regcreatekeyex; regsetvalueex; strchr; wsacleanup; wsainstallserviceclass; wsaremoveserviceclass; wsastartup


RNRsrv: Service Registration and Name Resolution Sample

Click to open or copy the files for the RNRsrv sample.

This sample is a test and demonstration service for the RNR (service Registration and Name Resolution) APIs. This is a simple service designed to show the basic principles involved in using the RNR APIs to write a protocol-independent Windows Sockets service.

This service opens a number of listening sockets, waits for an incoming connection from a client, accepts the connection, then echos data back to the client until the client terminates the virtual circuit. This service is single-threaded and can handle only a single client at a time.

The OpenListeners routine implemented herein is intended to be a demonstration of RNR functionality commonly used in protocol-independent services. Service writers are encouraged to leverage this code to assist them in writing protocol-independent services on top of the Windows Sockets API.

Building SDK Samples

This sample uses the following keywords:

accept; advertiseservice; bind; closesocket; enumprotocols; exit; fd_isset; fd_set; fd_zero; free; getaddressbyname; getlasterror; getsockname; gettypebyname; listen; localfree; malloc; openlisteners; printf; recv; rtlzeromemory; select; send; setlasterror; socket; wsasetservice; wsastartup


Simple: Sample TCP/UDP server

Click to open or copy the files for the Simple sample.

This sample is a simple TCP/UDP server. It listens on a specified port for client connections. When a client connects, the server receives data, echoes it back to the client and closes the connection.

Building SDK Samples

This sample uses the following keywords:

accept; atoi; bind; closesocket; connect; exit; fd_clr; fd_isset; fd_set; fd_zero; fprintf; gethostbyaddr; gethostbyname; htons; inet_addr; inet_ntoa; ioctlsocket; isalpha; listen; memcpy; memset; printf; readandecho; recv; recvfrom; select; send; sendto; socket; stricmp; switch; tolower; usage; writemessage; wsacleanup; wsagetlasterror; wsastartup; wsprintf


SockSpx: Win32 Winsock APIs over IPX/SPX

Click to open or copy the files for the SockSpx sample.

This sample illustrates the Win32 ®Winsock APIs over IPX/SPX protocol sequence. This example implements a client and a server. This example can use IPX and SPX as well as SPXII protocol sequences.

Building SDK Samples

This sample uses the following keywords:

atoh; btoh; checkprotocol; fprintf; printipxaddress


Tp4: SPX Socket Sample

Click to open or copy the files for the Tp4 sample.

This sample is a demonstration of the ISO Transport addendum to the Window Sockets interface.

Dgrecv.c is a sample program demonstrating NWLink. This program is a simple example of using SPX connect.

Listen.c is a sample program demonstrating NWLink. This program is a simple example of opening an SPX socket, binding to the socket, and listening for a connection.

Building SDK Samples

This sample uses the following keywords:

accept; bind; closesocket; connect; do_listen; do_recv_send; do_send_receive; dos_net_perror; dos_net_strerror; exit; free; get_error_text; getpeername; getsockname; iso_set_tp_addr; len; listen; localnetworkaddress; make_connection; makeword; malloc; mem_check; memset; net; net_init; net_length; printf; recv; remotenetworkaddress; scanf; send; setsockopt; sleep; socket; sprintf; tsel; wait_for_connection; wsastartup


WSock: Demonstration of the Windows Sockets API

Click to open or copy the files for the WSock sample.

This sample demonstrates the basics of sockets programming, specifically for Windows Sockets. It demonstrates how to accept incoming connections (using the Windows Sockets Asynchronous Extension APIs, threads, and traditional BSD-style blocking calls) and how to connect to remote hosts. Once connected, you can send a text string to the remote host. Wsock also allows the user to view information on a user-entered host name.

Wsock demonstrates how to use AcceptEx, which is a Microsoft specific extension to Windows Sockets and which is only supported on Windows NT®.

Building SDK Samples

This sample uses the following keywords:

_beginthread; _endthread; accept; acceptex; acceptthreadproc; atoi; bind; closesocket; connect; createevent; createwindow; defwindowproc; dialogbox; dispatchmessage; displayhostent; enablemenuitem; enddialog; filladdr; getdlgitem; getdlgitemtext; gethostbyname; gethostname; getmenu; getmessage; getsendstring; getservbyname; getstockobject; gettcpport; htons; initapplication; initinstance; listen; loadcursor; mainwndproc; makeword; memcpy; messagebox; postquitmessage; recv; registerclass; send; senddlgitemmessage; setconnectmenus; setfocus; setsockopt; setwindowtext; showwindow; socket; sprintf; switch; translatemessage; unreferenced_parameter; updatewindow; winmain; wsaasyncselect; wsacleanup; wsagetlasterror; wsagetselecterror; wsagetselectevent; wsastartup; wsprintf


SDK Tools Samples

Click to open or copy the files for the SDKtools samples.


AniEdit: Creating Animated Cursors

Click to open or copy the files for the AniEdit sample.

The AniEdit tool can be used to create and edit animated cursors. The program relies on the ImagEdit SDK tool for the actual bitmap manipulation. AniEdit is a good source of information on the format of animated cursors.

Building SDK Samples

This sample uses the following keywords:

addfontresource; allocmem; aniaddfontmodule; anienddialog; beginpaint; bitblt; btnbarwndproc; calcchecksum; checkdirty; checkradiobutton; clearstepsel; closehandle; convertdatatoicon; copymemory; copyrect; copystep; countof; createcompatiblebitmap; createcompatibledc; createdialogparam; createfile; createframefromcursorfile; createiconfromresource; createprocess; createsolidbrush; createthread; defined; defwindowproc; deletedc; deletefile; deleteobject; destroyclpbrddat; destroyframe; destroyicon; destroystep; destroywindow; dialogbox; dispatchmessage; docommand; dprint; drawcursorlistitem; drawfocusrect; drawicon; drawtext; editframe; enablewindow; enddialog; endpaint; enumthreadwindows; error; etwproc; execprogram; exitcommand; exitthread; fallthru; fflush; fillrect; findresource; fmtfree; fmtmessagebox; fmtsprintf; formatmessage; freemem; getclientrect; getcommandline; getcurrentsel; getdc; getdesktopwindow; getdlgitem; getdlgitemint; getdlgitemtext; getdlgitemtexta; getfilesize; getheightfrompoints; getlasterror; getmessage; getmodulefilename; getopenfilename; getparent; getsavefilename; getselstepcount; getstep; getstepcount; getsyscolor; getsystemmetrics; gettempcursorfilename; gettempfilename; gettemppath; gettextmetrics; getwindowlong; getwindowrect; getwindowtext; getwindowtextlength; globalalloc; globalfree; inflaterect; initapplication; initinstance; invalidaterect; isdbcsleadbyte; isdialogmessage; isdlgbuttonchecked; isiconic; isvalidps; iswindow; ji; killtimer; linkstepframe; loadaccelerators; loadanifile; loadicon; loadresource; loadresourcestr; loadstring; localalloc; localfree; lockresource; lookupiconidfromdirectory; lstrcat; lstrcpy; lstrlen; mainwndproc; makeintresource; makelparam; makewparam; memcmp; messagebeep; messagebox; min; mmiofourcc; movefile; muldiv; newanicursor; newclpbrddat; newstep; nextframe; offsetrect; optionsproc; pack; padup; parsecmdline; pausepreview; postmessage; postquitmessage; previewcursor; previewwndproc; procwaitthread; promptandopenfile; promptforfile; qsort; readanifile; readchunk; readchunkn; readfile; readiconfromfile; readregistry; readtag; regclosekey; regcreatekeyex; registerclass; regopenkeyex; regqueryvalueex; regsetvalueex; releasedc; removefontresource; resumepreview; resumethread; ret_close_if_err; revcompints; saveanifile; savefile; screentoclient; selectobject; senddlgitemmessage; sendmessage; setbkmode; setcurrentsel; setdlgitemint; setdlgitemtext; setdlgitemtexta; setfilepointer; setfocus; setforegroundwindow; setpreviewstep; setstepsel; settextcolor; settimer; setwindowfiletitle; setwindowlong; setwindowtext; sizeofresource; skipchunk; switch; text; translateaccelerator; translatemessage; unreferenced_parameter; updatestepsel; va_end; va_start; waitforinputidle; waitforsingleobject; winhelp; winmain; writefile; writeme; writeregistry; writetag; writetagdata; writetype; wsprintf; zeromemory


FontEdit: Font Editor Sample

Click to open or copy the files for the FontEdit sample.

The FontEdit tool allows you to modify an existing bitmap font. You can change any or all of the header information, as well as graphically edit the bitmap image of the glyphs. This sample can be useful for learning about the binary font format.

Building SDK Samples

This sample uses the following keywords:

_lclose; _lread; _lwrite; aboutdlg; adddel; atoi; beginpaint; bitblt; boxbackup; boxpaint; boxrestore; boxtochar; boxtoclipboard; bytecopy; charrectdimensions; chartobox; charupper; charwidth; checkdlgbutton; checkradiobutton; checksave; cj_dib_scan; clearbox; clearfill; clipboardtobox; closeclipboard; commdlgopen; commdlgsaveas; converttobitmapformat; converttofileformat; createbitmap; createcompatibledc; createsolidbrush; createwindow; defwindowproc; deletedc; deleteglobalbitmap; deleteobject; destroywindow; dialogbox; dispatchmessage; dlgmergestrings; drawbox; drawmenubar; drawrubberband; dupcol; duprow; emptyclipboard; enablemenuitem; enddialog; endpaint; endrubberbandingrect; errorbox; excisechars; fillrect; findmouse; fonteditcommand; fonteditinit; fonteditpaint; fonteditwndproc; fontload; fontrename; fontsave; fontshowhorzscroll; fontshowpaint; fontshowwndproc; format20filetoobig; getclientrect; getclipboarddata; getdc; getdlgitem; getdlgitemint; getdlgitemtext; getkstuff; getmenu; getmessage; getnewmap; getobject; getpixel; getprofilestring; getstockobject; getsystemmetrics; gettextextentpoint32; gettextmetrics; getwindowrect; globalalloc; globalfree; headerproc; initialiserubberbandingrect; initsizes; invalidaterect; invertfont; isclipboardformatavailable; isiconic; iswindowvisible; loadaccelerators; loadcursor; loadicon; loadstring; localalloc; localfree; lstrcat; lstrcpy; lstrlen; makeintresource; makeprocinstance; max; memset; messagebox; min; mouseinbox; mouseinfont; mousemovefont; mouseoutfont; movewindow; newaverage; newfirstchar; newlastchar; openclipboard; openfile; patblt; peekmessage; postmessage; postquitmessage; proport; ptinrect; readrect; rectangle; registerclass; releasecapture; releasedc; resizebody; resizeproc; resizeshow; resizewidths; rgb; scrollfont; selectobject; setbitmapbits; setcapture; setcharset; setclipboarddata; setcursor; setdlgitemint; setdlgitemtext; setfamily; setfixed; setfocus; setpixel; setrop2; setscrollpos; setstretchbltmode; setweight; setwindowtext; showwindow; shrinkfont; snappointtogrid; spreadwidths; sprintf; stretchblt; textout; toclipboard; translatemessage; unreferenced_parameter; updatewindow; usenewmap; verifyheadercontents; verifytablecontents; widthproc; winmain; zapcol; zaprow


Image

Click to open or copy the files for the Image samples.


DrWatson: Error Debugger and Diagnostic Log

Click to open or copy the files for the DrWatson sample.

Click to open or copy the Bin directory (required).

Click to open or copy the Include directory (required).

The DrWatson tool is an application error debugger. It traps application errors and logs diagnostic information.

The information obtained and logged by DrWatson is the information needed by technical support groups to diagnose application errors. The Drwtsn32.log log file is created in the form of an electronic text file that can be delivered to support personnel by whatever method they prefer.

To start DrWatson when no error has occurred, type DRWTSN32 at the command prompt or select the file from File Manager or Windows Explorer.

Building SDK Samples

This sample uses the following keywords:

_getcwd; _makepath; _splitpath; _stricmp; _vsnprintf; addnumber; addstring; adjusttokenprivileges; alloctctx; appendmenu; assert; asserterror; atoi; atol; attachtoactiveprocess; bit20; bit53; bit76; browsefordirectory; browsehookproc; calloc; callwindowproc; cleareventlog; closeeventlog; closehandle; closelogfile; containing_record; continuedebugevent; controlwndproc; crashdumpcallback; createdialog; createdumpfile; createfile; createsemaphore; createthread; debugactiveprocess; debugbreak; debugeventtothreadcontext; defdlgproc; defined; defwindowproc; deregistereventsource; dialogbox; dialogboxparam; didomodrm; disasm; dispatchdebugeventthread; dmpcreateuserdump; domemoryread; dprintf; drwatsonwinmain; dumphookproc; dumpsymbols; elclearallevents; elenumcrashes; elsavecrash; enablewindow; enddialog; enumchildproc; enumchildwindows; enumcrashes; enumcrashesforviewer; err; error; exitprocess; expandenvironmentstrings; expandpath; fatalerror; formatmessage; free; getappname; getcommandline; getcommandlineargs; getcomputername; getcontextforthread; getcurrentprocess; getdc; getdialogvalues; getdlgctrlid; getdlgitem; getdlgitemtext; getdumpfilename; getdword; getenv; getexceptiontext; getfileattributes; getfocus; gethelpfilename; getkeystate; getlasterror; getlocaltime; getlogfiledata; getmodulefilename; getmodulehandle; getnextoffset; getopenfilename; getparent; getpriorityclass; getregflagvalue; getregvalue; getsavefilename; getsegregvalue; getstockobject; getstring; getsymbolsearchpath; getsysteminfo; getsystemmenu; gettasklist; gettaskname; getteb; gettextextentpoint; gettextmetrics; getthreadcontext; getthreadpriority; getusername; getversion; getwavefilename; getwindowlong; getword; hthread; initializecrashlist; initializedialog; initializelisthead; inserttaillist; isdialogmessage; isdigit; isdlgbuttonchecked; isprint; loadcursor; loadicon; loadrcstring; loadstring; localalloc; localfree; logdisassembly; logfileviewerdialogproc; logstackdump; logstackwalk; logsysteminformation; logtasklist; lookupprivilegevalue; lpenumfunc; lprintf; lprintfs; makeintresource; makelangid; makelogfilename; malloc; max; memcpy; memmove; memset; messagebeep; messagebox; min; nonfatalerror; notifywinmain; openeventlog; openlogfile; openprocess; openprocesstoken; opensemaphore; outputallregs; outputdebugstring; outputhexaddr; outputhexcode; outputhexstring; outputhexvalue; outputstring; outputsymbol; pack; pc; playsound; postmortemdump; postquitmessage; printf; processcreateprocess; processcreatethread; processexitthread; processloaddll; processmoduleload; readeventlog; readfile; readprocessmemory; realloc; regclosekey; regcreateeventsource; regcreatekeyex; reggetallvalues; reggetappkey; reggetnumcrashes; reginitialize; reginitializedefaults; reginstalldrwatson; registerclass; registereventsource; reglogcurrentversion; reglogprocessortype; regopenkeyex; regquerybool; regquerydword; regquerysz; regqueryvalueex; regsave; regsaveallvalues; regsetbool; regsetdword; regsetexpandsz; regsetnumcrashes; regsetsz; regsetvalueex; releasedc; releasesemaphore; removeentrylist; reportevent; resumethread; save_ebp; save_trap; selectobject; senddlgitemmessage; sendmessage; setdlgitemtext; seterrormode; setevent; setfaultingcontext; setfilepointer; setfocus; setfocustocurrentcontrol; setforegroundwindow; setthreadcontext; settimer; setwindowlong; setwindowtext; shellabout; showwindow; skipoverbreakpoint; sleep; sprintf; sscanf; st; stackwalk; strcat; strcmp; strcpy; strncpy; subclasscontrols; suspendthread; swfunctiontableaccess; swgetmodulebase; switch; swreadprocessmemory; swtranslateaddress; symbolenumfunc; symenumeratesymbols; symfunctiontableaccess; symgetmoduleinfo; symgetsymfromaddr; syminitialize; symloadmodule; symsetsearchpath; sysinfothread; terminateprocess; terminatethread; terminationthread; tolower; trap_edited; trap_tss; updatewindow; va_start; virtualalloc; virtualfree; virtualqueryex; waitfordebugevent; waitforsingleobject; wavehookproc; waveoutgetnumdevs; widechartomultibyte; winhelp; writefile; wsprintf; zeromemory


SymCvt: Convert Symbols for an Image

Click to open or copy the files for the SymCvt sample.

Click to open or copy the Bin directory (required).

Click to open or copy the Lib directory (required).

Click to open or copy the Include directory (required).

This program is the shell for the SymCvt.dll. The DLL's purpose is to convert the symbols for the specified image. The resulting debug data must conform to the CODEVIEW spec.

Currently this DLL converts COFF symbols and C7/C8 MapToSym.sym files.

Building SDK Samples

This sample uses the following keywords:

_makepath; _splitpath; align; byt_toupper; calculateinputfilepointers; calculatentimagepointers; calculateoutputfilepointers; calloc; closehandle; convertasegment; convertasymtopublic; convertcofftocv; convertsymbolsforimage; convertsymtocv; copymemory; createaddresssorttable; createdirectories; createfile; createfilemapping; createmoduledirectoryentries; createmodulesfromcoff; createmodulesfromsyms; createpublicdirectoryentries; createpublicsfromcoff; createpublicsfromsyms; createsegmapdirectoryentries; createsegmapfromcoff; createsegmapfromsyms; createsignature; createsrclinenumbers; createsrcmodulesdirectoryentries; createsymbolhashtable; dwordxorlrl; dwrd_toupper; enumsymbols; fillinseparateimagepointers; free; getexceptioncode; getexceptioninformation; getfilesize; getsymname; getsysteminfo; guardpagefilterfunction; image_first_section; isdigit; lpenumproc; malloc; mapinputfile; mapviewoffile; max; memcpy; memset; min; nextmod; nextsym16; nextsym32; offsetsortcompare; qsort; realloc; sprintf; strcmp; strcpy; strdup; stricmp; strncmp; strncpy; strstr; switch; symbolcount; symhashcompare; undecoratesymbolname; unmapinputfile; unmapviewoffile; updateptrs; virtualalloc; virtualfree; virtualquery; zeromemory


SymEdit: Symbol Editor Sample

Click to open or copy the files for the SymEdit sample.

Click to open or copy the Bin directory (required).

Click to open or copy the Lib directory (required).

Click to open or copy the Include directory (required).

This sample is a symbol editor. It has the following functions:

  • CalculateOutputFilePointers

  • ComputeChecksum

  • DoCoffToCv

  • DoExtract

  • DoNameChange

  • DoStrip

  • DoSymToCv

  • FatalError

  • MapOutputFile

  • MungeDebugHeadersCoffToCv

  • MungeExeName

  • PrintCopyright

  • PrintUsage

  • ProcessCommandLineArgs

  • ReadDebugInfo

  • WriteDebugInfo

Building SDK Samples

This sample uses the following keywords:

_splitpath; adjustptr; calculatentimagepointers; calculateoutputfilepointers; closehandle; coff_dir; computechecksum; convertcofftocv; convertsymtocv; copyfile; copyfilea; createfile; createfilemapping; cv_dir; defined; deletefilea; docofftocv; doextract; donamechange; dostrip; dosymtocv; exit; fatalerror; filealign; fprintf; free; getmodulehandle; loadstring; malloc; mapfileandchecksum; mapinputfile; mapoutputfile; mapviewoffile; memcpy; memset; mungedebugheaderscofftocv; mungeexename; openfile; printcopyright; printf; printusage; processcommandlineargs; puts; readdebuginfo; readfile; res_str; sectionalign; setendoffile; setfilepointer; splitsymbols; strcmp; strcpy; strdup; switch; toupper; unmapinputfile; unmapviewoffile; va_end; va_start; vsprintf; writedebuginfo; writefile


WinNT

Click to open or copy the files for the WinNT sample.

There is only a makefile at this level.


PfMon: Performance Monitor

Click to open or copy the files for the PfMon sample.

Click to open or copy the Bin directory (required).

Click to open or copy the Include directory (required).

This sample is a performance monitor.

PfMon will run only on Windows NT®. It requires Psapi.dll, which is distributed with the Win32® SDK.

USAGE

pfmon [pfmon switches] command_line_of_application

Main Files

File | Description
Debug.c | Main debug loop.
Error.c | Error handle module.
Init.c | Initialization module.
Module.c | Maintains the module (symbol) information.
Pfmon.c | Main performance monitor code.
Process.c | Maintains state about each process/thread created by PfMon.

Building SDK Samples

This sample uses the following keywords:

addkerneldrivers; addmodule; addprocess; addthread; atoi; attachapplicationfordebug; containing_record; context_to_program_counter; continuedebugevent; createprocess; debugactiveprocess; debugeventhandler; debugeventloop; declareerror; deletemodule; deleteprocess; deletethread; emptyworkingset; enumdevicedrivers; enumprocesses; enumprocessmodules; exitprocess; fclose; findmodulecontainingaddress; findprocessandthreadforevent; findprocessbyid; fopen; formatmessage; fprintf; getcommandline; getcurrentprocess; getdevicedriverbasenamea; getdevicedriverbasenamew; getdevicedriverfilenamea; getdevicedriverfilenamew; getenv; getfileattributes; getlasterror; getmappedfilenamea; getmappedfilenamew; getmodulebasenamea; getmodulebasenamew; getmodulefilenameexa; getmodulefilenameexw; getmodulehandle; getmoduleinformation; getpriorityclass; getprocessmemoryinfo; getthreadcontext; getwschanges; initializelisthead; initializepfmon; initializeprocessforwswatch; insertheadlist; inserttaillist; islistempty; lazyload; loadapplicationfordebug; localalloc; localfree; mapdebuginformation; openprocess; printf; processpfmondata; queryworkingset; removeentrylist; removeheadlist; removetaillist; setpriorityclass; setsymbolsearchpath; setthreadcontext; sprintf; strcat; strchr; strnicmp; symgetsymfromaddr; syminitialize; symloadmodule; unmapdebuginformation; va_end; va_start; waitfordebugevent; zeromemory


ImagEdit: Image Editor

Click to open or copy the files for the ImagEdit sample.

The ImagEdit tool allows you to graphically create small bitmaps and icons. It demonstrates a variety of useful user interface techniques. It also serves as a reference for understanding the binary formats of bitmaps and icons.

Building SDK Samples

This sample uses the following keywords:

_lclose; _lread; _lwrite; _open_osfhandle; aboutdlgproc; addfilterstring; adjustwindowrect; ansinext; ansiprev; atoi; atol; beginpaint; bitblt; bitmapsizedlgproc; brushdp; centerwindow; charnext; checkdlgbutton; checkmenuitem; checkradiobutton; choosecolor; circledp; circledpdraw; cleanup; clearresource; clienttoscreen; closeclipboard; colorboxclicked; colorboxhittest; colorboxpaint; colorboxwndproc; colordlgproc; coloredit; colorinit; colorlrdrawsamples; colorlrpaint; colorlrupdate; colorlrwndproc; colorprocesscommand; colorshow; computeinversecolor; copyimageclip; createbitmap; createcompatiblebitmap; createcompatibledc; createdialog; createdibitmap; createpatternbrush; createpen; createsolidbrush; createwindow; dbgbltimage; dbgprintf; dbgstackreport; defextfromfilter; defhookproc; defined; defwindowproc; deletedc; deleteobject; deltagen; deltageninit; destroywindow; devicelinkalloc; devicelinkfind; devicelinkused; dialogbox; dispatchmessage; dlgbox; drawcolorrect; drawmarginborder; drawpoint; drawsunkenrect; drawtopoint; ellipse; emptyclipboard; enablemenuitem; enablewindow; enddialog; endpaint; endrubberbanding; enteringdialog; extfloodfill; far2near; filecat; fileinpath; findclose; findfirstfile; fitrecttoscreen; flooddp; freeprocinstance; fstat; get_wm_activate_state; get_wm_command_cmd; get_wm_command_id; get_wm_ctlcolor_hdc; get_wm_ctlcolor_type; get_wm_menuselect_cmd; get_wm_menuselect_flags; getbitmapbits; getclientrect; getclipboarddata; getdc; getdesktopwindow; getdibits; getdlgitem; getdlgitemint; getfocus; gethelpcontext; getkeystate; getmenu; getmessage; getmodulefilename; getnearestcolor; getobject; getopenfilename; getopenfilenamehook; getpixel; getprivateprofileint; getprivateprofilestring; getprocaddress; getsavefilename; getstockobject; getsyscolor; getsystemmenu; getsystemmetrics; gettypefromext; getwindow; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; hotspotdp; ids; imageallocundo; imagedcclear; imagedccombine; imagedccreate; imagedcdelete; imagedcmonoblt; imagedcseparate; imagedelete; imagefreeundo; imagelinkalloc; imagelinkfree; imagelinkfreelist; imagenew; imagenewbitmap; imagenewdialog; imageopen; imageopen2; imagesave; imageselectdialog; imageundo; imageupdateundo; initapplication; initdevicelist; initinstance; initmenu; invalidaterect; ischild; isclipboardformatavailable; isdbcsleadbyte; isdlgbuttonchecked; isiconic; isvaliddib; iswindowvisible; iszoomed; itoa; linedp; lineto; loadaccelerators; loadbitmap; loadbitmapfile; loadcolorfile; loadcursor; loadfile; loadicon; loadiconcursorfile; loadstring; localalloc; localfree; localrealloc; lstrcat; ltoa; mainwndproc; makeintresource; makeprocinstance; markhotspotposition; memcpy; menucmd; message; messagebeep; messagebox; min; movetoex; msgfilterhookfunc; my_mbschr; my_mbsncat; my_mbstok; myalloc; mycheckmenuitem; mycreatebitmap; mycreatesolidbrush; myenablemenuitem; myfileread; myfilewrite; myfree; mygetnearestcolor; myrealloc; myrectangle; newcursorimagedlgproc; newiconimagedlgproc; newimageok; normalizepoints; openafile; openclipboard; opencmdlinefile; opendlg; openfile; outputdebugstring; parsedeviceline; pasteimageclip; pasteoptionsdlgproc; patblt; pencildp; penwinregister; pickdp; picksetrect; postquitmessage; processdevicesection; propbarclearhotspot; propbarclearpos; propbarclearsize; propbardlgproc; propbarprocesscommand; propbarsethotspot; propbarsetimage; propbarsetpos; propbarsetsize; propbarshowhotspot; propbarupdate; readenv; readwindowpos; rectangle; rectdp; rectdpdraw; registerclass; registerclipboardformat; registerwindowmessage; releasecapture; releasedc; removemenu; resourcetypedlgproc; restoredefaultcolors; rgb; rubberbandcircle; rubberbandline; rubberbandrect; saveasdlg; savebitmapfile; savecolorfile; savefile; saveiconcursorfile; selectimagedlgproc; selectimageinit; selectimageok; selectobject; senddlgitemmessage; sendmessage; setbkcolor; setcapture; setclipboarddata; setcolorpalette; setcursor; setdibits; setdlgitemint; setdlgitemtext; setfilename; setfilepointer; setfocus; setleftcolor; setpixel; setrect; setrightcolor; setrop2; setscreencolor; setstretchbltmode; setwindowpos; setwindowshook; setwindowtext; showhelp; showwindow; sizeribbons; snappointtogrid; startrubberbanding; strcat; strcmpi; strcpy; stretchblt; strncat; strtok; toolboxcreate; toolboxdrawbitmap; toolboxselecttool; toolboxshow; toolboxupdate; toolboxwndproc; toolbtnwndproc; translateaccelerator; translatemessage; unhookwindowshook; updatewindow; va_end; va_start; verifysavefile; viewchar; viewcreate; viewreset; viewsetpixel; viewshow; viewupdate; viewwndproc; vsprintf; winhelp; winmain; workbuttondown; workbuttonmousemove; workbuttonup; workpaint; workreset; workupdate; workwndproc; writeenv; writeprivateprofilestring; writewindowpos; wsprintf


MC: Message Compiler Sample

Click to open or copy the files for the MC sample.

The Message Compiler (MC) tool takes a message definition script as input, and writes out a binary message table. It can be useful for obtaining a more complete understanding of message tables.

There is an additional sample distributed with the Win32 SDK CD that demonstrates how an application can make use of message tables. It may be found in the following directory: Q_A\SAMPLES\MSGTABLE.

Building SDK Samples

This sample uses the following keywords:

charnext; charprev; chartooem; convertapptooem; exit; fclose; feof; fflush; fgets; field_offset; fopen; fprintf; free; ftell; fwrite; iscsym; iscsymf; isdigit; makelangid; malloc; mcaddname; mcblockmessages; mcchartointeger; mccloseinputfile; mccloseoutputfiles; mcfindname; mcflushcomments; mcgetchar; mcgetline; mcgettoken; mcinitlexer; mcinputerror; mcmakestring; mcopeninputfile; mcparsefile; mcparsemessagedefinition; mcparsemessagetext; mcparsename; mcparsenamelist; mcprintusage; mcskipline; mcskipwhitespace; mcungetchar; mcungettoken; mcwritebinaryfiles; memcpy; primarylangid; setfileapistooem; sprintf; strcat; strcmp; strcpy; stricmp; strnicmp; sublangid; switch


PortTool: Porting Tool

Click to open or copy the files for the PortTool sample.

PortTool is used to help identify the places in your 16-bit Windows-based source code that might need to change to make it Win32®-compatible. The tool provides a brief description of the problem and a possible solution.

Building SDK Samples

This sample uses the following keywords:

_llseek; _lread; _splitpath; charnext; charprev; charupper; choosefonthookproc; createfont; createfontindirect; defined; deletedc; deleteobject; destroywindow; enablemenuitem; enddialog; getcmdline; getdc; getdevicecaps; getdlgitem; getfilename; getfocus; getlasterror; getmenu; getmodulehandle; getobject; getstockobject; gettextmetrics; getversion; getwindow; getwindowlong; getwindowtext; getwindowtextlength; id; initportdata; invalidaterect; isdbcsleadbyte; loadfilterspecstring; loadstring; localalloc; locallock; localrealloc; localunlock; lstrcat; lstrcpy; lstrlen; makeintresource; makeprocinstance; memset; messagebox; my_mbschr; my_mbsncmp; my_mbsncpy; my_mbsnicmp; my_mbstok; primarylangid; releasedc; resetevent; saveasfilename; selectobject; senddlgitemmessage; sendmessage; setevent; setwindowword; writefile


ScrnSave: Screen Saver

Click to open or copy the files for the ScrnSave sample.

The ScrnSave library contains control panel utility library routines for managing cpArrow spin controls used in applet dialog boxes.

Building SDK Samples

This sample uses the following keywords:

arrowcontrolproc; arrowtimerproc; arrowvscrollproc; bytecountof; charsizeof; clickedrectcalc; defhookproc; endpaint; getcommandline; getparent; getwindowlong; getwindowrect; loadcursor; lstrlen; makelong; movewindow; oddarrowwindow; ptinrect; registerclass; releasecapture; screentoclient; sendmessage; settimer; stateclear; stateset; statetest; text


Spy: Monitoring Messages with SPY

Click to open or copy the files for the Spy samples.

This download link will create a sdktools\spy directory on your computer that will contain an includes header, Readme files and all the samples. It is recommended that you download all Spy samples via this link.

The Spy tool demonstrates how to monitor system messages sent to a specified window. Spy records the messages and displays them on the specified device. Spy is also useful in debugging, to verify that the messages you think a window is receiving are actually being received.

Spy demonstrates the following techniques:

  • Using a system message hook.

  • Using the WM_COPYDATA message to pass data to another application.

  • Reading and writing the registry.

  • Creating a thread.

  • Creating a DLL for the hook.

The Spy source files are described in the next topic, App.


App: Build Mfract.exe

To get the files for this sample sample, use the download links in the Spy topic.

This sample builds Mfract.exe.

Main Files

File | Description
Dialogs.c | Dialog procs for the Windows debugging Spy SDK applet.
Hook.c | Message hooking functions for the Windows debugging Spy SDK applet.
Misc.c | Miscellaneous routines for the Windows debugging Spy SDK applet.
Spy.c | Main module for the Windows debugging Spy SDK applet.
Wm.c | Functions that lookup and format messages received by the Windows debugging Spy SDK applet.
Wprintf.c | Routines for using printf windows
Spy.h | Main include file for the Windows debugging Spy SDK applet.
Spyfuncs.h | External function declarations for the Windows debugging Spy SDK applet.
Winprintf.h | Functions used to debug applications quickly.

Building SDK Samples

This sample uses the following keywords:

_lclose; _lcreat; _lwrite; aboutdlgproc; addonewindow; beginpaint; bound; bringwindowtotop; bsearch; calculateprintftabs; charprev; charsindebugwindow; checkdlgbutton; checkmenuitem; choosefont; clearprintfwindow; closeclipboard; closehandle; copytoclipboard; createfile; createfontindirect; createhookthread; createprintfwin; createsolidbrush; createthread; createwindow; dbgprintf; debughscroll; debugpaint; debugvscroll; dec; decodegeneric; defwindowproc; deleteobject; destroywindow; dialogbox; dispatchmessage; drawmenubar; emptyclipboard; enablemenuitem; enablewindow; enddialog; endpaint; entercrit; enumchildwindows; enumwindows; exitthread; filllistbox; fillrect; findhwndinlistbox; first; ftwixti3; getclassname; getclientrect; getcurrentthreadid; getdc; getdesktopwindow; getdlgitem; getdlgitemint; getdlgitemtext; getlasterror; getmenu; getmessage; getmodulefilename; getmodulehandle; getobject; getparent; getprocaddress; getscrollrange; getstockobject; getsyscolor; getsystemmetrics; gettextextentpoint; gettextmetrics; getwindow; getwindowdc; getwindowlong; getwindowname; getwindowplacement; getwindowrect; getwindowtext; globalalloc; highlightwindow; hookmain; hookwndproc; inc; initmenu; insertstring; int2hfile; invalidaterect; isdlgbuttonchecked; isiconic; isprintfempty; isrectempty; iswindow; itvwprintf; last; leavecrit; linesindebugwindow; loadaccelerators; loadcursor; loadicon; loadlibrary; loadresourcestring; loadstring; localalloc; localfree; locallock; localunlock; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; makeintresource; makewindowname; max; memset; message; messagebox; messagescommand; messagesdlgproc; messagesinit; messagesupdatecheckboxes; min; modifymenu; movewindow; mprintf; msgcmp; mwprintf; mycheckmenuitem; mycreateprintfwin; mydialogbox; myenablemenuitem; newline; offsetrect; openclipboard; outputcommand; outputdebugstring; outputdlgproc; patblt; postmessage; postquitmessage; printfwndproc; printmsg; putoptions; readregistry; regclosekey; regcreatekey; registerclass; regqueryvalueex; regsetvalueex; releasedc; scrollwindow; selectfont; selectobject; selectwindowcommand; selectwindowdlgproc; selectwindowenablefields; selectwindowupdateinfo; sendmessage; setbkcolor; setclipboarddata; setcursor; setdlgitemint; setdlgitemtext; setfocus; setforegroundwindow; setlasterror; setprintffont; setprintftabs; setscrollpos; setscrollrange; setspycaption; setspyhook; settextcolor; setwindowclass; setwindowlong; setwindowplacement; setwindowshookex; setwindowtext; setwindowtospyon; showwindow; spycommand; spyinit; spywndproc; strcmp; stripextension; tabbedtextout; text; top; translateaccelerator; translatemessage; unhookwindowshookex; unreferenced_parameter; updatewindow; va_end; va_start; vwprintf; waitforsingleobject; winmain; wprintfsetscrollrange; writefile; writeregistry; wsprintf; wvsprintf


DLL: Windows Message Spy Sample

Click to open or copy the files for the Dll sample.

hook.c is the source for the Windows message spy application dll.

The Spy source files are described in App.

Building SDK Samples

This sample uses the following keywords:

callnexthookex; dbgprintf; dllmain; findspywindow; findwindow; getwindowlong; hookproc; ischild; iswindow; outputdebugstring; sendmessage; spycallwndproc; spygetmsgproc; text; unreferenced_parameter; va_end; va_start; wvsprintf


TList: Task List Application Sample

Click to open or copy the files for the TList sample.

The TList sample is a task list application.

File | Description
Tlist.c | Task list application
Kill.c | Task killer application
Common.c | Common APIs used by Tlist and Kill

Building SDK Samples

This sample uses the following keywords:

adjusttokenprivileges; atol; closehandle; enabledebugpriv; enabledebugpriv95; enabledebugprivnt; enumwindows; enumwindowsproc; exitprocess; fprintf; free; getcommandline; getcommandlineargs; getcurrentprocess; getcurrentprocessid; getlasterror; getmodulehandle; getprocaddress; gettasklist; gettasklist95; gettasklistnt; getversionex; getwindowtext; getwindowthreadprocessid; getwindowtitles; isdigit; isspace; killprocess; lookupprivilegevalue; lstrcpy; makelangid; malloc; matchpattern; memset; min; openprocess; openprocesstoken; pcreatetoolhelp32snapshot; postmessage; pprocess32first; pprocess32next; printf; printtask; realloc; regclosekey; regopenkeyex; regqueryvalueex; sprintf; strcat; strchr; strcpy; stricmp; strupr; terminateprocess; toupper; usage; widechartomultibyte


WinDiff: Graphical File Comparison Tool

Click to open or copy the files for the WinDiff sample.

The WinDiff tool takes two files or two directories and does a byte-for-byte file comparison. It then displays the results in a scrollable window, lining up the identical parts, and marking with color the parts of the files that differ. This application can be useful for doing source-level management of code.

This multithread tool allows you to interact with the window while the file comparisons occur in the background.

Building SDK Samples

This sample uses the following keywords:

_fullpath; _getcwd; _lclose; _llseek; _lread; _ltoa; _lwrite; _mkdir; abortdlg; abortdoc; abortproc; aboutbox; abs; absorbanyblanks; alloc; ansilowerbuff; attachthreadinput; barclick; bardrawposition; barpaint; barwndproc; beginpaint; bottomright; busyerror; charnext; charprev; checkdlgbutton; checkmenuitem; checkradiobutton; ci_compare; ci_copytext; ci_makecomposite; ci_onesection; closehandle; compitem_delete; compitem_discardsections; compitem_freefilename; compitem_getcomposite; compitem_getfilename; compitem_getleftfile; compitem_getleftsections; compitem_getrightfile; compitem_getrightsections; compitem_getstate; compitem_gettext_result; compitem_gettext_tag; compitem_new; complist_args; complist_copyfiles; complist_delete; complist_dirdialog; complist_dodlg_copyfiles; complist_dodlg_dir; complist_dodlg_savelist; complist_filedialog; complist_freeroot_left; complist_freeroot_right; complist_getitems; complist_getroot_left; complist_getroot_right; complist_match; complist_new; complist_open; complist_querytime; complist_savelist; copyfile; createdialog; createfile; createfontindirect; createpen; createprocess; createsolidbrush; createthread; createtools; createwindow; ctree_create; ctree_delete; ctree_find; ctree_getcount; ctree_update; defwindowproc; deletecriticalsection; deletedc; deletefile; deleteobject; deletetools; destroywindow; dialogbox; dir_adddirect; dir_addfile; dir_buildlist; dir_cleardirect; dir_closefile; dir_copy; dir_delete; dir_dirinit; dir_endcopy; dir_fileinit; dir_finalelem; dir_findnextfile; dir_firstitem; dir_freefullname; dir_freeopenname; dir_freerelname; dir_freeroot_item; dir_freeroot_list; dir_getfilesize; dir_getfullname; dir_getopenname; dir_getpathsize; dir_getrelname; dir_getroot_item; dir_getroot_list; dir_isfile; dir_isvaliddir; dir_isvalidfile; dir_nextitem; dir_openfile; dir_scan; dir_startcopy; dispatchmessage; dllmain; do_editfile; do_editthread; do_getdata; do_gethdr; do_getprops; dodlg_stringin; doprint; doresize; drawfocusrect; drawlink; drawsection; drawtext; enablemenuitem; enablewindow; enddialog; enddoc; endpage; endpaint; entercriticalsection; exit; exitprocess; exttextout; file_delete; file_discardlines; file_getdiritem; file_getlinelist; file_new; file_readlines; file_reset; fillrect; findclose; findendofmatched; findendofunmatched; findfirstfile; findfirstwithlink; findnextchange; findnextfile; findprevchange; free; freeprocinstance; gbit_alloc; gbit_findfree; gbit_free; gbit_init; gbit_set; gdate_daytodmy; gdate_dmytoday; gdate_monthdays; gdate_weekday; gdi_isleap; get_scroll_opcode; get_scroll_pos; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getclientrect; getcurrentthreadid; getdc; getdesktopwindow; getdevicecaps; getdlgitemtext; getfileattributes; getfilesize; getfiletime; getfocus; getkeystate; getmenu; getmessage; getmodulehandle; getopenfilename; getparent; getprofileint; getprofilestring; getstockobject; gettempfilename; gettemppath; gettextextent; gettextextentpoint; gettextmetrics; gettickcount; getwindowlong; getwindowplacement; globalalloc; globalfree; globalhandle; globallock; globalunlock; gmem_free; gmem_freeall; gmem_get; gmem_init; gmem_panic; gtab_alloclinedata; gtab_append; gtab_boxcell; gtab_buildtable; gtab_calcwidths; gtab_changesel; gtab_createtools; gtab_dblclick; gtab_delcr; gtab_deltable; gtab_deltools; gtab_dohscroll; gtab_dovscroll; gtab_drawvertline; gtab_enter; gtab_freelinedata; gtab_hsep; gtab_init; gtab_invallines; gtab_invertsel; gtab_isborder; gtab_key; gtab_linetorow; gtab_move; gtab_msg_hscroll; gtab_msg_vscroll; gtab_newsize; gtab_paint; gtab_paintcell; gtab_press; gtab_print; gtab_printhead; gtab_printjob; gtab_printpage; gtab_printsetup; gtab_prtwidths; gtab_release; gtab_rowtoline; gtab_select; gtab_selhome; gtab_sendtq; gtab_setrects; gtab_setsize; gtab_showsel; gtab_showsel_middle; gtab_trackcol; gtab_updatecontig; gtab_updateline; gtab_vsep; gtab_wndproc; gtab_xtocol; gtab_ytoline; hash_string; initapplication; initbarclass; initdc; initializecriticalsection; initinstance; invalidaterect; invertrect; isbusy; isdbcsleadbyte; isdialogmessage; leavecriticalsection; line_compare; line_delete; line_gethashcode; line_getlinenr; line_getlink; line_gettabbedlength; line_gettext; line_isblank; line_link; line_new; line_reset; lineto; list_addafter; list_addbefore; list_addfirst; list_addlast; list_card; list_check; list_clear; list_create; list_delete; list_deletebackwards; list_deletefirst; list_deleteforwards; list_deletelast; list_destroy; list_dump; list_enter_crit; list_first; list_init; list_insertlistafter; list_insertlistbefore; list_isempty; list_isok; list_itemlength; list_join; list_last; list_leave_crit; list_makeok; list_newafter; list_newbefore; list_newfirst; list_newlast; list_next; list_prev; list_recover; list_show; list_splitafter; list_splitbefore; list_traverse; loadaccelerators; loadcursor; loadicon; loadmenu; loadrcstring; loadrcstring2; loadstring; localalloc; localfree; localhandle; locallock; localunlock; lowerrect; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; mainwndproc; makelong; makeprocinstance; max; memcpy; memset; messagebox; min; move; moveback; movetoex; movewindow; muldiv; my_mbschr; my_mbsncmp; my_mbsncpy; my_mbsrchr; nextnonignorable; old_strncpy; openfile; outputdebugstring; parseargs; peekmessage; poll; postmessage; postquitmessage; printdlg; ptinrect; raiserect; readfile_delete; readfile_new; readfile_next; rectangle; redrawwindow; registerclass; registerwindowmessage; releasecapture; releasedc; rgb; scrollwindow; section_delete; section_deletelist; section_expandanchor; section_getcorrespond; section_getfirstline; section_getlastline; section_getleftbasenr; section_getlinecount; section_getlink; section_getrightbasenr; section_getstate; section_makecomposite; section_makectree; section_makelist; section_match; section_matchlists; section_new; section_setleftbasenr; section_setrightbasenr; section_setstate; section_takesection; selectobject; senddlgitemmessage; sendmessage; setabortproc; setbkcolor; setbusy; setbuttontext; setcapture; setcursor; setdlgitemtext; setfileattributes; setfiletime; setfocus; setnames; setnotbusy; setrop2; setscrollpos; setscrollrange; setselection; setstatus; settextcolor; setwindowlong; setwindowplacement; setwindowtext; showwindow; startdoc; startpage; statetocolour; statusadditem; statusalloc; statusbuttondown; statusbuttonup; statuscalcheight; statuscalcwidth; statuscreate; statuscreatetools; statusdeletetools; statusgetitem; statusheight; statusinit; statuspaint; statusresize; statuswndproc; strchr; stringinput; strncmp; strncpy; strrchr; svrclose; switch; switchlists; tableserver; terminatethread; to_blks; toexpand; tomoved; tooutline; topleft; translateaccelerator; translatemessage; tree_addafter; tree_create; tree_delete; tree_delitem; tree_find; tree_getitem; tree_newitem; tree_search; tree_update; updatewindow; utils_comppath; utils_isblank; view_changediffoptions; view_changeviewoptions; view_close; view_delete; view_expand; view_expand_item; view_findchange; view_findrow; view_freemappings; view_getcomplist; view_getcurrenttag; view_getitem; view_getlinenr_left; view_getlinenr_right; view_getrowcount; view_getstate; view_gettext; view_getwidth; view_isexpanded; view_new; view_newitem; view_outline; view_outline_opt; view_setcomplist; viewenter; viewleave; waitforsingleobject; wd_copy; wd_dirdialog; wd_initial; wdenter; wdleave; windiff_ui; windiff_usage; winmain; writeprofileint; writeprofilestring; wsprintf; zeromemory


CaCLs: Display or Modify Access Control Lists (ACLS) of Files

Click to open or copy the files for the CaCLs sample.

The CACLS tool displays or modifies the Access Control Lists (ACLs) of files.

Main Files

File | Description
Accacc.hxx | Class encapsulating NT security user ACCACC.
Account.cxx | Class wrapping account sid and name.
Account.hxx | Class encapsulating NT security user account.
Daclwrap.cxx | Class encapsulating file security.
DumpSec.cxx | Class to dump file security ACL.
DumpSec.hxx | Class encapsulating file security.
FileEnum.cxx | Class encapsulating file enumeration, including a deep option.
FileEnum.hxx | Class encapsulating file enumeration.
Filesec.cxx | CFileSecurity class encapsulating SECURITY_DESCRIPTOR.
Filesec.hxx | Class encapsulating file security.
T2.hxx | General include items for the Control ACLS program.

Building SDK Samples

This sample uses the following keywords:

_acetype; _allocated; _allocatenewacl; _cacethissid; _ccaa; _domain; _downdir; _fcannotaccess; _fdeep; _fillnewacl; _findeep; _foundinheritance; _froot; _fsid; _getnewaclsize; _handle; _ialize; _initdir; _mask; _name; _nextdir; _nextlocal; _pah; _pcfe; _pdacl; _psd; _psid; _pwfilename; _pwfileposition; _savemask; _setallowedace; _setdeniedace; _statbufsize; _stricmp; _system; _wcsicmp; accessmask; acetype; add2ptr; addace; addinheritance; atol; buildacl; ca; caccount; caccountaccess; cdaclwrap; cds; cdumpsecurity; cfe; cfileenumerate; cfilesecurity; cfs; clearaccessmask; closehandle; debugenumerate; display; display_mask; display_sids; displayaces; enumerate_extra; enumerate_fail; enumerate_returns; enumerate_stat; equalsid; errors; exit; fa; fastallocator; fgets; findclose; findfirstfile; findnextfile; formatmessage; formatmessagea; fprintf; fwprintf; getaccountdomain; getaccountname; getaccountsid; getbuf; getcmdlineargs; getconsoleoutputcp; getcurrentprocessid; getfilesecurity; getfullpathname; getlasterror; getlengthsid; getnextace; getsdgroup; getsdowner; getsecuritydescriptordacl; getsecuritydescriptorgroup; getsecuritydescriptorowner; getsystemdefaultlangid; getuserandaccess; initializeacl; last_error; localalloc; localfree; lookupaccountname; lookupaccountsid; makelangid; makelcid; mbstowcs; memcpy; modifyaces; multibytetowidechar; next; openprocess; openprocesstoken; opentoken; primarylangid; printf; printface; printfmask; printfsid; printmessage; reinit; resetace; setaccess; setfilesecurity; setfs; setlocale; setthreadlocale; sid; size; sprintf; strchr; testinheritance; usage; va_end; va_start; verbose; verboser; wcscat; wcscmp; wcscpy; wcslen; widechartomultibyte; wprintf


Compact: Display/Alter the Compression of Files or Directories

Click to open or copy the files for the Compact sample.

This module implements the Double Stuff utility for compressed NTFS volumes.

Building SDK Samples

This sample uses the following keywords:

_get_osfhandle; arrangecommandline; chartooem; closehandle; commandlinetoargvw; compressfile; createfile; deviceiocontrol; displayerr; displayfile; displaymsg; docompressaction; dolistaction; douncompressaction; fileisconsole; findclose; findfirstfile; findnextfile; formatfilesize; formatmessage; getcommandline; getcompressedfilesize; getconsolemode; getconsoleoutputcp; getcurrentdirectory; getfileattributes; getfileinformationbyhandle; getfiletype; getfullpathname; getlasterror; getstandardstream; getstdhandle; initializeiostreams; isntldr; isuncroot; lstrcat; lstrchr; lstrcmp; lstrcpy; lstricmp; lstrlen; lstrnicmp; makelangid; makelcid; openfileforcompress; setcurrentdirectory; setfileattributes; setlasterror; setthreadlocale; swprintf; text; uncompressfile; va_end; va_start; wcschr; writeconsole; writefile


DbMon: Implements a Debug Monitor

Click to open or copy the files for the DbMon sample.

DbMon is a simple program that demonstrates how to print strings passed to OutputDebugString when the application printing the strings is not currently being debugged.

Building SDK Samples

This sample uses the following keywords:

createevent; createfilemapping; exit; fprintf; getlasterror; initializesecuritydescriptor; mapviewoffile; printf; putchar; setevent; setsecuritydescriptordacl; waitforsingleobject


DDEspy: DDE Event and Status Viewer

Click to open or copy the files for the DDEspy sample.

The DDEspy tool allows you to view information about the status of dynamic data exchange (DDE) conversations.

The DDEspy tool demonstrates how to monitor DDE messages by setting up an APPCLASS_MONITOR callback function. The DDEspy-monitored data can be selected and filtered through various options. The information is represented in up to four selectable tracks for String Handles, Conversations, Links and Services, each displayed in different overlapped windows. DDEspy records the messages and displays them on the related window. DDEspy is useful in debugging to verify DDE data and messages.

Building SDK Samples

This sample uses the following keywords:

addmclbtext; atoi; beginpaint; bound; charnext; checkdlgbutton; checkmenuitem; clearscreen; closeapp; closehandle; closetestsubs; cmpcols; compareitems; createfile; createmclbframe; createsolidbrush; createwindow; ddeaccessdata; ddecallback; ddeinitialize; ddemsg2string; ddequerystring; ddeunaccessdata; ddeuninitialize; defwindowproc; deletemclbtext; deleteobject; destroywindow; dialogboxparam; disectmsglp; disectword; dispatchmessage; dodialog; drawfocusrect; drawlbitem; drawstring; drawtext; dumpdata; dumpformat; enddialog; endpaint; error2string; fillrect; filterdlgproc; flushfilebuffers; freeprocinstance; get_em_setsel_mps; get_wm_command_id; get_wm_command_mps; get_wm_hscroll_code; get_wm_hscroll_pos; get_wm_vscroll_code; get_wm_vscroll_pos; getclientrect; getclipboardformatname; getdc; getdesktopwindow; getdlgitem; getdlgitemtext; getfocus; getfullpathname; gethszname; getmclbcolvalue; getmenu; getmessage; getprivateprofilestring; getprofile; getprofileboolean; getscrollpos; getstockobject; getsyscolor; gettextmetrics; getwindowlong; globalgetatomname; inflaterect; initapplication; initinstance; inittestsubs; intersectrect; invalidaterect; invertrect; isdlgbuttonchecked; isprint; iswindow; loadaccelerators; loadcursor; loadicon; loadresourcestrings; loadstring; localalloc; localfree; localhandle; locallock; localunlock; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lstrlena; mainwndproc; makeintresource; makelong; makeprocinstance; markdlgproc; mclbclientwndproc; memcpy; memset; messagebox; min; movewindow; mprt; multibytetowidechar; my_mbschr; myalloc; myfree; nextline; off2p; offsetrect; opendlg; outputdebugstring; outputstring; paintstrwnd; pdf; postquitmessage; refstring; registerclass; releasedc; saveprofile; scroll; scrollwindow; selectobject; senddlgitemmessage; sendmessage; setbkmode; setdlgitemtext; setfilters; setfocus; setprofileboolean; setscrollpos; setscrollrange; setwindowlong; setwindowtext; showwindow; strwndcreate; strwndproc; text; translatemessage; type2string; unreferenced_parameter; unregisterclass; updatewindow; wcschr; widechartomultibyte; winmain; writefile; writeprivateprofilestring; wsprintf


DlgEdit: Dialog Editor

Click to open or copy the files for the DlgEdit sample.

The DlgEdit tool allows you to design and test a dialog box on a display screen instead of defining dialog box statements in a resource script. You can use DlgEdit to create new dialog boxes and to add or remove controls from an existing dialog box. You can then compile this resource file using the resource compiler. The binary output from the resource compiler can then be linked into your application's executable file.

DlgEdit demonstrates the following techniques:

  • Creating dialog boxes

  • Reading and writing resource files

  • Creating control windows

  • Creating a help file

  • Creating custom controls

  • Creating groups of controls

  • Working with include files

Building SDK Samples

This sample uses the following keywords:

_lread; _lwrite; _setjmp; _wcsnicmp; aboutdlgproc; abs; addcontrol; addcustomlink; additemtoinclb; addlabel; addnewdialog; addtopointsizecombo; adjustdefaultsizes; adjustwindowrect; adjustwindowrectex; aligncontrols; alloccustlink; allocdialogresource; allocreslink; applynewid; applynewname; applynewtext; arrangepushbuttons; arrangesettingsdialog; arrangesettingsdlgproc; arrangesize; arrangespacing; atfirsttabcolumn; atoi; atorabove; atorbelow; awtoi; axtoi; begindeferwindowpos; beginpaint; bitblt; builddefsavename; buildfilterstring; calccursoroffset; calcselectedrect; callcustominfoa; callcustomsizetotext; callcustomstyle; callnexthookex; callwindowproc; cancelselection; canceltracking; centerwindow; charnext; checkboxstylesdlgproc; checkdlgbutton; checkmenuitem; checkstyleboxes; childwndproc; clienttoscreen; clienttoscreenrect; closeclipboard; closehandle; comboboxstylesdlgproc; comma; copylabels; copytoclipboard; createcompatiblebitmap; createcompatibledc; createcontrol; createdc; createdialog; createdialogindirect; createdibitmap; createdlgfont; createfile; createfontindirect; createpen; createtestdialog; createwindow; createwindowex; ctrlbuttondown; ctrlbuttonup; ctrlhittest; ctrlmousemove; ctrlwndproc; customstylesdlgproc; customwndproc; deferwindowpos; defined; defwindowproc; deletecontrol; deletecontrol2; deletedc; deletedialog; deletedialogresource; deletefile; deletelabel; deleteobject; destroytestdialog; destroywindow; dialogbox; dialogctrlwndproc; dialogmenu; dialogstylesdlgproc; dialogterminate; differentdirs; dispatchmessage; dlgbox; dlginclipboard; dowesave; dragbegin; dragbegin2; dragcancel; dragend; dragnewbegin; dragwndproc; drawfocusrect; drawhandles; drawmenubar; drawownerdrawbutton; drawtext; drawtrackrect; dropcontrol; duplicate; dutowinpoint; dutowinrect; dwordalign; dwordpad; editstylesdlgproc; emptyclipboard; enablecomboboxstyles; enabledialogstyles; enableeditstyles; enablelistboxstyles; enablemenuitem; enablewindow; enddeferwindowpos; enddialog; endpaint; enteringdialog; enumfonts; equalrect; exttextout; filecat; fileinpath; filleditsfromlb; fillfontnamecombo; fillincludelb; filllanguagecombo; fillpointsizecombo; fillsublanguagecombo; finddefine; finddialog; findid; findidinres; findlabel; findresource; fitrecttobounds; fitrecttoscreen; fontnameenumfunc; formtempfilename; freectype; freecustlink; freeinclude; freelabels; freelibrary; freemenubitmaps; freeprocinstance; freeres; freereslink; freereslist; freeresource; genericstylesdlgproc; getacp; getbvalue; getcapture; getchar; getchildproc; getchildrect; getclasslong; getclassname; getclientrect; getclipboarddata; getcontrolkeyword; getcustomstylesfield; getdc; getdesktopwindow; getdevicecaps; getdialogbaseunits; getdlgitem; getdlgitemint; getdlgitemtext; getfileattributes; getfilesize; getfocus; getfontcharset; getfontcharsetenumfunc; getfullpathname; getgvalue; gethelpcontext; geticlass; getkeystate; getlabel; getmenu; getmessage; getmessagepos; getmodulefilename; getnextinc; getnextwindow; getobject; getopenfilename; getoverhang; getparent; getprivateprofileint; getprivateprofilestring; getprocaddress; getprop; getrvalue; getsavefilename; getstockobject; getsubmenu; getsyscolor; getsystemmenu; getsystemmetrics; getsystemvalues; gettempfilename; gettextextentpoint; gettextface; gettextmetrics; gettopwindow; getupdaterect; getvalue; getwindow; getwindowdc; getwindowlong; getwindowrect; getwindowtext; getword; globalalloc; globalfree; globallock; globalunlock; gridizerect; handlehittest; hasblanks; haspath; hidetrackrect; ids; idtolabel; idusedbyctrl; inflaterect; initapplication; initinstance; initmenu; inittracking; intersectrect; invalidatedlghandles; invalidaterect; ischild; isclipboardformatavailable; iscsym; isdbcsleadbyte; isdialogmessage; isdlgbuttonchecked; isiconic; islistchanged; isord; issymbol; isuniqueid; isvalidresfile; isvalue; iswdigit; iswindowvisible; iswxdigit; iszoomed; itoa; itoaw; itoax; kdexpandcopy; killtimer; kkexpandcopy; labeltoid; lineto; listboxstylesdlgproc; loadaccelerators; loadalterbitmap; loadbitmap; loadcursor; loadicon; loadincludefile; loadlibrary; loadmenubitmaps; loadresfile; loadresource; loadstring; loadsyscolorbitmaps; localalloc; localfree; localrealloc; lockresource; longjmp; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; lstrlena; mainwndproc; makecopyfromres; makeintresource; makelangid; makelong; makeprocinstance; mapdlgclientpoint; mapwindowpoint; max; memcmp; memcpy; memset; message; messagebeep; messagebox; min; modifymenu; mousetodragrect; mousetodu; movecontrol; movefile; movetoex; movewindow; msgfilterhookfunc; muldiv; multibytetowidechar; myalloc; mycheckmenuitem; myenablemenuitem; myenablemenuitembypos; myframerect; myfree; mygetchardimensions; myitoa; mymapwindowrect; myrealloc; nameordcmp; nameordcpy; nameorddup; nameordlen; newcustdlgproc; newcustinit; newcustok; newline; nextid; offsetrect; open; openclipboard; opencmdlinefile; opencustomdialog; opendllfile; openincludefile; openresfile; orderdlgcleartabs; orderdlgdrawitem; orderdlgenablecontrols; orderdlgfilllist; orderdlginit; orderdlginserthittest; orderdlglbwndproc; orderdlgmakegroup; orderdlgmarkgroupends; orderdlgproc; orderdlgreorder; orderdlgselchange; orderdlgsettabs; orderdlgtoggletab; ordergroupdialog; orderwindows; ordid; orsymbol; outlineselectbegin; outlineselectcancel; outlineselectdraw; outlineselectend; outlineselecthide; outlineselectsetrect; paintunderdrag; parsecontroldata; parsedialogboxheader; pastefromclipboard; patblt; pcfromhwnd; penwinregister; pixelstopointsize; point2long; pointsizeenumfunc; pointsizetopixels; positioncontrol; positioncontrol2; postmessage; postquitmessage; predragtimeout; primarylangid; ptinrect; pushbuttonstylesdlgproc; querycheckedstyles; querytextextent; quote; radiobuttonstylesdlgproc; readchar; readcustomprofile; readenv; readwindowpos; rectangle; redrawselection; registerclass; registerclipboardformat; registerwindowmessage; releasecapture; releasedc; remcustdlgproc; remcustinit; remcustok; removecustomlink; removemenu; removeprop; repositiondialog; reslinktodialog; resourcename; resourcepart2; resourcesize; resourcetype; restodialog; restoredialog; rgb; rgbinvertrgb; roundrect; rwtooffset; safedwordalign; safenameordlen; safeparseresheader; save; savedlgclientrect; screentoclient; screentoclientrect; searchpath; selcustdialog; selcustdlgproc; selcustinit; selcustok; selcustselect; selectcontrol; selectcontrol2; selectdefitem; selectdialogdialog; selectdialogdlgproc; selectdialogfilllanglist; selectdialoginit; selectdialogok; selectnext; selectobject; selectprevious; senddlgitemmessage; sendmessage; setactivewindow; setanchortofirstsel; setbitmapdimensionex; setbkcolor; setbkmode; setcapture; setchildproc; setclasslong; setclipboarddata; setcursor; setcursorpos; setcustomstylesfield; setdlgitemint; setdlgitemtext; setfocus; setincbuttonenable; setparent; setpcintohwnd; setprop; setrect; setrop2; settab; settextcolor; settimer; setwindowlong; setwindowpos; setwindowshook; setwindowtext; showfilestatus; showhelp; showtrackrect; showwindow; sizectrltotext; sizedragtocontrol; sizeribbons; sizetotext; skipcontroldata; skipdialogboxheader; skipresheader; skipsz; space; statusapplychanges; statusclear; statusclearid; statusclearname; statusdlgproc; statusfillsymbollist; statusinit; statusprocesscommand; statussetcoords; statussetenable; statussetid; statussetname; statussetnameid; statussettext; statussettextlabels; statusshowfields; statusupdate; strtok; strtonameord; stylesdialog; styleshelp; sublangid; synchdialogresource; tab; testdlgproc; testinitdlg; text; toolboxcreate; toolboxdrawbitmap; toolboxontop; toolboxselecttool; toolboxshow; toolboxwndproc; toolbtnwndproc; translateaccelerator; translatecharsetinfo; translatemessage; typefromclassstyle; unhookwindowshookex; unlockresource; unselectcontrol; unsetchildproc; unsetpcintohwnd; updatewindow; va_end; va_start; validatenewid; validatenewname; valtoi; viewincadd; viewinccancel; viewincchange; viewincdelete; viewincinit; viewinclude; viewincludedlgproc; wcsncmp; widechartomultibyte; winhelp; winmain; wintodupoint; wintodurect; writeaddedinc; writechangedinc; writeclass; writeclassstyle; writecontrol; writecoords; writecustomprofile; writecustomstyle; writedeletedinc; writedialogheader; writedialogheaderlanguage; writedlg; writedlgchar; writedlgflush; writedlginclude; writedlgincluderes; writedwordpad; writeenv; writeescapedstring; writehexdword; writehexword; writeiddlg; writeidinc; writeinc; writeincchar; writeincflush; writenameord; writeord; writeprivateprofilestring; writequotedstring; writeres; writeresheader; writestring; writestyles; writesymbol; writesz; writetext; writethefile; writevalue; writewindowpos; wsprintf; wvsprintf


NetWatch: File Server Monitor

Click to open or copy the files for the NetWatch sample.

The NetWatch tool allows you to monitor the file server activities on your workstation and on remote servers. It demonstrates how an application can programmatically gather this information.

Building SDK Samples

This sample uses the following keywords:

adderrorstringtotv; allocandloadstring; assert; assertsz; assertszfn; beginpaint; bliticon; button_enable; callwindowproc; caption_item; charlower; charupper; checkmenuitem; closehandle; commandlinetoargvw; comparefilenamesqsortcallback; comparesharenames; comparesharenamesqsortcallback; compareusernamesqsortcallback; createsolidbrush; createwindow; dbgprint; debugbreak; defwindowproc; deinitnetwatchwnd; deletebrush; destroymenu; dialogbox; dispatchmessage; displaycomputerdetails; displayfiledetails; displaysharedetails; displayuserdetails; drawicon; edit_enable; edit_gettext; edit_gettextlength; edit_limittext; edit_settext; enablemenuitem; enddialog; endpaint; fanyremotedrives; filesenum; fislparamtvdata; fissharehidden; formatmessage; freelibrary; ftreeview_deleterange; ftreeview_getstring; get_wm_ctlcolor_hdc; getclientrect; getcommandline; getcomputerimage; getcomputername; getdateformat; getdlgitem; getdrivetype; getkeystate; getlocaleinfo; getmenu; getmenustate; getmessage; getmessagepos; getparent; getprocaddress; getsubmenu; getsyscolor; getsystemerrmessage; gettickcount; gettimeformat; getwindowlong; getwindowplacement; getwindowrect; globalallocptr; globalfreenullptr; globalfreeptr; haddcomputer; handle_wm_command; handle_wm_notify; handlemenu; handlewm_vkey; handlewmcommand; handlewmnotify; idbgprint; imagelist_destroy; imagelist_draw; imagelist_loadbitmap; initcommoncontrols; initnetwatchwnd; isbadstringptr; isiconic; iswindow; iswindowenabled; killtimer; loadaccelerators; loadcursor; loadicon; loadlibrary; loadmenu; loadstring; localfree; localtime; lstrcat; lstrcata; lstrcmp; lstrcmpi; lstrcpy; lstrcpya; lstrcpyn; lstrlen; makeintresource; messagebeep; messagebox; messageboxa; modifymenu; multibytetowidechar; netapibufferfree; netconnectionenum; netfileclose; netfileenum; netfilegetinfo; netservergetinfo; netsessiondel; netsessiongetinfo; netsharedel; netshareenum; netsharegetinfo; newtvproc; offsetof; outputdbgstr; outputdbgstrerror; outputdebugstringa; postmessage; postquitmessage; propdlgproc; propertydlg; propertysheet; punchtimer; putcountertime; putdate; puttime; qsort; refreshdisplay; regcreatekeyex; registerclass; regopenkeyex; regqueryvalueex; regsetvalueex; restoreserverlist; restorewindowposition; savewindowposition; screentoclient; selectcomputer; selectdlgproc; sendmessage; setbkcolor; setcursor; setdlgitemtext; seterrormode; setfocus; setmenu; settimer; setwindowlong; setwindowplacement; setwindowpos; sharemanage; sharesenum; shellabout; shoffset; showtitle; showwindow; sideassert; subclasswindow; switch; szfromids1; text; text_item; time; trackpopupmenu; translateaccelerator; translatemessage; treeview_deleteitem; treeview_ensurevisible; treeview_expand; treeview_findexactstring; treeview_freeitemdata; treeview_getchild; treeview_getcount; treeview_getitem; treeview_getnextsibling; treeview_getparent; treeview_getroot; treeview_getrootcount; treeview_getrootlist; treeview_getselecteditemdata; treeview_getselection; treeview_hittest; treeview_insertitem; treeview_selectitem; treeview_setimagelist; treeview_setitem; treeview_tvdatainsert; treeview_tvreplacelparam; usersenum; va_arg; va_end; va_start; windows; winmain; wndproc; wnetconnectiondialog; wnetdisconnectdialog; wsprintf; wsprintfa; wvsprintfa


PerfMon: Performance Monitor

Click to open or copy the files for the PerfMon sample.

The PerfMon tool allows you to view information about the resources being used by the operating system. It is the quintessential sample of how an application can get performance data from the registry.

Building SDK Samples

This sample uses the following keywords:

aboutdlg; addnewname; alertdata; alertitemtopmargin; allocateperfdata; anylogline; argument_present; beginpaint; binittimeline; bookmarkdlg; boolequal; buildnametable; buildnewnametable; buildoldnametable; callwinhelp; cbadd; cbdata; cbfind; cbinsert; cbreset; cbselection; cbsetdata; cbsetselection; cbstring; cbstringlen; chartdeleteline; chartooembuff; checkdlgbutton; checkradiobutton; chooselogcomputerdlgproc; cleargraphtimer; closelogstoptimer; colcangrow; convertunicodestr; counter_average_bulk; counter_average_timer; counter_bulk; counter_counter; counter_counter_common; counter_elapsed_time; counter_large_rawcount; counter_null; counter_queuelen; counter_raw_fraction; counter_rawcount; counter_text; counter_timer; counter_timer100ns; counter_timer100ns_inv; counter_timer100ns_multi; counter_timer100ns_multi_inv; counter_timer_common; counter_timer_inv; counter_timer_multi; counter_timer_multi_inv; createbrushindirect; createscreendc; createsolidbrush; createthread; currentalertline; currentgraphline; dbg_unreferenced_parameter; dda_distribute; defwindowproc; deletebitmap; deletebrush; deletefont; deletepen; destroywindow; dialogbox; dialogcontrol; dialogint; dialogsetint; dialogsetstring; dialogtext; didisabled; dientire; difocus; difocuschanged; diindex; diselected; diselectionchanged; displaytimeline; diwindow; dragqueryfile; drawgrid; drawmenubar; drawtlgraphdata; editmodified; editsetlimit; editsetmodified; editsettextendpos; editsettextpos; eelapsedtime; egettimeinterval; enddialog; endpaint; errorexit; eupdateave; eupdatemax; eupdatemin; eupdateminmaxave; evalthischar; fileerrormessagebox; filehandlecreate; filehandleopen; filehandlereadonly; filemap; fileseekbegin; fileseekcurrent; fileseekend; filetell; fileunmap; firstcounter; firstindexblock; firstinstance; firstobject; framerect; gdisetbatchlimit; getcounterdata; getcounterdef; getcounternumbytitleindex; getcurrentprocess; getcurrentthread; getcurrentthreadid; getdatetimeformats; getdc; getdlgitem; getgraphconfig; gethelptext; getinstance; getinstancebyname; getinstancebynameusingparenttitleindex; getinstancebyuniqueid; getinstancecounterdata; getinstancename; getinstancenamestr; getinternational; getkeystate; getlasterror; getnextinstance; getobjectdef; getobjectdefbyname; getobjectdefbytitleindex; getobjectidbyname; getopenfilename; getperfcomputername; getprocaddress; getprofileint; getprofilestring; getsavefilename; getstockobject; getsyscolor; getsystemnames; gettextmetrics; gettickcount; getuserdefaultlangid; graphdata; graphoptiondlg; handleselectionstate; hline; horzinchpixels; id; ilbegin; ilend; ilgrabwidth; ilmode; ilrange; ilstart; ilstartpixel; ilstop; ilstoppixel; ilwidth; inalertadd; inchartadd; inreportadd; insertgraph; insertsystem; instancename; invalidaterect; isbookmarkindex; isbw; iscounternameindex; isdataindex; isiconic; islegendlabelvisible; islocalcomputer; isnumberinunicodelist; isprinterdc; isremotecomputer; istlinewindowup; killtimer; labeltopmargin; lbadd; lbdata; lbdelete; lbfind; lbfocus; lbinsert; lbnumitems; lbreset; lbselected; lbselection; lbsetdata; lbsethorzextent; lbsetredraw; lbsetselection; lbsetvisible; lbstring; legenddata; legendhorzmargin; legenditemtopmargin; legendleftmargin; lineparentname; loadcursor; loadlibrary; loadlinegraphsettings; loadrefreshsettings; loadstring; logappendsetup; logbuildnametable; logdata; logentryn; logfindentry; lstrcat; lstrcmp; lstrcpy; lstrlen; memcpy; memoryallocate; memoryresize; memorysize; menucheck; messagebox; mlbsetselection; modelessdispatch; nextcounter; nextinstance; nextobject; nextrelogindexposition; numcolorindexes; numprinterlinecolors; numprinterlinestyles; numstyleindexes; numwidthindexes; openfilehandler; opensystemperfdata; perfmonviewwindow; pinexclusive; pininclusive; playingbacklog; pointerseek; polyline; posterror; primarylangid; pstrsame; pstrsamei; queryperformancename; querytitleentry; rectcontract; rectdrawable; regcreatekeyex; registerwindowmessage; regopenkeyex; regqueryvalueex; regsetvalueex; releasemutex; removeobjectsfromsystem; reportdata; resetgraphtimer; rgb; sample_common; sample_counter; sample_fraction; savefilehandler; selectbitmap; selectbrush; selectfont; selectlogobjects; selectobject; selectpen; senddlgitemmessage; sendmessage; setarrowcursor; setbkmode; setcursor; setfont; setgraphtimer; sethourglasscursor; setlocale; setpriorityclass; setthreadpriority; settimer; simulatebuttonpush; statusbottommargin; statusdrawavg; statusdrawmax; statusdrawmin; statusleftmargin; statustextmargin; statustopmargin; statusvaluemargin; strclr; strcpy; strempty; stringload; strnsame; strsame; strsamei; switch; swscanf; systemcount; text; translateaccelerator; tsprintf; unmapviewoffile; updatelgdata; updatelines; va_arg; valuemargin; vertinchpixels; vertpointpixels; vline; waitforsingleobject; wcstoul; windowexstyle; windowid; windowinstance; windowinvalidate; windowparent; windowsetid; windowsetstyle; windowshow; windowstyle; winhelp


PViewer: Process Viewer

Click to open or copy the files for the PViewer sample.

The PViewer tool reads the information (counters) from the registry that relate to the threads and processes running on your machine. It also allows you to change the priority of the processes. This sample includes about a third of the code necessary to do the same thing on a thread-by-thread basis. If you want to learn more, you may want to try to complete the code.

See also the PView sample.

Building SDK Samples

This sample uses the following keywords:

instancename; li2double; loadicon; paintmemdlgaddrdata; text


Remote: Demonstrates a Client-Server Connection

Click to open or copy the files for the Remote sample.

The Remote tool can be used as both a client and a server.

Main Files

File | Description
Client.c | The Client component of Remote. Connects to the remote server using named pipes. It sends its stdin to the server and outputs everything from server to its stdout.
Pipeex.c | Create Pipe-like function that lets one or both handles be overlapped.
Rdsrelay.c | Relays received Remote.exe broadcasts (for Remoteds.exe) to another domain/workgroup.
Remote.c | This module contains the main entry point for Remote. Calls the Server or the Client depending on the first parameter.
Remoteds.c | A "directory service" for the limited job of finding Remote.exe servers on the same domain/workgroup.
Remoteds.c | Implements a listener that allows searching.
Server.c | The server component of Remote. It spawns a child process and redirects the stdin/stdout/stderr of child to itself. Waits for connections from clients, passing the output of the child process to client and the input from clients to the child process.
Server.h | The server component of Remote, rewritten using ReadFileEx/WriteFileEx completion routines.
Srvad.c | This module uses mailslots to broadcast the existence of this remote server to allow a form of browsing for remote server instances. This is disabled in the customer version of Remote.exe, and can be disabled in the internal version using the /v- switch to remote /s.
SrvChild.c | The server component of Remote. It spawns a child process and redirects the stdin/stdout/stderr of child to itself. Waits for connections from clients, passing the output of the child process to client and the input from clients to the child process.
SrvCtoS.c | This file implements the client-to-server flow of data for remote server. The data is the keyboard or piped input that the client received and sent over the wire to us, bracketed by BEGINMARK and ENDMARK bytes so we can display nice attribution comments in brackets next to input lines.
SrvHShak.c | The server component of Remote. Handshake with client at start of session.
SrvList.c | The server component of Remote. This module implements three lists of REMOTE_CLIENT structures, for handshaking, connected, and closing clients. To simplify the interface items always progress through the three lists in order, with list node memory being freed as it is removed from the closing list.
SrvList.h | List package for SrvList.
SrvMain.c | The server component of Remote. It spawns a child process and redirects the stdin/stdout/stderr of child to itself. Waits for connections from clients, passing the output of the child process to the client and the input from clients to the child process. This version uses overlapped I/O so that it uses only one thread, rather than nine.
SrvQuery.c | The server component of Remote. Respond to client "remote /q" requests to list available remote servers on this machine.
SrvStoC.c | This file implements the server-to-client flow of data for remote server. The data is the output of the child program intermingled with client input.
SrvUtil.c | The server component of Remote. It spawns a child process and redirects the stdin/stdout/stderr of child to itself. Waits for connections from clients, passing the output of the child process to client and the input from clients to the child process.

Building SDK Samples

This sample uses the following keywords:

_beginthreadex; _snprintf; _strlwr; addaccessallowedace; addaccessdeniedace; addclienttohandshakinglist; advertisetimerfired; assert; atoi; calloc; cancelio; child; cleanuptempfiles; cleanupthread; client; closeclient; closeclientpipes; closehandle; cmdstring; connectnamedpipe; connectouttimerfired; containing_record; copymemory; copypipetopipe; copystdintopipe; createevent; createfile; createfilea; createmailslot; createmutex; createmysecuritydescriptor; createnamedpipe; createnamedpipea; createpipe; createpipeandissueconnect; createprocess; createthread; debugbreak; defined; deletefile; disconnectnamedpipe; displayclienthlp; displayserverhlp; duplicatehandle; entercriticalsection; enumwindowproc; enumwindows; errorexit; errormsg; establishsession; except; exit; exitprocess; exitthread; fflush; filterclientinp; filtercommand; findclose; findfirstfile; findnextfile; flushfilebuffers; forkchildprocess; formatmessage; formatmessagea; formatsecuritydescriptor; fputs; free; generateconsolectrlevent; getactivewindow; getchldoutput; getclientinput; getcolornum; getcomputername; getconsolescreenbufferinfo; getconsoletitle; getcurrentprocess; getcurrentprocessid; getdateformat; getenvironmentstrings; getenvironmentvariable; getexitcodeprocess; getfilesize; getformattedtime; getlasterror; getlengthsid; getlocaltime; getnamedpipehandlestate; getnextconnectinfo; getoverlappedresult; getpriorityclass; getprocaddress; gets; getsidlengthrequired; getstdhandle; getsystemtime; gettempfilename; gettemppath; gettimeformat; getversion; getversionex; getwindowtext; handleconnecterror; handleinpipeconnected; handleoutpipeconnected; handlesessionerror; handshakewithremoteclient; heapalloc; heapcreate; heapfree; heaprealloc; initad; initclientlist; initializeacl; initializeclientlists; initializecriticalsection; initializelisthead; initializequeryserver; initializesecuritydescriptor; insertheadlist; inserttaillist; int32x32to64; interactthread; interlockedexchange; isdebuggerpresent; iskdstring; islistempty; leavecriticalsection; listenforsession; loadlibrary; localalloc; localclient; localsession; lookupaccountname; malloc; max; maximum; memcmp; memcpy; memset; messagebox; min; minimum; moveclienttoclosinglist; moveclienttonormallist; movememory; mych; mycreatepipeex; newsession; oldforkchildprocess; outputdebugstring; overlappedserver; pfncancelio; pfncancelwaitabletimer; pfncreatewaitabletimer; pfnnetapibufferfree; pfnnetwkstagetinfo; pfnsetwaitabletimer; printf; queryhandlerthread; queryremotepipes; querywaitcompleted; readchildoutputcompleted; readclientinputcompleted; readclientnamecompleted; readclientstartupinfocompleted; readclientstartupinfosizecompleted; readfile; readfileex; readfilesynch; readfixbytes; readtempfilecompleted; realloc; realloctable; remoteinfo; remotesession; removeentrylist; removefirstclientfromclosinglist; removeheadlist; removeinpmark; removetaillist; resetevent; rtlzeromemory; runtimelinkapis; sendmyinfo; sendserverinp; sendstatus; server; setcolor; setconsolectrlhandler; setconsoletextattribute; setconsoletitle; setenvironmentvariable; setevent; setfilepointer; setlasterror; setsecuritydescriptordacl; setstdhandle; setupsecuritydescriptors; showpopup; shutad; sleep; sleepex; sprintf; srvctrlhand; startchildoutpiperead; startlocalsession; startreadclientinput; startreadtempfile; startservertoclientflow; startservingquerypipe; startsession; startwritesessionoutput; strcat; strchr; strcmp; strcpy; strstr; strtol; switch; systemtimetofiletime; terminateprocess; terminatethread; trace; transferfiletoclient; unreferenced_parameter; updatetimestamp; waitformultipleobjects; waitformultipleobjectsex; waitforsingleobject; waitforsingleobjectex; waitnamedpipe; writechildstdincompleted; writef; writefile; writefileex; writefilesynch; writemailslotcompleted; writeserverreplycompleted; writesessionoutputcompletedcommon; writesessionoutputcompletedreadnext; writesessionoutputcompletedwritenext; writetempfilecompleted; wsprintf; zeromemory


Switcher: CreateDesktop and SwitchDesktop Functions

Click to open or copy the files for the Switcher sample.

The Switcher tool allows you to manage multiple desktops. Invoking Switcher creates or opens a number of desktops and allows you to switch between them with the click of a button.

Building SDK Samples

This sample uses the following keywords:

closehandle; createthread; dispatchmessage; getcommandlinea; getcurrentthreadid; getdesktopwindow; getmessage; getprocesswindowstation; getthreaddesktop; getwindowlong; globalalloc; lstrlen; postquitmessage; psz; rgb; text; threadinit; translatemessage; winmain; wndproc


UConvert: Unicode Conversion Utility

Click to open or copy the files for the UConvert sample.

The UConvert tool converts text files between the 16-bit Unicode character encoding and other traditional character encodings. It may also be used to install conversion tables, which are used by the MultiByteToWideChar and WideCharToMultiByte functions.

Building SDK Samples

This sample uses the following keywords:

beginpaint; conversionoptionsproc; createfile; createwindow; createwindows; defwindowproc; destinationoptionsproc; dispatchmessage; emptyclipboard; enumclipboardformats; getacp; getlasterror; getmessage; getmodulehandle; getoemcp; getopenfilename; getsavefilename; gettablefilenames; globalalloc; globallock; globalunlock; installtableproc; loadcursor; loadicon; loadresourcestring; loadstring; lstrcpya; lstrcpyw; lstrlen; lstrlena; lstrlenw; mainwndproc; multibytetowidechar; postquitmessage; registerclass; senddlgitemmessage; sourceoptionsproc; text; translateaccelerator; translatemessage; unreferenced_parameter; viewdestinationproc; viewsourceproc; widechartomultibyte; winhelp; winmain


Walker: Views Process Virtual Memory

Click to open or copy the files for the Walker sample.

The Walker tool allows you to view information about the virtual memory of a process.

Building SDK Samples

This sample uses the following keywords:

abs; beginpaint; charnext; charprev; createfontindirect; defined; defwindowproc; destroywindow; drawfocusrect; drawlistitem; endpaint; exttextout; getcmdline; getdc; getdevicecaps; getdrivetype; getexceptioncode; getlogicaldrives; getstockobject; getsyscolor; getsysteminfo; getsystemmetrics; gettextmetrics; handlebreakpoint; isdbcsleadbyte; makelangid; min; movewindow; my_mbschr; my_mbstok; primarylangid; releasedc; selectobject; setbkcolor; setrect; settextcolor; text; textout; updatewindow; wsprintf


Zoomin: Manipulate Bitmaps and Device Contexts

Click to open or copy the files for the Zoomin sample.

The Zoomin tool can be used to visually expand bitmap images from the Windows desktop. As such, it demonstrates techniques for manipulating bitmaps and device contexts.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; adjustwindowrect; appwndproc; beginpaint; bitblt; bound; calczoomedsize; checkdlgbutton; clienttoscreen; closeclipboard; copytoclipboard; createcompatiblebitmap; createcompatibledc; createpalette; createphysicalpalette; createwindow; defwindowproc; deletedc; deleteobject; destroywindow; dialogbox; dispatchmessage; dothezoomin; drawzoomrect; emptyclipboard; enablerefresh; enddialog; endpaint; getclientrect; getdc; getdevicecaps; getdlgitemint; getkeystate; getmessage; getstockobject; getsystemmetrics; inflaterect; initinstance; isdlgbuttonchecked; killtimer; loadaccelerators; loadcursor; loadicon; localalloc; localfree; makeintresource; messagebeep; moveview; openclipboard; patblt; postquitmessage; realizepalette; refreshratedlgproc; registerclass; releasecapture; releasedc; selectobject; selectpalette; senddlgitemmessage; setbitmapdimensionex; setcapture; setclipboarddata; setcursor; setdlgitemint; setrect; setscrollpos; setscrollrange; setstretchbltmode; settimer; showwindow; stretchblt; translateaccelerator; translatemessage; winmain


System Management Samples

Click to open or copy the files for the SysMgmt samples.


Lsapi: Sample for Licensing API

Click to open or copy the files for the Lsapi sample.

This sample demonstrates the Licensing API. It consists of two parts: Challeng.c, and Simple.c.

Challeng.c

This example demonstrates how license updates are made and how the challenge mechanism is used at request and update times. You should analyze the application to determine the appropriate time to perform an update. For example, this application prints a message 20 times; the developer decided that the appropriate time to do an update was after every 5th message was printed.

Simple.c

This example uses the minimum amount of code required to use any licensing system. This example is provided in the SDK and you can use it to familiarize yourself with a licensing system or as a template for an application. Note that the code exits if a grant cannot be obtained. Recall that this is strictly an application's decision and is not dictated by any licensing system which adheres to the LSAPI standard.

In order to use these samples, copy Lsapi32.dll and Mslsp32.dll from mstools\bin to the %systemroot%\system32 directory on Windows NT® or to the %windir%\system directory on Windows® 95.

Building SDK Samples

This sample uses the following keywords:

checkchallenge; exit; ff; getchallenge; getlasterror; getsystemdirectory; gg; hh; lsfreehandle; lsgetmessage; lsinstall; lslicenseunitsset; lsrelease; lsrequest; lstrcat; lsupdate; md4final; md4init; md4update; memcpy; placeint; printerrors; printf; rand; rotate_left; sprintf; srand; strcpy; swap; time


MSI Samples: Microsoft Installer SDK

Click to open or copy the files for the MSI samples.

This release of Microsoft Installer SDK includes the following samples:

Sample | Description
ApiTstDb | Sample using database APIs to resequence table.
CustAct1 | Sample DLL custom action for testing.
CustExe1 | Sample EXE custom action for testing.
MsiMerg | Sample database merge tool.
Sequence | Sample VBA script to run install externally.
SampProd | These are sample product installations for Alpha and Intel processors. The sample product is an MSI viewer tool, MSIspy.


ApiTstDb: Sample Database API to Resequence a Table

Click to open or copy the files for the ApiTstDb sample.

This sample uses database APIs to resequence a table.

Building SDK Samples

This sample uses the following keywords:

_tmain; _tprintf; _ttoi; checkmsi; gettemppath; handle; message; msicloseallhandles; msidatabasecommit; msidatabaseexport; msidatabaseopenview; msiopendatabase; msirecordgetinteger; msirecordgetstring; msirecordsetinteger; msiviewexecute; msiviewfetch; msiviewmodify; smoothsequence; text


CustAct1: Sample for DLL Custom Action

Click to open or copy the files for the CustAct1 sample.

This sample demonstrates DLL custom action for testing.

Building SDK Samples

This sample uses the following keywords:

action1; message; messagebox; msigetproperty; text


CustExe1: Sample for EXE Custom Action

Click to open or copy the files for the CustExe1 sample.

This sample demonstrates EXE custom action for testing.

Building SDK Samples

This sample uses the following keywords:

_twinmain; createdialog; destroywindow; dialogproc; getmessage; isdialogmessage; makeintresource; message; postquitmessage; setdlgitemtext


InstMSI: Sample of Installer for MSI Components

Click to open or copy the files for the InstMSI sample.

This sample is an installer for shipping MSI components and Msi.hlp (along with Msi.cnt).

Building SDK Samples

This sample uses the following keywords:

fhandlehelp; findcomponent; finitmsi; getuserdefaultlcid; langidfromlcid; loadlibrary; loadstring; lstrcpy; messagebox; msiconfigurefeature; msigetproductcode; msiprovidequalifiedcomponent; msiqueryfeaturestate; msireinstallfeature; msiusefeature; primarylangid; switchmode; text; winhelp; wsprintf


MSIMerg: MSI Database Merge Tool Sample

Click to open or copy the files for the MSIMerg sample.

This sample is a database merge tool.

Building SDK Samples

This sample uses the following keywords:

_tcsclen; _tcscmp; _tmain; checkerror; databases\n\nmsimerg; display; errorexit; exitprocess; getcommandline; getfiletype; getstdhandle; lstrlen; merge; message; messagebox; msicloseallhandles; msidatabasecommit; msidatabasemerge; msimerg; msiopendatabase; text; widechartomultibyte; writefile; wsprintf


SampProd: Sample Product Installation and MSD Viewer Tool

Click to open or copy the files for the SampProd samples.

There are three folders:

This sample is a sample product installation. The sample product happens to be an MSI viewer tool, MSIspy. The sample includes several folders to demonstrate installing different versions.

Folder | Description of Product Version
I386 | Install folder for Intel processors, Ship version.
Debug | Install folder for Intel processors, Debug version.
Alpha | Install folder for Alpha processors, Ship version.

The sample installation includes ReadMe.txt, containing notes describing installation and usage.

About MSIspy, the sample product being installed

MSIspy is a tool that provides a component level view of the products and features installed on a system, using either an MSI Package, or the registry information. MSIspy also displays the status of each, and allows you to partially or completely reinstall missing or damaged items. You can also reconfigure any product or feature, selecting the install level and specifying whether to install it locally or run it from a CD or network server.


Alpha: Sample Product Installation for Alpha Processor

Click to open or copy the files for the Alpha sample.

This sample is a demonstration of a product installation for Alpha processors, with a Ship version of the product.


Debug: Sample Product Installation for Intel, Debug Version

Click to open or copy the files for the Debug sample.

This sample is a demonstration of a product installation for Intel processors, with a Debug version of the product.


i386: Sample Product Installation for Intel Processor

Click to open or copy the files for the i386 sample.

This sample is a demonstration of a product installation for Intel processors, with a Ship version of the product.


Sequence: Sample VBA Script to Run Installer Externally

Click to open or copy the files for the Sequence sample.

Sample VBA script to run install externally. Sample script for sequencing an installation from outside MSI - test code only, hardwired paths.


Setup: Installation and Setup API Samples

Click to open or copy the files for the Setup samples.


InfInst: Win32 Installation and Setup API Samples

Click to open or copy the files for the InfInst sample.

The InfInst sample demonstrates the basic use of the Win32 Setup APIs. The Win32 Setup APIs are a series of functions for installing files, modifying the registry, and modifying INI files. The primary way to use the Win32 Setup APIs is to combine the INF handling functions with one or more INF files that describe the actions to perform during your install or uninstall. One benefit of the Win32 Setup APIs is that it provides dialog boxes that are consistent, familiar to user from the NT and Windows 95 setup, and localized if the OS is localized. Moreover, the copy operations can handle things like version checking and replacing in use files. See the thorough documentation in the Win32 SDK help.

The primary APIs used in this sample are implemented in the Doinst.c file. The rest of the sample is a basic wizard that collects simple information from the user. The wizard is based on the win32\wizard sample and is not complete in its error handling and in helping the user determine things like available disk space.

Building SDK Samples

This sample uses the following keywords:

checkradiobutton; closehandle; createfile; createwindow; createwizard; custom_options; defwindowproc; dispatchmessage; doinstallation; enddialog; fillinpropertypage; free; getdlgitem; getlasterror; getmessage; getmodulefilename; getparent; getregstring; getstockobject; initapplication; initinstance; install; install_destination; install_type; installfinish; license; loadcursor; loadicon; lstrcpy; mainwndproc; makeintresource; makelong; messagebox; postmessage; postquitmessage; propertysheet; propsheet_setwizbuttons; readfile; regclosekey; regcreatekeyex; registerclass; registerstring; regopenkeyex; regqueryvalueex; regsetvalueex; runtimeregistration; senddlgitemmessage; sendmessage; setdlgitemtext; setfocus; setupclosefilequeue; setupcloseinffile; setupcommitfilequeue; setupdefaultqueuecallback; setupinitdefaultqueuecallbackex; setupinstallfilesfrominfsection; setupinstallfrominfsection; setupopenfilequeue; setupsetdirectoryid; setuptermdefaultqueuecallback; setwindowlong; showwindow; specify_location; strcat; strcpy; strrchr; switch; text; translatemessage; unreferenced_parameter; updatewindow; welcome; winexec; winmain; wsprintf; yourinfo


Win9xMig Samples

Click to open or copy the files for the Win9xMig samples.

This is a prerelease of the migration sample code and documentation for Windows NT.


PView: Windows NT Setup Services DLL Sample

Click to open or copy the files for the PView sample.

Windows NT Setup services DLL.

See Also PViewer sample

Building SDK Samples

This sample uses the following keywords:

_mbschr; _mbscpy; _mbsicmp; _mbsinc; _mbslen; _mbsnicmp; assert; checkforinstalledcomponents; copyfilea; getlasterror; getprocessheap; getpviewdirectory9x; getpviewdirectorynt; heapalloc; heapfree; info; localalloc; localfree; lstrcat; lstrlen; messageboxa; miginf_addhandleddirectory; miginf_addhandledfile; miginf_addhandledregistry; miginf_addmessage; miginf_addmessagedirectory; miginf_addmessagefile; miginf_addmessageregistry; miginf_addmoveddirectory; miginf_addmovedfile; miginf_addobject; miginf_cleanup; miginf_firstinsection; miginf_getfirstexcludedpath; miginf_getfirstmigrationpath; miginf_initialize; miginf_nextinsection; miginf_pathisexcluded; miginf_usespace; miginf_writeinftodisk; pathisinpath; pbuildlistfromsection; pcreatemigobject; pescapestring; pfindsection; pgetmbssize; pgettypeasstring; pgetvaluestring; poolmemaddmemory; poolmemcreatedword; poolmemcreatestring; poolmemcreatestringa; poolmemdestroypool; poolmemduplicatestringa; poolmemgetalignedmemory; poolmemgetmemory; poolmeminitpool; ppathisinpath; pwriteinfsectiontodisk; regclosekey; regopenkeyex; regqueryvalueex; setlasterror; setupcloseinffile; setupfindfirstline; setupfindnextline; setupgetlinetexta; setupopeninffilea; sprintf; wcscpy; wcslen; writeprivateprofilestring; zeromemory


ScrnSave: Example of Migrating to Windows NT

Click to open or copy the files for the ScrnSave sample.

This sample demonstrates implementing the seven required functions for a Windows NT 5.0 migration DLL. The DLL demonstrates how the interface works by performing the Windows 9x screen saver upgrade.

This sample demonstrates the following.

  • How to detect installation of your application.

  • A typical implementation of QueryVersion, Initialize9x, MigrateUser9x, MigrateSystem9x, InitializeNT, MigrateUserNT and MigrateSystemNT.

  • How to provide language-dependent incompatibility messages to the user.

  • How to remove Setup's incompatibility messages via [Handled] section.

  • Saving settings to a temporary file in the working directory.

  • Mixed use of ANSI and UNICODE.

  • Use of the SetupLogError API.

  • Deleting files.

  • Handling the move from system to system32.

Building SDK Samples

This sample uses the following keywords:

_mbsbytes; _mbschr; _mbscpy; _mbsicmp; _mbsinc; _mbslen; _mbsnicmp; assert; countstringbytes; defmac; generatefilepaths; getlasterror; getprocessheap; getscrnsaveexe; heapalloc; heapfree; miginf_addhandleddirectory; miginf_addhandledfile; miginf_addhandledregistry; miginf_addmessage; miginf_addmessagedirectory; miginf_addmessagefile; miginf_addmessageregistry; miginf_addmoveddirectory; miginf_addmovedfile; miginf_addobject; miginf_cleanup; miginf_firstinsection; miginf_getfirstexcludedpath; miginf_getfirstmigrationpath; miginf_initialize; miginf_nextinsection; miginf_writeinftodisk; pbuildlistfromsection; pcreatemigobject; pescapestring; pfindsection; pgetmbssize; pgettypeasstring; pgetvaluestring; poolmemaddmemory; poolmemcreatedword; poolmemcreatestring; poolmemcreatestringa; poolmemdestroypool; poolmemduplicatestringa; poolmemgetalignedmemory; poolmemgetmemory; poolmeminitpool; ppathisinpath; pwriteinfsectiontodisk; setupcloseinffile; setupcloselog; setupfindfirstline; setupfindnextline; setupgetlinetexta; setupopeninffilea; sprintf; text; warning; wcscpy; wcslen; writeprivateprofilestring; zeromemory


SMS Samples

Click to open or copy the files for the SMS samples.

For more information, see Introduction to Microsoft Systems Management Server in the BackOffice Programmer's Reference.


DemoDb: SMS Demonstration Database

Click to open or copy the files for the DemoDb sample.

The files Smsdmp.dat and Sms.sql are used to create a sample database in Systems Management Server (SMS). These files are compatible with SMS 1.2.

Documentation on the import and use of this database is contained in the SMS part of the BackOffice documentation.

See also Systems Management Server in the BackOffice Programmer's Reference.


NetMon Samples

Click to open or copy the files for the NetMon samples.


Browser: Bloodhound Parser DLL Sample for MS Browser

Click to open or copy the files for the Browser sample.

This sample is a parser DLL for MS Browser.

Main Files

File | Description
Browser.c | Bloodhound parser DLL for MS Browser.
Main.c | Bloodhound parser DLL Browser.
Hostannc.h | Defines the data structures related to host announcements.

Building SDK Samples

This sample uses the following keywords:

addproperty; attachpropertyinstance; browse_annc_comment; browse_annc_name; browserattachproperties; browserderegister; browserformatcommand; browserformatproperties; browserformatsummary; browserrecognizeframe; browserregister; createpropertydatabase; createprotocol; debugbreak; destroypropertydatabase; destroyprotocol; dllentry; election_make_rev; field_offset; formatbrowsersummary; formatperiodicity; formatuptime; host_annc_comment; host_annc_name; oemtochar; pack; switch; wsprintf


RemApi: Bloodhound Parser DLL Sample for SMB Remote APIs

Click to open or copy the files for the RemApi sample.

Main Files

File | Description
RemAPI.c | Bloodhound Parser DLL for SMB Remote APIs.
RemAPI.h | Bloodhound parser SMB Remote APIs.

Building SDK Samples

This sample uses the following keywords:

addproperty; attachpropertyinstance; createpropertydatabase; createprotocol; destroypropertydatabase; destroyprotocol; dllentry; getframecapturehandle; pack; remapiattachproperties; remapideregister; remapiformatproperties; remapiformatsummary; remapirecognizeframe; remapiregister; wsprintf


SmsApi: Samples for the SMS C API

Click to open or copy the files for the SmsApi samples.

This directory contains sample programs for the SMS C API.

The makefiles for each sample program includes "..\paths.mk", thus you need to make sure that this file is present in the parent directory when you build each sample program. Before building the samples, edit "paths.mk" and change the paths specified there to match your system's configuration. Also note that the DEST directory, specified in "paths.mk", must exist before you can build the sample applications.

About SMS

In an SMS system, a primary site's site database stores the inventory and configuration information for itself and the sites below it in the site hierarchy. Using the SMS API, your application can access the information in a site database.

For more information, see SMS API Overview in the Microsoft SMS API.


Attribut: Attribute Filter Sample for Displaying Folder Properties

Click to open or copy the files for the Attribut sample.

Click to open or copy the Common files (required).

This sample is a console-mode application that displays folder properties by using the Attribute filter. This filter is applied to a site container in order to enumerate specified properties of a machine of architecture type Personal Computer. This technique is used because it is faster than setting group filters and then retrieving specified machine group scalars.

For more information, see Attribut.exe in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

check; chkstat; connecttodatasource; didrequesthelp; displayfolder; displaygreeting; displayhelp; displayscalars; displaysmserror; format; gets; getsize; getstatusname; inputstring; memset; printf; removeall; setat; setfilters; setsize; smsaddtoken; smsapiver; smsclosecontainer; smsclosefilter; smsclosefolder; smscreatefilter; smsdatasourceconnect; smsdatasourcedisconnect; smsgetfoldercount; smsgetfolderid; smsgetfoldertype; smsgetnextfolder; smsgetnextscalar; smsgetscalarcount; smsopencontainer; smspopulate; smssetfilter; strcmp; strcpy


Browser: SMS Objects Browser Sample

Click to open or copy the files for the Browser sample.

This is a graphical mode application that implements a browser for SMS objects. The program allows you to configure and apply filters to the containers that you open. You can view the containers, folders, subfolders, and scalars with this program.

For more information, see Browser.exe in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

cframe; cframestack; chkit; configfilterdlg; containerviewdlg; createfolderframe; ctl3dautosubclass; ctl3dcolorchange; ctl3dregister; ctl3dunregister; dialogbox; displayfolderframe; dump; enablewindow; enddialog; expressionviewdlg; fclose; folderviewdlg; fopen; format; fprintf; framestack; ftell; getat; getdlgitem; getdlgitemtext; getsize; getupperbound; localtime; log; logindlg; maindlg; makeintresource; makewparam; memset; messagebox; pop; postmessage; push; remove; removeall; removeat; scalarviewdlg; sendmessage; setatgrow; setdlgitemint; setdlgitemtext; setfocus; setwindowtext; showwindow; smsaddtoken; smsclosecontainer; smsclosefilter; smsclosefolder; smscreatefilter; smsdatasourceconnect; smsdatasourcedisconnect; smsenumcontainers; smsenumfilters; smsenumfoldertypes; smsgetallfilters; smsgetfiltertype; smsgetfoldercount; smsgetfolderid; smsgetfoldertype; smsgetnextfolder; smsgetnextscalar; smsgetscalarcount; smsgettoken; smsgettokencount; smsopencontainer; smspopulate; smsrewind; smssetfilter; strcat; strcpy; time; va_end; va_start; viewselfiltersdlg; vsprintf; winmain; wsprintf


Common File for SMS Samples

Click to open or copy the files for the Common sample.

This directory contains Status.inc only.


DelJob: Sample for Deleting Jobs from SMS Database

Click to open or copy the files for the DelJob sample.

Click to open or copy the Common files (required).

Deljob.exe is a console mode application that can be used for deleting jobs from the SMS database. This code demonstrates data-source connection, folder deletion, scalar manipulation, and helper functions.

For more information, see Deljob.exe in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

connecttodatasource; didrequesthelp; displaygreeting; displayhelp; displaysmserror; gets; getstatusname; inputstring; malloc; printf; smsclosecontainer; smsclosefolder; smscommitfolder; smsdatasourceconnect; smsdatasourcedisconnect; smsgetfoldercount; smsgetfolderid; smsgetnextfolder; smsopencontainer; smspopulate; smsunlinkfolder; sprintf; strcmp; usersaysyes


EnumObj: Sample for Enumerating Objects in SMS Site Server Database

Click to open or copy the files for the EnumObj sample.

Click to open or copy the Common files (required).

Enumobj.exe is a console application that enumerates the high-level objects within an SMS site server database. This sample demonstrates the use of the enumeration functions SmsEnumObjects and SmsEnumObjectTypes.

For more information, see Enumobj.exe in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

connecttodatasource; displaysmserror; enumobj; gets; inputstring; printf; smsapiver; smsdatasourceconnect; smsdatasourcedisconnect; smsenumobjects; smsenumobjecttypes; strcat; strcpy


MGrp: Sample for Creating Machine Group in SMS Site Server Database

Click to open or copy the files for the MGrp sample.

Click to open or copy the Common files (required).

MGrp.exe is a console application that creates a machine group in the SMS Site Server database and populates it with the machines from the local site server. This sample demonstrates the code required to create and populate a machine group.

For more information, see Mgrp.exe in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

chkstat; chkstat_rtn; connecttodatasource; ctime; displayfolder; displayscalars; displaysmserror; dothework; free; gets; getstatusname; inputstring; malloc; memset; printf; setmachfilters; setscalarstring; smsaddtoken; smsapiver; smsclosecontainer; smsclosefilter; smsclosefolder; smscommitfolder; smscreatefilter; smscreatefolder; smsdatasourceconnect; smsdatasourcedisconnect; smsdupfolder; smsgetfoldercount; smsgetfolderid; smsgetfoldertype; smsgetnextfolder; smsgetnextscalar; smsgetscalarcount; smslinkfolder; smsopencontainer; smspopulate; smssetfilter; smssetscalar; sprintf; strcpy


NewJob: Sample for Creating and Viewing Jobs in SMS Database

Click to open or copy the files for the NewJob sample.

Click to open or copy the Common files (required).

This is a console mode application that illustrates how to view, create, and delete jobs. There are four types of jobs in SMS: Run Command On Workstation jobs, Share Package On Server jobs, Remove Package From Server jobs, and System jobs. Of these, all except System jobs can be created and deleted from the SMS API. All job types can be viewed.

For more information, see Newjob.exe in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

atol; connecttodatasource; createnewfolder; ctime; didrequesthelp; displaygreeting; displayhelp; displayscalars; displaysmserror; free; gets; getstatusname; inputstring; malloc; memcpy; mktime; printf; readtime; smsclosecontainer; smscommitfolder; smscreatefolder; smsdatasourceconnect; smsdatasourcedisconnect; smsdescribefolder; smsgetfoldercount; smsgetfolderid; smsgetfoldertype; smsgetnextfolder; smsgetnextscalar; smsgetscalarcount; smslinkfolder; smsopencontainer; smspopulate; smsrewind; smssetscalar; smsunlinkfolder; strcmp; strcpy; time; viewfolder


NewPkg: Sample for Creating and Viewing Packages in SMS Database

Click to open or copy the files for the NewPkg sample.

Click to open or copy the Common files (required).

NewPkg.exe is a console mode application that can be used for viewing, creating, or removing packages from the SMS database. This code demonstrates datasource connection, folder creation, scalar manipulation, folder display, and helper functions.

For more information, see Newpkg.exe in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

connecttodatasource; createpackagefolder; createprogitem; createwcl; ctime; didrequesthelp; displaygreeting; displayhelp; displayscalars; displaysmserror; free; getplatformselection; gets; getstatusname; inputstring; malloc; mktime; number; printf; readtime; setscalardword; setscalarstring; smsclosecontainer; smsclosefolder; smscommitfolder; smscreatefolder; smsdatasourceconnect; smsdatasourcedisconnect; smsgetfoldercount; smsgetfolderid; smsgetfoldertype; smsgetnextfolder; smsgetnextscalar; smsgetscalarcount; smslinkfolder; smsopencontainer; smspopulate; smsrewind; smssetscalar; smsunlinkfolder; sprintf; strcmp; strcpy; switch; time; usersaysyes; viewfolder


PDF: Sample for Processing PDF File, Creating Package in Site Server DB

Click to open or copy the files for the PDF sample.

Click to open or copy the Common files (required).

Pdf.exe is a console application that processes a PDF file and creates a package in the SMS Site Server database. The main purpose of this program is to provide a working sample to developers who may want to process PDFs and load them into SMS from their own applications. This code demonstrates datasource connection, folder creation, scalar and token manipulation, folder display, SMS API version identification, and helper functions.

For more information, see Pdf.exe in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

_stricmp; _strnicmp; connecttodatasource; cplatform; cstring; ctime; didrequesthelp; displaygreeting; displayhelp; displayscalars; displaysmserror; fclose; fileexists; fillfiletokens; find; fopen; fread; fseek; ftell; getcurrentdirectory; getplatforms; getprivateprofilestring; gets; getsize; getstatus; getstatusname; import; initplatforms; inputstring; left; memset; parseinventoryrules; parsepackagedef; parseprogramitemproperties; parsesetupforsharing; parsesetupvariations; printf; reversefind; setscalarint; setscalarstring; smsaddtoken; smsapiver; smsclosecontainer; smsclosefolder; smscommitfolder; smscreatefolder; smsdatasourceconnect; smsdatasourcedisconnect; smsgetfoldercount; smsgetfolderid; smsgetfoldertype; smsgetnextfolder; smsgetnextscalar; smsgetscalarcount; smsgettoken; smsgettokencount; smslinkfolder; smsmanipulatetokens; smsopencontainer; smsrewind; smssetscalar; sprintf; squote; sscanf; strcat; strcmp; strcpy; strstr; strtok; viewfolder


ResDll: Sample for Overriding and Extending Graphics in SMS Administrator

Click to open or copy the files for the ResDll sample.

The code in this directory demonstrates how to override and extend graphics in the SMS Administrator. In this example DLL, the default SMS icons for Packages, Macintosh workstations, PC Servers, User Groups, Macintosh Operating System, Mouse, and any non-Macintosh or non-PC systems are replaced by the "eye" icon.

For more information, see Resdll.dll in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

dllmain; dllmain


SrvInst: Sample for Creating Server Install Jobs

Click to open or copy the files for the SrvInst sample.

Click to open or copy the Common files (required).

SrvInst.exe is a console mode application that can be used for creating server install jobs or Run Command on Workstation jobs and monitoring the status of these jobs. This code demonstrates datasource connection, folder creation, scalar manipulation, and helper functions.

For more information, see Srvinst.exe in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

clientdoruncommand; clientjobcreate; clientpkgcreate; clientwritejob; clientwritepkg; clientwritewcl; connecttodatasource; didrequesthelp; displaygreeting; displayhelp; displaysmserror; findfolder; getjobtype; getplatformselection; gets; getscalardword; getscalarstring; getsitename; getstatusname; inputstring; jobstatustostring; number; printf; servercreatepkg; serverdoshare; serversubmitsharejob; serverwaitjobcomplete; serverwritejob; serverwritepkg; serverwriteprogitem; setscalarbool; setscalardword; setscalarstring; setscalartime; sleep; smsclosecontainer; smsclosefolder; smscommitfolder; smscreatefolder; smsdatasourceconnect; smsdatasourcedisconnect; smsgetnextfolder; smsgetscalarbyname; smslinkfolder; smsopencontainer; smspopulate; smssetscalar; sprintf; sscanf; strcmp; strcpy; switch; time


TestAll: Sample for Viewing Site Hierarchy, Package or Job Container

Click to open or copy the files for the TestAll sample.

Click to open or copy the Common files (required).

This program illustrates the use of the SMS functions to examine a site hierarchy, package container, or job container. For each type of container, the user is prompted for which of the standard sets of filters to apply. The container is then populated, and enumerated to the console.

For more information, see Testall.exe in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

chkstat; chkstat_rtn; connecttodatasource; ctime; didrequesthelp; displayexpression; displayfolder; displaygreeting; displayhelp; displayscalars; displaysmserror; dothework; free; getdumpoption; gets; getsize; getstatusname; inputstring; malloc; memset; printf; setjobfilters; setpkgfilters; setsitefilters; smsaddtoken; smsapiver; smsclosecontainer; smsclosefilter; smsclosefolder; smscreatefilter; smsdatasourceconnect; smsdatasourcedisconnect; smsgetfoldercount; smsgetfolderid; smsgetfoldertype; smsgetnextfolder; smsgetnextscalar; smsgetscalarcount; smsgettoken; smsgettokencount; smsopencontainer; smspopulate; smssetfilter; strcmp; strcpy


Tree: Sample for Building and Viewing Container Hierarchy

Click to open or copy the files for the Tree sample.

Tree.exe is a console mode application that builds and displays a tree of the container hierarchy. For each container, the container's type and tag are displayed, followed by a list of filters (possibly empty) which may be acted upon directly at that level of the hierarchy. Following the filter list is a folder list. The folder list gives the folder's type and tag, its filter list, and then a list of scalars for the folders. The scalar display shows the scalar name, type, and access mode. For filters, a list of the filter's attributes are displayed.

For more information, see Tree.exe in the Microsoft SMS API.

Building SDK Samples

This sample uses the following keywords:

addcontainer; didrequesthelp; displaygreeting; displayhelp; docontainer; dofilter; dofolder; doscalars; dumpscalar; enumerated; filter; findfilter; gets; getsize; inputstring; isenumerated; memset; printf; smsapiver; smsenumcontainers; smsenumfilters; smsenumfolders; sprintf; strcat; strcmp


SMSView Samples

Click to open or copy the files for the SmsView sample.

These samples demonstrate SMS Create Views. With the SMSView program, you can create database views on a site database. Using the Microsoft Desktop ODBC Database Driver, you can use these views in other applications (such as Microsoft Word for Windows) to view the computer inventory and generate reports.

SMSView is provided with the Microsoft Systems Management Server product.

The SMS SDK provides samples for viewing, extracting, and using the computer inventory and other information in the site database. Samples are provided for the following applications:

  • Microsoft Word for Windows version 6.0

  • Microsoft Excel version 5.0

  • Microsoft Access version 2.0

For more information, see SMSVIEW Samples in Setup and Systems Management Services.


NT

Click to open or copy the files for the NT sample.

It is recommended that you download from the parent node instead (SMSView Samples), because there are several files there, including imported files.

This sample creates Views based on the current Group Map in SMS.

Building SDK Samples

This sample uses the following keywords:

checkcommandline; checksqlreturn; creategroupview; createsnmpvarbindsview; createv; ctl3dautosubclass; ctl3dregister; ctl3dunregister; dbconnect; dberrhandle; dbexit; dbinit; dblogin; dbmsghandle; dialogboxparam; enddialog; err_handler; errormsg; genresults; genviews; getconnectioninfo; getlasterror; getstockobject; loadcursor; loadicon; loadstring; localalloc; localfree; lstrcpy; makeintresource; makeuname; messagebox; registerclass; registereventsource; reportevent; senddlgitemmessage; setcursor; setupdbconnection; sqltestinit; strchr; strncpy; strstr; switch; text; toupper; winmain


VBSmsApi: Samples for Using SMS API with Visual Basic

Click to open or copy the files for the VBSmsApi samples.

This directory provides code that allows the SMSAPI to be used with Visual Basic 4.0. It also provides sample Visual Basic code which interfaces with SMS.

For more information about these samples or the Visual Basic SMSAPI set, see the SDK documentation: Using the SMS API with Visual Basic in Setup and Systems Management Services.


Common Files for SmsApi Samples

Click to open or copy the files for the Common sample.

This directory contains BAS files.


Samples

Click to open or copy the files for the Samples sample.

This directory contains the subdirectories Browser, Common, and Report. These subdirectories contain BAS, FRM, and VBP files.


TaskSched: Task Scheduler Sample

Click to open or copy the files for the TaskSched sample.

This sample demonstrates the scheduling agent API provided with installation of the Scheduling Agent package. The sample mimics the functionality of the AT command through the Scheduling Agent APIs, as opposed to the NetSchedule API used by AT. This sample implements only a small subset of the AT command set, but should be easily extensible.

The output of the sample program is one of four possibilities:

  • The program can present a help file. This case occurs from command line arguments requesting help, or from input parameter lists that are longer than the expected range. Output is to stdout.

  • The program can enumerate all task objects in the tasks folder. Output is provided to stdout, and consists of a line containing "Job: filename.job" followed by indented lines containing strings of the type "Trigger: text representation of trigger values". Empty task folders cause no output.

  • The program can delete jobs from the job folder. This action will fail in a secure environment (Windows NT on an NTFS partition) if the caller does not have permissions to remove the file. Deletion of tasks is not limited to those that were created from this program. If the deletion succeeds, no output is displayed.

  • The program can add a task from the command line. If the scheduling agent is to recognize the task, the filename (Jobname.job) given MUST have the extension ".job" on it. Otherwise, it will fail to be enumerated from this tool, the task scheduler, or anywhere else. In addition, that task will fail to run if ".job" is not the file extension. If the addition succeeds, no output is displayed. The task type that is created has a single trigger of type "ONCE" and is limited to running within the next 24 hours. Also, like AT, these jobs will be deleted upon completion of their run. For creation of other types of triggers, please consult the documentation for the TASK_TRIGGER structure.

SA.cpp contains all code needed to build the simple job submission tool. This sample demonstrates calls to methods of the following new interfaces:

  1. ITaskScheduler

  2. ITask

  3. ITaskTrigger

  4. IEnumWorkItems

This application is similar in functionality to the "AT" command provided with Windows NT. However, the AT command functions through the NetSchedule APIs, as opposed to the COM interfaces demonstrated here. The Task Scheduler replaces Atsvc.exe and implements those APIs as a restricted subset of the new ones demonstrated here.

On Win9x systems, the Task Scheduler replaces the System Agent, providing more flexible and reliable scheduling options than previously available. However, although the SAGE jobs are converted to Task Scheduler work items, the actual SAGE API has been abandoned and is not implemented. The Task Scheduler APIs provide a greater degree of freedom and robustness than those APIs. This code demonstrates a stripped version of AT rewritten to use the new APIs.

About Task Scheduler

Task Scheduler is a scheduling service and user interface that is available as a common resource with the Microsoft Windows® 98 operating system. Windows 98 includes Task Scheduler as a Component Object Model (COM) interface. Task Scheduler manages all aspects of job scheduling: starting jobs, enumerating currently running jobs, tracking job status, and so on. In Task Scheduler, the user works with a folder under My Computer called Scheduled Tasks, which lists currently scheduled items and enables creation of new tasks. The Task Scheduler replaces the Microsoft Windows® 95 System Agent.

For more information, see Component Object Model.

Building SDK Samples

This sample uses the following keywords:

_getmbcp; activate; addjob; cleanup; cocreateinstance; coinitialize; converttosystemtime; cotaskmemfree; couninitialize; createtrigger; delete; deletejob; displayhelp; enum; enumeratejobs; failed; getlocaltime; gettriggercount; gettriggerstring; lstrcmpia; multibytetowidechar; newworkitem; next; queryinterface; release; save; setaccountinformation; setapplicationname; setcomment; setflags; setparameters; settrigger; switch; wcslen; wcstoul; wprintf; wscanf


Windows Base Services Samples

Window Base Services Samples

Click to open or copy the Windows-Base Services project files.

The Windows base services (WinBase) samples demonstrate how to use Windows base services.


Cluster

Cluster Samples: Microsoft Cluster Server SDK

Click to open or copy the Cluster project files.


SMBsmp Sample

SMBsmp Samples

Click to open or copy the SMBsmp project files.


SMBsmp Sample

SMBsmp Sample: SMB Cluster Resource DLL

Click to open or copy the Smbsmp project files.

This DLL demonstrates the basics of using the Cluster API and is also a starting point for writing your DLL.

AppWizard has created this SMB Sample resource DLL for you. This sample resource DLL demonstrates the basics of using the Cluster API and is also a starting point for writing your DLL.

The following files make up the SMB Sample resource DLL:

File | Description
SmbSmp.c | The main DLL source file. It contains implementations for all required resource DLL entry points along with some helper functions.
SmbSmp.rc | A listing of all of the Microsoft Windows resources that the program uses. This file can be directly edited in Microsoft Developer Studio.
SmbSmp.def | Contains information about the DLL that must be provided to run with the cluster software. It defines parameters such as the name and description of the DLL. It also exports functions from the DLL.

Building SDK Samples

This sample uses the following keywords:

clres_v1_function_table; clusterregclosekey; clusterregcreatekey; clusworkercreate; clusworkerterminate; comment; dbg_print; disablethreadlibrarycalls; dllmain; field_offset; getlasterror; localalloc; localfree; lstrcmpiw; lstrcpyw; lstrlenw; netshareadd; netsharedel; netsharegetinfo; resutildupparameterblock; resutilenumproperties; resutilfreeparameterblock; resutilgetallproperties; resutilgetpropertiestoparameterblock; resutilsetpropertyparameterblock; resutilstartresourceservice; resutilverifypropertytable; setlasterror; smbsmpcheckisalive; smbsmpclose; smbsmpdoterminate; smbsmpgetprivateresproperties; smbsmpisalive; smbsmplooksalive; smbsmpoffline; smbsmponline; smbsmponlinethread; smbsmpopen; smbsmpresourcecontrol; smbsmpresourcetypecontrol; smbsmpsetprivateresproperties; smbsmpterminate; smbsmpvalidateprivateresproperties; startup; switch; text; warning; zeromemory


Smbsmpex Sample

SMBsmpEx Sample: Cluster Administrator Extension

Click to open or copy the SMBsmpEx project files.

This Cluster Administrator Extension DLL is created for you by AppWizard, and demonstrates the basics of modifying the interface of Cluster Administrator and is also a starting point for writing your DLL.

Building SDK Samples

This sample uses the following keywords:

_t; addprop; addpropertysheetpage; addtail; addwizardpage; afx_manage_state; afxdllcanunloadnow; afxformatstring2; afxgetstaticmodulestate; afxmessagebox; align_clusprop; allocproplist; assert; attach; ballrequiredfieldspresent; bapplychanges; bbackpressed; bcreateparamskey; begin_com_map; begin_message_map; begin_object_map; binit; bsetprivateprops; buildproplist; bwizard; cbasepropertypage; cbproplist; cclusproplist; cextobject; cleanuplabel; clustergroupcontrol; clusternetinterfacecontrol; clusternetworkcontrol; clusternodecontrol; clusterregclosekey; clusterregopenkey; clusterregqueryvalue; clusterregsetvalue; clusterresourcecontrol; clusterresourcetypecontrol; cobj; com_interface_entry; comment; commonconstruct; comparenocase; construct; copymemory; copyprop; cot; cotaskmemfree; cpl; cpropertypage; cprops; createobject; createpropertysheetpage; createpropertysheetpages; createpropetysheetpages; createwizardpages; csmbsmpparamspage; ddv_requiredtext; ddx_control; ddx_number; ddx_text; declare_dynamic; declare_dyncreate; declare_message_map; declare_registry; delete; destroypropertysheetpage; detach; dllcanunloadnow; dllgetclassobject; dllregistercluadminextension; dllregisterserver; dllunregistercluadminextension; dllunregisterserver; dodataexchange; dwgetgroupproperties; dwgetnetinterfaceproperties; dwgetnetworkproperties; dwgetnodeproperties; dwgetprivateprops; dwgetresourceproperties; dwgetresourcetypeproperties; dwparseproperties; dwparseunknownproperty; dwsetprivateprops; empty; enablenext; end_com_map; end_message_map; end_object_map; exc; exitinstance; fail; format; formaterror; formatmessage; getclassobject; getclusterhandle; getclusterkey; getclusterresourcetypekey; getdlgitemint; getdlgitemtext; getfont; getheadposition; geticon; getlasterror; getlength; getlocale; getlockcount; getmodulehandle; getnext; getobjectcount; getobjectname; getobjecttype; getresourcehandle; getresourcetypename; getuserdefaultlangid; getwindowtext; getwindowtextlength; hcluster; hfont; hicon; hpage; hrgetobjectinfo; hrgetobjectname; hrgetresourcetypename; hrgetuiinfo; hrsavedata; iddpropertypage; iddwizardpage; idscaption; implement_dynamic; implement_dyncreate; initinstance; inlineisequalguid; interfacesupportserrorinfo; iskindof; istrrestypename; lcid; localalloc; localfree; lpg; lstrcmp; lstrcmpiw; lstrcpyw; lstrlenw; makelangid; max; memcmp; object_entry; on_en_change; on_wm_create; on_wm_destroy; onapply; onchangectrl; onchangerequiredfield; oncreate; ondestroy; oninitdialog; onsetactive; onwizardback; onwizardfinish; onwizardnext; pbproplist; peo; pgdgroupdata; pidata; piwizardcallback; pndnetinterfacedata; pndnetworkdata; pndnodedata; podobjdata; podobjdatarw; pprops; prdresdata; prdresdatarw; prepareeditctrl; primarylangid; proplist; queryinterface; readvalue; registeranycluadminextension; registercluadminallgroupsextension; registercluadminallnetinterfacesextension; registercluadminallnetworksextension; registercluadminallnodesextension; registercluadminallresourcesextension; registercluadminallresourcetypesextension; registercluadminclusterextension; registercluadminresourcetypeextension; registerserver; release; removeall; reporterror; runtime_class; sendmessage; set; sethpage; seticon; setmodified; stdmethod; stringfromclsid; term; trace; unregisteranycluadminextension; unregistercluadminallgroupsextension; unregistercluadminallnetinterfacesextension; unregistercluadminallnetworksextension; unregistercluadminallnodesextension; unregistercluadminallresourcesextension; unregistercluadminallresourcetypesextension; unregistercluadminclusterextension; unregistercluadminresourcetypeextension; unregisterserver; updatedata; warning; wprintf; wsprintf; zeromemory


Template Sample

Template for Cluster Servers

Click to open or copy the Template files.

This sample directory contains .awx and .hlp files.


Debug Sample

Click to open or copy the Debug project files.


DEB Sample

DEB Sample: Debug Event Browser

Click to open or copy the DEB project files.

The DEB sample demonstrates the Win32 debug functions. This sample is a simple debugger that can debug both a process that it starts or a currently running process.

DEB is not a debugger in the traditional sense; it is a browser, as its name implies. DEB displays the debug events, and their relevant properties, as they occur and invokes the default handlers supplied either by the debuggee or the system. Only minimal debug event handling is imposed, so that the debug events are displayed and the debuggee continues on its normal course of execution.

The sample is source-code compatible for the Intel 80x86, the MIPS R4x00, and the DEC Alpha AXP Windows NT platforms.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; allocdllnode; allocprocessnode; allocthreadnode; attachdlgproc; attachtodebuggee; beginpaint; callwindowproc; charnext; check_pointer; checkmenuitem; choosecolor; choosefont; choosefonthookproc; choosenewbackcolor; choosenewfont; closeclipboard; closehandle; continuedebugevent; copylistboxtoclipboard; createbrushindirect; createdlllist; createfontindirect; createiconwindow; createlist; createnode; createpen; createprocess; createprocesslist; createtextbuttonbar; createthread; createthreadlist; createwindow; debugactiveprocess; debugeventthread; debugnewprocess; defined; defwindowproc; deletecurrentdllnode; deletecurrentnode; deletecurrentprocessnode; deletecurrentthreadnode; deletedllnode; deleteobject; deleteprocessnode; deletethreadnode; destroydlllist; destroydllnode; destroylist; destroynode; destroyprocesslist; destroyprocessnode; destroythreadlist; destroythreadnode; destroywindow; dialogbox; dispatchmessage; dllmain; dllorderfunction; emptyclipboard; enddialog; endpaint; enumprocesslistfunc; enumwindows; errormessagebox; exitprocess; exitthread; formatmessage; free; freedllnodeinfo; freeprocessnodeinfo; freethreadnodeinfo; getclientrect; getcurrentnode; getcurrentprocessid; getdc; getdebuggeefilename; getdesktopwindow; getdlgitem; getdllfilename; getdllfilenamefromlist; getfiletype; getfirstnode; getfocus; getlasterror; getlastnode; getlisterror; getmenu; getmessage; getmodulefilename; getmodulefilenamefromheader; getmodulehandle; getnextnode; getopenfilename; getoutputdebugstring; getpathfromfullpathname; getprevnode; getprivateprofileint; getprivateprofilesettings; getprivateprofilestring; getstockobject; getsyscolor; getsysteminfo; gettextextentpoint; gettextmetrics; getthreadcontext; getwindowlong; getwindowrect; getwindowtext; getwindowthreadprocessid; globalalloc; globalfree; globallock; globalunlock; handlebreakpointexception; handlecreateprocessevent; handlecreatethreadevent; handleexceptionevent; handleexitprocessevent; handleexitthreadevent; handleloaddllevent; handleoutputdebugstringevent; handleripevent; handleunknownevent; handleunloaddllevent; heapalloc; heapcreate; heapdestroy; heapfree; initdllnodeinfo; initprocessnodeinfo; initthreadnodeinfo; insertdllnode; insertnode; insertprocessnode; insertthreadnode; invalidaterect; isdbcsleadbyte; killtimer; lineto; listboxinsert; listboxprintf; loadaccelerators; loadcursor; loadicon; loadstring; localalloc; localfree; locallock; lstrcat; lstrcpy; lstrlen; mainwndproc; makecommondebugeventstring; makelong; malloc; max; maxdebuggeesmessagebox; messagebox; movetoex; movewindow; newlistboxwndproc; offsetof; openclipboard; outofmemorymessagebox; postmessage; postquitmessage; preferencesdlgproc; processcommandswndproc; processorderfunction; readfile; readprocessmemory; registerclass; releasedc; rgb; selectobject; sendmessage; sendwmsizemessage; setbkcolor; setclipboarddata; setcurrentdllnode; setcurrentnode; setcurrentnodeex; setcurrentprocessnode; setcurrentthreadnode; setdebugerrorlevel; setfilepointer; setfocus; settextcolor; setthreadcontext; settimer; setwindowlong; setwindowpos; showwindow; skipbreakpoint; sleep; startdebuggee; stringappendf; stringprintf; subclasswindow; switch; text; textbuttonbar; textbuttonbarproc; threadorderfunction; timerproc; translateaccelerator; translatemessage; unreferenced_parameter; updatemenusettings; updatewindow; va_end; va_start; virtualalloc; virtualfree; waitfordebugevent; winhelp; winmain; writeprivateprofileint; writeprivateprofilesettings; writeprivateprofilestring; wsprintf; wvsprintf


WDbgExts Sample: Creating a WinDbg Extension

Click to open or copy the WDbgExts project files.

Click to open or copy the Include project files (required).

This sample demonstrates how to create an extension for the WinDbg debugger. This is a port of the sample demonstrating how to create an NTSD extension.

Building SDK Samples

This sample uses the following keywords:

dbgkdgetcontext; dbgkdgets; dbgkdlookupselector; dbgkdreadcontrolspace; dbgkdreadiospace; dbgkdreadphysicalmemory; dbgkdreadvirtualmemory; dbgkdreboot; dbgkdrestorebreakpoint; dbgkdsendbreakin; dbgkdsetcontext; dbgkdwaitstatechange; dbgkdwritebreakpoint; dbgkdwritecontrolspace; dbgkdwriteiospace; dbgkdwritephysicalmemory; dbgkdwritevirtualmemory; defined; getlasterror; localalloc; localfree; strcpy; strstr; unreferenced_parameter


Fibers Sample: Fiber-based File Copy Operation

Click to open or copy the Fibers project files.

This module illustrates the Win32 fiber APIs.

This example implements a fiber-based file copy operation. Note that a number of different techniques exist for copying files programmatically; this sample simply illustrates the fiber APIs.

This example makes use of a fiber data structure which is used to determine the behavior and state of the fiber. One data structure exists for each fiber; the pointer to the data structure is passed to the fiber at fiber creation time via the lpParameter fiber parameter.

The executing thread in the process makes a call to ConvertThreadToFiber, which allows fibers to be scheduled by the caller. This also allows the resultant fiber to be scheduled by another fiber.

Next, two additional fibers are created, one fiber which performs read operations against a specified file, and another fiber which performs the write operations against a specified file.

The primary fiber then schedules the read fiber. After a successful read, the read fiber schedules the write fiber. After a successful write in the write fiber, the write fiber schedules the read fiber. When the read/write cycle has completed, the primary fiber is scheduled, which results in the display of the read/write status. If an error occurs during the read or write fibers, the primary fiber is scheduled and status of the read/write is displayed.

The fibers, fiber data structures, and file handles are then freed prior to process termination.

Building SDK Samples

This sample uses the following keywords:

closehandle; convertthreadtofiber; createfiber; createfile; deletefiber; displayfiberinfo; getcurrentfiber; getfiberdata; getlasterror; getprocessheap; heapalloc; heapfree; printf; readfiberfunc; readfile; switchtofiber; writefiberfunc; writefile


IO Sample

IO Samples

Click to open or copy the IO project files.


AsyncIO Sample: Pattern-Matching Search

Click to open or copy the AsyncIO project files.

The AsyncIO sample (also called the "PDC" sample) is a character-mode program for searching the files in a directory tree for a match against a pattern. It uses multiple threads, with each thread processing one file at a time, accumulating its matches. When each thread finishes searching a file, the thread sends the matches contiguously to a standard output.

Building SDK Samples

This sample uses the following keywords:

_except; argument_present; atoi; closehandle; containing_record; createevent; createfile; createfilemapping; createsemaphore; createthread; createvirtualbuffer; createworkqueue; deletecriticalsection; destroyworkqueue; entercriticalsection; enumeratedirectorytree; exit; exitthread; extendvirtualbuffer; findclose; findfirstfile; findnextfile; fprintf; freevirtualbuffer; getexceptioncode; getexceptioninformation; getfullpathname; getlasterror; getstdhandle; getsysteminfo; initializecriticalsection; initializelisthead; insertheadlist; inserttaillist; interlockeddecrement; islistempty; leavecriticalsection; localalloc; localfree; mapviewoffile; processcommandlinearguments; processreadfilecompletion; processrequest; processsearchfile; queuesearchfile; queueworkitem; readfile; readfileex; releasesemaphore; removeentrylist; removeheadlist; round_down; round_up; setevent; setthreadpriority; sprintf; strchr; strcmp; strcpy; switch; terminatethread; tlsalloc; tlsgetvalue; tlssetvalue; tolower; trimvirtualbuffer; unmapviewoffile; virtualalloc; virtualbufferexceptionfilter; virtualfree; waitformultipleobjectsex; waitforsingleobjectex; workerthread; writefile


Filer sample: File I/O API Demonstration

Click to open or copy the Filer project files.

The Filer sample is a basic file management applet, such as File Manager or Norton Commander. It demonstrates many of the new File I/O API, and their related algorithms, such as drive enumeration, EXE version information retrieval, and directory tree walking. It also demonstrates many intensive user algorithms, such as child management, subclassing, synchronization and control window management.

Building SDK Samples

This sample uses the following keywords:

aboutproc; beginpaint; bitblt; changedrive; charnext; charprev; charupper; checkmenuitem; checkrm; closehandle; collapsedir; constructdirname; constructlbentry; copyfile; createcompatiblebitmap; createcompatibledc; createdialog; createdirectory; createfontindirect; createmutex; createprocess; createsolidbrush; createthread; createwindow; defwindowproc; deletecriticalsection; deletedc; deletefile; deletemenu; deleteobject; destroywindow; dialogbox; dialogboxparam; dispatchmessage; dofileio; drvwndproc; enddialog; endpaint; entercriticalsection; enumdrives; errormsg; executefileaction; exitthread; expdir; expdirexit; exttextout; filergetversion; fillrect; fillselectdlg; findclose; findfirstfile; findnextfile; fullexpand; functionbarproc; getclientrect; getcurrentdirectory; getcurrentthread; getdc; getdevicecaps; getdirdepth; getdlgitem; getdrivebitmap; getdrivetype; getfileattributes; getfileversioninfo; getfileversioninfosize; getfocus; getlasterror; getlbtext; getlogicaldrives; getlogicaldrivestrings; getmenuitemcount; getmessage; getparent; getsubmenu; getsyscolor; getsystemmetrics; gettextmetrics; getuserdefaultlangid; getversion; getvolumeinformation; getwindowlong; getwindowrect; getwindowtext; handleioerror; heapalloc; heapcreate; heapdestroy; heapfree; initializeapp; initializecriticalsection; insertmenu; invalidaterect; isdirectory; leavecriticalsection; loadbitmap; loadcursor; loadicon; loadmenu; loadstring; lstrcat; lstrcmp; lstrcmpi; lstrcpy; lstrlen; mainwndproc; makeintresource; makelong; messagebeep; messagebox; mkdirproc; movefile; movefileex; movewindow; openlistboxitem; outputdebugstring; postmessage; postquitmessage; primarylangid; registerclass; releasedc; releasemutex; removedirectory; renameproc; runcommanditem; runlistboxitem; selectobject; selectproc; senddlgitemmessage; sendmessage; setbkcolor; setbkmode; setdlgitemtext; seterrormode; setfocus; setmenu; settextcolor; setthreadpriority; setwindowlong; setwindowtext; showwindow; strcat; strcpy; switch; systemparametersinfo; text; textout; translateaccelerator; translatemessage; tstrchr; unreferenced_parameter; updatedrivesmenu; updatefilelb; updatewindow; verqueryvalue; versionproc; waitforsingleobject; wcschr; winmain; wsprintf


Floppy Sample: Accessing a Floppy Disk

Click to open or copy the Floppy project files.

The Floppy sample is designed to show how to access a physical floppy disk under Windows NT®.

Building SDK Samples

This sample uses the following keywords:

createfile; deviceiocontrol; dismountvolume; exitprocess; getdiskgeometry; getfilesize; getlasterror; getsupportedgeometrys; isalpha; localalloc; localfree; lockvolume; lowlevelformat; printf; printgeometry; readfile; sprintf; toupper; unlockvolume; virtualalloc; writefile


Fwatch sample: ReadDirectoryChangesW API

Fwatch Sample: Using ReadDirectoryChangesW API

Click to open or copy the Fwatch project files.

The Fwatch sample displays changes to watched directories and files in the command window. The directories and files to be watched are specified in the Fwatch.ini file, which you can leave in the application directory.

Building SDK Samples

This sample uses the following keywords:

checkchangedfile; closehandle; createdirectory; createfile; createiocompletionport; createthread; exit; filetimetolocalfiletime; filetimetosystemtime; getch; getcurrentdirectory; getfileinformationbyhandle; getlasterror; getprivateprofilestring; getqueuedcompletionstatus; handledirectorychange; lstrcat; lstrcmpi; lstrcpy; lstrlen; postqueuedcompletionstatus; readdirectorychangesw; waitforsingleobject; watchdirectories; wprintf


Serial Sample: Communications Demonstration

Click to open or copy the Serial project files.

The COMM sample (TTY) demonstrates using the Win32 communications functions while maintaining a common code base with 16-bit Windows code.

The program performs communications using the functions OpenFile, ReadFile, SetCommState, SetCommMask, WaitCommEvent, WriteFile, and CloseFile.

The program creates a background thread to watch for COMM receiver events and posts a notification message to the main terminal window. Foreground character processing is written to the communications port.

Simple TTY character translation is performed and a screen buffer is implemented for use as the I/O window.

Overlapped file I/O techniques are demonstrated.

Building SDK Samples

This sample uses the following keywords:

_fmemmove; _fmemset; aboutdlgproc; autowrap; baudrate; beginpaint; bitblt; bytesize; checkdlgbutton; choosefont; clearcommerror; closeconnection; closehandle; column; comdev; commwatchproc; connected; createcaret; createcompatibledc; createevent; createfile; createfontindirect; createthread; createttyinfo; createwindow; cursorstate; defwindowproc; deletedc; deleteobject; destroycaret; destroyttyinfo; dialogboxparam; dispatchmessage; displayerrors; enablemenuitem; enablewindow; enddialog; endpaint; escapecommfunction; exttextout; fgcolor; fillcombobox; flowctrl; free; freeprocinstance; get_prop; getcommstate; getdc; getdlgitem; getdlgitemtext; gethinst; getlasterror; getmenu; getmessage; getnpttyinfo; getoverlappedresult; getparent; getprop; getsyscolor; gettextmetrics; getversion; getwindowlong; getwindowrect; gomodaldialogboxparam; hidecaret; hthread; httyfont; initapplication; initinstance; invalidaterect; isdlgbuttonchecked; killttyfocus; lfttyfont; loadaccelerators; loadbitmap; loadcursor; loadicon; loadstring; localalloc; localecho; localfree; lstrcpy; lstrlen; makeintatom; makeintresource; makelong; makeprocinstance; malloc; max; memset; messagebeep; messagebox; min; movettycursor; newline; openconnection; outputdebugstring; painttty; parity; port; postevent; postmessage; postquitmessage; processttycharacter; purgecomm; read_os; readcommblock; readfile; registerclass; releasedc; remove_prop; removeprop; resetttyscreen; rgb; row; screen; scrollttyhorz; scrollttyvert; scrollwindow; selectobject; selectttyfont; senddlgitemmessage; sendmessage; set_prop; setbkcolor; setbkmode; setcaretpos; setcommmask; setcommstate; setcommtimeouts; setcursor; setdlgitemtext; setnpttyinfo; setprop; setscrollpos; setscrollrange; settextcolor; settingsdlginit; settingsdlgproc; settingsdlgterm; setttyfocus; setupcomm; setupconnection; setwindowlong; showcaret; showwindow; sizetty; stopbits; termwnd; threadid; translateaccelerator; translatemessage; ttywndproc; updatewindow; usecnreceive; waitcommevent; winmain; write_os; writecommblock; writefile; writettyblock; wsprintf; xchar; xoffset; xonxoff; xscroll; xsize; ychar; yoffset; yscroll; ysize


WinNT Sample

WinNT IO Samples

Click to open or copy the WinNT IO project files.


UnbufCpy Sample: Fast Copy Routines

Click to open or copy the UnbufCpy project files.

The UnbufCpy sample consists of two parts: Unbufcp1 and Unbufcp2.

The UnbufCp1 sample shows a fast copy routine that uses I/O completion ports. It demonstrates using a single thread to complete I/O requests from multiple file handles.

Only one thread and one I/O completion port are used. The file handles for the source and destination files are both associated with the same port. The thread starts by posting a number of overlapped reads from the source file. It then waits on the I/O completion port. Whenever a read completes, it immediately turns it into a write to the destination file. Whenever a write completes, it immediately posts the next read from the source file.

The UnbufCp2 sample shows a fast copy routine that uses I/O completion ports. It demonstrates how to complete I/O in a different thread than the thread that started the I/O.

Two threads are used. The first thread posts overlapped reads from the source file. These reads complete to an I/O completion port that the second thread is waiting on. The second thread sees the I/O completion and posts an overlapped write to the destination file. The write completes to another I/O completion port that the first thread is waiting on. The first thread sees the I/O completion and posts another overlapped read.

Building SDK Samples

This sample uses the following keywords:

closehandle; copyloop; createfile; createiocompletionport; createthread; exit; fprintf; getfilesize; getlasterror; getqueuedcompletionstatus; getsysteminfo; gettickcount; getversionex; messagebox; printf; readfile; readloop; setendoffile; setfilepointer; virtualalloc; writefile; writeloop


IPC Sample

IPC Samples

Click to open or copy the IPC project files.


DDEml Samples

Click to open or copy the DDEml project files.

DDEml is a sample application suite comprising Client, Clock, DDEinst, DDEmo, DDEprog, and Server.


Client Sample: Client Use of DDEml Library

Click to open or copy the Client project files.

This sample demonstrates how a client uses the DDEml library.

Building SDK Samples

This sample uses the following keywords:

_stscanf; _tcscat; _tcschr; _tcscmp; _tcscpy; _tcslen; aboutdlgproc; addconv; advoptsdlgproc; begindeferwindowpos; beginpaint; bringwindowtotop; callnexthookex; checkdlgbutton; checkhugedata; checkmenuitem; checkradiobutton; clienttoscreen; closeallchildren; closeclipboard; completetransaction; connectdlgproc; contextdlgproc; copyrect; countwindows; createconv; createhugedatahandle; createinfoctrl; createsolidbrush; createwindow; createxactionwindow; dbgalloc; dbgfree; ddeabandontransaction; ddeaccessdata; ddeadddata; ddecallback; ddeclienttransaction; ddecmpstringhandles; ddeconnect; ddeconnectlist; ddecreatedatahandle; ddecreatestringhandle; ddedisconnect; ddedisconnectlist; ddeenablecallback; ddefreedatahandle; ddefreestringhandle; ddegetdata; ddegetlasterror; ddeinitialize; ddekeepstringhandle; ddequeryconvinfo; ddequerynextserver; ddequerystring; ddereconnect; ddesetuserhandle; ddeunaccessdata; ddeuninitialize; debugbreak; deferwindowpos; defframeproc; defwindowproc; delay; delaydlgproc; destroywindow; dialogboxparam; dispatchmessage; dodialog; drawfocus; drawtext; drawtrackrect; enablemenuitem; enablewindow; enddeferwindowpos; enddialog; endpaint; equalrect; error2string; findadvisechild; findlistwindow; framerect; framewndproc; freeprocinstance; getcapture; getcascadewindowpos; getclientrect; getclipboarddata; getclipboardformatname; getconvinfotext; getconvlisttext; getconvtitletext; getcurrentthreadid; getcurrenttime; getcursorpos; getdc; getdlgitem; getdlgitemint; getdlgitemtext; getfocus; getformatdata; getformatname; gethszname; getmenu; getmessage; getparent; getstockobject; gettextdata; gettextmetrics; getwindow; getwindowlong; getwindowtext; getwindowtextlength; globalgetatomname; globallock; globalunlock; horzupdate; inflaterect; infoctrlwndproc; initializeapplication; initializeinstance; intersectcliprect; intersectrect; invalidaterect; ischild; isclipboardformatavailable; isdlgbuttonchecked; iswindow; lineto; loadcursor; loadicon; loadstring; localalloc; localfree; localrealloc; localunlock; makeintresource; makelong; makeprocinstance; max; mdichildfromhconv; mdichildwndproc; memcpy; messagebeep; min; movetoex; movewindow; mperror; myalloc; mycascadechildwindows; mydisconnect; mydrawtext; myfree; mygetclipboardformatname; mymsgfilterproc; myrand; offsetrect; openclipboard; outputdebugstring; peekmessage; postmessage; postquitmessage; processtransaction; randtest; registerclass; registerclipboardformat; releasedc; rgb; screentoclient; senddlgitemmessage; sendmessage; setbkmode; setcapture; setcursor; setcursorpos; setdlgitemint; setdlgitemtext; setfocus; setmyrand; setrect; setrop2; setwindowlong; setwindowshookex; setwindowtext; showwindow; state2string; status2string; text; textentrydlgproc; tilechildwindows; timeoutdlgproc; trackingwndproc; trackrect; transactdlgproc; translatemessage; type2string; unhookwindowshook; unreferenced_parameter; updatewindow; va_start; vertupdate; viewhandledlgproc; winmain; wsprintf


Clock Sample: Request or Advise Transactions

Click to open or copy the Clock project files.

The Clock sample uses Request or Advise transactions to get the time or the Poke transaction to change the time.

Building SDK Samples

This sample uses the following keywords:

addfontresource; adjusttokenprivileges; appendmenu; beginpaint; checkmenuitem; clockcreate; clockinit; clockpaint; clocksize; clocktimer; clockwndproc; compclockdim; convtime; createdc; createfontindirect; createpen; createsolidbrush; createtools; createwindow; ddeaccessdata; ddecallback; ddecreatedatahandle; ddecreatestringhandle; ddegetdata; ddeinitialize; ddenameservice; ddepostadvise; ddeunaccessdata; ddeuninitialize; defwindowproc; deletedc; deleteobject; deletetools; destroywindow; dialogbox; dispatchmessage; drawborder; drawface; drawfathand; drawhand; enddialog; endpaint; exttextout; fillrect; formatinit; getasynckeystate; getclientrect; getcurrentprocess; getdc; getdevicecaps; getlocaltime; getmenu; getmessage; getnearestcolor; getprivateprofileint; getprofileint; getprofilestring; getstockobject; getsyscolor; getsystemmenu; getsystemmetrics; gettextmetrics; gettime; getwindowlong; getwindowrect; inflaterect; invalidaterect; isiconic; iszoomed; itoa; killtimer; lineto; loadcursor; loadicon; loadstring; localalloc; localtime; lookupprivilegevalue; lstrcpy; makeintresource; makeprocinstance; messagebox; min; movetoex; offsetrect; openprocesstoken; postquitmessage; rectangle; registerclass; releasecapture; releasedc; removefontresource; rgb; selectobject; setbkcolor; setbkmode; setcapture; setcursor; setlocaltime; setmenubar; setrect; setrop2; settextalign; settextcolor; settimer; setwindowlong; setwindowpos; showwindow; sizefont; sscanf; strcat; time; translatemessage; unreferenced_parameter; updatewindow; winmain; writeprivateprofilestring; wsprintf


DDEinst Sample: DDEml API Demonstration

Click to open or copy the DDEinst project files.

The Install SDK sample provides an example of how to use the DDEml APIs to add groups and program items to the Program Manager. You can run the program either in interactive or batch mode. You can specify the search path on the command line.

Building SDK Samples

This sample uses the following keywords:

additem; creategroup; loadcursor; loadicon; makeintresource; messagebox; registerclass; resumethread; setfocus; showgroup


Ddemo Sample: Lists of Conversations

Click to open or copy the Ddemo project files.

Ddemo.exe demonstrates how to use lists of conversations, handle links, handle simple asynchronous transactions, and use your own custom formats.

Building SDK Samples

This sample uses the following keywords:

beginpaint; broadcasttransaction; createwindow; ddeabandontransaction; ddeaccessdata; ddecallback; ddeclienttransaction; ddeconnectlist; ddecreatedatahandle; ddecreatestringhandle; ddedisconnectlist; ddefreestringhandle; ddegetdata; ddeinitialize; ddenameservice; ddepostadvise; ddequeryconvinfo; ddequerynextserver; ddesetuserhandle; ddeuninitialize; defwindowproc; destroywindow; dispatchmessage; drawtext; endpaint; fillrect; getdc; getkeystate; getmessage; getstockobject; getsystemmetrics; gettextmetrics; invalidaterect; itoa; killtimer; loadcursor; mainwndproc; makeprocinstance; mbstowcs; messagebeep; myprocesskey; offsetrect; paintdemo; postquitmessage; rand; registerclass; registerclipboardformat; releasedc; setbkmode; setrect; settextcolor; settimer; setwindowpos; showwindow; stricmp; text; translatemessage; unregisterclass; updatewindow; winmain


DDEprog Sample: Simple DDEML Service

Click to open or copy the DDEprog project files.

This sample implements a simple DDEML service DLL that makes interaction with a program simple.

Building SDK Samples

This sample uses the following keywords:

connecttoprogman; connecttoprogmana; connecttoprogmanw; ddeclienttransaction; ddeconnect; ddecreatestringhandlea; ddedisconnect; ddeinitializea; ddeinitializew; ddeuninitialize; dialogbox; disconnectfromprogman; dllmain; enddialog; getdlgitemtext; localalloc; localfree; mainwndproc; makeintresource; messagebeep; postmessage; proghelpddecallback; progmanexecutestring; progmanexecutestringa; progmanexecutestringw; showwindow; sleep; tlsalloc; tlsfree; tlsgetvalue; tlssetvalue; unreferenced_parameter; wcslen; winmain


Server Sample: DDE Server

Click to open or copy the Server project files.

This module serves to demonstrate one way a sophisticated DDE server that uses enumerable topics and items might be implemented. It takes full advantage of application-owned data handles (when fAppowned is set) to minimize the need for repeated rendering of data when shared with multiple clients.

The server supports full system topic information plus help and nonsystem topic item enumeration for the benefit of browsing clients that are wondering what's available.

This server can be made secure by altering the conversation context filter.

This server can appear to support alternate codepages and languages by altering the conversation context filter. On Windows this is moot since there is not yet a clearly defined way of doing international communication and because the atom manager restricts what topic and item strings can be used on the system.

Building SDK Samples

This sample uses the following keywords:

_stscanf; _tcscat; _tcschr; _tcscpy; _tcslen; beginpaint; checkhugedata; checkmenuitem; checkradiobutton; contextdlgproc; createhugedatahandle; createwindow; ddeaccessdata; ddeadddata; ddecallback; ddecmpstringhandles; ddecreatedatahandle; ddecreatestringhandle; ddedisconnect; ddeenablecallback; ddefreedatahandle; ddefreestringhandle; ddegetdata; ddeimpersonateclient; ddeinitialize; ddenameservice; ddepostadvise; ddeunaccessdata; ddeuninitialize; defwindowproc; delay; dialogboxparam; dispatchmessage; dodialog; drawtext; drawtextline; enddialog; endpaint; freeprocinstance; getclientrect; getcurrenttime; getdc; getdlgitemint; getdlgitemtext; getfocus; getmenu; getmessage; gettextmetrics; getversion; helpxfer; hszize; initapplication; initinstance; intersectrect; invalidaterect; isdlgbuttonchecked; itemlistxfer; loadcursor; loadicon; mainwndproc; makeintresource; makelong; makeprocinstance; min; myrand; offsetrect; paintserver; peekmessage; postmessage; postquitmessage; rand; randtest; registerclass; registerclipboardformat; releasedc; renderdelaydlgproc; reverttoself; sendmessage; setbkmode; setdlgitemint; setdlgitemtext; setfocus; setmyrand; setserverdlgproc; settopicdlgproc; setwindowtext; showwindow; srand; sysformatsxfer; testcountxfer; testhugexfer; testrandomxfer; text; topiclistxfer; translatemessage; unhszize; unregisterclass; updatewindow; validatecontext; winmain; wsprintf


NamePipe: Named Pipe Samples

Click to open or copy the NamePipe project files.


Console: Console Named-Pipe Sample

Click to open or copy the Console project files.

This is a simple console named-pipe sample demonstrating the "thread per client" method of a named pipe client/server architecture. This sample application demonstrates how to create and connect clients from a server application, and how to wait for and connect to pipes from a client application.

Building SDK Samples

This sample uses the following keywords:

_beginthread; _endthread; closehandle; connectnamedpipe; createevent; createfile; createnamedpipe; free; getlasterror; getnamedpipehandlestate; getoverlappedresult; initializesecuritydescriptor; malloc; memset; perr; pipecheck; printf; puts; reader; readfile; setconsoletitle; setsecuritydescriptordacl; sprintf; tolower; waitnamedpipe; writefile; writer


NPclient: Named Pipe Client/Server Demonstration

Click to open or copy the NPclient project files.

NPclient and NPserver demonstrate the use of named pipes. The basic design consists of a server application serving multiple client applications. The user can use the client applications as an interface to all of the other client applications via the server. The effect is a simple communication program that can be used over the network between multiple clients.

Building SDK Samples

This sample uses the following keywords:

enddialog; exitthread; getdlgitem; getlasterror; getmodulehandle; loadstring; unreferenced_parameter


NPserver: Named Pipe Client/Server Demonstration

Click to open or copy the NPserver project files.

Npclient and Npserver demonstrate the use of named pipes. The basic design consists of a server application serving multiple client applications. The user can use the client applications as an interface to all of the other client applications via the server. The effect is a simple communication program that can be used over the network between multiple clients.

Building SDK Samples

This sample uses the following keywords:

bitblt; connectnamedpipe; createcompatibledc; createevent; deletedc; drawbranch; exitthread; getlasterror; getmapmode; getobject; initializesecuritydescriptor; invalidaterect; loadstring; localalloc; localfree; messagebox; registerclass; selectobject; serverproc; setmapmode; setsecuritydescriptordacl; tellall; unreferenced_parameter


Memory Sample: Sharing Memory between Processes

Click to open or copy the Memory project files.

The Memory sample demonstrates the use of the file mapping functions to create named shared memory.

Building SDK Samples

This sample uses the following keywords:

beginpaint; clientwndproc; createfile; createfilemapping; createfontindirect; createmap; createmapfile; createwindow; createwindowex; defframeproc; defmdichildproc; defwindowproc; deleteobject; destroymenu; dialogbox; dispatchmessage; drawmenubar; enablemenuitem; enddialog; endpaint; errorout; exttextout; filetype; getclientrect; getdc; getdevicecaps; getdlgitemtext; getlasterror; getmessage; getmodulehandle; getparent; getstringres; getsubmenu; getsyscolor; getsystemmetrics; gettextmetrics; getwindowlong; getwindowtext; id; initializeapp; invalidaterect; iswindow; killtimer; loadcursor; loadicon; loadmenu; localalloc; localfree; locallock; localunlock; mainwndproc; makeintresource; mapfilename; mapview; mapviewoffile; messagebox; movewindow; openfilemapping; openmap; postquitmessage; registerclass; releasedc; rgb; selectobject; sendmessage; serverwndproc; setbkcolor; setbkmode; setfocus; settextcolor; settimer; setwindowlong; setwindowpos; setwindowtext; strncpy; systemparametersinfo; translatemessage; unreferenced_parameter; updatewindow; winmain; wsprintf


Registry Sample: Using the Win32 API to Access the Registry

Click to open or copy the Registry project files.

The Registry sample is a simply utility which demonstrates the functions needed to access the registry. The sample goes up and down the branches of the registry tree, displaying the individual key's data values. The sample can also print specified trees to a file named Registry.txt.

Building SDK Samples

This sample uses the following keywords:

displaykeydata; getdlgitem; loadstring; unreferenced_parameter


Security Samples

Click to open or copy the files for the Security samples.

The Security samples include the CertSvr and Crypto samples, and WinNT samples that are specific to security.


CertSvr Samples

Click to open or copy the files for the CertSvr samples.


Exit Sample

Exit Sample: Exit Module for Microsoft Certificate Server

Click to open or copy the files for the Exit sample.

The source code in this directory can be used to build a sample Exit Module for the Microsoft Certificate Server. It is meant to run on Windows NT 4.0 with SP3 or later, or on Windows NT 5.0 only. The Certificate Server must already be installed.

The Certificate Server calls the Exit Module through the ICertExit interface, and the Exit Module can call back to the Certificate Server through the ICertServerExit interface.

Each time the Certificate Server issues a certificate, it passes control to the CCertExit::Notify method in Exit.cpp, specifying that a certificate has been issued. The passed Context parameter is used with the ICertServerExit interface to retrieve properties from the newly issued certificate.

Building SDK Samples

This sample uses the following keywords:

_certexit_check_iid; _certexit_iid_lookup; addref; begin_com_map; begin_object_map; bstr_userfree; bstr_usermarshal; bstr_usersize; bstr_userunmarshal; ccertexit; checkcert; checkrequestproperties; cinterface_proxy_vtable; cocreateinstance; code_seg; com_interface_entry; data_seg; declare_not_aggregatable; declare_registry; declspec_uuid; defined; disablethreadlibrarycalls; dllcanunloadnow; dlldata_routines; dllgetclassobject; dllmain; dllregisterserver; dllunregisterserver; end_com_map; end_object_map; enumerateattributes; enumerateattributesclose; enumerateattributessetup; enumerateextensions; enumerateextensionsclose; enumerateextensionssetup; exit:checkrequestproperties; exit:enumerateattributes; exit:enumerateextensions; extern_proxy_file; getcertificateextension; getcertificateextensionflags; getclassobject; getdescription; getidsofnames; getlockcount; getrequestattribute; getrequestproperty; gettypeinfo; gettypeinfocount; icertexit_addref; icertexit_getdescription; icertexit_getdescription_proxy; icertexit_getdescription_stub; icertexit_getidsofnames; icertexit_gettypeinfo; icertexit_gettypeinfocount; icertexit_initialize; icertexit_initialize_proxy; icertexit_initialize_stub; icertexit_invoke; icertexit_notify; icertexit_notify_proxy; icertexit_notify_stub; icertexit_queryinterface; icertexit_release; iid_generic_check_iid; initialize; inlineisequalguid; interfacesupportserrorinfo; invoke; midl_memset; midl_user_allocate; midl_user_free; ndrclearoutparameters; ndrconvert; ndrfcshort; ndrpointerfree; ndrproxyerrorhandler; ndrproxyfreebuffer; ndrproxygetbuffer; ndrproxyinitialize; ndrproxysendreceive; ndrstubgetbuffer; ndrstubinitialize; ndrusermarshalbuffersize; ndrusermarshalfree; ndrusermarshalmarshall; ndrusermarshalunmarshall; notify; object_entry; printf; queryinterface; reference_proxy_file; registerserver; release; rpcexcept; rpcexceptioncode; setcontext; stdmethod; sysallocstring; sysfreestring; sysstringbytelen; term; text; unregisterserver; variantclear; variantinit


PolicyVB Sample

PolicyVB Sample: Policy Module for Microsoft Certificate Server

Click to open or copy the files for the PolicyVB sample.

The Visual Basic source code in this directory can be used to build a sample Policy Module for the Microsoft Certificate Server. It is meant to run on Windows NT 4.0 with SP3 or later, or on Windows NT 5.0 only. The Certificate Server must already be installed.

The Certificate Server calls the Policy Module through the ICertPolicy interface, and the Policy Module can call back to the Certificate Server through the ICertServerPolicy interface.


Crypto Sample

Crypto Samples

Click to open or copy the files for the Crypto samples.


Cfiler Sample

Cfiler Sample: Cryptography Filer

Click to open or copy the files for the Cfiler sample.

The Cfiler sample is a file encryptor that uses the Microsoft Cryptography API (CAPI). Its interface is an adaptation of the FILER sample. CFiler demonstrates many CAPI capabilities, including encryption, digital signature, and password-based key generation.

Cfiler's interface contains two list boxes: the directory list box and the file list box. Users navigate through their directory tree by double-clicking on the directory list box, which is located on the left of Cfiler's client area. Double-clicking on an entry in the directory list box once expands the directory, with all its subdirectories displayed indented below the entry. Double-clicking on the entry a second time collapses the entry.

Users can perform cryptographic operations on files and directories by selecting them in the file list box and selecting operations from the menu. When a user double-clicks on an item in the file list box, Cfiler encrypts the file and displays its filename in gray text. (Note: The plaintext file is deleted.) A second double-click causes Cfiler to decrypt the file and display its filename in its original color. Users sign files by first selecting them in the file list box and then clicking Sign on the File menu. Signed files appear in red text. Users can verify the signature of a file by selecting the file in the file list box and clicking Verify on the File menu. An encrypted file that has been signed appears in light red text.

When users encrypt and then sign files, they know that adversaries have not encrypted the files. Users can select the algorithms for encryption and the digital signature from the Options menu.

Building SDK Samples

This sample uses the following keywords:

_heapchk; _wrename; aboutproc; beginpaint; bitblt; bringwindowtotop; buildsigtable; c2r64; cfilerdecryptfile; cfilerencryptfile; cfilerisdirectory; cfilerlstrcmp; changedrive; charupper; checkheap; checkmenuitem; checkradiobutton; checkrm; closehandle; collapsedir; compare; constructdirname; constructlbentry; copyrect; createcompatiblebitmap; createcompatibledc; createdialog; createdirectory; createfile; createfontindirect; createmutex; createsolidbrush; createthread; createwindow; cryptacquirecontext; cryptcreatehash; cryptdecrypt; cryptderivekey; cryptdestroyhash; cryptdestroykey; cryptdlgproc; cryptencrypt; cryptexportkey; cryptgenkey; cryptgethashparam; cryptgetuserkey; crypthashdata; cryptimportkey; cryptreleasecontext; cryptsignhash; cryptverifysignature; decryptdir; defwindowproc; deletecriticalsection; deletedc; deletefile; deletehashdirectory; deletemenu; deleteobject; destroymenu; destroywindow; dialogbox; dispatchmessage; drawentireitem; drawitem; drawtext; drvwndproc; encryptdir; encryptdlgproc; enddialog; endpaint; entercriticalsection; enterpass; enumdrives; errormsg; exit; exit1; exit2; exitthread; expdir; expdirexit; exttextout; fillfile; fillrect; findclose; findfirstfile; findnextfile; findwindow; free; fullexpand; genrandomname; genrandomname2; getbkcolor; getclientrect; getcurrentdirectory; getdc; getdecrypteddirname; getdecryptedfilename; getdevicecaps; getdirdepth; getdlgitem; getdlgitemtext; getdrivebitmap; getdrivetype; getencryptpublickey; getfileattributes; getfnkey; getlastactivepopup; getlasterror; getlbtext; getlogicaldrives; getlogicaldrivestrings; getmenuitemcount; getmessage; getparent; getpass; getsigdir; getsigfilename; getsignaturepublickey; getsize; getsubmenu; getsyscolor; getsystemdirectory; getsystemmetrics; gettextmetrics; getwindowlong; getwindowtext; handleselectionstate; hashdlgproc; hassignature; hidesignatures; initializeapp; initializecriticalsection; insertmenu; invalidaterect; isencrypted; islegaltoadd; leavecriticalsection; loadbitmap; loadicon; loadmenu; logoff; logon; lstrcat; lstrcmp; lstrcpy; lstrlen; mainwndproc; makehashdirectory; makeintresource; makelong; malloc; messagebeep; messagebox; movewindow; outputdebugstring; postmessage; postquitmessage; rand; rcrypt_failed; readfile; regcreatekeyex; registerclass; regopenkeyex; regqueryvalueex; regsetvalueex; releasedc; releasemutex; removedirectory; rename; replaceescapecharacters; rgb; runlistboxitem; selectobject; sendmessage; separatepathname; separatepathname2; setbkcolor; setbkmode; setdlgitemtext; seterrormode; setfileattributes; setfocus; settextcolor; setwindowlong; setwindowtext; shatoradix64; showsignatures; showwindow; signfile; simplifyfilename; srand; switch; systemparametersinfo; tableadd; tablefind; tablefree; tablegethidden; tableinsert; tablenew; tableremove; tablesend; tablesort; text; textout; time; tolower; toupper; translateaccelerator; translatemessage; unreferenced_parameter; updatedrivesmenu; updatefilelb; updatewindow; verifyfile; waitforsingleobject; winhelp; winmain; writefile; wsprintf


Encrypt Sample

Encrypt Sample: File Encryption

Click to open or copy the files for the Encrypt sample.

The Encrypt sample is a console application that encrypts files. Files encrypted with this sample can be later decrypted with the Decrypt sample.

Note Run the Inituser sample (or equivalent) prior to running these samples to create a key container for the default user.

Building SDK Samples

This sample uses the following keywords:

capidecryptfile; capiencryptfile; cryptacquirecontext; cryptcreatehash; cryptdecrypt; cryptderivekey; cryptdestroyhash; cryptdestroykey; cryptencrypt; cryptexportkey; cryptgenkey; cryptgetuserkey; crypthashdata; cryptimportkey; cryptreleasecontext; decryptfile; encryptfile; exit; fclose; feof; ferror; fopen; fread; free; fwrite; getlasterror; malloc; printf


EnumAlgs Sample

EnumAlgs Sample: Enumerate Algorithms

Click to open or copy the files for the EnumAlgs sample.

The EnumAlgs sample is a console application that lists the algorithms supported by the default PROV_RSA_FULL provider. By default, this will be the Microsoft RSA Base Provider, which is included along with the operating system.

Note Run the Inituser sample (or equivalent) prior to running this sample in order to create a key container for the default user.

In addition to listing the name of each supported algorithm, this sample also lists the following.

  • The type of algorithm (encryption, hash, key exchange, or signature).

  • The key length used by the algorithm (or number of bits in the hash value for hash algorithms).

  • The algorithm identifier for the algorithm. This value can be passed to the appropriate CryptoAPI function in order to create a key or hash object that makes use of the particular algorithm.

The core structure of this sample can be used by applications that want to display a list of available applications to the user.

Building SDK Samples

This sample uses the following keywords:

cryptacquirecontext; cryptgetprovparam; cryptreleasecontext; get_alg_class; getlasterror; printf; strncpy; switch


InitUser Sample

InitUser Sample: Initialize Client

Click to open or copy the files for the InitUser sample.

The Inituser sample sets up the default cryptographic client. This sample (or its equivalent) must be run prior to running the other cryptography samples, so that they will work correctly.

Inituser performs the following operations:

  • Creates a default key container

  • Creates a digital signature key pair within the key container

  • Creates a key exchange key pair within the key container

These operations only need to be done once, unless the operating system is reinstalled. If the default key container and key pairs have already been created, this sample performs no operations.

Building SDK Samples

This sample uses the following keywords:

cryptacquirecontext; cryptdestroykey; cryptgenkey; cryptgetprovparam; cryptgetuserkey; cryptreleasecontext; exit; getlasterror; printf


Sign Sample

Sign Sample: File Signature

Click to open or copy the files for the Sign sample.

The Sign sample is a console application that signs files. Files signed with this sample can be later verified with the Verifile sample.

Note Run the Inituser sample (or equivalent) prior to running these samples, to create a key container for the default user.

Building SDK Samples

This sample uses the following keywords:

cryptacquirecontext; cryptcreatehash; cryptdestroyhash; cryptdestroykey; cryptgetuserkey; crypthashdata; cryptreleasecontext; cryptsignhash; cryptverifysignature; exit; fclose; feof; ferror; fopen; fread; free; fwrite; getlasterror; malloc; printf; signfile; verifyfile


WinNT Security Samples

Click to open or copy the files for the WinNT security samples.


AclAPI Sample

AclAPI Sample: Acl Management API

Click to open or copy the files for the AclAPI sample.

This module illustrates the new Acl management API for Windows NT® 4.0.

Developers of new software that is to run on Windows NT version 4.0 and above are encouraged to utilize these security APIs rather than implementing code that uses lower level security APIs. You can greatly reduce development and test time by using these APIs.

This sample illustrates this point by implementing code that modifies the security on an existing file using the Windows NT 4.0 Acl management API.

Building SDK Samples

This sample uses the following keywords:

accfree; atol; buildexplicitaccesswithname; displaylasterror; formatmessagea; freelibrary; getlasterror; getnamedsecurityinfo; getstdhandle; loadlibraryex; localfree; makelangid; printf; setentriesinacl; setnamedsecurityinfo; stricmp; text; writefile


Audit Sample

Audit Sample: Windows NT LSA Security API

Click to open or copy the files for the Audit sample.

Click to open or copy the Include files (required).

The Audit sample illustrates how to use the Windows NT® LSA security API to manage the audit status on the local machine or a remote machine.

Querying the current audit status is illustrated, in addition to changing the audit state of an audit event type. Enabling and disabling all auditing is also illustrated.

When targeting a domain controller for an audit update operation, target the primary domain controller for the domain.

The audit settings are replicated by the primary domain controller to each backup domain controller as appropriate. The NetGetDCName Lan Manager API call can be used to get the primary domain controller computer name from a domain name.

If no command line argument is specified, this sample will target the local machine. Or, you can specify a machine in argv[1]; for example:

  Audit.exe \\winbase

The sample relies on the Ntsecapi.h header file found in the Win32SDK \mstools\security directory.

Building SDK Samples

This sample uses the following keywords:

displayaudit; displayauditeventoption; displayntstatus; displaywinerror; formatmessagea; fprintf; getstdhandle; initlsastring; localfree; lsaclose; lsafreememory; lsantstatustowinerror; lsaopenpolicy; lsaqueryinformationpolicy; lsasetinformationpolicy; lstrlenw; makelangid; openpolicy; printf; setauditevent; setauditmode; wmain; writefile; zeromemory


Check_sd Sample

Check_sd Sample: Check Security Descriptors (SD)

Click to open or copy the files for the Check_sd sample.

In the Win32 Programmer's Reference, if you go to the Security overview and choose the subtopic "Allowing Access", you'll find the following comment.

Note It is fine to write code like this that builds security descriptors from scratch. It is, however, a good practice for people who write code that builds or manipulates security descriptors to first write code that explores the default security descriptors that Windows NT places on objects. For example, if Windows NT by default includes in a DACL an ACE granting the Local Logon SID certain access, it's good to know that, so that a decision not to grant any access to the Local Logon SID would be a conscious decision.

This comment is accurate; however, to begin with, this task of examining the SD is easier if there is sample code to start from. The purpose of the CHECK_SD sample is to provide sample code you can start from as you examine an SD. This sample only examines the SD on files, but the code can be modified to examine the SD on other objects.

This sample is not a supported utility.

Building SDK Samples

This sample uses the following keywords:

ace; closehandle; closeservicehandle; dacl; displayhelp; equalsid; examineaccesstoken; examineacl; examinemask; examinesd; freopen; getace; getaclinformation; getcurrentprocess; getcurrentthreadid; getfilesecurity; getlasterror; getprocesswindowstation; getsecuritydescriptorcontrol; getsecuritydescriptordacl; getsecuritydescriptorgroup; getsecuritydescriptorlength; getsecuritydescriptorowner; getsecuritydescriptorsacl; getsididentifierauthority; getsidlengthrequired; getsidsubauthority; getsidsubauthoritycount; getthreaddesktop; gettokeninformation; getversion; initializesid; initializewellknownsids; isvalidacl; isvalidsecuritydescriptor; isvalidsid; localalloc; lookupaccountsid; lookupprivilegename; lookupprivilegevalue; lookupsidname; memcmp; messagebox; openprocesstoken; openscmanager; openservice; perr; pmsg; printf; regclosekey; regopenkeyex; sacl; sd; seterrormode; setlasterror; setprivilegeinaccesstoken; sid; sidstringname; sprintf; strcat; strcpy


DispTrus Sample

DispTrus Sample: Enumerates the Trusted Domains

Click to open or copy the files for the DispTrus sample.

Click to open or copy the Include files (required).

The DispTrus sample enumerates the trusted domains on the target machine, and displays them on stdout. This list matches (minus sorting) the list of domains presented by the WinNT DACL editor. For practical applications, replace the AddTrustToList function with linked-list management code and then use the resultant list later on in the application.

The optional target machine is specified as argv[1], eg, lsatrust \\winbase

Relevant Trusted Domains

For a WinNT workstation that is not a member of a domain, the only relevant trusted domain is the account domain of the machine. This sample detects a nonmember workstation by checking if the primary domain Sid is NULL.

For a WinNT workstation that is a member of a domain, the relevant trusted domain is the account domain, the primary domain, and the trusted domain(s) of the primary domain.

For a WinNT Domain controller, the relevant trusted domain is the account domain and the trusted domains.

Building SDK Samples

This sample uses the following keywords:

addtrusttolist; buildtrustlist; displaywinerror; enumtrusteddomains; formatmessagea; fprintf; freelibrary; getlasterror; getprocessheap; getstdhandle; heapalloc; heapfree; initlsastring; isdomaincontroller; loadlibraryex; localfree; lsaclose; lsaenumeratetrusteddomains; lsafreememory; lsantstatustowinerror; lsaopenpolicy; lsaqueryinformationpolicy; lstrcpynw; lstrlenw; makelangid; netapibufferfree; netgetdcname; netservergetinfo; openpolicy; printf; setlasterror; text; wmain; writefile; zeromemory


DomTrust Sample

DomTrust Sample: Manage Trusted Domains

Click to open or copy the files for the DomTrust sample.

Click to open or copy the Include files (required).

The DomTrust sample illustrates how to manage Windows® NT trusted domains at the domain controller level.

The first command line argument indicates the name of the new or existing trusted domain to create or modify.

The second command line argument indicates the new password for the trusted domain specified in the first argument.

The optional third argument indicates the domain name that is the target of the trusted domain update operation. If this argument is not specified, the update will occur on the local domain. Note that this sample will not allow a trusted domain update to occur on a nondomain controller.

This sample works correctly when compiled as ANSI or Unicode. Note that the LAN Manager NetXxx APIs are Unicode only, and the Windows NT LSA APIs are Unicode only.

Building SDK Samples

This sample uses the following keywords:

copysid; displayerror; displayntstatus; formatmessagea; fprintf; freelibrary; freesid; getdomainsid; getlasterror; getlengthsid; getprocessheap; getstdhandle; heapalloc; heapfree; initlsastring; isvalidsid; loadlibraryex; localfree; lsaclose; lsadeletetrusteddomain; lsafreememory; lsantstatustowinerror; lsaopenpolicy; lsaquerytrusteddomaininfo; lsasettrusteddomaininformation; lstrcatw; lstrcmpiw; lstrcpyw; lstrlenw; makelangid; netapibufferfree; netgetdcname; netservergetinfo; netuseadd; netusedel; netusermodalsget; openpolicy; printf; setlasterror; settrusteddomaininfo; switch; text; towupper; verifytrustrelationship; wmain; writefile; zeromemory


Gina Sample

Gina Sample: Graphical Identification and Authentication DLL

Click to open or copy the files for the Gina sample.

The Gina sample demonstrates the Gina-related functions.

To install the Gina DLL, copy it into %systemroot%\SYSTEM32, add a registry value of type REG_SZ named GinaDLL under the key \HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon, and reboot the machine.

WARNING! - It is possible to make your machine unusable if you install a replacement Gina and it fails. To avoid this situation, be sure that you have a method of accessing the %systemroot%\SYSTEM32 directory independent of the Windows NT® installation you are testing on.

If the Gina sample malfunctions, and you are not able to log on to fix the problem, you can recover by doing one of the following:

  • If the test machine is on the network and you have an account on another machine with Administrative privileges on the test machine, open the test machine registry remotely with regedt32 and delete the GinaDLL value.

  • If the test machine is on the network, and %systemroot%\SYSTEM32 is available on a network share for that machine (e.g. \\<name>\c$), rename Gina.dll to something else with a command like:
    ren \\<name>\c$\winnt351\system32\gina.dll gina.sdk
Reboot the test machine.
  • Delete the GinaDLL value from the registry.

  • If the test machine will dual boot to another version of Windows NT or another operating system capable of accessing %systemroot%\system32, boot to that operating system, delete %systemroot%\system32\Gina.dll, reboot, and delete the GinaDLL value from the registry.

For more information see Gina.hlp.

Building SDK Samples

This sample uses the following keywords:

_vsnprintf; allocandcapturetext; attemptlogon; centerwindow; changepassworddlgproc; checkdlgbutton; closehandle; configdlgproc; copysid; createprocessasuser; debuglog; dllmain; dupstring; enablewindow; enddialog; errormessage; fflush; fopen; formatmessage; fprintf; getcurrentprocessid; getcurrentthreadid; getdebugkeyvalue; getdesktopwindow; getdlgitem; getdlgitemtext; getlasterror; getlengthsid; getlocaltime; getparent; getprocaddress; getprofileint; getprofilestring; getprofilestringa; getsystemmetrics; gettokeninformation; getwindowlong; getwindowrect; handlelvnotify; imagelist_addicon; imagelist_create; impersonateloggedonuser; initcommoncontrols; initdebugsupport; initializeaccountlist; initializeimagelists; initoptionsdialog; isdlgbuttonchecked; listview_getitem; listview_getnextitem; listview_insertcolumn; listview_insertitem; listview_setcolumnwidth; listview_setimagelist; listview_setitemtext; loaddebugparameters; loadicon; loadlibrary; loadminiaccounts; loadnetapi; localalloc; localfree; localrealloc; logevent; logondlginit; logondlgproc; logonuser; makeintresource; makelangid; messagebox; netuserchangepasswordfn; newuserdlgproc; openlogfile; optionsdlgproc; outputdebugstringa; populatelistview; postmessage; regclosekey; regcreatekeyex; regenumvalue; regopenkey; regqueryinfokey; regqueryvalueex; regsetvalueex; reverttoself; saveminiaccount; setdlgitemtext; setfocus; setforegroundwindow; setlasterror; setwindowlong; setwindowpos; setwindowtext; showwindow; shutdowndialoginit; shutdowndlgproc; sprintf; strcmpi; strtok; text; trytochangepassword; updateshutdownsettings; va_start; warning; wcscmp; wcscpy; wcslen; wcstok; welcomedlgproc; wlxactivateusershell; wlxdialogboxparam; wlxdisplaylockednotice; wlxdisplaysasnotice; wlxinitialize; wlxislockok; wlxislogoffok; wlxloggedonsas; wlxloggedoutsas; wlxlogoff; wlxnegotiate; wlxsasnotify; wlxshutdown; wlxusectrlaltdel; wlxwkstalockedsas; zeromemory


GinaStub Sample

GinaStub Sample: Pass-through "Stub" Gina

Click to open or copy the files for the GinaStub sample.

This sample illustrates a pass-through "stub" Gina that can be used in some cases to simplify Gina development.

A common use for a Gina is to implement code that requires the credentials of the user logging onto the workstation. The credentials may be required for synchronization with foreign account databases or custom authentication activities.

In this example case, it is possible to implement a simple Gina stub layer that simply passes control for the required functions to the previously installed Gina, and captures the interesting parameters from that Gina. In this scenario, the existing functionality in the existent Gina is retained. In addition, the development time is reduced greatly, as existing functionality does not need to be duplicated.

When dealing with credentials, take steps to maintain the security of the credentials. For instance, if transporting credentials over a network, be sure to encrypt the credentials.

Building SDK Samples

This sample uses the following keywords:

getprocaddress; gwlxactivateusershell; gwlxdisplaylockednotice; gwlxdisplaysasnotice; gwlxinitialize; gwlxislockok; gwlxislogoffok; gwlxloggedonsas; gwlxloggedoutsas; gwlxlogoff; gwlxnegotiate; gwlxscreensavernotify; gwlxshutdown; gwlxstartapplication; gwlxwkstalockedsas; loadlibrary; myinitialize; text; wlxactivateusershell; wlxdisplaylockednotice; wlxdisplaysasnotice; wlxinitialize; wlxislockok; wlxislogoffok; wlxloggedonsas; wlxloggedoutsas; wlxlogoff; wlxnegotiate; wlxscreensavernotify; wlxshutdown; wlxstartapplication; wlxwkstalockedsas


HTTPauth Sample

HTTPauth Sample: Handles Authentication Sequence ( Basic & SSPI )

Click to open or copy the files for the HTTPauth sample.

Click to open or copy the Include files (required).

The elements described here are not a part of the Win32® API. They are specific to Security Providers and Account Management.

Please be aware that in the future many of these elements will be replaced with OLE Interfaces, and will subsequently be dropped.

Building SDK Samples

This sample uses the following keywords:

ACE; BLOB; BOOL; BYTE; CHAR; CONST; CONTEXT; DWORD; FIXED; FreeLibrary; GetComputerName; GetLastError; GetProcAddress; GetVersion; GetVersionEx; HANDLE; HCONV; HINSTANCE; Initialize; INT; LoadLibrary; LONG; LP; max; min; OSVERSIONINFO; PBYTE; PCH; POINT; POINTS; PROC; PSTR; PSZ; Resolve; SetLastError; SID; SIZE; Skip; String; TCHAR; TOKEN_SOURCE; UCHAR; ULONG; VOID; WORD


LSAprivs Sample

LSAprivs Sample: LSA Security API

Click to open or copy the files for the LSAprivs sample.

Click to open or copy the Include files (required).

This module illustrates how to use the Windows NT LSA security API to manage account privileges on the local machine or on a remote machine.

When targeting a domain controller for privilege update operations, target the primary domain controller for the domain. The privilege settings are replicated by the primary domain controller to each backup domain controller as appropriate. The NetGetDCName Lan Manager API call can be used to get the primary domain controller computer name from a domain name.

For a list of privileges, consult Winnt.h, and search for SE_ASSIGNPRIMARYTOKEN_NAME.

For a list of logon rights, which can also be assigned using this sample code, consult Ntsecapi.h, and search for SE_BATCH_LOGON_NAME

You can use domain\account as argv[1]. For instance, mydomain\scott will grant the privilege to the mydomain domain account scott.

The optional target machine is specified as argv[2], otherwise, the account database is updated on the local machine.

The LSA APIs used by this sample are Unicode only.

Use LsaRemoveAccountRights to remove account rights.

Building SDK Samples

This sample uses the following keywords:

displayntstatus; displaywinerror; formatmessagea; fprintf; getaccountsid; getlasterror; getprocessheap; getstdhandle; heapalloc; heapfree; heaprealloc; initlsastring; localfree; lookupaccountname; lsaaddaccountrights; lsaclose; lsantstatustowinerror; lsaopenpolicy; lsaremoveaccountrights; lstrlenw; makelangid; openpolicy; setprivilegeonaccount; text; writefile; wsprintf; wsprintfw; zeromemory


LSAsamp Sample

LSAsamp Sample: Managing User Privileges

Click to open or copy the files for the LSAsamp sample.

Click to open or copy the Include files (required).

The APIs found in this directory are not Win32 APIs. They are specific APIs for Security Providers and Account Management. Please be aware In the future many of these APIs will be replaced with OLE Interfaces, and will subsequently be dropped.

Building SDK Samples

This sample uses the following keywords:

displayntstatus; displaywinerror; formatmessagea; fprintf; getaccountsid; getlasterror; getprocessheap; getstdhandle; getuserdefaultlangid; heapalloc; heapfree; heaprealloc; initlsastring; localfree; lookupaccountname; lsaaddaccountrights; lsaclose; lsantstatustowinerror; lsaopenpolicy; lsaremoveaccountrights; openpolicy; setprivilegeonaccount; text; wcslen; writefile; wsprintf; wsprintfw; zeromemory


MachAcct Sample

MachAcct Sample: Create a Machine Account on a Specified Domain

Click to open or copy the files for the MachAcct sample.

This sample illustrates how to create a machine account on the specified domain.

Machine account types are defined by the following flags:

  • UF_SERVER_TRUST_ACCOUNT (Backup domain controller)

  • UF_WORKSTATION_TRUST_ACCOUNT (Workstation and server)

  • UF_INTERDOMAIN_TRUST_ACCOUNT (Interdomain trust account)

This sample attempts to create a workstation machine account, of type UF_WORKSTATION_TRUST_ACCOUNT. This account type is used for workstations and non-DC servers which are domain members.

If the computer account creation fails with GetLastError == ERROR_ACCESS_DENIED, the sample attempts to enable the SeMachineAccountPrivilege for the caller. If the privilege is enabled successfully, the computer account add operation is re-tried.

Deleting machine accounts can be accomplished using the NetUserDel Windows NT Lan Manager API call.

Account update operations against a domain must be performed against the primary domain controller for the specified domain. This sample uses the NetGetDCName Windows NT Lan Manager API call to determine the computer name of the primary domain controller.

Commandline parameter argv[1] indicates the name of the account to create, which is typically the name of the machine.

Commandline parameter argv[2] is optional and indicates the target domain. If this commandline argument is omitted, the machine account is created on the local domain. It is recommended that you always supply a domain name in this sample, as this insures that the update occurs at the primary domain controller.

The following commandline creates a machine account named WINBASE in the domain named NTWKSTA:

machacct.exe WINBASE NTWKSTA

Building SDK Samples

This sample uses the following keywords:

addmachineaccount; adjusttokenprivileges; closehandle; displayerror; formatmessagea; fprintf; freelibrary; getcurrentprocess; getlasterror; getstdhandle; loadlibraryex; localfree; lookupprivilegevalue; lstrlenw; makelangid; netapibufferfree; netgetdcname; netuseradd; openprocesstoken; setcurrentprivilege; setlasterror; text; towlower; towupper; wmain; writefile; zeromemory


Rcmd Sample

Rcmd Sample: DuplicateTokenEx API

Click to open or copy the files for the Rcmd sample.

This sample illustrates the new DuplicateTokenEx API for Windows® NT 4.0.

Building SDK Samples

This sample uses the following keywords:

addaccessallowedace; buildnamedpipeacl; closehandle; connectnamedpipe; createfile; createnamedpipe; createprocessasuser; createthread; disconnectnamedpipe; displaylasterror; displaywinerror; duplicatetokenex; formatmessagea; fprintf; getcurrentthread; getcurrentthreadid; getlasterror; getprocesswindowstation; getsidlengthrequired; getsidsubauthority; getstdhandle; getthreaddesktop; impersonatenamedpipeclient; initializeacl; initializesecuritydescriptor; initializesid; localfree; makelangid; openthreadtoken; printf; readfile; readfunc; reverttoself; seterrormode; setsecuritydescriptordacl; setupnamedpipes; setuserobjectsecurity; setwinstadesktopsecurity; terminatethread; text; waitforsingleobject; waitnamedpipe; writefile; writefunc; wsprintf


sd_flppy Sample

sd_flppy Sample: How to Put a DACL on Floppy Drives

Click to open or copy the files for the sd_flppy sample.

This sample is a good starting place for anyone writing code to apply DACLs.

You can install a version of this sample program as a service, so that each time the machine boots up the DACLs are automatically reapplied.

There is no way to put a DACL on the floppy drives or on the COM ports with REGEDT32, or using the Control Panel or other part of the user interface. Also, there is no way to use the Win32® API to put a DACL on the floppy drives or on the COM ports that survives reboots.

However, the SD_FLPPY sample does put DACLs on the floppy drives or on the COM ports that survive logoff and logon; that is, these DACLs are on the floppy drives or on the COM ports until the next reboot.

This sample is not a supported utility.

Building SDK Samples

This sample uses the following keywords:

_stricmp; addaccessallowedace; callnamedpipe; closehandle; closeservicehandle; connectnamedpipe; crackargs; createevent; createfile; createnamedpipe; createservice; createthread; deleteservice; deregistereventsource; die; disconnectnamedpipe; displayhelp; enumservicesstatus; exit; getdrivetype; getlasterror; getsidlengthrequired; getsidsubauthority; getversion; initializeacl; initializesecuritydescriptor; initializesid; installservice; isvalidsecuritydescriptor; messagebox; openscmanager; openservice; perr; pmsg; printf; readfile; registereventsource; registerservicectrlhandler; removeservice; reportevent; reportstatustoscmgr; resumethread; service_ctrl; service_main; seterrormode; setevent; setfilesecurity; setsecuritydescriptordacl; setservicestatus; sprintf; startservicectrldispatcher; stopsimpleservice; strcat; strcpy; stricmp; suspendthread; switch; text; waitforsingleobject; worker_thread; writefile; writesd_toa_file


SecFile Sample

SecFile Sample: File Security

Click to open or copy the files for the SecFile sample.

The Secfile sample demonstrates the following security-related activities:

  • Constructing well-known security identifiers (SIDs)

  • Obtaining the current user's SID

  • Building a discretionary access control list (DACL)

  • Building a security descriptor (SD)

Use this sample in conjunction with the Win32 Programmer's Reference. Looking at the documentation and an example function call should make both the documentation and the sample more clear.

This sample only works on an NTFS partition. No other file system supports security. You can use File Manager or the Windows Explorer to check the security on the file after you run the sample. One thing you may notice is that the user "Everyone" has "Special" access instead of "Read" access. That's because the system considers "Read" access to include both read and execute rights. To modify the sample to give "Everyone" "Read" access, change the statement:

#define WORLD_ACCESS GENERIC_READ

to the following:

#define WORLD_ACCESS (GENERIC_READ | GENERIC_EXECUTE)

Building SDK Samples

This sample uses the following keywords:

addaccessallowedace; allocateandinitializesid; closehandle; copysid; createfile; createworldsid; exitprocess; fprintf; freesid; getcurrentprocess; getlasterror; getlasterrortext; getlengthsid; getprocessheap; gettokeninformation; getusersid; heapalloc; heapfree; initializeacl; initializesecuritydescriptor; lstrlen; openprocesstoken; perr; setsecuritydescriptordacl; writefile


SecPerf Sample

SecPerf Sample: Regulate Access to the Performance Data

Click to open or copy the files for the SecPerf sample.

The SecPerf sample illustrates how to regulate access to the performance data provided by the registry key HKEY_PERFORMANCE_DATA.

The security on the following registry key dictates which users or groups can gain access to the performance data:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib

This sample opens the registry key for WRITE_DAC access, which allows for a new Dacl to be applied to the registry key.

A Dacl is then built, which grants the following users access:

Administrators are granted full control to allow for future updates to the security on the key and to allow for querying performance data.

Interactively logged on users, through the well-known Interactive Sid, are granted KEY_READ access, which allows for querying performance data.

The new Dacl is then applied to the registry key using the RegSetKeySecurity Win32 API.

This sample relies on the import library Advapi32.lib.

Building SDK Samples

This sample uses the following keywords:

addaccessallowedace; allocateandinitializesid; displaywinerror; formatmessagea; fprintf; freesid; getlasterror; getlengthsid; getprocessheap; getstdhandle; heapalloc; heapfree; initializeacl; initializesecuritydescriptor; localfree; makelangid; printf; regclosekey; regopenkeyex; regsetkeysecurity; setsecuritydescriptordacl; text; writefile


SidCln Sample

SidCln Sample: Security Functions

Click to open or copy the files for the SidCln sample.

The SidCln sample demonstrates some of the security functions. It provides a sample utility that recovers on-disk resources that remain allocated to deleted user accounts.

Building SDK Samples

This sample uses the following keywords:

charlower; copysid; crackargs; deleteace; deleteacesasappropriate; displayhelp; doalldirsinonedir; domatchingfilesinonedir; doonefileordir; findfirstfile; findnextfile; free; getace; getaclinformation; getcurrentprocess; getfullfileordirname; getlasterror; getlengthsid; getprocesssid; getsecuritydescriptorcontrol; getsecuritydescriptordacl; getsecuritydescriptorgroup; getsecuritydescriptorowner; getsecuritydescriptorsacl; initializesecuritydescriptor; isvalidacl; isvalidsecuritydescriptor; isvalidsid; lookupprivilegevalue; malloc; openprocesstoken; perr; pmsg; printappstyleapierror; printf; setcurrentdirectory; setsecuritydescriptordacl; setsecuritydescriptorgroup; setsecuritydescriptorowner; setsecuritydescriptorsacl; strcmp; strcpy; takeownershipifappropriate


SockAuth Sample

SockAuth Sample: Socket Connection Conversations

Click to open or copy the files for the SockAuth sample.

Click to open or copy the Include files (required).

The SockAuth sample shows both the client and server conversations with the security provider when just a socket connection is used. The server side, in this sample, authenticates the client and provides evidence of this by reporting the client's user name back to the client via the socket connection.

This sample is distantly related to the Httpauth sample, which demonstrates the use of the SSPI package to implement the client side of NTLM authentication when interacting with IIS.

Some of the APIs used in this sample are not Win32® APIs. They are specific APIs for Security Providers.

Building SDK Samples

This sample uses the following keywords:

htons; memcpy; sec_success


SubAuth Sample

SubAuth Sample: Sample SubAuthentication Package

Click to open or copy the files for the SubAuth sample.

Click to open or copy the Include files (required).

This sample demonstrates a SubAuthentication DLL for the MSV1_0 authentication package.

The MSV1_0 authentication package is the standard LSA authentication package for Windows NT. It provides or supports:

  • Authentication of users in the SAM database.

  • Pass-Thru authentication of users in trusted domains.

Windows NT allows SubAuthentication DLLs to be used in conjunction with the MSV1_0 authentication package. A SubAuthentication DLL allows the authentication and validation criteria stored in SAM to be replaced for particular subsystems that use the MSV1_0 authentication package. For instance, a particular server might supply a SubAuthentication DLL that validates a user's password via a different algorithm, uses a different granularity of logon hours, and/or specifies workstation restrictions in a different format.

Building SDK Samples

This sample uses the following keywords:

accountrestrictions; chartooemw; copymemory; copyunicodestring; equalcomputername; filetimetosystemtime; getpasswordexpired; getsystemtime; gettimezoneinformation; initunicodestring; localalloc; localfree; lstrcmpia; msv1_0subauthenticationroutine; netapibufferfree; netpsecondstodeltatime; netusermodalsget; nt_success; querysystemtime; sampmatchworkstation; systemtimetofiletime; wcslen; wcstok


TakeOwn Sample

TakeOwn Sample: Granting Administrator Access

Click to open or copy the files for the TakeOwn sample.

The TakeOwn sample implements a recovery scheme to give an Administrator access to a file that has had its access denied to all.

This sample must be run from an Administrator account in order to perform reliably.

Building SDK Samples

This sample uses the following keywords:

allocateandinitializesid; asserttakeownership; getcurrentprocessid; getlasterror; gettokenhandle; initializesecuritydescriptor; lookupprivilegevalue; openprocess; printf; setfilesecurity; variableinitialization


TextSid Sample

TextSid Sample: Textual Representation of a Binary Sid

Click to open or copy the files for the TextSid sample.

This module illustrates how to obtain the textual representation of a binary Sid. This is useful in scenarios where it is not appropriate to obtain the name associated with the Sid, or, when the network is not available to obtain such information. The Windows NT event viewer utility displays Sids in textual form when the username cannot be looked up. Furthermore, lookup of local user profiles is facilitated through conversion of the user Sid to textual form.

This sample obtains the Sid of the current user and then displays the Sid in textual notation.

Building SDK Samples

This sample uses the following keywords:

closehandle; displaywinerror; formatmessagea; fprintf; getcurrentprocess; getlasterror; getsididentifierauthority; getsidsubauthority; getsidsubauthoritycount; getstdhandle; gettextualsid; gettokeninformation; isvalidsid; localfree; makelangid; openprocesstoken; printf; setlasterror; text; writefile; wsprintf


WinNT Samples

Click to open or copy the files for the WinNT samples.


MpHeap Sample: Multithreaded Heap Manager

Click to open or copy the files for the MpHeap sample.

The MpHeap sample is a DLL that provides an implementation of multiple heaps and serializes access to the heaps. It will only work on Windows NT® 4.0 and later.

Many multithreaded applications that use the standard memory allocation routines pay a significant performance penalty when running on a multiprocessor machine. This is due to the serialization used by the default heap. On a multiprocessor machine, more than one thread may try to allocate memory simultaneously. One thread will block on the critical section guarding the heap. The other thread must then signal the critical section when it is finished to release the waiting thread. This adds significant overhead.

By providing multiple heaps, Mpheap.dll allows simultaneous operations on each heap. A thread on processor 0 can allocate memory from one heap at the same time that a thread on processor 1 is allocating from a different heap. The additional overhead in this DLL is offset by greatly reducing the number of times a thread must wait for heap access.

The Tmpheap sample is a simple program that demonstrates the functionality of Mpheap.dll.

Building SDK Samples

This sample uses the following keywords:

atoi; containing_record; createthread; deletecriticalsection; entercriticalsection; exit; fprintf; free; getcurrentthreadid; getlasterror; getsysteminfo; heapalloc; heapcompact; heapcreate; heapdestroy; heapfree; heaprealloc; heapvalidate; initializecriticalsection; interlockedcompareexchange; interlockedexchange; leavecriticalsection; localalloc; localfree; lookasideindexfromsize; malloc; mpheapalloc; mpheapcompact; mpheapcreate; mpheapdestroy; mpheapfree; mpheapgetstatistics; mpheaprealloc; mpheapvalidate; printf; processdelayedfreelist; rand; setlasterror; sleep; threadstartup; tryentercriticalsection; waitformultipleobjects; zeromemory


Pop3 Sample

Pop3 Sample: POP3 Sample

Click to open or copy the files for the Pop3 sample.

The Pop3 sample includes a server that sets up a listening socket on the Pop3 port, then loops, accepting incoming connections from clients. Whenever the server gets a connection, it sends a greeting message and starts a read operation on the newly connected socket.

Building SDK Samples

This sample uses the following keywords:

_stricmp; _strnicmp; _vsnprintf; accept; acceptclients; allocandcopystring; bind; closeclient; closehandle; closesocket; commitmaildirectory; copymemory; createfile; createiocompletionport; createpop3context; createthread; debuglog; debugopenlogfile; deledispatch; deletefile; deletepop3context; deregistereventsource; doargs; doservicecontroller; failservicestart; fflush; findclose; findfirstfile; findnextfile; fopen; fprintf; freemaildirectory; getcurrentprocessid; getcurrentthreadid; getdebugkeyvalue; getlasterror; getlocaltime; getprofilestringa; getqueuedcompletionstatus; gets; getsysteminfo; helodispatch; htons; impersonateloggedonuser; initdebugsupport; initializeevents; initializethreads; lastdispatch; listdispatch; listen; loaddebugparameters; localalloc; localfree; lockmaildirectory; logevent; logonusera; multibytetowidechar; noopdispatch; notifyservicecontroller; openmailmessage; outputdebugstringa; passdispatch; pop3_failure; pop3_success; pop3crackcommand; pop3dispatch; pop3srvmain; printf; quitdispatch; readfile; readmaildirectory; readparameters; regclosekey; registereventsource; registerservicectrlhandler; regopenkey; regqueryvalueex; reportevent; reportserviceevent; retrdispatch; reverttoself; rsetdispatch; send; servicecontrolhandler; setservicestatus; setsockopt; shutdownevents; socket; sprintf; sscanf; startservicectrldispatcher; statdispatch; strcpy; strtok; testloop; text; transmitfile; unlockmaildirectory; updateservicestatus; userdispatch; va_arg; va_start; warning; wcscat; wcscpy; wcsicmp; wcslen; writefile; wsastartup


Service Sample

Service Sample: Create and Install a Service

Click to open or copy the files for the Service sample.

The Service sample demonstrates how to create and install a service.

In this particular sample, the service merely opens a named pipe (the name defaults to \\.\pipe\simple) and waits for read and write operations to the pipe. If the pipe receives input, it creates the string:

Hello! [<input goes here>]

and sends it back to the client through the pipe.

The service can be started and stopped from the control panel Services applet, the net command, or by using the service controller utility (see MORE INFORMATION).

The service also provides command-line parameters that install, remove, or run (debug) the service as a console application.

Building SDK Samples

This sample uses the following keywords:

_stprintf; _stricmp; _tcsicmp; _tprintf; addtomessagelog; callnamedpipea; closehandle; closeservicehandle; cmddebugservice; cmdinstallservice; cmdremoveservice; commandlinetoargvw; connectnamedpipe; controlservice; createevent; createnamedpipe; createservice; deleteservice; deregistereventsource; disconnectnamedpipe; exit; formatmessage; free; getcommandlinew; getlasterror; getlasterrortext; getmodulefilename; initializesecuritydescriptor; localfree; lstrlen; malloc; memset; openscmanager; openservice; printf; queryservicestatus; readfile; registereventsource; registerservicectrlhandler; reportevent; reportstatustoscmgr; resetevent; service_ctrl; service_main; servicestart; servicestop; setconsolectrlhandler; setevent; setsecuritydescriptordacl; setservicestatus; sleep; startservicectrldispatcher; strcpy; stricmp; switch; text; waitformultipleobjects; writefile


Performance Tools Samples

Click to open or copy the files for the Performance Tools samples.

These performance tools samples are part of the WinBase\WinNT samples.


PDH Samples

Click to open or copy the files for the PDH samples.


Proclist Sample

ProcList Sample: List Current Processes Using PDH.DLL

Click to open or copy the files for the ProcList sample.

This sample demonstrates how to list the current processes using the Pdh.dll browsing functions.

Building SDK Samples

This sample uses the following keywords:

lstrlen; text


Statlist Sample

StatList Sample: PDH Counter Statistics Demo Application

Click to open or copy the files for the StatList sample.

This sample demonstrates use of the Counter Browser and statistical counter data functions provided by the PDH library.

Building SDK Samples

This sample uses the following keywords:

clienttoscreen; createfont; createwindow; defwindowproc; deleteallcounters; dialogbox; dispatchmessage; enddialog; getdlgitem; getdlgitemtext; getfileversioninfo; getfileversioninfosize; getfocus; getlasterror; getmessage; getprocessheap; getstringres; getsystemmetrics; getversion; getwindowlong; globalalloc; globalfree; globallock; globalunlock; heapalloc; initapplication; initinstance; isiconic; loadcursor; loadicon; lstrcat; lstrcpy; lstrlen; messagebeep; myregisterclass; postquitmessage; registerclass; selectobject; setdlgitemtext; showwindow; systemparametersinfo; translatemessage; updatewindow; verqueryvalue; winmain; wndproc; wsprintf


PerfDLLs Samples

Click to open or copy the files for the PerfDLLs samples.


Appmem Samples

AppMem Samples: Application Heap Usage Counter

Click to open or copy the files for the AppMem samples.

The AppMem DLLs allow an application developer to instrument the heap usage of an application program as determined by the calls to GlobalAlloc, GlobalReAlloc and GlobalFree. The frequency of calls and amount of memory used by these calls can be tracked via the performance registry and Perfmon.


Appdll Sample

AppDLL Sample: Application Memory Performance Counter Interface Functions

Click to open or copy the files for the AppDLL sample.

Click to open or copy the PerfDLL files (required).

Click to open or copy the Pub files (required).

This sample contains the memory allocation function "wrappers" to allow monitoring of the memory usage by a performance monitoring application, for example, PerfMon.

Building SDK Samples

This sample uses the following keywords:

appmem_inst; closehandle; dllinit; first_free; first_inuse; getcurrentprocessid; globalsize; lstrcmpiw; switch


Perfdll Sample

PerfDLL Sample: Event Logging Functions

Click to open or copy the files for the PerfDLL sample.

Click to open or copy the Pub files (required).

The PerfDLL sample implements the utility routines used to construct the common parts of a PERF_INSTANCE_DEFINITION (see Winperf.h) and perform event logging functions.

Building SDK Samples

This sample uses the following keywords:

align_on_dword; appmem_inst; closeappmemperformancedata; closehandle; collectappmemperformancedata; createfilemapping; dword_multiple; evalthischar; first_free; first_inuse; getlasterror; lstrlenw; mapviewoffile; memmove; monbuildinstancedefinition; moncloseeventlog; monopeneventlog; openappmemperformancedata; regqueryvalueex; report_error; report_error_data; report_information; report_information_data; report_success; report_warning; report_warning_data


Leakybin Sample

LeakyBin Sample: WinNT-based Application

Click to open or copy the files for the LeakyBin sample.

This sample demonstrates the use of application performance counters.

Building SDK Samples

This sample uses the following keywords:

clienttoscreen; createfont; createwindow; defwindowproc; dialogbox; dispatchmessage; enddialog; freeallocatedmemory; getdlgitem; getdlgitemtext; getfileversioninfo; getfileversioninfosize; getfocus; getlasterror; getmessage; getstringres; getsystemmetrics; getuserdefaultlangid; getversion; globalalloc; globalfree; globallock; globalunlock; initapplication; initinstance; loadcursor; loadicon; lstrcat; lstrcpy; lstrlen; messagebeep; myregisterclass; postquitmessage; primarylangid; registerclass; setdlgitemtext; showwindow; systemparametersinfo; translatemessage; updatewindow; verqueryvalue; winmain; wndproc; wsprintf


Perfgen Sample

PerfGen Sample: Using the Signal Generator Performance DLL

Click to open or copy the files for the PerfGen sample.

This sample is a Signal Generator Performance DLL that provides three waveforms at five different periods for use with the Performance Monitor to provide data at a known rate and value. This can be useful in testing applications that use performance data and need predictable values to test against.

Building SDK Samples

This sample uses the following keywords:

align_on_dword; closesiggenperformancedata; collectsiggenperformancedata; dword_multiple; evalthischar; gettimeinmilliseconds; heap_probe; lstrlenw; memmove; monbuildinstancedefinition; moncloseeventlog; monopeneventlog; opensiggenperformancedata; regqueryvalueex; report_error; report_error_data; report_information; report_information_data; report_success; report_warning; report_warning_data; rtlmovememory


Windows UI Samples

Click to open or copy the files for the WinUI samples.


ClipText: Clipboard Copying and Pasting Sample

Click to open or copy the files for the ClipText sample.

This program demonstrates the use of the Edit menu to copy and paste text to and from the clipboard. Try using the Copy command to move this text to the clipboard, and the Paste command to replace this text with data from another application. You might want to try running Notepad and Clipboard alongside this application so that you can watch the data exchanges take place.

Function | Description
WinMain | Calls initialization function, processes message loop.
InitApplication | Initializes window data and registers window.
InitInstance | Saves instance handle and creates main window.
MainWndProc | Processes messages.
About | Processes messages for About dialog box.
OutOfMemory | Displays warning message.

Building SDK Samples

This sample uses the following keywords:

closeclipboard; createwindow; defwindowproc; destroywindow; dialogbox; dispatchmessage; emptyclipboard; enablemenuitem; enddialog; getclipboarddata; getfocus; getmenu; getmessage; getstockobject; globalalloc; globalfree; globallock; globalsize; globalunlock; initapplication; initinstance; invalidaterect; isclipboardformatavailable; loadaccelerators; loadcursor; loadicon; mainwndproc; messagebox; openclipboard; outofmemory; postquitmessage; registerclass; setclipboarddata; showwindow; strcpy; switch; translateaccelerator; translatemessage; unreferenced_parameter; updatewindow; winmain


CmdDlg Samples

Click to open or copy the files for the CmdDlg samples.


CdTest: Common Dialogs Sample

Click to open or copy the files for the CdTest sample.

The CdTest sample demonstrates how to use the common dialog boxes provided in the Win32® API. In addition to displaying each default dialog box, the sample also allows you to modify the parameters passed to the functions to create variations of the common dialog boxes.

Building SDK Samples

This sample uses the following keywords:

aboutproc; callnexthookex; checkmenuitem; checkradiobutton; choosecolor; choosefont; colorshookproc; colorsproc; colorthreadproc1; colorthreadproc2; commdlgextendederror; createthread; createwindow; defwindowproc; devmodeproc; devnamesproc; dialogbox; dialogboxparam; dispatchmessage; dochoosecolorstuff; dochoosefontstuff; docolorsdialog; dofinddialog; dofindrepstuff; dofontdialog; doopendialog; doopensavestuff; doprintdialog; doprintdlgstuff; doreplacedialog; dosavedialog; dotitledialog; enablecolorbuttons; enablefontbuttons; enableprintcontrols; enablewindow; enddialog; enumfontfamilies; enumfontsproc; fillcolordlg; filldevmodedlg; filldevnamesdlg; fillfinddlg; fillfontdlg; fillfontsbox; filllogfontdlg; fillopendlg; fillprintdlg; findproc; findreplacehookproc; findresource; findtext; fonthookproc; fontproc; fontthreadproc1; fontthreadproc2; freeresource; getcolordlg; getcolorsreshandle; getcorrectresourcehandle; getcurrentthreadid; getdc; getdevmodedlg; getdevnamesdlg; getdlgitem; getdlgitemtext; getfiletitle; getfinddlg; getfinddlghandle; getfontdlg; getfontdlghandle; getforegroundwindow; gethdc; getlogfontdlg; getmenu; getmessage; getopendlg; getopenfilename; getparent; getprintdlg; getprintdlghandle; getreplacedlghandle; getsavefilename; getsetupdlghandle; getstockobject; globalalloc; globalfree; globallock; globalunlock; handlefontcheckbox; handlethecommand; initapplication; initcolorstruct; initcustfilterstring; initfilterstring; initfindstruct; initfontstruct; initglobals; initinstance; initlogfontstruct; initopenstruct; initprintstruct; interpretcustomfilterstring; invalidaterect; isdialogmessage; isdlgbuttonchecked; loadcursor; loadicon; loadresource; logfontproc; lpfnfilterproc; lstrcat; lstrcpy; lstrlen; mainwndproc; makeintresource; messagebox; multithreadcolordlg; multithreadfontdlg; multithreadopensave; multithreadprintdlg; myatol; openfunc; openmultithreadenablebuttons; opensavehookproc; opensavethread1proc; opensavethread2proc; postmessage; postquitmessage; printdlg; printhookproc; printmultiproc1; printmultiproc2; printproc; registerclass; registerwindowmessage; releasedc; replacetext; resetcheckboxes; resumethread; rgb; senddlgitemmessage; sendmessage; setbkmode; setdlgitemint; setdlgitemtext; setfocus; settextcolor; setwindowshookex; setwindowtext; showwindow; switch; text; titleproc; translatemessage; unhookwindowshookex; unreferenced_parameter; updatewindow; winmain; wsprintf


ComDlg32: Common Dialog Boxes

Click to open or copy the files for the ComDlg32 sample.

The ComDlg32 sample demonstrates how to use the file open common dialog box. It shows how to create a hook procedure for GetOpenFileName.

Building SDK Samples

This sample uses the following keywords:

closehandle; comdlg32dlgproc; commdlg_opensave_getfilepath; commdlg_opensave_getfolderpath; commdlg_opensave_getspec; commdlgextendederror; createfile; createwindow; defwindowproc; dialogbox; dispatchmessage; enddialog; enternew; getdlgitemtext; getfilesize; getmessage; getopenfilename; getparent; getstockobject; getwindowlong; globalalloc; initapplication; initinstance; loadcursor; loadicon; loadstring; mainwndproc; makeintresource; messagebox; movewindow; openthefile; postquitmessage; processcderror; readfile; registerclass; registerwindowmessage; sendmessage; setdlgitemtext; setwindowlong; showwindow; strcpy; switch; testnotify; translatemessage; updatewindow; winmain


ComCtl Sample (REitp)

Click to open or copy the files for the ComCtl sample.


REitp: RichEdit Test Program Sample

Click to open or copy the files for the Reitp sample.

The REitp sample demonstrates the main features of a RichEdit control. It is also a good replacement for the NotePad applet.

Building SDK Samples

This sample uses the following keywords:

_assert; _based; _fstrncpy; _lclose; _lcreat; _llseek; _lopen; _lread; _lwrite; _segname; _tcschr; _tcscpy; a2w; abortdoc; addref; appendmenu; arerectsequal; assert; assertsz; beginpaint; bottomless; browse; cache; callwindowproc; checkinmenu; checkmenuitem; checkoutmenu; checkrevert; checksave; childwindowfrompoint; choosefont; choptext; cleardebugscreen; clienttoscreen; closeclipboard; closemetafile; closeredoc; cogetmalloc; combobox_getitemdata; commdlgextendederror; copymemory; copymetafile; createbitmap; createcompatiblebitmap; createcompatibledc; createdialog; createhatchwindow; createic; createicon; createmetafile; createpopupmenu; createsolidbrush; createstorage; createtoolbarex; createwindow; data_seg; debugbreak; debugbreak2; debugstr; declare_reguid; defined; defwindowproc; deletedc; deletemetafile; deleteobject; destroymenu; destroywindow; dialogboxparam; dispatchmessage; doesfileexist; doopen; dotagsdialog; doverb; dragacceptfiles; dragqueryfile; drawmenubar; eates; emptyclipboard; enablemenuitem; enablewindow; enddialog; enddoc; endpage; endpaint; enumcache; enumfontfamilies; enummetafile; enummetafileextracticon; enummetafileextracticonsource; enummetafileextractlabel; enummetafileicondraw; errorwithfile; escape; exttextout; failed; fb_oncommand; fb_ondrawitem; fb_onmeasureitem; fb_onnccreate; fb_onpaint; fenablepaste; ffillsizes; ffromtag; ficonfilefromclass; file; fillcolors; fillerup; fillnames; fillrect; findreplace; findtext; finitformatbarclass; finsertsize; fnassert; fppinit; framerect; free; freelocalstring; frestorewindowpos; fserverfromclass; fverbget; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; get_wm_command_mps; getassociatedexecutable; getasynckeystate; getbitmapbits; getclassfile; getclassinfo; getclientrect; getclientsite; getclipboarddata; getcursorpos; getdc; getdesktopwindow; getdevicecaps; getdisplayname; getdlgitem; getdragdropeffect; getfiletitle; getfocus; getformatbarfield; gethatchrect; gethatchwidth; geticonofclass; geticonoffile; getkeystate; getlasterror; getmenu; getmenustate; getmessage; getobject; getopenfilename; getparent; getsavefilename; getscode; getstockobject; getsyscolor; getsystemmetrics; gettext; gettickcount; getwindowid; getwindowlong; getwindowplacement; getwindowrect; getwindowtext; getword; globalalloc; globalallocptr; globalfree; globalfreeptr; globallock; globalreallocptr; globalunlock; gtdlgproc; handle_msg; handlecommand; handlecreate; hiconandsourcefromclass; hiconfromclass; hinstfromhwnd; hourglassoff; hourglasson; hrgetclassfilea; hrprogidfromclsida; hwndcreateformatbar; ignoreleftclick; imoniker_getdisplaynamea; importdataobject; indentfirst; inflaterect; init_interfaceimpl; initializemallocspy; inplacedeactivate; insertobject; invalidaterect; ipersistfile_loada; iscloseformatetc; isdialogmessage; isequalclsid; isequalformatetc; isequaliid; isiconic; isspace; itpcall_addref; itpcall_contextsensitivehelp; itpcall_deleteobject; itpcall_getclipboarddata; itpcall_getcontextmenu; itpcall_getdragdropeffect; itpcall_getinplacecontext; itpcall_getnewstorage; itpcall_new; itpcall_queryacceptdata; itpcall_queryinsertobject; itpcall_queryinterface; itpcall_release; itpcall_showcontainerui; itpoleinplaceframe_addref; itpoleinplaceframe_contextsensitivehelp; itpoleinplaceframe_enablemodeless; itpoleinplaceframe_getborder; itpoleinplaceframe_getwindow; itpoleinplaceframe_insertmenus; itpoleinplaceframe_new; itpoleinplaceframe_queryinterface; itpoleinplaceframe_release; itpoleinplaceframe_removemenus; itpoleinplaceframe_requestborderspace; itpoleinplaceframe_setactiveobject; itpoleinplaceframe_setborderspace; itpoleinplaceframe_setmenu; itpoleinplaceframe_setstatustext; itpoleinplaceframe_translateaccelerator; lfbcomboboxwndproc; lfbeditwndproc; lfbtoolbarwndproc; lformatbarwndproc; lineto; load; loadaccelerators; loadcursor; loadicon; loadlibrary; loadmenu; loadstring; lstrcmp; lstrcmpi; lstrcpy; lstrcpyn; lstrlen; make_str_local_copya2w; make_str_local_copyw2a; makelong; map_loghim_to_pix; map_pix_to_loghim; mapwindowpoints; max; memset; message; messagebeep; messagebox; messageboxa; messageboxw; mfenumcallback; min; movememory; movewindow; muldiv; multibytetowidechar; myread; mywrite; nenumfontnameproc; nenumfontsizeproc; newredoc; next; nyi; offsetrect; offsetviewportorg; offsetwindoworg; oledbg_begin; oledbg_begin1; oledbg_begin2; oledbg_begin3; oledbg_begin4; oledbgaddrefmethod; oledbgassert; oledbgassertsz; oledbgdata_main; oledbggetdbglevel; oledbgindent; oledbgout; oledbgout1; oledbgout2; oledbgout3; oledbgout4; oledbgouthresult; oledbgoutnoprefix; oledbgoutnoprefix1; oledbgoutnoprefix2; oledbgoutnoprefix3; oledbgoutnoprefix4; oledbgoutrect; oledbgoutrect1; oledbgoutrect2; oledbgoutrect3; oledbgoutrect4; oledbgoutrefcnt; oledbgoutrefcnt1; oledbgoutrefcnt2; oledbgoutrefcnt3; oledbgoutrefcnt4; oledbgoutscode; oledbgprint; oledbgprintalways; oledbgprintrect; oledbgprintrectalways; oledbgprintrefcnt; oledbgprintrefcntalways; oledbgprintscodealways; oledbgqueryinterfacemethod; oledbgreleasemethod; oledbgsetdbglevel; oledbgverify; oledbgverifysz; oleduplicatedata; olegeticonofclass; olegeticonoffile; oleinitialize; olemetafilepictfromiconandlabel; olesetmenudescriptor; olestdcheckvtbl; olestdcommitstorage; olestdcompareformatetc; olestdcopyformatetc; olestdcopymetafilepict; olestdcopystatdata; olestdcopystring; olestdcopytargetdevice; olestdcreatechildstorage; olestdcreatedc; olestdcreateic; olestdcreaterootstorage; olestdcreatestandardpalette; olestdcreatestorageonhglobal; olestdcreatetargetdevice; olestdcreatetempfilemoniker; olestdcreatetempstorage; olestddeletetargetdevice; olestddestroyallelements; olestddoconvert; olestddotreatasclass; olestdenumfmtetc_create; olestdenumstatdata_create; olestdfillobjectdescriptorfromdata; olestdfree; olestdfreestring; olestdgetauxusertype; olestdgetdata; olestdgetdefaultfileformatofclass; olestdgetdropeffect; olestdgetfirstmoniker; olestdgetitemtoken; olestdgetlenfileprefixofmoniker; olestdgetlinksourcedata; olestdgetmetafilepictfromoleobject; olestdgetmiscstatusofclass; olestdgetobjectdescriptordata; olestdgetobjectdescriptordatafromoleobject; olestdgetoleobjectdata; olestdgetpriorityclipboardformat; olestdgetsize; olestdgettreatasfmtusertype; olestdgetusertypeofclass; olestdiconlabeltextout; olestdinitialize; olestdinitvtbl; olestdisduplicateformat; olestdisolelink; olestdmalloc; olestdmarkpasteentrylist; olestdmkparsedisplayname; olestdnotefilechangetime; olestdnoteobjectchangetime; olestdnullmethod; olestdopenchildstorage; olestdopenorcreaterootstorage; olestdopenrootstorage; olestdqueryformatmedium; olestdqueryinterface; olestdquerylinksourcedata; olestdqueryobjectdescriptordata; olestdqueryoleobjectdata; olestdrealloc; olestdregisterasrunning; olestdrelease; olestdrevokeasrunning; olestdseticonincache; olestdsetupadvises; olestdswitchdisplayaspect; olestduninitialize; olestdverifyrelease; oleuiaddverbmenu; oleuicanunloadnow; oleuidrawhandles; oleuidrawshading; oleuiinsertobject; oleuilocklibrary; oleuimetafilepictextracticon; oleuimetafilepictextracticonsource; oleuimetafilepictextractlabel; oleuimetafilepictfromiconandlabel; oleuimetafilepicticondraw; oleuimetafilepicticonfree; oleuishowobject; oleuninitialize; onframewindowactivate; openclipboard; openfileerror; openredoc; outputdebugstring; paintalignment; paintcolor; painteffects; paintname; paintsize; parsearguments; parsecmdline; pfbsgetwindowptr; pipframefrompunk; pitpcallfrompunk; playmetafile; playmetafilerecord; pointertonthfield; postmessage; postquitmessage; ppchangepage; ppdlgproc; ppinitdialogsize; pppaint; printdlg; printredoc; processfindreplace; protectselection; queryacceptdata; querycheck; queryinsertobject; queryinterface; readredoc; rectangle; regclosekey; regcreatekeyex; registerclass; registerclipboardformat; registerhatchwindowclass; registerwindowmessage; regopenkeyex; regqueryvalueex; regsetvalueex; release; releasedc; replacecharwithnull; replacetext; resetorigdc; resizeborder; resizeredoc; restoredc; resultfromscode; revertredoc; rgb; savedc; saveredoc; saveredocas; savewindowpos; scaleviewportext; scalewindowext; screentoclient; selectcharformat; selectobject; sendmessage; setadvise; setalignment; setbkcolor; setbkmode; setcharformat; setclipboarddata; setcursor; setcursorpos; setdata; setdctoanisotropic; setdctodrawinhimetricrect; setdefaultformatetc; setdibits; setfocus; setformatetc; sethatchrect; sethatchwindowsize; sethostnames; setlimit; setmapmode; setmenu; setoffset; setparaformat; setupmenu; setupwordwrapmenu; setviewportext; setviewportextex; setviewportorg; setviewportorgex; setwindowext; setwindowextex; setwindowfont; setwindowlong; setwindoworg; setwindoworgex; setwindowplacement; setwindowpos; setwindowptr; setwindowtext; setwordwrap; showmargins; showwindow; sideassert; startdoc; startpage; stdapi_; stdmethodimp_; stgcreatedocfile; stretchblt; stringfromclsid2a; stringfromguid2a; stringfromiid2a; succeeded; switch; text; textout; togglecheck; toupper; tracecharformat; traceerror; tracestring; tracetag; tracetagstring; translateaccelerator; translatemessage; uclassfromdescription; udescriptionfromclass; uncache; uninitializemallocspy; updatebrush; updatebrushes; updateformatbar; updatewindow; utdupstringa2w; utdupstringw2a; w2a; wasansi; widechartomultibyte; winmain; winoleapi_; wndproc; wsprintf; wsprintfa; wsprintfw; xformheightinhimetrictopixels; xformheightinpixelstohimetric; xformrectinhimetrictopixels; xformrectinpixelstohimetric; xformsizeinhimetrictopixels; xformsizeinpixelstohimetric; xformwidthinhimetrictopixels; xformwidthinpixelstohimetric


CommCtrl Samples

Click to open or copy the files for the CommCtrl samples.


ReBar: Rebar Control Sample

Click to open or copy the files for the ReBar sample.

This sample is a simple demonstration of implementing a rebar common control in an application. This example creates a rebar control that has two bands. One contains a ComboBox and the other contains a Pushbutton.

The rebar control can be placed on any of the four sides of the parent window by selecting the desired side from the View menu. When the side is changed, the existing rebar control is destroyed and another one is created. The reason for this is that the control statically stores some styles at creation time and they cannot be changed while running.

Building SDK Samples

This sample uses the following keywords:

buildrebar; checkmenuradioitem; createwindowex; defwindowproc; destroywindow; dialogbox; dispatchmessage; donotify; enddialog; get_wm_command_id; getclientrect; getdlgitem; getmessage; getstockobject; getwindowrect; handlecommand; handlemenupopup; imagelist_addicon; imagelist_create; initapplication; initcommoncontrolsex; initinstance; loadbitmap; loadcursor; loadicon; mainwndproc; makeintresource; makelparam; moverebar; movewindow; postquitmessage; registerclass; sendmessage; showwindow; switch; text; translatemessage; updatewindow; winmain; wsprintf; zeromemory


VListVw: Virtual ListView Control Sample

Click to open or copy the files for the VListVw sample.

VListVw is a simple example of implementing a virtual ListView common control in an application. A virtual ListView is not a separate control, but a standard ListView with the LVS_OWNERDATA style. This example creates a ListView control that has the LVS_OWNERDATA style and "virtually" holds 100,000 items. The items are never actually added. Instead, the virtual ListView control is "told" how many items it contains with the LVM_SETITEMCOUNT message. When an item needs to be drawn, the ListView control queries the parent window for display information with the LVN_GETDISPINFO notification.

The ListView control can be placed in any of the four different view modes by selecting the desired view from the View menu. When the view is changed, the sample changes the style while running, using the SetWindowLong API.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; checkmenuitem; checkmenuradioitem; createlistview; createwindowex; defwindowproc; destroymenu; destroywindow; dialogbox; dispatchmessage; docontextmenu; enddialog; errorhandler; errorhandlerex; formatmessage; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getclientrect; getdlgitem; getlasterror; getmenu; getmessage; getparent; getsubmenu; getwindow; getwindowlong; header_layout; imagelist_addicon; imagelist_create; initapplication; initcommoncontrols; initinstance; initlistview; insertlistviewitems; listview_deleteallitems; listview_ensurevisible; listview_insertcolumn; listview_setimagelist; listview_setitemcount; listviewnotify; loadcursor; loadicon; loadimage; loadmenu; loadstring; lstrcpy; mainwndproc; makeintresource; makelangid; messagebox; movewindow; positionheader; postquitmessage; registerclass; registerclassex; resizelistview; setwindowlong; setwindowpos; showwindow; switch; switchview; text; trackpopupmenu; translatemessage; updatemenu; updatewindow; winmain; wsprintf


ConGui: Sample for Console I/O with GUI I/O

Click to open or copy the files for the ConGui sample.

The ConGui sample demonstrates how a standard console application can take advantage of some of the graphical capabilities of Windows NT®.

Caution This sample application illustrates a method by which a console application can utilize some (but not all) of the graphical user interface (GUI) capabilities of the Win32 API. It was not the original design intention of the Console layer of Windows NT to allow it to interact in this manner with the graphical API, and because of this, problems can occur if you try to accomplish too much. Therefore, exercise restraint in using the graphical Win32 API in your console application. If your needs go beyond the simple methods illustrated here, consider designing your application as a full GUI application.

Building SDK Samples

This sample uses the following keywords:

doargs; enddialog; getchar; getconsolescreenbufferinfo; getdialogargs; getfocus; getlasterror; getstdhandle; islower; senddlgitemmessage; toupper; usage


Console: Demonstration of the Console Functions

Click to open or copy the files for the Console sample.

The Console sample demonstrates most of the Win32 console functions. The program takes no parameters. After starting the sample, you can click one of the functions on the screen to see a demonstration of that function. While the demo is running, the title of the Console window changes to show the name of the source file where the demo function resides. This should make it easy to find the sample code where the function of interest resides.

Some of the demonstrations cover multiple console functions, so some of the choices run the same demo.

Building SDK Samples

This sample uses the following keywords:

allocconsole; atoi; closehandle; cls; createconsolescreenbuffer; demoallocfree; demoapi; democoninfo; democonmode; democreate; democursor; demofillatt; demofillchar; demoflush; demogetlargest; demogetnumbut; demogetnumevents; demogettitle; demoinputcodepage; demooutputcodepage; demoreadconchar; demoreadconout; demoscrollcon; demosetctrlhandler; demosizeinfo; demowritein; exit; fillconsoleoutputattribute; fillconsoleoutputcharacter; flushconsoleinputbuffer; formatmessage; free; freeconsole; generateconsolectrlevent; getconsolecursorinfo; getconsolemode; getconsoleoutputcp; getconsolescreenbufferinfo; getconsoletitle; getconx; getcony; getlargestconsolewindowsize; getlasterror; getnumberofconsoleinputevents; getnumberofconsolemousebuttons; getstdhandle; getversionex; handler_routine; invertrectangle; isprint; localfree; makelangid; malloc; max; memcmp; memcpy; memset; messagebeep; messagebox; min; mygetchar; myputs; peekconsoleinput; perr; putstatusline; rawout; readconsoleinput; readconsoleoutput; readconsoleoutputattribute; readconsoleoutputcharacter; readfile; regenumvalue; regopenkeyex; resizeconbufandwindow; scrollconsolescreenbuffer; setconsoleactivescreenbuffer; setconsolectrlhandler; setconsolecursorinfo; setconsolecursorposition; setconsolemode; setconsoleoutputcp; setconsolescreenbuffersize; setconsoletextattribute; setconsoletitle; setconsolewindowinfo; setcontitle; setlocale; showconapis; showcp; sleep; sprintf; sscanf; strcat; strcpy; switch; writeconsole; writeconsoleinput; writeconsoleoutput; writeconsoleoutputattribute; writeconsoleoutputcharacter; writefile


Controls Sample

Click to open or copy the files for the Controls sample.


SpinCube: Example Custom Control Class DLL, Exported Variables

Click to open or copy the files for the SpinCube sample.

The SpinCube sample provides a generic Win32 DLL template. It demonstrates the use of DLL entry points, exported variables, and using the C run-time in a DLL. This sample also provides a functional example of how to create a custom control class that can be used by applications, such as Spintest.exe, as well as the Dialog Editor.

Building SDK Samples

This sample uses the following keywords:

data_seg; defwindowproc; do_erase; getwindowlong; in_motion; makelong; memcmp; rand; repaint_bkgnd


Cursor: Sample for Manipulating Cursor and Selecting Region

Click to open or copy the files for the Cursor sample.

This sample demonstrates how to manipulate a cursor and select a region.

Function | Description
WinMain | Calls initialization function, processes message loop.
InitApplication | Initializes window data and registers window.
InitInstance | Saves instance handle and creates main window.
MainWndProc | Processes messages.
About | Processes messages for the About dialog box.
sieve | Generates primes. Time consuming function.

Building SDK Samples

This sample uses the following keywords:

clienttoscreen; createwindow; defwindowproc; dialogbox; dispatchmessage; enddialog; getclientrect; getcursorpos; getdc; getmessage; getstockobject; getsystemmetrics; initapplication; initinstance; lineto; loadcursor; loadicon; mainwndproc; movetoex; mpoint2point; point2mpoint; postquitmessage; registerclass; releasecapture; releasedc; screentoclient; setcapture; setcursor; setcursorpos; setrop2; showcursor; showwindow; sieve; strcpy; translatemessage; unreferenced_parameter; updatewindow; winmain; wsprintf


Input Samples

Click to open or copy the files for the Input samples.


IME Samples

Click to open or copy the files for the IME samples.


IMEapps: IME Applications Sample

Click to open or copy the files for the IMEapps sample.

Building SDK Samples

This sample uses the following keywords:

aboutdlg; addidtableentry; ansinext; ansiprev; beginpaint; candlistwndproc; checkmenuitem; choosefont; clearconvmodeparts; compstrwndproc; createfontindirect; createic; createimemenu; createpopupmenu; createstatus; createstatuswindow; createtbar; createtoolbarex; createwindowex; defwindowproc; deletedc; deleteobject; destroymenu; dialogbox; dispatchmessage; enddialog; endmenuitemidtable; endpaint; fillmemory; fillmenuiteminfo; finditemdata; freeprocinstance; getclientrect; getdc; getkeyboardlayout; getmenu; getmessage; getmessagepos; getstockobject; gettargetclause; gettextextentpoint; gettextextentpointw; getwindowlong; getwindowrect; globalalloc; globalfree; handlecandpaint; handlechangeattr; handlechar; handlecomposition; handleconvertcommand; handleendcomposition; handlemodecommand; handlenotify; handlepaint; handlestartcomposition; immassociatecontext; immcreatecontext; immdestroycontext; immgetcandidatelist; immgetcandidatewindow; immgetcontext; immgetconversionstatus; immgetopenstatus; immgetproperty; immnotifyime; immreleasecontext; immsetcandidatewindow; immsetcompositionstring; immsetcompositionstringw; immsetcompositionwindow; immsetconversionstatus; immsetopenstatus; initapplication; initimeuiposition; initinstance; initmenuitemidtable; insertmenuitem; invalidaterect; isdbcsleadbyte; loadcursor; loadicon; loadstring; localalloc; localfree; lstrcat; lstrcmp; lstrcpy; lstrlen; lstrlenw; mainwndproc; makelparam; makepaintstring; makeprocinstance; memcpy; memset; movecompcandwindow; movewindow; mycharnext; mycharnextw; mycharprev; mycharprevw; myimmgetcompositionstring; myimmgetimemenuitems; mylstrcat; mylstrcatw; mylstrcmp; mylstrcmpw; mylstrcpy; mylstrcpyw; mylstrlen; mytext; outputdebugstring; postquitmessage; releasedc; rgb; screentoclient; selectobject; sendmessage; setattrcolor; setbkcolor; setbkmode; setconvmodeparts; setfocus; setopenstatusparts; setstatusitems; settextcolor; settooltiptext; setwindowlong; showwindow; switch; textout; textoutw; trackpopupmenuex; translatemessage; updatebutton; updatemodebutton; updateshowcandbutton; updateshowopenstatusbutton; updatewindow; wcslen; widechartomultibyte; winmain; wsprintf


MultiUI Sample

Click to open or copy the files for the MultiUI sample.

Building SDK Samples

This sample uses the following keywords:

aboutdlg; addresultstring; beginpaint; choosefont; createfontindirect; createic; createwindow; createwindowex; defwindowproc; deletedc; deleteobject; destroystringbuffer; dialogbox; dispatchmessage; drawtext; enddialog; endpaint; freeprocinstance; getclientrect; getdc; getdefaultguifont; getfocus; getmessage; getobject; getstockobject; gettextmetrics; getversionex; getwindowlong; globalalloc; globalfree; immassociatecontext; immcreatecontext; immdestroycontext; immgetcompositionstring; immgetcontext; immisuimessage; immreleasecontext; immsetcompositionfont; immsetcompositionwindow; initapplication; initinstance; initstringbuffer; invalidaterect; iswindow; loadcursor; loadicon; lstrcat; lstrcpy; lstrlen; mainwndproc; makeprocinstance; memset; movewindow; mychangefont; mydrawstring; mysetcompositionfont; mysetcompositionform; nouinoimcwndproc; nouiownimcwndproc; overflowtext; ownuiownimcwndproc; postquitmessage; releasedc; rgb; selectobject; setfocus; setwindowlong; switch; systemparametersinfo; textout; translatemessage; winmain; wmcommandwparam; wsprintf


MouseInfo: Demonstration of Mouse Wheel and Mouse Tracking

Click to open or copy the files for the MouseInfo sample.

This sample demonstrates the use of the mouse wheel and TrackMouseEvent API. It is an SDK sample for handling the WM_MOUSEWHEEL message. This applet displays MouseButton, MouseWheel, MouseMovement, and any mouse messages in the title bar.

Building SDK Samples

This sample uses the following keywords:

createwindow; defwindowproc; dispatchmessage; getdc; getmessage; getstockobject; getsystemmetrics; gettextmetrics; loadcursor; loadicon; mainwndproc; makeintresource; messagebox; postquitmessage; registerclass; releasedc; setwindowpos; setwindowtext; showwindow; switch; trackmouseevent; translatemessage; updatewindow; winmain; wsprintf


MDI

Click to open or copy the files for the MDI sample.


RegMpad: MDI Notepad Sample

Click to open or copy the files for the RegMpad sample.

This sample demonstrates how to use the Multiple Document Interface (MDI) functions to create an MDI notepad.

RegDB.c implements the semantics of the registry interface for this application. The visible interfaces and data structures are defined in RegDB.h.

The NT Registry is an object database consisting of keys and values. Keys have names and may contain other keys and values. A value is a name paired with a data object and a data type. The keys in the registry are analogous to the directories in a file system. In that vein the values are analogous to files.

Access to a key and its associated set of values is mediated by a key handle. Four key handles are given as predefined constants. Those handles correspond to the roots of key trees which have special significance. Handles for the other keys in the registry database may be constructed via the Registry's Open and Create interfaces using an existing key handle and a relative path string.

Building SDK Samples

This sample uses the following keywords:

_alloca; _lclose; _llseek; _lread; _mbschr; _mbslen; _mbsncmp; aboutdlgproc; addaccessallowedace; addfile; alreadyopen; bringwindowtotop; changefile; charnext; charprev; charupper; checkdlgbutton; closeallchildren; closehandle; commandhandler; createappkeys; createmutex; defframeproc; deletedc; dialogbox; dialogboxparam; dlgdirlist; dlgdirselectex; enablemenuitem; enddialog; equalsid; escape; fileexists; find; finddlgproc; findnext; findprev; freelibrary; freesid; get_em_setsel_mps; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_mps; get_wm_mdiactivate_factivate; getcmdline; getcommandline; getcurrentprocess; getcurrentthread; getcurrentuserinfo; getdevicecaps; getdlgitem; getdlgitemtext; getfilename; getinitializationdata; getlasterror; getmenu; getprinterdc; gettextextentpoint; gettokeninformation; getwindow; getwindowlong; getwindowtext; getwindowtextlength; getwindowword; id; initializeacl; initializeapplication; initializeinstance; initializesecuritydescriptor; inituser; installapp; isdbcsleadbyte; isdlgbuttonchecked; iswild; loadconfiguration; loadcursor; loadfile; loadicon; loadlibrary; loadstring; local_findtext; localalloc; localfree; locallock; localrealloc; localunlock; lstrcpy; lstrlen; makeintresource; makelong; messagebox; mperror; mpframewndproc; mpmdichildwndproc; myreadfile; open; openfile; openprocesstoken; openthreadtoken; printdlgproc; printfile; querycloseallchildren; queryclosechild; realslowcompare; regclosekey; regcreatekeyex; regdeletekey; regdeletevalue; regflushkey; registerclass; regopenkeyex; regqueryvalueex; regsetvalueex; releasemutex; runningasadministrator; saveasdlgproc; saveconfiguration; savefile; selectfile; senddlgitemmessage; sendmessage; setdlgitemtext; setsecuritydescriptordacl; setsecuritydescriptorowner; setwindowlong; setwindowword; setwrap; showwindow; storeappconfig; strcpy; unreferenced_parameter; waitforsingleobject; winmain; wsprintf


Menu Sample: Popup Menus, User-Defined Menus, and Menu Functions

Click to open or copy the files for the Menu sample.

This sample demonstrates the use of popup menus, user-defined menus and menu functions.

Function | Description
WinMain | Calls the initialization function and enters the message loop.
MenuInit | Registers the app. window class.
About | Contains dialog function for the About dialog box.
ShrinkBitmap | Shrinks a 64x64 bitmap to a size useable for a user-defined menu checkmark.
HandleCreate | Creates a new menu and appends it to the main menu.
HandlePaint | Handles repainting the app's client area.
HandleChangeColors | Changes the state of the Colors menu item.
HandleDrawItem | Redraws the menu items in the Colors menu.
HandlePopupMenu | Handles display of the Floating popup.
MenuWndProc | Window function for the app.

Building SDK Samples

This sample uses the following keywords:

defwindowproc; destroymenu; enddialog; endpaint; handlechangecolors; handledrawitem; localalloc; locallock; long2point; menuinit; menuwndproc; messagebox; modifymenu; unreferenced_parameter; winmain


OwnCombo: Owner Draw and Combo Box Sample

Click to open or copy the files for the OwnCombo sample.

The Owncombo.exe example application illustrates the use of functions and messages for combo boxes and owner draw. The user interface of this example application is fairly self-explanatory except, perhaps, for the text combo box dialog. The Readme file provides an explanation of this portion of the application's user interface to help you interpret the source code.

The text combo box dialog buttons send various messages to the combo box and the edit control. These buttons allow the user to vary the data sent with each message.

The following actions are performed by the buttons:

Button | Result
Unsl All | Unselects any selection in the combo box.
Sel No | Takes an integer value from the edit control and attempts to select an entry in the combo box given this index value.
Sel Txt | Takes a text string from the edit control and attempts to select the item with the given text prefix.
Find Txt | Searches for the text given in the edit control and returns the item number where it was found in the combo box.
Cb Dir | Appends a directory listing of the current directory into the combo box.
Clr It | Clears all the items in the combo box.
Add It | Takes the string given in the edit control and adds it to the combo box.
Del It | Deletes the currently selected item from the combo box.
Cpy It | Copies the currently selected item in the combo box to the edit control.
Combo Notifications check box | When this box is checked, a message box will appear showing what notification codes the combo box is returning to the application in response to the messages sent by the buttons.

Building SDK Samples

This sample uses the following keywords:

comboboxexample; createsolidbrush; defwindowproc; drawentireitem; enddialog; framerect; getdlgitem; getstockobject; getsyscolor; handlefocusstate; handleselectionstate; listboxexample; messagebox; owncomboinit; owncombowndproc; ownercomboboxexample; sendmessage; setdlgitemint; setdlgitemtext; unreferenced_parameter; winmain


PropSheet

Click to open or copy the files for the PropSheet sample.


ComCtl

Click to open or copy the files for the ComCtl sample.


Wizard: Demonstration of a Wizard Control

Click to open or copy the files for the Wizard sample.

The Wizard sample demonstrates how to manipulate a wizard control.

Function | Description
WinMain | Calls initialization function and processes message loop.
InitApplication | Initializes window data and registers window.
InitInstance | Saves instance handle and creates main window.
MainWindProc | Processes messages.
About | Processes messages for the About dialog box.
YourInfo | Processes the Your Information page of the wizard.
WorkHabits | Processes the Work Habits page of the wizard.
TeamWork | Processes the Team Work pages of the wizard.
Reliability | Processes the Reliability page of the wizard.
Goals | Processes the Goal Attainment page of the wizard.
Adaptation | Processes the Adaptability to Change page of the wizard.
FillInPropertyPage | Fills in a PROPSHEETPAGE structure.
CreateWizard | Creates the wizard.
GenerateReview | Generates the resulting review.

Building SDK Samples

This sample uses the following keywords:

adaptation; checkradiobutton; createwindow; createwizard; defwindowproc; dialogbox; dispatchmessage; enddialog; fillinpropertypage; generatereview; getdlgitem; getmessage; getparent; getstockobject; getwindowlong; goals; initapplication; initinstance; loadcursor; loadicon; loadstring; lstrcat; lstrcpy; mainwndproc; makeintresource; makelong; messagebox; movewindow; postquitmessage; propertysheet; propsheet_setwizbuttons; registerclass; reliability; senddlgitemmessage; sendmessage; setwindowlong; showwindow; switch; teamwork; text; translatemessage; updatewindow; winmain; workhabits; wsprintf; yourinfo


Resource Samples

Click to open or copy the files for the Resource samples.


DynDlg: Dynamic Dialog Box Creation Sample

Click to open or copy the files for the DynDlg sample.

The DynDlg sample shows how to create the dialog box template at run time. Usually, an application defines a dialog box template in an RC or DLG file, then creates a dialog box at run time from the template. However, it is possible to create the dialog box template at run time.

One of the dialog boxes uses a custom control which is expected to be defined in the Spincube.dll file.

Building SDK Samples

This sample uses the following keywords:

create1; create2; createwindow; defwindowproc; dispatchmessage; getacp; getmessage; getmodulehandle; getstockobject; loadcursor; loadicon; lstrlen; mainwndproc; multibytetowidechar; postquitmessage; primarylangid; registerclass; text; translatemessage; unreferenced_parameter; winhelp; winmain


IconPro: Icon Manager Sample

Click to open or copy the files for the IconPro sample.

This sample is designed to manipulate icons having images with bit depths from 1bpp to 32bpp, as well as sizes from 16x16 to 128x128.

IconPro provides no editing capabilities. To create an icon, the user must first edit the image in DIB format, using a program like PBRUSH. Then the image can be imported into IconPro without loss of bit depth.

IconPro restricts the size of its child windows, so MDI tiling might look different than expected.

When extracting icons from DLL and EXE files, IconPro will operate only on 32 bit files.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; addformatdlgproc; adjusticonimagepointers; beginpaint; bitblt; bytesperline; calculateimageoffset; checkdlgbutton; chooseiconfromexefile; closeclipboard; closehandle; convertdibformat; copycolortable; createblanknewformaticon; createchildlistbox; createchildren; createcompatibledc; createdibsection; createfile; createhalftonepalette; createiconfromresource; createiconfromresourceex; createmdiwindow; createnewmdichildwindow; createpen; createsolidbrush; createwindow; defframeproc; defmdichildproc; deletedc; deleteobject; destroyicon; destroywindow; dialogbox; dialogboxparam; dibnumcolors; dibtoiconimage; dispatchmessage; draw3drect; drawandmask; drawicon; drawiconex; drawxormask; emptyclipboard; enablemenuitem; enddialog; endpaint; enumresourcenames; erasebackground; extractdlgproc; fillrect; finddibbits; findresource; free; freelibrary; gdiflush; getclientrect; getclipboarddata; getdc; getdlgitem; getfiletitle; geticonfrominstance; geticoninfo; getmenu; getmessage; getobject; getopenfilename; getopeniconfilename; getpaletteentries; getpixel; getsavefilename; getsaveiconfilename; getstockobject; getsubmenu; getsyscolor; gettextextentpoint32; getwindow; getwindowlong; getwindowrect; getwindowtext; getxorimagerect; globalalloc; globallock; globalunlock; iconchildwndproc; iconimagefrombmpfile; iconimagefromclipboard; iconimagetobmpfile; iconimagetoclipboard; initapplication; initinstance; invalidaterect; isclipboardformatavailable; isdlgbuttonchecked; lineto; loadcursor; loadicon; loadlibraryex; loadresource; loadstring; lockresource; lookupiconidfromdirectory; lstrcpy; lstrlen; makeiconfromresource; makeintresource; makelong; makenewandmaskbasedonpoint; makepoints; malloc; memcpy; memset; messagebox; movetoex; myenumprocedure; oncommand; openclipboard; pack; palettesize; postmessage; postquitmessage; ptinrect; querycloseallchildren; readbmpfile; readfile; readicoheader; readiconfromexefile; readiconfromicofile; realloc; rectangle; rectheight; rectwidth; registerclass; releasedc; rgb; screentoclient; selectobject; senddlgitemmessage; sendmessage; setbkmode; setclipboarddata; setcursor; setdibcolortable; setdibitstodevice; setdlgitemtext; setfilepointer; setmonodibpixel; setpixelv; setrect; setstretchbltmode; settextcolor; setwindowlong; setwindowtext; showwindow; sizeofresource; strdup; stretchblt; switch; text; textout; translatemdisysaccel; translatemessage; updatemenustate; updatewindow; widthbytes; winhelp; winmain; wndproc; writebmpfile; writefile; writeicoheader; writeicontoicofile; wsprintf; zeromemory


MsgTable: Message Table Sample

Click to open or copy the files for the MsgTable sample.

The MsgTable sample demonstrates how to construct and use a message table resource in your application. The sample message table (Messages.mc) for the message compiler (Mc.exe) shows the format of a typical message table source file. The message table source file contains strings in both English and Japanese. Depending on what your current language settings are, the correct message strings will be displayed on the console. Note that some of the entries for each message are optional but are shown for demonstration purposes. See the documentation in the Tools.hlp file on the message table compiler for more information on which fields are optional.

The msgtest.exe executable shows how to load the message table DLL, how to extract the message text from the resource with the FormatMessage API, and how to decode the various bits in the message identifier. Note that the Messages.h include file to the executable is created during the make process by the message compiler (Mc.exe) as it is creating the binary resource file from the message table source file.

The makefile demonstrates how to set up your dependency rules for your message table source files, output files, and message table DLL.

This sample could be easily modified to link the message table resource directly into your executable rather than into a stand-alone DLL. There is no requirement that the message table resource be located only in a DLL, though this is the common case.

Building SDK Samples

This sample uses the following keywords:

closehandle; formatmessage; getchar; getlasterror; getversion; loadlibraryex; localfree; messagebox; myputmsg; printf; puts


Shell Samples

Click to open or copy the files for the Shell samples.


BandObjs: Band Object Implementation Sample

Click to open or copy the files for the BandObjs sample.

BandObjs is a simple example that demonstrates the implementation of the three types of band objects. These are Desk Bands, Explorer Bars and Communication Bands. See the Band Objects topic under Internet Tools and Technologies - Windows Shell in the Internet Client SDK documentation for more information on band objects.

Building SDK Samples

This sample uses the following keywords:

addref; arraysize; beginpaint; cclassfactory; ccommband; cdeskband; cexplorerbar; closedw; cocreateinstance; cogetmalloc; coinitialize; contextsensitivehelp; couninitialize; createinstance; createsolidbrush; createwindowex; data_seg; define_guid; defwindowproc; destroywindow; dllcanunloadnow; dllgetclassobject; dllmain; dllregisterserver; drawtext; endpaint; focuschange; free; getbandinfo; getclassid; getclassinfo; getclientrect; getcommandstring; getmodulefilename; getsite; getsizemax; getwindow; getwindowlong; hasfocusio; insertmenu; invokecommand; isdirty; isequalclsid; isequaliid; iswindow; load; loadcursor; lockserver; lstrcpy; lstrcpyw; lstrlen; make_hresult; messagebox; oncommand; onfocuschangeis; onkillfocus; onpaint; onsetfocus; querycontextmenu; queryinterface; regclosekey; regcreatekeyex; registerandcreatewindow; registerclass; registerclassimplcategories; registercomcat; registerserver; regsetvalueex; release; resizeborderdw; rgb; save; setbkmode; setfocus; setsite; settextcolor; setwindowlong; showdw; showwindow; stdmethodimp_; stringfromiid; succeeded; switch; text; translateacceleratorio; uiactivateio; ushort; widechartomultibyte; wndproc; wsprintf; zeromemory


DropExt: Drag-and-Drop Context Menu Extension Sample

Click to open or copy the files for the DropExt sample.

The DropExt sample demonstrates how to extend the drag-and-drop context menu.

To test Dropext.dll

  1. Build Dropext.dll.

  2. Copy Dropext.dll to the system directory (for example, c:\windows\system). Alternatively, you can modify Dropext.reg file to point to a fully qualified path to the DLL.

  3. Run the command: regedit dropext.reg.

  4. Use the right mouse button to drag a file from one folder to another. You will see additional menu items for the drop operation.

Building SDK Samples

This sample uses the following keywords:

_ioffset; _offset2ptr; addref; cdefclassfactory_addref; cdefclassfactory_create; cdefclassfactory_createinstance; cdefclassfactory_lockserver; cdefclassfactory_queryinterface; cdefclassfactory_release; data_seg; define_guid; dllcanunloadnow; dllgetclassobject; dragqueryfile; dropext_checkforhdrop; dropext_checkforhnres; dropext_createinstance; dropext_ctm_addref; dropext_ctm_queryinterface; dropext_ctm_release; dropext_getcommandstring; dropext_getnetresource; dropext_initialize; dropext_invokecommand; dropext_querycontextmenu; dropext_sxi_addref; dropext_sxi_queryinterface; dropext_sxi_release; getdata; globalfree; globallock; globalunlock; insertmenu; isequaliid; itoclass; itoclassn; libmain; localalloc; localfree; lpfnci; lstrcpy; lstrlen; make_scode; messagebeep; messagebox; pctm2psmx; psxi2psmx; pvoid2psmx; queryinterface; regclosekey; registerclipboardformat; regopenkeyex; release; resultfromscode; shcreatedefclassobject; shell_createdefclassobject; shgetpathfromidlist; smx_offsetof; stdmethodimp_; succeeded; switch; wsprintf


FileView: Text-File Viewer Sample

Click to open or copy the files for the FileView sample.

The Fileview sample demonstrates the basic steps to implement a simple text-based file viewer. This sample is a viewer for text files, those with the TXT extension, as well as any compound file with the CLSID of CLSID_SampleTextFile, defined as 0x00021116-0000-C000-000000000046. The files Flattext.txt and Comptext.txt are two such files.

If you build the sample viewer and register it via the Fvtext.reg file, you will be able to use the sample viewer. Note that the system has a TXT file viewer installed by default. To disable the default viewer, rename the Vsasc8.dll file in the system\viewers subdirectory or edit Fvtext.reg and change the TXT extension to another extension not supported by QuickView, like XXX, and then use text files with the XXX extension.

You can build the sample using Microsoft NMAKE. Be aware that building the sample produces a DLL. Once this DLL is registered, clicking with the right mouse button on one of the TXT (XXX) files will display a context menu. Within this context menu, you will see the QuickView option. If you click on this menu item, the sample file viewer will be invoked.

Building SDK Samples

This sample uses the following keywords:

_lclose; _llseek; _lread; aboutproc; addref; alloc; appendmenu; beginpaint; cfileviewer; cfvclassfactory; checkmenuitem; childrenresize; choosefont; cimpifileviewer; cimpipersistfile; clienttoscreen; cogetmalloc; coinitialize; commdlgextendederror; copymemory; createfont; createfontindirect; createinstance; createpopupmenu; createstatuswindow; createtoolbarex; createwindow; createwindowex; cstatushelper; cstringtable; define_guid; defwindowproc; deleteobject; destroymenu; destroywindow; dialogbox; dispatchmessage; dllcanunloadnow; dllgetclassobject; dllmain; dragacceptfiles; dragfinish; dragqueryfile; drawtext; dropfiles; enddialog; endpaint; failed; fileload; fileshow; fileshowinit; fileviewerframeproc; findresource; finit; finitframecontrols; fontchange; fopenas; free; freeresource; getclassid; getclientrect; getcurfile; getdc; getdevicecaps; getmenu; getmenuitemcount; getmenuitemid; getmenustring; getmessage; getobject; getpinnedwindow; getscrollinfo; getsubmenu; getsyscolor; getwindowlong; getwindowrect; globalalloc; globalfree; globallock; globalunlock; idfromhmenu; interface; invalidaterect; isdirty; isequalclsid; isequaliid; istringfromid; iswindow; load; loadaccelerators; loadcursor; loadicon; loadmenu; loadresource; loadstring; localalloc; localfree; lockresource; lockserver; lstrcpy; lstrlen; makeintresource; malloc; max; mbstowcs; memalloc; memfree; memset; menuselect; messagebox; messagedisplay; messagemap; min; muldiv; objectdestroyed; ods; odslu; odssz; odsszlu; odsszu; odsu; offsetrect; oleinitialize; oncommand; openfile; openstream; outputdebugstring; postmessage; postquitmessage; printto; psztooltip; punkrel; queryinterface; registerclass; release; releasedc; replacewindowmodechange; resultfromscode; save; savecompleted; scrollwindow; selectobject; setbkcolor; setforegroundwindow; setpinnedwindow; setrect; setscrollinfo; setscrollpos; settextcolor; setwindowlong; setwindowpos; setwindowtext; shellexecuteex; show; showinitialize; showwindow; sizeofresource; sort; stat; stdmethodimp_; stgisstoragefile; stgopenstorage; string; succeeded; trackpopupmenu; translateaccelerator; translatemessage; unlockresource; unregisterclass; updatewindow; viewportresize; viewportscrollset; viewportwndproc; wcstombs; wsprintf


Fparser: File Parser Sample

Click to open or copy the files for the Fparser sample.

The Fparser sample parses files with a particular extension.

The default file extension for this sample is TST. To use this file parser for ASCII files of different extensions, the registry must be changed. The registry entry for the new extension must be given a new key named QuickViewAddOn under the subkey that contains our viewer class identifier. Within this key, the registry should have an item named DllName, whose value is the name of your DLL.

Building SDK Samples

This sample uses the following keywords:

_fmemcpy; _fmemmove; _fmemset; _itoa; _llseek; _ltoa; atoi; atol; figetfirstid; figetnextid; fiidfile; fiidhandle; functionname; globalalloc; globalfree; globallock; globalrealloc; globalunlock; itoa; localalloc; localfree; localhandle; locallock; lstrcpy; ltoa; message; setrgbpixel; soangletenths; sobailout; sobegintable; sobluefromrgb; sodrawline; sodummy; soendcolumninfo; soendfieldinfo; soendfonttable; soendhdrinfo; soendpalette; soendtable; soendtabstops; sogetinfo; sogotoposition; sogreenfromrgb; sopaletteindex; sopalettergb; soputarchivefield; soputbitmapheader; soputbreak; soputchar; soputcharattr; soputcharfontbyid; soputcharfontbyname; soputcharheight; soputcharx; soputcolumninfo; soputdatacell; soputfield; soputfieldinfo; soputfonttableentry; soputgraphicobject; soputhdrentry; soputmargins; soputmoretext; soputmorevarfield; soputpaletteentry; soputparaalign; soputparaindents; soputparaspacing; soputscanlinedata; soputsectionname; soputsectiontype; soputspecialcharx; soputsubdocinfo; soputtablecellinfo; soputtablerowformat; soputtabstop; soputtextcell; soputvarfield; soputvectorheader; soredfromrgb; sorgb; sosetdatebase; sosetratio; sostartcolumninfo; sostartfieldinfo; sostartfonttable; sostarthdrinfo; sostartpalette; sostarttabstops; sotagbegin; sotagend; sovectorattr; sovectorobject; strcpy; sualloc; sufree; sulock; surealloc; suseekentry; suunlock; suuserretrievedata; suusersavedata; vatoi; vatol; vwallocprocfunc; vwdospecialfunc; vwfreeprocfunc; vwgetdatafunc; vwgetinfofunc; vwgetrtnsfunc; vwgetsectiondatafunc; vwlocaldownfunc; vwlocalupfunc; vwsetdatafunc; vwsetsectiondatafunc; vwsetsortnfunc; vwsetuserfunc; vwstreamclosefunc; vwstreamopenfunc; vwstreamreadfunc; vwstreamreadrecordfunc; vwstreamsectionfunc; vwstreamseekfunc; vwstreamtellfunc


RegView: Shell Name Space Extension Sample

Click to open or copy the files for the RegView sample.

RegView is a simple example of a shell name space extension. It implements the minimum number of interfaces required to create a multi-level name space extension.

RegView will display the registry similar to the way that Regedit.exe does, except that the registry information can only be viewed. The sample does not support modification of the registry, although this functionality can be added if desired. Once the extension DLL is built and registered, an item called "Registry View" will be available on the desktop and within the Explorer tree. Note: this sample will not run or build on Alpha and will only run with IE4 final release or later.

Building SDK Samples

This sample uses the following keywords:

addpropertysheetpages; addref; addremovedockingwindow; addtoenumlist; addtoolbar; alloc; arraysize; beginpaint; bindtoobject; bindtostorage; browseobject; buildregistrymenu; candoidockingwindow; cclassfactory; cdockingwindow; cenumidlist; cextracticon; checkmenuitem; clone; closedw; cogetmalloc; compareids; compareitems; concatenate; contextsensitivehelp; copy; copymemory; cpidlmgr; cqueryinfo; create; createenumlist; createimagelists; createinstance; createlist; createmenu; createpopupmenu; createrootkey; createsolidbrush; createsubkey; createvalue; createviewobject; createviewwindow; createwindowex; cshellfolder; cshellview; data_seg; define_guid; defwindowproc; delete; deletelist; destroyimagelists; destroymenu; destroyviewwindow; destroywindow; dllcanunloadnow; dllgetclassobject; dllmain; dllregisterserver; drawtext; enablemenuitem; enablemodeless; endpaint; enumobjects; exec; extract; failed; filllist; focuschange; free; freelibrary; get_shgdn_for; get_shgdn_relation; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getattributesof; getborderdw; getclassid; getclassinfo; getclientrect; getcurrentinfo; getdata; getdatapointer; getdatatext; getdisplaynameof; getfolderpath; getfoldertext; getglobalsettings; geticonlocation; getinfoflags; getinfotip; getitemobject; getitemtext; getkeyname; getlastitem; getmenuiteminfo; getmodulefilename; getnextitem; getpidlpath; getprocaddress; getrootkey; getrootkeytext; getsite; getsize; getsubkeytext; getsystemmetrics; getuiobjectof; getvaluename; getvaluetext; getvaluetype; getversionex; getwindow; getwindowlong; hasfocusio; hassubkeys; imagelist_addicon; imagelist_create; imagelist_destroy; imagelist_geticon; initcommoncontrols; initcommoncontrolsex; initialize; initlist; insertmenuitem; insertmenussb; invalidaterect; isequalclsid; isequaliid; isrootkey; issubkey; isvalue; iswindow; listview_deleteallitems; listview_getcolumnwidth; listview_getitem; listview_getitemcount; listview_getitemstate; listview_insertcolumn; listview_insertitem; listview_setextendedlistviewstyle; listview_setimagelist; listview_sortitems; loadcursor; loadimage; loadlibrary; loadstring; localtowidechar; lockserver; lstrcat; lstrcmpi; lstrcpy; lstrcpyn; lstrlen; lstrlenw; makeintresource; mergefilemenu; mergeviewmenu; messagebeep; movewindow; multibytetowidechar; negotiateborderspace; next; onactivate; oncommand; oncreate; ondeactivate; onfocuschangeis; onkillfocus; onnotify; onpaint; onsetfocus; onsettingchange; onsize; onviewwindowactive; parsedisplayname; queryinterface; queryservice; querystatus; refresh; regclosekey; regcreatekeyex; regenumkeyex; regenumvalue; registerclass; regopenkeyex; regqueryvalueex; regsetvalueex; release; removemenussb; removetoolbar; requestborderspacedw; reset; resizeborderdw; rgb; rootkeyexists; saveglobalsettings; saveviewstate; selectitem; sendcontrolmsg; sendmessage; separatekeyandvalue; setbkmode; setborderspacedw; setfocus; setmenusb; setnameof; setsite; settextcolor; setwindowlong; shgetmalloc; showdw; showwindow; skip; stdmethod; stdmethodimp_; stringfromiid; succeeded; switch; text; translateaccelerator; translateacceleratorio; uiactivate; uiactivateio; updatemenu; updateshellsettings; updatewindow; widechartolocal; widechartomultibyte; wndproc; wsprintf; zeromemory


ShellExt: Shell Extensions Sample

Click to open or copy the files for the ShellExt sample.

This sample demonstrates how to implement the basic shell extensions. These include context menu, property sheet, icon handler, and copy hook extensions. This sample does not implement a drag-drop handler, but the implementation would be similar to context menu handlers.

Building SDK Samples

This sample uses the following keywords:

addpages; addref; copycallback; createinstance; createpropertysheetpage; cshellext; cshellextclassfactory; data_seg; define_guid; destroypropertysheetpage; dllcanunloadnow; dllgetclassobject; dllmain; dogakmenu1; dogakmenu2; dogakmenu3; dogakmenu4; dragqueryfile; extract; gakpagecallback; gakpagedlgproc; getclassid; getcommandstring; getcurfile; getdata; getdlgctrlid; geticonlocation; getmodulefilename; getprivateprofileint; getprop; getwindowlong; initialize; insertmenu; invokecommand; isdirty; isequaliid; load; lockserver; lpfnaddpage; lstrcpy; make_scode; makeintresource; messagebox; ods; outputdebugstring; querycontextmenu; queryinterface; release; removeprop; replacepage; resultfromscode; resultfromshort; save; savecompleted; senddlgitemmessage; setprop; setwindowlong; shchangenotify; stdmethodimp_; succeeded; switch; widechartomultibyte; writeprivateprofilestring; wsprintf


TrayNot Sample

Click to open or copy the files for the TrayNot sample.

App32.c in this sample has the following functions:

  • IconDrawItem

  • NotifyAdd

  • NotifyChange

  • NotifyDelete

  • StateChange

  • TestAppDlgProc

  • TrayMessage

  • WinMain

Building SDK Samples

This sample uses the following keywords:

arraysize; checkradiobutton; destroyicon; dialogbox; drawiconex; enablewindow; enddialog; get_wm_command_id; getdlgctrlid; getdlgitem; getdlgitemint; getdlgitemtext; gettickcount; getwindow; icondrawitem; isdlgbuttonchecked; killtimer; loadimage; loadstring; lstrcpyn; makeintresource; notifyadd; notifychange; notifydelete; setforegroundwindow; settimer; shell_notifyicon; showwindow; statechange; testappdlgproc; traymessage; winmain


Topic Not Found

No matching topic was found. Some possible reasons and remedies are as follows:

  • The file (.chm) that contains the destination topic is not in the expected location.

    • Remedy: Rerun the MSDN Library Setup.

  • The file (.chm) that contains the current topic or destination topic is out-of-date and the link is no longer valid.

    • Remedy: Install the latest version of the MSDN Library.

  • The MSDN Library CD is not in the CD-ROM drive.

    • Remedy: Insert the MSDN Library CD into the CD-ROM drive.


Topic Not Found

No matching topic was found. Some possible reasons and remedies are as follows:

  • The file (.chm) that contains the destination topic is not in the expected location.

    Remedy: Rerun the MSDN Library Setup.

  • The file (.chm) that contains the current topic or destination topic is out-of-date and the link is no longer valid.

    Remedy: Install the latest version of the MSDN Library.

  • The MSDN Library CD is not in the CD-ROM drive.

    Remedy: Insert the MSDN Library CD into the CD-ROM drive.