← Back to team overview

sikuli-driver team mailing list archive

[Bug 1292336] [NEW] Sikuli focuses the wrong application

 

Public bug reported:

focusWinByAppName in WinUtil.cc attempts to use
GetWindowModuleFileName() to search for applications by executable name
but there are multiple bugs in that function:

1. GetWindowModuleFileName() only works for windows owned by the calling
process (i.e. Sikuli itself): http://support.microsoft.com/?id=228469

2. GetWindowModuleFileName() returns a fully-qualified path, and I think
looking for a substring in this path is not a good idea. Instead it
should look at executable filename only, i.e. the last component of the
path.

3. focusWinByAppName does not initialise the "filename" variable and it
does not check to see whether GetWindowModuleFileName() succeeded or
failed, so when it fails the "filename" variable is uninitialised.

One consequence of this is that if I run Sikuli from a path containing
the word "Foo" and then I try to call App.focus('Foo') with the
intention of focusing an application with that word in the title bar,
Sikuli may set the focus to the wrong window, depending on the order of
windows returned by EnumWindows().

I am using Sikuli IDE 1.0.1 on Windows Server 2008 R2 (64-bit).

** Affects: sikuli
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1292336

Title:
  Sikuli focuses the wrong application

Status in Sikuli:
  New

Bug description:
  focusWinByAppName in WinUtil.cc attempts to use
  GetWindowModuleFileName() to search for applications by executable
  name but there are multiple bugs in that function:

  1. GetWindowModuleFileName() only works for windows owned by the
  calling process (i.e. Sikuli itself):
  http://support.microsoft.com/?id=228469

  2. GetWindowModuleFileName() returns a fully-qualified path, and I
  think looking for a substring in this path is not a good idea. Instead
  it should look at executable filename only, i.e. the last component of
  the path.

  3. focusWinByAppName does not initialise the "filename" variable and
  it does not check to see whether GetWindowModuleFileName() succeeded
  or failed, so when it fails the "filename" variable is uninitialised.

  One consequence of this is that if I run Sikuli from a path containing
  the word "Foo" and then I try to call App.focus('Foo') with the
  intention of focusing an application with that word in the title bar,
  Sikuli may set the focus to the wrong window, depending on the order
  of windows returned by EnumWindows().

  I am using Sikuli IDE 1.0.1 on Windows Server 2008 R2 (64-bit).

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1292336/+subscriptions


Follow ups

References