A difference between application->create and NEW
When I wrote the Windows service recently, I happened to encounter a problem. I built a datamodal and then created an object A in the Datamodal OnCreate event with another class A.
A will go to access the global pointer for Datamodal. This is equivalent to the following thing:
It is found that the Datamodal global pointer to a access has the following 2 cases,
If created with Application->createform, a can access the global pointer to Datamodal. That is, create it in the following way:
?
If you create a datamodal global pointer in new mode, it is null at OnCreate.
?
Writing the example below to test it confirms my idea.
?
?
- New project, have a Form1, then put 2 buttons
- Create a new Form2 class and set the startup properties so that Form2 is not actively created.
- Write the following code to the button on the Form1
- Add the following code to the OnCreate event in Form2
- Run the program with the following results:
?
As a result, forms created using the Application->createform method are, indeed, written differently through the new C + + creation.
?
?
?
?
?
?
A distinction between createform and new, mamicode.com "style=" color: _blank and New in >BCB in #ffffff "target=" Application->createform " One of the differences