Forum Discussion

arnold_preg's avatar
arnold_preg
New Contributor
11 years ago

Casting VarDelegate to C# type

Hi,



Given I have this code snippet in C#:

int hwnd = Sys["Process"]("DubQuest")["Find"]("Name", "VCLObject(\"AdvPageControlBase\")", 100)["Handle"];

It generates runtime error because specified cast is not valid. How could I accomplish this type casting?

2 Replies

  • Hi Tanya,



    Sadly your solution does not seem to work, but I figured out that my problem is basically the same as this guy's here. However I don't know how should I apply the given solution in my case. Could you clarify that to me?



    I tried this way:

    AutomatedQA.script.var controlBase = Sys["Process"]("DubQuest")["Find"]("Name", "VCLObject(\"AdvPageControlBase\")", 100);

    int hwnd = aqConvert["VarToInt"](controlBase["Handle"]());

    but it gives 0 value to hwnd.