| |

VerySource

 Forgot password?
 Register
Search
View: 809|Reply: 7

Problems with instance handles

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-11 11:30:01
| Show all posts |Read mode
The actual value of the instance handle is the basic address space used by the system when loading the image of the executable into the address space of the process.

Isn't the address space of the process independent? Why is the value of the instance handle unique?

How do you understand
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-4-8 08:15:01
| Show all posts
The actual value of the instance handle is the basic address space used when the system loads the image of the executable file into the address space of the process.
------------------------------------

Who told you that?

The instance handle is a 32-bit unsigned integer. Its actual value is not necessary to care about it.
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-4-8 17:15:01
| Show all posts
Just like a country, each person ’s ID card number is different. If there are duplicates, the identification of the population will be wrong, and the system will be the same, just like defining an object:
CDialog dlg1;
CDialog dlg2;

It is absolutely impossible for their object columns to be the same!
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-4-9 00:30:01
| Show all posts
The core programming said that it seems to be wrong
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-4-9 15:00:01
| Show all posts
The core programming said that it seems to be wrong
--------------------------------

I have also read this book, and I have no impression of what you said
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-4-9 17:30:01
| Show all posts
The real column handle is needed in some occasions. For example, to obtain the path and file name of the real column, if I have two QQ.exe, one in C: the other in D :, I start both A QQ.exe program, and I want to get their respective file paths in the program. If the instance handle values ​​of the two executable files are the same, who gets the path? Of course this is impossible!

TCHAR szPath [MAX_PATH];
GetModuleFileName (GetModuleHandle (NULL), szPath, MAX_PATH);
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-4-10 12:00:01
| Show all posts
No matter what book you read, as long as you can understand the meaning of this instance, the system is used to manage these instances of the execution program, which is also a unique identifier.
Reply

Use magic Report

0

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-4-17 22:15:01
| Show all posts
// The actual value of the instance handle is the basic address space used when the system loads the image of the executable file into the address space of the process.

I think this sentence is correct. The actual value here refers to the instance that the operating system assigns to the instance when the executable file is executed to uniquely identify it.

// The instance handle is a 32-bit unsigned integer. Its actual value is not necessary to care about it.
In VC programming, the instance handle is indeed a 32-bit unsigned integer
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list