A difference between application->createform and New in the BCB

Source: Internet
Author: User

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.

?

?

    1. New project, have a Form1, then put 2 buttons

    2. Create a new Form2 class and set the startup properties so that Form2 is not actively created.

    3. Write the following code to the button on the Form1

    4. Add the following code to the OnCreate event in Form2

    5. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.