WHICHWIN - filter for Window Handle

#1
Hi Vince,
Would it be possible to add an option to WHICHWIN so that I can filter by the Window Handle?
Code:
Filters:

  /E | /D       enabled | disabled windows only
  /V | /I       visible | invisible windows only
  /P pid        decimal or hex prefixed with "0x"
  /M module     case-insensitive substring match on fully-qualified name
  /C class      case-insensitive substring match
  /T title      case-insensitive substring match
                "quote" strings containing spaces
...maybe...
Code:
/W handle     case-insensitive substring match
Joe
 
#2
It's certainly possible but I'm reluctant to do so. It doesn't seem very useful. A one-time, non-time-critical (and rather unusual) problem like the one in the support forum can be solved with
Code:
whichwin /r > file
and then opening the file in an editor and searching for the handle.

Do you have a more general use for it?
 
#3
A few years back, I wrote a plugin in 32-bit PowerBASIC, in which I had the function FindWindowName.

Passing the hWnd returned the WindowName.

As PowerBASIC does not have a 64-bit version, I made a stand-alone 32-bit FindWindowName.exe, which I use in a few .BTMs

I can also use something like the following;
Code:
@setlocal
@echo off
iff PLUGIN sysutils then
  ::Next Sentence
else
  plugin /l c:\utils\sysutils64.dll
endiff
whichwin /F ht > whichwin.txt
set LineCount=0

::set CmdhWnd=0x00330E54
iff %# eq 0 then
  echo USAGE: %0 0x00330E54
  quit
else
  set CmdhWnd=%1
endiff

do theline in @whichwin.txt
  set LineCount=%@eval[%LineCount+1]
  iff %@left[2,%theline] eq 0x then
    iff %@word[0,%theline] eq %CmdhWnd then
      echo The Window Title for %@word[0,%theline] is "%@line[whichwin.txt,%LineCount]"
     quit
   endiff
  endiff
enddo
if exist whichwin.txt del /q whichwin.txt
endlocal
Joe