Ask a Question

Connected Application C# Keys method

Occasional Contributor

Connected Application C# Keys method



I created a windows form application (connected application) and im trying to execute the code below:

Sys["Process"]("notepad")["Window"]("Notepad")["Window"]("Edit")["Click"](459, 242);

The first and second line run, but i got an exception when trying to send the Keys method.


The exception that is thrown by methods invoked through reflection.


How can i use Keys method on connnected application? 

If i execute the code on testcomplete, it runs all lines.

Community Hero

I will need to see the rest of the code that connects on the Winforms side to be able to help more.

I have 2 recommendations and hope they help:

1- Connected Apps has been deprecated and obsolete for 6 years in TestComplete, the last Visual studio that was supported was VS 2013.  I would recommend you use TestLeft instead in Visual Studio.

2- Using C#Script in TestComplete is a mistake, I don't recommend it and most people that used it confirm my observation




Occasional Contributor

Thank for reply, but your answer is useless.

I am using visual studio 2013.


TestLeft has some bugs yet. I am wainting the develeopers fixes.

Suport send me this mesage about TestLeft:

"The developers have registered a bug for copying the identification, it should be fixed in one of the following releases"


So, why cant i use Keys method on a edit by connected application?




My apology for my useless answer, I was just trying to help.


If you can send me the code of the Winforms app, I promise to look at it.

The setfocus and the Click are functions of the Edit Control in Windows and were found using .NET reflection at runtime by the compiler.  Keys on the other hand is a TestComplete function that runs against the Edit control.

There are 3 different ways of connecting apps, I can't tell what you are doing by the 3 lines you sent, that is why I asked for more info.


Thanks and sorry for wasting your time.


Occasional Contributor

Thank you again for helping.


I uploaded win forms code.



Can you also please send the C:\Testes\Minicurso\ControleTransportadora.pjs?



Occasional Contributor

Its a empty project to store log, do you need it ?

No thanks, if it is empty.  I wanted to make sure that there is nothing there affecting the outcome.


I will get back to you in few hours, I am teaching the TestComplete class till 1:00 pm EST today




It is not going to work, sorry

First of all, I have Visual Studio 2019 and also 2017 and none of these 2 will run the project at all because of the line that says Connect.TC["Visiable"] = true; that code will only run by maximum in Visual Studio 2013.

Error: Cannot implicitly convert type 'bool' to 'AutomatedQA.script.var.VarDelegate' 


I was curious why, so I reversed engineer the assembly AutomatedQA.TestComplete.CSConnectedApp.dll

Within few minutes, I figured out why ConnectedApps have been obsolete and no longer supported for the last 6 years. It is just a pure mess how they were marshelling the types.

As I said earlier, I do not recommend the use of ConnectedApps and I am sorry if that answer is useless again to you.

My recommendation is for you to use the TestComplete TypeLibrary for 64 bit and use the Integration Object to execute the tests


// Obtains ITestCompleteCOMManager
// TestComplete.ITestCompleteCOMManager TestCompleteManager = (TestComplete.ITestCompleteCOMManager)TestCompleteObject;
// // Obtains Integration object
// TestComplete.ItcIntegration IntegrationObject = TestCompleteManager.Integration;

// // We have a reference to the integration object.
// // Now we can use its methods and properties to automate TestComplete.

// // Loads the project suite
// IntegrationObject.OpenProjectSuite("C:\\TCTests\\Valenca.pjs");

and go from there...




Occasional Contributor

Thank you, but its not the answer.

I want to know why i cant use edit Keys method. Why i got acess violation.

Showing results for 
Search instead for 
Did you mean: