is there any way to close an application from within hb application

113 views
Skip to first unread message

kosh...@gmail.com

unread,
Dec 3, 2024, 4:47:18 AMDec 3
to Harbour Users
is there any way to close an application from within hb application 

hmpaquito

unread,
Dec 3, 2024, 5:37:17 AMDec 3
to Harbour Users
taskkill.exe

diego...@gmail.com

unread,
Dec 3, 2024, 5:38:59 AMDec 3
to Harbour Users
// Usage: taskkiller.exe <taskname.exe>
// cTask is the name of the task to kill. Include the .exe extension if needed

FUNCTION Main( cTask )  

   LOCAL cCommand := "taskkill /IM " + cTask + " /F"
   LOCAL cStdOut := ""

   IF Empty( cTask )
      ? "use: taskkiller.exe <taskname>"
   ELSE
      IF hb_processRun( cCommand,, @cStdOut ) != 0
         ? cStdOut
      ELSE
         ? "Task " + cTask + " killed"
      ENDIF
   ENDIF

RETURN

roberto....@gmail.com

unread,
Dec 3, 2024, 9:33:46 AMDec 3
to Harbour Users
Hi,
you can also use getTasks() to check if there are multiple processes running with the same name

Roberto
Reply all
Reply to author
Forward
0 new messages