Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


UDF to Determine the Fully-Pathed EXE Associated with the NT Module Names

Keywords:   determine the fully-pathed EXE associated with the NT module names

Question:

Is there a way for me to further determine the fully-pathed EXE associated with the NT module names?

Answer:

Hmmm. See if this works for you.
#DefineFunction GetProcessExeFromWindowTitle(wnd)
If WinVersion(4)==4 ; NT
   AddExtender("wproc34i.dll")
   h=DllHwnd(wnd)  ; window title goes in here
   bb=BinaryAlloc(4)
   BinaryEodSet(bb,4)
   dllname=StrCat(DirWindows(1),"user32.dll")
   DllCall(dllname,long:"GetWindowThreadProcessId",long:h,lpbinary:bb)
   p=BinaryPeek4(bb,0)
   BinaryFree(bb)
   modlist=tListMod(p,0)
   firstmod=ItemExtract(1,modlist,@TAB)
   exe=ItemExtract(1,firstmod,"|")
Else
   exe=WinExename(wnd)
EndIf
Return (exe)
#EndFunction


prog=GetProcessExeFromWindowTitle("WinBatch Studio")
Message("",prog)


Exit