Page 1 of 1 1
Topic Options
#43182 - 2003-07-22 08:04 PM does focus stay set after setfocus
wolfsong Offline
Lurker

Registered: 2003-07-17
Posts: 4
Loc: Vienna, VA
Hi,
My question is when running a script and the script does a setfocus but other things are running on the system which might change the focus on the screen, does the reference set focus to by the script get overridden or does it "remember" where you set the focus in the script. The reason for the question is that one of my friends had started writing a GUIscripter before I discovered this one and had made good use of getting the handles of the different windows which meant by knowing them, you could go from object to object without worrying about the focus on the desktop. Also how does one get to a window which does not have a title (looked at what is there with SPY++ and some don't have titles). If the code has been written correctly you can often tab from button and handle to the next one but if one of the objects hasn't been included, I am not sure how you would get there reliably without using some kind of handle approach. Thanks for the info,
=gerry=

Top
#43183 - 2003-07-22 08:21 PM Re: does focus stay set after setfocus
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
SetFocus() is not an exact science and comes without such guarantees. If at all possible, I would avoid its use. AFAIK you cannot reliably SetFocus() to a window that does not have a title, especially application modal child windows of a parent window.

That said, there is a product called AutoIT that stands head and shoulders above KiX for this sort of thing.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#43184 - 2003-07-22 10:19 PM Re: does focus stay set after setfocus
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
gerry,

What is it you are trying to do? Can you show some code?

Maybe look at some of the RUNDLL options?

RunDLL/RunDLL32

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#43185 - 2003-07-23 01:21 AM Re: does focus stay set after setfocus
wolfsong Offline
Lurker

Registered: 2003-07-17
Posts: 4
Loc: Vienna, VA
Kent,
The question was a generic one since I had been playing with the implementation my friend was write (being his beta tester) and found that I always knew where my commands were being sent since I first acquired the handle to a specific window and no matter what the system did to the screen (as long as the window I wanted to send a command to was not close still worked no matter where the focus was. That was the reason for my question. You are not always guaranteed some user will not leave something running that pops up a dialog box and takes over the focus of the desktop right in the middle of a script which thinks its current focus is on a different window,
=gerry=

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1607 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.057 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org