When is the global variable hinstance assigned?

Source: Internet
Author: User
When learning resource files and hook functions, we often use the global variable of the current module handle (hinstance). Today I want to know when it assigns a value.

Enter hinstance; "Ctrl + mouse" to find its declaration: Row 29th of the sysinit unit (Delphi 2007)-hinstance: longword;
It seems that the hidden unit of Delphi is not just system. Pas, but also sysinit. Pas.

In row 658 of the sysinit unit, find its value assignment statement: hinstance: = getmodulehandle (NiL );
Is in the process of _ initexe.

ThatProgramWhen is the _ initexe method executed?

Debugging with F7 one by one... cannot be found!

Check project-> options-> compiler-> use DEBUG dcus, and then use F7 to debug the code one by one:

The original program came to the sysinit unit to execute the _ initexe method before executing application. initialize!

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.