<div>Point of interest - something basic for me and possibly others to learn.</div>
<div> </div>
<div>I've only ever used unit 'initialization and finalization' "blindly" since Delphi 3 days for Activex / OLE type stuff, as just someting that you have to do - without understanding.</div>
<div> </div>
<div>initialization<br> OleInitialize(nil);<br> </div>
<div>finalization<br> OleUninitialize;</div>
<div> </div>
<div>Otherwise I've used the <strong>onFormComplete</strong> and <strong>onDestroy</strong> to set intial stuff up and then release stuff. </div>
<div> </div>
<div>But I am guessing that <strong>Finailization</strong> is a better place to release stuff (<strong>help avoid memoery leakage under certain circumstances</strong>?), but <strong>Initialization</strong> would have to be used for
<strong>Finalization</strong> to be acceptable..</div>
<div> </div>
<div>I've read the Delphi 2005 help and googled a bit, but am not yet sure just what sorts of code can be put in the Initialization and Finalization.</div>
<ol>
<li>Can anything declared as a unit <strong>VAR</strong> or <strong>CONST</strong> be dealt with or used in Initialization ? it appears so to me from what I see (below).<br></li>
<li>Could I safely .<strong>create</strong> and .<strong>free</strong> objects respectively?</li></ol>
<div>
<div>I was reading through a <strong>Unit</strong> the other day and saw all sorts of things in <strong>Initialization</strong> there that surprised me.</div></div>
<div> </div>
<div>Can any one please point me to a good reference on this, or in our new learning sharing attitude, explain it for every ones benefit here?</div>
<div> </div>
<div>initialization<br> FillChar(BrowserData,SizeOf(BrowserData),#0);<br> OleInitialize(nil);<br> New(PtrWGUID);<br> New(PtrMGUID);<br> New(PtrDGUID);<br> PtrWGUID^:=CGID_WebBrowser;<br> PtrMGUID^:=CGID_MSHTML;<br>
PtrDGuid:=PGUID(nil);<br> GetBrowserData(BrowserData);<br> IEStr:=IEVerStr;<br> OnMessageCompNo:=0;<br><br>finalization<br> Dispose(PtrWGUID);<br> Dispose(PtrMGUID);<br> Dispose(PtrDGUID);<br> OleUninitialize;<br>
<br>end.</div>
<div> </div>
<div> </div>
<div> </div>