WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Process UDFs

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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

Keywords:   WINEXENAME 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("wwprc44I.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

Article ID:   W15726
File Created: 2013:04:01:09:22:00
Last Updated: 2013:04:01:09:22:00