RRUZ / wmi-delphi-code-creator

Generate Object Pascal (Delphi, FPC), Oxygene, C++ and C# code to access the WMI
https://theroadtodelphi.wordpress.com/
182 stars 44 forks source link

Overflow while Converting Variant of Type (OLESTR) into type (Integer) #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm having a problem for a long time, this appeared an error with the following 
description "Overflow while Converting Variant of Type (OLESTR) into type 
(Integer)"
I'm using Delphi XE on Windows XP 32 ...

Thank you for your attention

Original issue reported on code.google.com by pr...@novapc.com.br on 20 Aug 2012 at 7:11

GoogleCodeExporter commented 9 years ago
can you attach a copy of the generated code? to reproduce the issue.

Thanks.

Original comment by Rodrigo.Ruz.V@gmail.com on 20 Aug 2012 at 11:03

GoogleCodeExporter commented 9 years ago
ok, is attached ^^
Thanks for your great job

Original comment by joeduard...@gmail.com on 21 Aug 2012 at 12:48

Attachments:

GoogleCodeExporter commented 9 years ago
The issue occurs on this line 

Writeln(Format('Capacity %d',[Integer(FWbemPropertySet.Item('Capacity', 
0).Get_Value)]));// Uint64

because the returned value (which is a Uint64) is cast to a Integer, to fix 
just cast to the UInt64 type

Writeln(Format('Capacity %d',[UInt64(FWbemPropertySet.Item('Capacity', 
0).Get_Value)]));

Original comment by Rodrigo.Ruz.V@gmail.com on 21 Aug 2012 at 5:13

GoogleCodeExporter commented 9 years ago
Thank you, worked perfectly

Original comment by pr...@novapc.com.br on 3 Sep 2012 at 12:09