Using White in a Winforms appplication

Jul 31, 2009 at 9:18 AM
Edited Jul 31, 2009 at 10:05 AM

Hi All,

I've set up a White console program and it works OK. I now to need run the same (or similar code) in a Winforms application, however I can't get it to work. The following code works OK in the console application, but when I try to run it in my Winforms app the first line times out:

Dim myWindows As List(Of Core.UIItems.WindowItems.Window) = Desktop.Instance.Windows()

For Each win As Core.UIItems.WindowItems.Window In myWindows
      If InStr(win.Name, RequiredWindowName) > 0 Then
             MyWin = win
             exit for
      End If

I have tried various other methods of getting the widow but with no success, including launching the program with a ProcessStartInfo structure. I have also created a C# winforms test application to see if it was Vb which is causing this problem. I guess my question is does White work in this way or am I doing something Fundamentally wrong?



Jul 31, 2009 at 9:33 AM


you first need the application (all infos in c#)

Application app = Application.Launch("path to the application"); (this starts the application)


you can also use

Application app = Application.Attach("path to the application" ); (if the application is already running)




Window window = app.GetWindow("Name of the Window", InitilizeOption.NoCache);





Jul 31, 2009 at 10:32 AM


Thanks for the prompt response. I've tried both those methods - the launch method works OK in my console application, but works intermittently in the Winforms application. I'll use the launch method for the time being now you have confirmed it should work OK and I'll take a look at the other libraries I'm loading in the application as I think these may be causing my issue - when I converted from the console app to winforms I added a 3rd proprietry libraries which also accesses the aplication I'm testing.