Macro in Visual C ++ MFC

xiaoxiao2021-03-06  40

And_catchand_catch and_catch (Exception_Class, Exception _Object_point_name) Description:

Define a code block that is used to get an additional exception type in the current TRY block. Use the Catch Macro to get an exception type, then use the and_catch macro to access the subsequent exception handling code Access an exception object (if appropriate) has obtained more information about the particular reason of the abnormality. Call the Throw_last macro in the and_catch block to move the processing process to the next external exception frame. And_catch tagged the end of the Catch or the AND_CATCH block.

Note: The and_catch block is defined as a C scope (described by the curly brackets). If the user defines a variable in this scope, remember that they can only be accessed in this scope. He also used the exception_Object_point_name variable. AskERT Assert (BooleaneXpression) Description: Calculate the value of the variable. If the value of the structure is 0, then this macro can print a diagnostic message and failure to run. If the condition is not 0, then nothing. The form of diagnostic message is: assertion failed in file in line where Name is a meta file name, NUM is a snap number that is failed in the source file. In the Release version, Assert does not calculate the value of the expression does not interrupt the program. If you must calculate the value of this expression and use Verify instead of ASSERT regardless of the environment. Note: ASSERT can only be described in a debug version: The validity used to detect the internal state of the object. Assert_Valid calls the AssertvalID member function of this object (transfer them as its own variable). Assert_Valid in the release version does not do. In the Debug version, he checks the pointer to check in a different way in NULL and calls the object's own Assertvalid member function. If there is any failure in these tests, he will display a warning message in the same way as Assert. Note: This function is only valid in the Debug version. Begin_MESSAGE_MAP BEGIN_MESSAGE_MAP (THE CLASS, BASECLASS) Description: Use Begin_Message_MAP to start the definition of the user message mapping. In the tool (.cpp) file that defines the user class function, the message map is started with the begin_message_map macro, and then the macro item is added to each message processing function, then the message mapping is completed in an end_MESSAGE_MAP macro. Catch catch (Exception_Class, Exception_Object_pointer_name) Description: Use this to define a code block, which is used to get an exception type in the current TRY block. An exception handling code can access an exception object, how is appropriate, more messages about exceptions. Call the throw_last macro to put the process procedure with an external exception frame, if exception-class is class CEXCEPTIOON, then all exception types will be obtained. Users can use the COBject :: iskindof member function to determine that particular exception is excluded. A best way to get an abnormality is to use the order-to -_catch statement, each with a different exception type. This exception type pointer is defined by macro, and the user does not have to be defined. Note: This CATCH block is defined as a C range (description by the curly bracket). If the user defines a variable in this range, they can access only within the range of eating. He can also use the pointer name of the abnormal object. Debug_new #define new debug_new Description: Help look up memory errors. The user uses debug_new in the program, and the user usually uses the New operator to allocate from the pile. In Debug mode (but define a debug symbol), Debug_New records file names and line numbers for each object it assigns. Then, when the user uses the CMemoryState :: DumpAllObjectsince member function, each place allocated by the object assigned by Debug_new displays the file name and line number.

In order to use Debug_New, you should insert the following instructions in the user's resource file: #define new debug_new Once the user inserts this instruction, the preprocessor will insert debug_new where the NEW is used, while the MFC is operated. But when users compile one release of their programs, Debug_new makes simple New operations and does not produce file names and line number messages. Declare_Dynamic Declare_Dynamic (class_name) Description: But when a class is derived from the COBject, this macro adds access to the access runtime function of an object class. Enclude this module in the .cpp file that you need to access the word class object all in all the .cpp files you need to access the word class object all. If you use DELCARE_DYNAMIC and IMPLEMENT_DYNAMIC macros as described, the user can use the runtime_class macro and the cobject :: iskindof function to determine the object class at runtime. If the declare_dynamic is included in the class definition, the importmetn_dynamic must be included in the class tool. Declare_dyncreate declare_dyncreate (class_name) Description: Use the Declare_Dyncrete macro to allow the COBject derived object to be automatically created at runtime. Host use this feature to automatically create new objects, for example, when it reads an object from disk during serialization, files and views and frame windows should support dynamic establishment because the framework needs to be created automatically. Include the DECLARE_DYNCREATE Macro into the class .h file, then you need to access this type of .cpp file in this object. If DECLARE_DYNCREATE is included in the class definition, the import_dynce must be included in the class tool. DECLARE_MESSAGE_MAP DECLARE_MESSAGE_MAP () Description: Each CCMDTARGET derived class in the user program must provide message mapping to process messages. Use the declare_message_map macro at the end of the class definition. Then, in the .cpp file defined by the class member function, use the begin_message_map macro, the macro of the macro item of each user message processing function and the end_message_map macro. Note: If you define any member after declare_message_map, you must specify a new access type (public, private, protected). DECLARE_SERIAL DECLARE_SERIAL (Class_name) Description: Declare_serial is a C title code that can be used in serialized COBJECT derived classes. Serialization is to read and write a file from one file from one file. Using the Declare_Serial Macro in .h file, this file is included in all .cpp files that need to access such objects. If DECLARE_SERIAL is included in the class definition, the import_serial must be included in the class tool. The Declare_Serial macro contains all the features of all declare_dynamic, import_dycreate. END_CATCH END_CATCH Description: Identify the end of the last Catch or the AND_CATCH block.

