The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
“Nice” application names
#1
The examples in Samples2 give a good way to put together a list of the currently running applications. Unfortunately, Windows tends to use cryptic names like MSIMN.exe, though.

Is there any good way of getting a human-readable name for each one? The best I have been able to figure out is to check the registry key
"Software\Microsoft\Windows\ShellNoRoam\MUICache"

I have no idea what the part of the registry is supposed to do, but it usually (but not always) gives a readable application name. (This is with Windows XP Home SP1.)

Just in case you’re curious, here’s the macro I’m using this with. Beware that this probably has a memory bug hidden in it — I don’t recommend it for general use.

(It’s meant to be triggered by a mouse click in the upper right corner of the screen, using a filter function. Filter functions are definitely keen. Smile )

---------------------------

#compile "toolhelp"

str theWindowList
int listChoice

spe
;ClearOutput


str s.flags=1; s.all(MAX_PATH)
str sLong.flags=1; sLong.all(MAX_PATH)
str realNameList = ""; realNameList.all(1024)
str appList = ""; appList.all(512)
str realName; realName.all(256)

int n, n2(256), i, hMod, hProcess
int* a

rep()
,a=realloc(a n2*2)
,if( !EnumProcesses(a n2 &n) or n!n2 )
,,break
for i 0 n/4
,hProcess = OpenProcess( PROCESS_QUERY_INFORMATION|PROCESS_VM_READ 0 a[i] )
,if( !hProcess )
,,continue
,if( !EnumProcessModules(hProcess &hMod 4 &n2) )
,,continue
,sLong.fix(GetModuleFileNameEx(hProcess hMod sLong 256))
,;;s.fix(GetModuleFileNameEx(hProcess hMod sLong 256))
,realName = ""
,rget( realName, sLong, "Software\Microsoft\Windows\ShellNoRoam\MUICache" )
,s.fix(GetModuleBaseName(hProcess hMod s 256))
,;;s.getfilename(s)
,CloseHandle(hProcess)
,theWindowList = ""
,GetWindowList( &theWindowList, s, 1+4 )
,if( theWindowList != "" )
,,appList + s
,,;out s
,,;out theWindowList
,,if( realName != "" )
,,,realNameList + realName
,,else
,,,if( find( theWindowList, "[]" ) == -1 )
,,,,realNameList + theWindowList
,,,else
,,,,Substitute(&s, ".exe", "", 1)
,,,,realNameList + s
,,appList + "[]"
,,realNameList + "[]"
free a

if( appList.len == 0 )
,ret
realNameList.left(realNameList realNameList.len-2) ;; Remove the extra CR-LF at the end of the last line
listChoice = PopupMenu( realNameList 0 0 0 1)
if( listChoice != 0 )
,str chosenApp
,chosenApp.getl( appList, listChoice-1 )
,str appWindows
,GetWindowList( &appWindows, chosenApp, 1+4 )
,;out appWindows
,int foundCount
,for( foundCount, 0, 100 )
,,if( findl( appWindows, foundCount ) == -1 )
,,,break
,foundCount - 1
,;out "%i" foundCount
,rep( foundCount )
,,str winName
,,winName.getl( appWindows, foundCount-1 )
,,;out winName
,,act( win( winName "" chosenApp ) )
,,foundCount - 1
9: ) Lindsey Dubb


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)