Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazarus 1.8.4 FPC 3.0.4. #20

Open
lexe2017 opened this issue Nov 29, 2018 · 0 comments
Open

Lazarus 1.8.4 FPC 3.0.4. #20

lexe2017 opened this issue Nov 29, 2018 · 0 comments

Comments

@lexe2017
Copy link

Lazarus 1.8.4 FPC 3.0.4.
ActiveX issue when using WMIDephiCodeCreator.
Also found it in the old closed issues on a different version.

The code (WMI delphi code creator).

procedure GetWin32_ComputerSystemInfo;
const
WbemUser ='';
WbemPassword ='';
WbemComputer ='localhost';
wbemFlagForwardOnly = $00000020;
var
FSWbemLocator : OLEVariant;
FWMIService : OLEVariant;
FWbemObjectSet: OLEVariant;
FWbemObject : Variant;
oEnum : IEnumvariant;
sValue : string;
begin;
FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
FWMIService := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);
FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM Win32_ComputerSystem','WQL',wbemFlagForwardOnly);
oEnum := IUnknown(FWbemObjectSet.NewEnum) as IEnumVariant;
while oEnum.Next(1, FWbemObject, nil) = 0 do
begin
sValue:= FWbemObject.Properties.Item('Model').Value;
Writeln(Format('Model %s',[sValue]));// String

Writeln('');
FWbemObject:=Unassigned;
end;
end;

Compiler log:

Free Pascal Compiler version 3.0.4 [2018/05/19] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling C:\FPC\FPC\test_delphi.pp
test_delphi.pp(47,39) Error: Call by var for arg no. 3 has to match exactly: Got
"Pointer" expected "LongWord"
test_delphi.pp(69,4) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant