共用方式為


CWinApp Class Members

Data Members
Construction
Operations
Overridables
Initialization
Command Handlers

Data Members

m_pszAppName Specifies the name of the application.
m_hInstance Identifies the current instance of the application.
m_hPrevInstance Set to NULL in a 32-bit application.
m_lpCmdLine Points to a null-terminated string that specifies the command line for the application.
m_nCmdShow Specifies how the window is to be shown initially.
m_bHelpMode Indicates if the user is in Help context mode (typically invoked with SHIFT+F1).
m_pActiveWnd Pointer to the main window of the container application when an OLE server is in-place active.
m_pszExeName The module name of the application.
m_pszHelpFilePath The path to the application’s Help file.
m_pszProfileName The application’s .INI filename.
m_pszRegistryKey Used to determine the full registry key for storing application profile settings.

Construction

CWinApp Constructs a CWinApp object.

Operations

LoadCursor Loads a cursor resource.
LoadStandardCursor Loads a Windows predefined cursor that the IDC_ constants specify in WINDOWS.H.
LoadOEMCursor Loads a Windows OEM predefined cursor that the OCR_ constants specify in WINDOWS.H.
LoadIcon Loads an icon resource.
LoadStandardIcon Loads a Windows predefined icon that the IDI_ constants specify in WINDOWS.H.
LoadOEMIcon Loads a Windows OEM predefined icon that the OIC_ constants specify in WINDOWS.H.
RunAutomated Tests the application’s command line for the /Automation option. Obsolete.  Use the value in CCommandLineInfo::m_bRunEmbedded after calling ParseCommandLine.  instead.
RunEmbedded Tests the application’s command line for the /Embedding option. Obsolete. Use the value in CCommandLineInfo::m_bRunEmbedded after calling ParseCommandLine. instead.
ParseCommandLine Parses individual parameters and flags in the command line.
ProcessShellCommand Handles command-line arguments and flags.
GetProfileInt Retrieves an integer from an entry in the application’s .INI file.
WriteProfileInt Writes an integer to an entry in the application’s .INI file.
GetProfileString Retrieves a string from an entry in the application’s .INI file.
WriteProfileString Writes a string to an entry in the application’s .INI file.
AddDocTemplate Adds a document template to the application’s list of available document templates.
GetFirstDocTemplatePosition Retrieves the position of the first document template.
GetNextDocTemplate Retrieves the position of a document template. Can be used recursively.
OpenDocumentFile Called by the framework to open a document from a file.
AddToRecentFileList Adds a filename to the most recently used (MRU) file list.
SelectPrinter Selects a printer previously indicated by a user through a print dialog box.
CreatePrinterDC Creates a printer device context.
GetPrinterDeviceDefaults Retrieves the printer device defaults.

Overridables

InitInstance Override to perform Windows instance initialization, such as creating your window objects.
Run Runs the default message loop. Override to customize the message loop.
OnIdle Override to perform application-specific idle-time processing.
ExitInstance Override to clean up when your application terminates.
HideApplication Hides the application before closing all documents.
CloseAllDocuments Closes all open documents.
PreTranslateMessage Filters messages before they are dispatched to the Windows functions and .
SaveAllModified Prompts the user to save all modified documents.
DoMessageBox Implements AfxMessageBox for the application.
ProcessMessageFilter Intercepts certain messages before they reach the application.
ProcessWndProcException Intercepts all unhandled exceptions thrown by the application’s message and command handlers.
DoWaitCursor Turns the wait cursor on and off.
OnDDECommand Called by the framework in response to a dynamic data exchange (DDE) execute command.
WinHelp Calls the WinHelp Windows function.

Initialization

LoadStdProfileSettings Loads standard .INI file settings and enables the MRU file list feature.
SetDialogBkColor Sets the default background color for dialog boxes and message boxes.
SetRegistryKey Causes application settings to be stored in the registry instead of .INI files.
EnableShellOpen Allows the user to open data files from the Windows File Manager.
RegisterShellFileTypes Registers all the application’s document types with the Windows File Manager.
Enable3dControls Enables controls with three-dimensional appearance.
Enable3dControlsStatic Enables controls with a three-dimensional appearance.

Command Handlers

OnFileNew Implements the ID_FILE_NEW command.
OnFileOpen Implements the ID_FILE_OPEN command.
OnFilePrintSetup Implements the ID_FILE_PRINT_SETUP command.
OnContextHelp Handles SHIFT+F1 Help within the application.
OnHelp Handles F1 Help within the application (using the current context).
OnHelpIndex Handles the ID_HELP_INDEX command and provides a default Help topic.
OnHelpFinder Handles the ID_HELP_FINDER and ID_DEFAULT_HELP commands.
OnHelpUsing Handles the ID_HELP_USING command.

See Also   CWinApp OverviewBase Class MembersHierarchy Chart