Partager via


CWinApp::RegisterShellFileTypes

Call this member function to register all of your application's document types with the Windows File Manager.

void RegisterShellFileTypes(
   BOOL bCompat = FALSE 
);

Parameters

  • bCompat
    TRUE adds registration entries for shell commands Print and Print To, allowing a user to print files directly from the shell, or by dragging the file to a printer object. It also adds a DefaultIcon key. By default, this parameter is FALSE for backward compatibility.

Remarks

This allows the user to open a data file created by your application by double-clicking it from within File Manager. Call RegisterShellFileTypes after you call AddDocTemplate for each of the document templates in your application. Also call the EnableShellOpen member function when you call RegisterShellFileTypes.

RegisterShellFileTypes iterates through the list of CDocTemplate objects that the application maintains and, for each document template, adds entries to the registration database that Windows maintains for file associations. File Manager uses these entries to open a data file when the user double-clicks it. This eliminates the need to ship a .REG file with your application.

If the registration database already associates a given filename extension with another file type, no new association is created. See the CDocTemplate class for the format of strings necessary to register this information.

Requirements

Header: afxwin.h

See Also

Concepts

CWinApp Class

CWinApp Members

Hierarchy Chart

CDocTemplate Class

CWinApp::EnableShellOpen

CWinApp::AddDocTemplate