Welcome, Guest
Username: Password: Remember me
General Purpose Components and Libraries, discussions, problems and suggestions
  • Page:
  • 1

TOPIC:

Invalid variant operation 8 years 10 months ago #7778

  • universe
  • universe's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 122
  • Thank you received: 8
Hello, Migrating from CT5.3 to 5.4 I noticed that the above code doesn't work anymore and raises EInvalidVariantOpError
function GetWin32_PhysicalMediaInfo:string;
const
  WbemUser            ='';
  WbemPassword        ='';
  WbemComputer        ='localhost';
  wbemFlagForwardOnly = $00000020;
var
  FSWbemLocator : OLEVariant;
  FWMIService   : OLEVariant;
  FWbemObjectSet: OLEVariant;
  FWbemObject   : OLEVariant;
  oEnum         : IEnumvariant;
  lw            : LongWord;
begin;
  FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
  FWMIService   := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);
  FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM Win32_PhysicalMedia','WQL',wbemFlagForwardOnly);
  oEnum         := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
  while oEnum.Next(1, FWbemObject, lw) = 0 do
  begin
    try
    result:= FWbemObject.Properties_.Item('SerialNumber').Value;// <------------EXCEPTION
    except
    end;
  end;
end;  
Any hints?

Please Log in or Create an account to join the conversation.

Invalid variant operation 8 years 10 months ago #7779

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4519
  • Thank you received: 1102
Sir on Win 64 bit or win32 bits

This test project work OK on Windows 64 bit (test PC has 5 Hard Disks)
but NOT on Windows 32


PilotLogic Architect and Core Programmer
The following user(s) said Thank You: xcod, universe

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.

Invalid variant operation 8 years 10 months ago #7788

  • universe
  • universe's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 122
  • Thank you received: 8
Sorry for not being precise , it's a 32Bit application, this error is either under Windows Vista (32Bit) or Windows 10 (x64) Build 10240.. I've just tested the 64Bit version and is working well.
Is it a bug? Is there a fix as it was working under CT5.3?
PS: Development platform :Windows 10 x64
Thanks

Please Log in or Create an account to join the conversation.

Last edit: by universe.

Invalid variant operation 8 years 10 months ago #7789

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4519
  • Thank you received: 1102
We don't know yet Sir
we will try to explain and solve this
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

Invalid variant operation 8 years 10 months ago #7831

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4519
  • Thank you received: 1102
Finally we fix this and many Windows API call functions problems like DirectX.
Tested on Win7 and Win10 32 and 64Bits.

It was FreePascal Trunk Problem,
give us 1-2 days to release Lab CT 5.5 for test..
.
PilotLogic Architect and Core Programmer
The following user(s) said Thank You: universe

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.

Invalid variant operation 8 years 10 months ago #7834

  • universe
  • universe's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 122
  • Thank you received: 8
Very good, I'll test when available

Please Log in or Create an account to join the conversation.

Invalid variant operation 8 years 8 months ago #8106

  • universe
  • universe's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 122
  • Thank you received: 8
Problem solved, thanks for your great work

Please Log in or Create an account to join the conversation.

  • Page:
  • 1