CreateOleObject in a 64-bit Delphi program?
delphi, delphi-xe7, ole
Solution
Although the source code for `Vcl.OleAuto` is still supplied, the 64 bit `lib` directory does not include `Vcl.OleAuto.dcu`. Instead you are expected to use `System.Win.ComObj` and/or `System.Win.ComServ`. Note that the source for `Vcl.OleAuto` marks that unit as being deprecated, and tells you what to use instead.
If we look through the source for `Vcl.OleAuto` we can find some 32 bit asm code that has not been ported. Presumably Embarcadero decided not to port this to 64 bit because the unit is deprecated.
Problem
In a Delphi XE7 64-bit VCL program, the unit `Vcl.OleAuto`cannot be found: `[dcc64 Fatal Error] Unit1.pas(33): F1026 File not found: 'Vcl.OleAuto.dcu'` While it works without problems in a 32-bit program: ``` uses Vcl.OleAuto; ... FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); ``` So how can I use `CreateOleObject` in a 64-bit program?