Here's the code I have ATM
#constant USER32DLLNUMBER 201
#constant WM_CLOSE 0x0010
InitialiseUser32DLL()
W=FindWindowByName("Untitled - Notepad")
if W <> 0 then PostMessage(W, WM_CLOSE, 0, 0)
ShutdownUser32DLL()
end
function InitialiseUser32DLL()
load dll "user32.dll", USER32DLLNUMBER
endfunction
function ShutdownUser32DLL()
delete dll USER32DLLNUMBER
endfunction
function PostMessage(Window as dword, Message as dword, WParam as dword, LParam as dword)
r as dword
r=call dll(USER32DLLNUMBER, "PostMessageA", Window, Message, WParam, LParam)
endfunction r
function FindWindowByName(WindowName as string)
Window as dword
Window=call dll(USER32DLLNUMBER, "FindWindowA", 0, WindowName)
endfunction Window
function FindWindowByClass(ClassName as string)
Window as dword
Window=call dll(USER32DLLNUMBER, "FindWIndowA", ClassName, 0)
endfunction Window
function FindWindow(ClassName as string, WindowName as string)
Window as dword
Window=call dll(USER32DLLNUMBER, "FindWIndowA", ClassName, WindowName)
endfunction Window
You need to know the window title or window class name or both at the moment I'm afraid. I will be following up on Solo's post to find out how to trace an app by executable name.