END_MESSAGE_MAP END_MESSAGE_MAP Description: end user using macro END_MESSAGE_MAP message mapping definition IMPLEMENT_DYNAMIC IMPLEMENT_DYNAMIC (class_name, base_class_name) Description: to generate the necessary C code to dynamically access class CObject derived class name and location in the structure by the serial operation. Use IMPLEMENT_DYNAMIC macro .CPP file, followed by a result of linking object code IMPLEMENT_DYNCREATE IMPLEMENT_DYNCREATE (class_name, base_class_name) Description: macros used IMPLEMENT_DYNCREATE DECLARE_DYNCREATE macros to allow CObject derived object automatically created at run time. The host uses this feature to automatically establish an object, for example, when it reads an object from the disk during the serialization process, he adds the Implement_DyncReate Macro in the class tool. If the user uses the declare_dynce_dyncreate macro, then use the runtime_class macro and the COBject :: iskindof member function to determine the object class at runtime. If DECLARE_DYNCREATE is included in the definition, IMPLEMENT_DYNCREATE must be included in the class tool. Implement_serial import_serial (class_name, base_class_name, wschema) Description: Dynamic COBJECT derived class access class and location by running in a serial structure to establish the necessary C code. Use the Implement_Serial Macro in the .cpp file, then link the result object code once. ON_COMMAND ON_COMMAND (ID, Memberfxn) Description: This macro is mapped by ClassWizard or manually inserting a message. It indicates that the function will process a command message from a command user interface (such as a menu item or Toolbar button). When a command object accepts a Windows WM_COMMAND message by the specified ID, ON_COMMAND will call the member function MEMBERFXN to process this message. In the user's message map, there should be an ON_COMMAND macro statement for each menu or accelerator command (must be mapped to a message processing function). ON_CONTROL ON_CONTROL (WNOTIFYCODE, ID, MEMBERFXN) Description: Indicates which function will process a regular control representation message. Control identification messages are messages that are sent from one control husband to the mother window. ON_MESSAGE ON_MESSAGE (Message, Memberfxn) Description: Specifies which function will process a user-defined message. User-defined messages are typically defined within WM_USER to 0x7FF. User-defined messages are any messages that are not standard Windows WM_MESSAGE messages. In the user's message map, each must be mapped to a messaging function. User-defined messages should have an on_message macro statement. ON_REGISTERED_MESSAGE (NMESSAGEVARIBLE (MEMBERFXN) Description: The REGISTERWINDOWINDOWSMESAGE function of Windows is used to define a new window message, which is unique in the entire system. This macro indicates which function handles the registered message. Variable NMESSAGEVIABLE should be defined in a NEAR modifier.

ON_UPDATE_COMMAND_UI ON_UPDATE_COMMAND_UI (ID, MEMBERFXN) Description: This macro is usually inserted into a message mapping via ClassWizard to indicate which function will process a user interface change command message. In the user's message map, each user interface changes command (the signal is mapped to a message handler) should have an on_update_command_ui macro statement. ON_VBXEVENT ON_VBXEVENT (WNOTIFYCODE, MEMBERFXN) Description: This macro is usually inserted into a message mapping via ClassWizard to indicate which function will process a message from VBX control. Each VBX control message that is mapped to a messaging function in the user's message map should have a macro statement. Runtime_class runtime_class (class_name) Description: Use this macro to get the runtime structure from the C class. Runtime_class returns a pointer to the CRUNTIMECLASS structure for classes specified by class_name. Only the COBJECT derived class defined by declare_dynamic, declare_dyncreate or declare_serial_DyncReate or Declare_Serial_DyncReate or Declare_Serial_DyncReate or Declare_Serial_Dyncreate or the pointer to a CRUNTIMECLASS structure. Throw throw (Exception_Object_pointer) Description: Distribute an exception. The THrow interrupt program is running to pass the control to the associated CATCH block in the user program. If the user does not provide a Catch block, the control is passed to an MFC module, and he prints an error and terminates run. Throw_last throw_last () Description: This macro allows the user to send a partially established exception. If the user tries to exclude an exception that is discovered, this exception will overflow and deleted. With throw_last, this exception is transmitted directly to the next Catch handler. TRACE TRACE (EXP) Description: Send a formatted string to the dump device, for example, a file or debug monitor, and provides a similar function with Printf. Like the printf of the C program under MS_DOS, the Trace Macro is a convenient form of tracking variable values ​​at the program runtime. In the Debug environment, the Trace macro outputs to AFXDUMP. He doesn't do anything in the Release version. Note: This macro is only valid in the Debug version of the MFC. TRACE0 TRACE0 (EXP) Description: Similar to Trace, but he puts the tracking string in code segment, not DGROUP, so use less DGROUP space. TRACE0 is a variant of a set of tracking macros that can be used to debug output. This group includes trace0, trace1, trace2, and trace3, which differ from the number of parameters taken. Trace0 takes only one format string and can be used for simple text messages. TRACE1 takes a formatted string plus a variable - a variable that will be dump. Similarly, TRACE2, Trace3 takes 2 or 3 parameters (after formatting a string). If the user has used the application's release, it only dumps the data to AFXDUMP. Note: This macro is only valid in the MFC's Debug. TRACE1 TRACE1 (EXP, PARAM1) Description: See Trace0 Trace2 Trace2 (EXP, PARAM1, PARAM2) Description: See Trace0 Trace3 Trace3 (Exp, Param1, Param2, Param3) Description: TRY TRY Description: Use this macro to establish a TRY block. A try recognizes a code block that can exclude exceptions. These exceptions are processed in subsequent Catch and And_CATCH blocks.

转载请注明原文地址:https://www.9cbs.com/read-56576.html

New Post(0)