A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service
Defines a code block to obtain the additional exception types in the current try block. Use the catch macro to obtain an exception type, and then use the and_catch macro to obtain the subsequent exception handling code. You can access the exception object (if appropriate) and have more messages about the special cause of the exception. Call the throw_last macro in the and_catch block to move the processing process to the next External exception framework. And_catch can mark the end of the catch or and_catch block.
The and_catch block is defined as a C ++ scope (described by curly brackets ). If you define variables in this scope, remember that they are only accessible in this scope. It is also used for the prediction_object_pointer_name variable.
Calculates the value of a variable. If the value of the structure is 0, this macro prints a Diagnostic message and fails to run the message. If the condition is not 0, nothing will be done. The diagnosis message is in the form of assertion failed in file in line, where name is the object name, And num is the interrupt Number of the failed operation in the source file. In release, the program is not interrupted if assert does not calculate the expression value. If the value of this expression must be calculated regardless of the environment, use verify instead of assert.
Assert can only be used in debug
Used to check the validity of the internal state of an object. Assert_valid calls the assertvalid member functions of this object (pass them as their own variables ). In release, assert_valid does nothing. In the debug version, it checks pointers in a way different from null and calls the object's own assertvalid member function. If any of these checks fails, a warning message is displayed in the same way as assert.
This function is only valid in debug.
Begin_message_map (the class, baseclass)
Use begin_message_map to start the definition of user message ing. In the tool (. cpp) file that defines user-class functions, start message ing with begin_message_map macro, add macro items for each message processing function, and then use end_message_map macro to complete message ing.
Catch (exception_class, exception_object_pointer_name)
Use this to define a code block, which is used to obtain an exception type in the current try block. The exception handling code can access the exception object. If appropriate, you will receive more messages about the special causes of the exception. Call the throw_last macro to set the processing process as an external exception framework. If exception-class is a class c0000tioon, all Exception types are obtained. You can use the cobject: iskindof member function to confirm that the special exception is excluded. The best way to get exceptions is to use the sequential and_catch statement, each with a different exception type. The pointer to this exception type is defined by a macro, which is not required by the user.
This catch block is defined as a C ++ range (described in curly brackets ). If you define variables in this range, they can only be accessed within the eating range. It can also be used as a pointer to an exception object.
# Define new debug_new
Helps to find memory errors. The user uses debug_new in the program. The user usually uses the new operator to allocate data from the stack. In debug mode (but a debug symbol is defined), debug_new records the file name and row number of each object assigned to it. Then, when you use the cmemorystate: dumpallobjectsince member function, the file name and row number are displayed for each object allocated with debug_new. To use debug_new, insert the following command in the user's resource file: # define new debug_new once the user inserts this command, the Preprocessing Program inserts debug_new where new is used, while MFC does the rest of the work. However, when you compile a release version of your program, debug_new performs a simple new operation without generating file name and row number messages.
However, when a class is derived from cobject, this macro adds the access runtime function for an object class. Add the declare_dynamic macro to the Class header file, and then include this module in all. cpp files that need to access part class objects. If delcare_dynamic and implement_dynamic macros are used as described, you can use the runtime_class macro and cobject: iskindof function to determine the object class during running time. If declare_dynamic is included in the class definition, implemetn_dynamic must be included in the class tool.
Use the declare_dyncrete macro to allow the cobject derived class to automatically create objects at runtime. The host uses this function to automatically create new objects. For example, when it reads an object from the disk during serialization, the file, view, and frame window should support dynamic creation, because the framework needs to be automatically created. Add the declare_dyncreate macro to the. h file of the class, and then include this mode in the. cpp file that needs to access such objects. If declare_dyncreate is included in the class definition, implement_dyncreate must be included in the class tool.
Each csf-target derived class in the user program must provide message ing to process messages. Use the declare_message_map macro at the end of the class definition. Next, use the begin_message_map macro in the. cpp file that defines the class member function, the list under the macro item of each user message processing function, and the end_message_map macro.
If any member is defined after declare_message_map, a new access type (public, private, and protected) must be specified for them ).
Declare_serial generates the necessary C ++ title code for a serializable cobject derived class. Serialization refers to reading and writing the content of an object from a file. Use the declare_serial macro in the. h file, and then include the file in all. cpp files that need to access such objects. If declare_serial is included in the class definition, implement_serial must be included in the class tool. The declare_serial macro contains all the functions of declare_dynamic and implement_dycreate.
The end of the final catch or and_catch block.
Use the end_message_map macro to end your message ing definition.
Implement_dynamic (class_name, base_class_name)
The necessary C ++ code is generated by running the sequence class name and position of the dynamic cobject derived class in the serial structure. Use the implement_dynamic macro in the. cpp file, and then link the result object code
Implement_dyncreate (class_name, base_class_name)
Use the declare_dyncreate macro to use the implement_dyncreate macro to allow the cobject derived class object to be automatically created at runtime. The host uses this function to automatically create an object. For example, when it reads an object from the disk during serialization, it adds the implement_dyncreate macro to the class tool. If you use the declare_dyncreate and implement_dyncreate macros, use the runtime_class macro and cobject: iskindof member functions 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 (class_name, base_class_name, wschema)
The necessary C ++ code is established through the class name and position of the dynamic cobject derived class in the serial structure during runtime. Use the implement_serial macro in the. cpp file, and then link the result object code once.
On_command (ID, memberfxn)
This macro inserts a message ing by classwizard or manually. 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 receives a Windows wm_command message with the specified ID, on_command calls the member function memberfxn to process the message. In user message ing, there should be an on_command macro statement for each menu or accelerator command (which must be mapped to a message processing function.
On_control (wnotifycode, ID, memberfxn)
Indicates which function will process a general control to indicate the message. Control identifies messages that are sent from a controller to the parent window.
On_message (message, memberfxn)
Specifies which function will process a user-defined message. User-defined messages are generally defined within the range of wm_user to 0x7ff. User-defined messages are any messages that are not standard Windows wm_message messages. In user message ing, each message must be mapped to a message processing function. A user-defined message should have an on_message macro statement.
On_registered_message (nmessagevarible, memberfxn)
The registerwindowsmesage function of Windows is used to define a new window message, which is always unique throughout the system. This macro indicates which function processes registered messages. The nmessageviable variable should be defined by the near modifier.
On_update_command_ui (ID, memberfxn)
This macro usually inserts a message ing through classwizard to indicate which function will process a user interface change command message. In the message ing of a user, each user interface change command (which is mapped to a message processing function) should have an on_update_command_ui macro statement.
On_vbxevent (wnotifycode, memberfxn)
This macro usually inserts a message ing through classwizard to indicate which function will process a message from vbx control. In message ing, each vbx Control Message mapped to a message processing function should have a macro statement.
Use this macro to obtain the class structure during runtime from the C ++ class. Runtime_class returns a pointer to the cruntimeclass structure for the class specified by class_name. Only cobject Derived classes defined by declare_dynamic, declare_dyncreate, or declare_serial can return a pointer to a cruntimeclass structure.
The specified exception is sent. Throw interrupts the running of the program and passes the control to the Catch Block related to the user program. If a Catch Block is not provided, the control is passed to an MFC module, which prints an error and terminates the operation.
This macro allows the user to send a local build exception. If you try to exclude a detected exception, the exception will generally overflow and be deleted. Throw_last is used. This exception is directly transmitted to the next catch handler.
Send a formatted string to a dump device, such as a file or debugging monitor, and provide functions similar to printf. Like printf of C program in ms_dos, trace macro is a convenient form of tracking variable values during program running. In the debug environment, the trace macro is output to afxdump. He does not do any work in release.
This macro is only valid in the debug version of MFC.
Similar to the trace, but it places the trace string in the code segment, instead of the dgroup, So it uses less dgroup space. Trace0 is a variant of a group of Trace macros that can be used for debugging and output. This group includes trace0, trace1, trace2, and trace3. These macros differ in the number of parameters they take. Trace0 only takes one formatted string and can be used for simple text messages. Trace1 takes a formatted string and adds a variable -- a variable that will be dumped. Similarly, trace2 and trace3 take two or three parameters respectively (after formatting the string ). If you use the release version of the application, it only dumps data to afxdump.
This macro is only valid in debug of MFC.
Trace1 (exp, param1)
Trace2 (exp, param1, param2)
Trace3 (exp, param1, param2, param3)
Use this macro to create a try block. A try identifies a code block that can exclude exceptions. These exceptions are handled in subsequent catch and and_catch blocks. Transfer is allowed: An exception can be passed to an external try block, ignore them, or use the throw_last macro.
In the debug version of MFC, verify macro calculates its variable value. If the result is 0, a macro prints a Diagnostic message and terminates the program. If the condition is not 0, nothing will be done. Diagnosis can be performed as follows: assertion failed in file in line where name is the name of the source file, and num is the stop row number that fails in the source file. In the release version of MFC, verify calculates the expression value but does not print or stop the program. For example, if the expression is a function call, the call is successful.
Start building with 50+ products and up to 12 months usage for Elastic Compute Service