From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!p15g2000vbl.googlegroups.com!not-for-mail From: Pablo Newsgroups: comp.lang.ada Subject: Re: kill a process Date: Wed, 23 Sep 2009 07:02:50 -0700 (PDT) Organization: http://groups.google.com Message-ID: <3b7b70f3-29b7-4542-a5a3-2f83e3c19519@p15g2000vbl.googlegroups.com> References: <6eea521f-5113-4982-bf66-066c2c277951@e34g2000vbm.googlegroups.com> <46b358ce-ca3b-4c26-9f31-52040c3a1a1d@d21g2000vbm.googlegroups.com> NNTP-Posting-Host: 201.7.145.1 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1253714570 8900 127.0.0.1 (23 Sep 2009 14:02:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 23 Sep 2009 14:02:50 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p15g2000vbl.googlegroups.com; posting-host=201.7.145.1; posting-account=n9Sa1woAAACZc_iwSjaEkj9Lnt-XVrSr User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8436 Date: 2009-09-23T07:02:50-07:00 List-Id: On 22 set, 16:48, Gautier write-only wrote: > On 22 sep, 20:43, Pablo wrote: > > > On 21 set, 20:45, tmo...@acm.org wrote: > > > > >How can I kill a Windows process in Ada? > > > > =A0 type Process_Handles is new Interfaces.C.Unsigned; > > > =A0 type Exit_Codes is new Interfaces.C.Unsigned; > > > =A0 type Bool is new Interfaces.C.Int; > > > > =A0 function TerminateProcess(Process =A0 : Process_Handles; > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Exit_Code : E= xit_Codes) return Bool; > > > =A0 pragma Import(StdCall, TerminateProcess, "TerminateProcess"); > > > Thanks!! > > Now do you know how can I start two non-exiting Windows process in > > paralell ? (something like command "&" in unix...) > > -->8------>8------>8------>8------>8------>8------>8---- > =A0 ----------- > =A0 -- Start -- > =A0 ----------- > > =A0 procedure Start( > =A0 =A0 File =A0 =A0 =A0 : in String; > =A0 =A0 Parameter =A0: in String :=3D ""; > =A0 =A0 Minimized =A0: in Boolean:=3D False > =A0 ) > =A0 is > > =A0 =A0 C_Operation =A0: aliased Interfaces.C.Char_Array :=3D > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Interfaces.C.To_C(= "open"); > =A0 =A0 C_Executable : aliased Interfaces.C.Char_Array :=3D > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Interfaces.C.To_C(= File); > =A0 =A0 C_Parameter =A0: aliased Interfaces.C.Char_Array :=3D > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Interfaces.C.To_C(= Parameter); > =A0 =A0 -- Parts from Win32Ada: > =A0 =A0 subtype PVOID is System.Address; > =A0 =A0 subtype HANDLE is PVOID; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-= - =A0winnt.h :144 > =A0 =A0 subtype HWND is HANDLE; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 -= - =A0windef.h :178 > =A0 =A0 subtype HINSTANCE is HANDLE; > =A0 =A0 subtype INT is Interfaces.C.int; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0-- =A0windef.h > =A0 =A0 -- > =A0 =A0 Exe : HINSTANCE; > =A0 =A0 pragma Warnings(Off, Exe); > =A0 =A0 SW_SHOWNORMAL =A0 =A0: constant :=3D 1; > =A0 =A0 SW_SHOWMINIMIZED : constant :=3D 2; > =A0 =A0 sw: constant array( Boolean ) of INT:=3D > =A0 =A0 =A0 (SW_ShowNormal, > =A0 =A0 =A0 =A0SW_ShowMinimized); > =A0 =A0 function GetFocus return HWND; =A0 =A0 =A0 =A0 =A0 =A0 =A0-- =A0w= inuser.h:2939 > =A0 =A0 pragma Import (Stdcall, GetFocus, "GetFocus"); > =A0 =A0 subtype CHAR is Interfaces.C.char; > =A0 =A0 type PCCH is access constant CHAR; > =A0 =A0 type PCHAR is access all CHAR; > =A0 =A0 subtype LPCSTR is PCCH; > =A0 =A0 subtype LPSTR is PCHAR; > =A0 =A0 function ShellExecuteA > =A0 =A0 =A0 (hwnd0 : HWND; > =A0 =A0 =A0 =A0lpOperation : LPCSTR; > =A0 =A0 =A0 =A0lpFile : LPCSTR; > =A0 =A0 =A0 =A0lpParameters : LPSTR; > =A0 =A0 =A0 =A0lpDirectory : LPCSTR; > =A0 =A0 =A0 =A0nShowCmd : INT) > =A0 =A0 =A0 return HINSTANCE; =A0 =A0 =A0 =A0 =A0 =A0 =A0 -- =A0shellapi.= h:54 > =A0 =A0 pragma Import (Stdcall, ShellExecuteA, "ShellExecuteA"); =A0 -- > shellapi.h:54 > =A0 =A0 function ShellExecute > =A0 =A0 =A0 (hwnd0 : HWND; > =A0 =A0 =A0 =A0lpOperation : LPCSTR; > =A0 =A0 =A0 =A0lpFile : LPCSTR; > =A0 =A0 =A0 =A0lpParameters : LPSTR; > =A0 =A0 =A0 =A0lpDirectory : LPCSTR; > =A0 =A0 =A0 =A0nShowCmd : INT) > =A0 =A0 =A0 return HINSTANCE > =A0 =A0 =A0 renames ShellExecuteA; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 -- =A0shellapi.h:54 > =A0 begin > =A0 =A0 Exe :=3D Shellexecute > =A0 =A0 =A0(Hwnd0 =A0 =A0 =A0 =A0=3D> Getfocus, > =A0 =A0 =A0 Lpoperation =A0=3D> C_Operation > (C_Operation'First)'Unchecked_Access, > =A0 =A0 =A0 Lpfile =A0 =A0 =A0 =3D> C_Executable > (C_Executable'First)'Unchecked_Access, > =A0 =A0 =A0 Lpparameters =3D> C_Parameter > (C_Parameter'First)'Unchecked_Access, > =A0 =A0 =A0 Lpdirectory =A0=3D> null, > =A0 =A0 =A0 Nshowcmd =A0 =A0 =3D> sw(minimized)); > =A0 end Start; > -->8------>8------>8------>8------>8------>8------>8---- > HTH > _________________________________________________________ > Gautier's Ada programming --http://sf.net/users/gdemont/ > NB: For a direct answer, e-mail address on the Web site! Thanks, Gautier, it was exactly what I was looking for.