>How can I programmatically determine which application (window title)is running on my desktop?
>
Use GetForeGroundWindow() to get the hWnd of the Foreground Window, and use the hWnd to call GetWindowText() to retrieve the title bar text:
DECLARE INTEGER GetForegroundWindow IN WIN32API
DECLARE INTEGER GetWindowText IN WIN32API INTEGER hWnd, STRING @ lpString, INTEGER nMaxCount
lpTitle = REPL(CHR(0),512)
=GetWindowText(GetForegroundWindow(),@lpTitle,511)
cWindowTitle=LEFT(lpTitle,AT(CHR(0),lpTitle)-1)
>How can I could programmatically close\Alt+F4 running application?
You can use SendMessage() to send a WM_QUIT message to the main Window of the application, and if that doesn't work, get a process handle to the application and invoke TerminateProcess() through the API.