开发者

Initialization in Delphi

开发者 https://www.devze.com 2023-01-10 16:39 出处:网络
When compiling code without initializing a THandle the Delphi 2009 compiler gives a warning of the va开发者_开发百科riable not being initalized. Is there any need to initialize these THandles? If you

When compiling code without initializing a THandle the Delphi 2009 compiler gives a warning of the va开发者_开发百科riable not being initalized. Is there any need to initialize these THandles? If you need to init. them do you need to also free a THandle when you no longer need it?


You can initialize with 0 or nil, and then you don't need to Free anything.

But you'll normally want to put a 'real' handle in it, and the you usually have to Free/Close it again. The details depend on the API in question.

0

精彩评论

暂无评论...
验证码 换一张
取 消