Start and Kill a 3rd party aplication

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
salamandra
Posts: 311
Joined: Thu Jul 31, 2008 8:33 pm
DBs Used: DBF, MySQL, SQL
Location: Brazil

Start and Kill a 3rd party aplication

Post by salamandra »

Hi to all,
Hope you all and you families are well and safe :)

I need a help regarding how to start and to "kill" a 3rd party application.
I need to start a 3rd party application after my system starts (easy, using EXECUTE) and need to "Kill" this application before shutdown my system.
Any ideia ??



[]´s Salamandra.
There is one time in which is crucial awakening. That time is now. ( Buddha )
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Start and Kill a 3rd party aplication

Post by AUGE_OHR »

hi,

the "easy" Way, to use EXECUTE -> _execute -> ShellExecute did not give you a handle of App which have start.
in this Case you have to "find" Windows to terminate it

Code: Select all

HB_FUNC( FINDWINDOW )
   {
      hb_retnl( ( LONG_PTR ) FindWindow( hb_parc( 1 ),
      hb_parc( 2 ) ) ) ;
   }

Code: Select all

LOCAL nHandle := FINDWINDOW("Title_Of_Window")
   IF !EMPTY(nHandle)
      SendMessage( nHandle, WM_CLOSE, 0, 0 )
   ENDIF
---

better Way i to use CreateProcess() like WAITRUN in c:\hmg.3.4.4\SOURCE\c_winapimisc.c
as i have not made it under harbour (only Xbase++) i can´t tell you hole Way, only Direction.
have fun
Jimmy
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: Start and Kill a 3rd party aplication

Post by bpd2000 »

salamandra wrote: Fri May 29, 2020 1:14 am Hi to all,
Hope you all and you families are well and safe :)

I need a help regarding how to start and to "kill" a 3rd party application.
I need to start a 3rd party application after my system starts (easy, using EXECUTE) and need to "Kill" this application before shutdown my system.
Any ideia ??
[]´s Salamandra.
Visit
https://www.hmgforum.com/viewtopic.php? ... ill#p39513
BPD
Convert Dream into Reality through HMG
User avatar
salamandra
Posts: 311
Joined: Thu Jul 31, 2008 8:33 pm
DBs Used: DBF, MySQL, SQL
Location: Brazil

Re: Start and Kill a 3rd party aplication

Post by salamandra »

Hi AUGE_OHR & bpd2000,
Thank you very much for your help.
I´ll try


[]´s Salamandra.
There is one time in which is crucial awakening. That time is now. ( Buddha )
Post Reply