How to pass onscreen object handle to dot net assembly
I am using 3.09.3089 version of TestComplete.
I am testing dotNet application that is using Infragistics controls. I have added the assembly in dotNetBridge Option->References. [The assembly is not present in GAC so I have added it using browse button.]
Now I want to map an onscreen object to Infragistics tree control.
One solution I have found to this is to assign a value to handle variable present in .NET Assembly (eg altrawintree.handle) and assign oncreeen object handle (oncreentree.handle) to this.
dotNET["Infragistics_Win_UltraWinTree_v4_3"]["Infragistics_Win_UltraWinTree_UltraTree"]["ctor"]()["Handle"] = Sys["Process"]("ApplicationName")["MainApp"]["treeJobs"]["Handle"]
But I am getting invalid type case error while doing this.
Invalid cast from System.Int32 to System.IntPtr
Member name: Handle
Onscreeen.handle returns system.int32 and assembly variable altrawintree.handle is of type System.IntPtr.
Is there any way to type cast int32 to intptr.
Or is there any way to directly change WndClass of onscreenobject?
Wndclass of onscreentree is WindowsForms10.Window.8.app6d And I want to change it to Infragistics_Win_UltraWinTree_UltraTree
Re: How to pass onscreen object handle to dot net assembly
As far as I know, our Support Team has already answered your email massage with a similar question.
Please give them more information on your problems with this control - they will try to help you.
BTW, here is a sample script that works with the UltraTree control.
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[JScript]
var p = Sys.Process("UltraTree Appearances CS"
var w = p.Form1
var tree = w.AppearanceTree
var node = FindNodeByPath(tree, "Control\\NodeLevel 2\\Overrides\\Appearances"
tree.DblClick((node.Bounds.Left + node.Bounds.Right ) / 2,
(node.Bounds.Top + node.Bounds.Bottom) / 2)
function FindNodeByPath(tree, node_name)
var node = tree
while (node_name.length > 0)
var p = node_name.indexOf("\\"
if (p == -1) p = node_name.length
var item_name = node_name.substr(0, p)
node_name = node_name.substr(p + 1)
var found = false
for (var i = 0; i < node.Nodes.Count; i++)
if (node.Nodes.get_Item(i).Text == item_name)
node = node.Nodes.get_Item(i)
if (node_name != "" node.Expanded = true
found = true
if (! found)
Log.Error("The node is not found: " + item_name)
}</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">The above script works with the 'UltraTree Appearances CS' sample shipped with the Infragistics controls package. The script double-clicks a tree node that was specified by its full path.
Save on AutomatedQA Products