Board index » delphi » Interface using question

Interface using question

Hi all!

Do you think it is really critical to use

tmpOleInPlaceObject := (OleContainer.OleObjectInterface as
IOleInPlaceObject);
tmpOleInPlaceObject.InPlaceDeactivate;
tmpOleInPlaceObject := nil;

instead of

(OleContainer.OleObjectInterface as
IOleInPlaceObject).InPlaceDeactivate;

I do understand that the second method doesn't call Release on
the specified interface, but for some strange reason it gives no side
effects on my application.

--
/*--------------- INTERFACE Software Solution House -----------------*/
/*                  Igor V. Nechaev  i...@iface.ru                   */
/*           http://www.iface.ru  Phone/FAX +7(343-2) 510-926        */
/*-------------------------------- * --------------------------------*/

 

Re:Interface using question


Both versions behave the same way. Both will properly Release the
IOleInPlaceObject pointer.

have fun
--
Binh Ly
http://www.techvanguards.com

Quote
"Igor Nechaev" <i...@iface.ru> wrote in message

news:3A2497B8.9D9BDE95@iface.ru...
Quote
> Hi all!

> Do you think it is really critical to use

> tmpOleInPlaceObject := (OleContainer.OleObjectInterface as
> IOleInPlaceObject);
> tmpOleInPlaceObject.InPlaceDeactivate;
> tmpOleInPlaceObject := nil;

> instead of

> (OleContainer.OleObjectInterface as
> IOleInPlaceObject).InPlaceDeactivate;

> I do understand that the second method doesn't call Release on
> the specified interface, but for some strange reason it gives no side
> effects on my application.

> --
> /*--------------- INTERFACE Software Solution House -----------------*/
> /*                  Igor V. Nechaev  i...@iface.ru                   */
> /*           http://www.iface.ru  Phone/FAX +7(343-2) 510-926        */
> /*-------------------------------- * --------------------------------*/

Other Threads