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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!d21g2000vbm.googlegroups.com!not-for-mail From: Gautier write-only Newsgroups: comp.lang.ada Subject: Re: kill a process Date: Tue, 22 Sep 2009 12:48:28 -0700 (PDT) Organization: http://groups.google.com Message-ID: <46b358ce-ca3b-4c26-9f31-52040c3a1a1d@d21g2000vbm.googlegroups.com> References: <6eea521f-5113-4982-bf66-066c2c277951@e34g2000vbm.googlegroups.com> NNTP-Posting-Host: 85.3.161.165 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1253648909 28042 127.0.0.1 (22 Sep 2009 19:48:29 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 22 Sep 2009 19:48:29 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d21g2000vbm.googlegroups.com; posting-host=85.3.161.165; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.21 Safari/532.0,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8428 Date: 2009-09-22T12:48:28-07:00 List-Id: 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 : Exi= t_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---- ----------- -- Start -- ----------- procedure Start( File : in String; Parameter : in String :=3D ""; Minimized : in Boolean:=3D False ) is C_Operation : aliased Interfaces.C.Char_Array :=3D Interfaces.C.To_C("open"); C_Executable : aliased Interfaces.C.Char_Array :=3D Interfaces.C.To_C(File); C_Parameter : aliased Interfaces.C.Char_Array :=3D Interfaces.C.To_C(Parameter); -- Parts from Win32Ada: subtype PVOID is System.Address; subtype HANDLE is PVOID; -- winnt.h :144 subtype HWND is HANDLE; -- windef.h :178 subtype HINSTANCE is HANDLE; subtype INT is Interfaces.C.int; -- windef.h -- Exe : HINSTANCE; pragma Warnings(Off, Exe); SW_SHOWNORMAL : constant :=3D 1; SW_SHOWMINIMIZED : constant :=3D 2; sw: constant array( Boolean ) of INT:=3D (SW_ShowNormal, SW_ShowMinimized); function GetFocus return HWND; -- winuser.h:2939 pragma Import (Stdcall, GetFocus, "GetFocus"); subtype CHAR is Interfaces.C.char; type PCCH is access constant CHAR; type PCHAR is access all CHAR; subtype LPCSTR is PCCH; subtype LPSTR is PCHAR; function ShellExecuteA (hwnd0 : HWND; lpOperation : LPCSTR; lpFile : LPCSTR; lpParameters : LPSTR; lpDirectory : LPCSTR; nShowCmd : INT) return HINSTANCE; -- shellapi.h:54 pragma Import (Stdcall, ShellExecuteA, "ShellExecuteA"); -- shellapi.h:54 function ShellExecute (hwnd0 : HWND; lpOperation : LPCSTR; lpFile : LPCSTR; lpParameters : LPSTR; lpDirectory : LPCSTR; nShowCmd : INT) return HINSTANCE renames ShellExecuteA; -- shellapi.h:54 begin Exe :=3D Shellexecute (Hwnd0 =3D> Getfocus, Lpoperation =3D> C_Operation (C_Operation'First)'Unchecked_Access, Lpfile =3D> C_Executable (C_Executable'First)'Unchecked_Access, Lpparameters =3D> C_Parameter (C_Parameter'First)'Unchecked_Access, Lpdirectory =3D> null, Nshowcmd =3D> sw(minimized)); 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!