Forum Discussion

moriyasa's avatar
moriyasa
Occasional Visitor
10 years ago

unexpected window handler via c# project

Hi ,

 

I am trying to use the event handler for Unexpected window but having trouble making it work.

I have a project written in c# which uses the TestComplete dll's, I want now to be able to handle the unexpected window using the listener .

so after a small searching I found that I need to create a winform (and make it invisible since I dont want it to be shown)

,create the test complete event and implementing the "OnUnexpectedWindow" which has been created. 

But I cant figure out how it is suppose to work in order to do the implementation I have written in the handler every time a unexpected window shows up ? do I need to connect some how the winform?  

please I need more clarification on the process of connecting this handler to my project 

Thank you!

1 Reply

  • Hi,

     

    Generally, you don't need any special form to create an event handler. It's just that you have to have a window, e.g. the main window of your connected application, to drag the event from Toolbox to. I recommend that you follow the suggestions from this article to create event handlers in C# applications.

     

    Also, I think it can be helpful for you to look through one of the samples shipped along with TestComplete. You can find it in the <Users>\Public\Public Documents\TestComplete 11 Samples\Desktop\Connected Applications\Events\C# folder.