I am attempting to write a small app, that has a feature of ""Switching" to a given window that is already open on my computer. Let's just for the example say, that I have a Notepad window open on my system. My app scrolls through all the Children windows of the desktop, and finds the one for Notepad. I then let it derive the handle for that window. So far, the app works just fine.
The problem arises when I try to Activate, and Focus the newly found Window. I have been looking on a couple of other apps, that I thought could have lead me in right direction, but without any luck (they simply got too complicated for my brain). Then also, I have been spending a couple of hours with that App developers Reference under the Help menu in WE. Still I don't grasp why my app won't switch to the found window. Here is the troublesome code, that I cannot get to work. What am I doing wrong? Maybe I am totally astray here? Thanks for your feedback: Dim WinHandle ' My app search for the window I want, and fills in this variable with the Window Handle, just fine. I won't copy that few lines here. ' Then comes the section I apparently have got wrong: Sleep 2000 'Just tried to give the app enough time here. dim FWin: Set FWin = Desktop.Children.Find( WinHandle ) ' This line, I thought, would find the correct window, and make it ready for activation. FWin.Overlap.Activate ' To Activate the Window, or it's Overlap. FWin.Focus ' I had hoped, this would have focused me on the actual window. But such is not the case. Sleep 1000 ' A last sleep command, just to let things settle. End of code snip
