Could not convert variant of type (Null) into type (OleStr)

后端 未结 4 1291
离开以前
离开以前 2021-02-09 15:14

Do you know why the block of code bellow will negate the \"Could not convert variant of type (Null) into type (OleStr)\" on some computers, not all of them but 3 out of ten comp

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-09 15:31

    Sometimes, the FWbemObject is not NULL but an exception is raise : "Can'nt convert an Array of Variant in OleStr "

    As exemple : the BiosVersion (is an array) To solve it, try this :

    for I := VarArrayLowBound(FWbemObject.BIOSVersion, 1) to VarArrayHighBound(FWbemObject.BIOSVersion, 1) do L.Add( VarToStr(FWbemObject.BIOSVersion[i]) );

    Regards

    Zerrouki

提交回复
热议问题