views:

42

answers:

1

When compiling code without initializing a THandle the Delphi 2009 compiler gives a warning of the variable 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?

+1  A: 

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.

Henk Holterman