Author: remi
Date: 2008-09-17 20:36:35 +0200 (Wed, 17 Sep 2008)
New Revision: 1890

Added:
   software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver_start.dpr
   software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver_stop.dpr
Log:
* added the tuxhttperver start and stop delphi source codes

Added: software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver_start.dpr
===================================================================
--- software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver_start.dpr   
                        (rev 0)
+++ software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver_start.dpr   
2008-09-17 18:36:35 UTC (rev 1890)
@@ -0,0 +1,52 @@
+program tuxhttpserver_start;
+
+{$APPTYPE CONSOLE}
+
+uses
+  Windows,
+  SysUtils,
+  shellApi,
+  tlhelp32;
+
+{**
+ *
+ *}
+function KillTask(ExeFileName: string): Integer;
+const
+  PROCESS_TERMINATE = $0001;
+var
+  ContinueLoop: BOOL;
+  FSnapshotHandle: THandle;
+  FProcessEntry32: TProcessEntry32;
+begin
+  Result := 0;
+  FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+  FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
+  ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
+  while Integer(ContinueLoop) <> 0 do
+  begin
+    if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = 
UpperCase(ExeFileName)) or
+         (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then
+    begin
+      Result :=
+        Integer(
+          TerminateProcess(
+            OpenProcess(
+              PROCESS_TERMINATE,
+              BOOL(0),
+              FProcessEntry32.th32ProcessID
+            ),
+            0
+          )
+        );
+    end;
+    ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
+  end;
+  CloseHandle(FSnapshotHandle);
+end;
+
+begin
+  KillTask('pyTDFS.exe');
+  ShellExecute(HWND(nil), nil, 'c:\tuxdroid\bin\python\pyTDFS.exe',
+    'c:\tuxdroid\bin\tuxhttpserver\tuxhttpserver.py', nil, SW_HIDE);
+end.

Added: software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver_stop.dpr
===================================================================
--- software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver_stop.dpr    
                        (rev 0)
+++ software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver_stop.dpr    
2008-09-17 18:36:35 UTC (rev 1890)
@@ -0,0 +1,50 @@
+program tuxhttpserver_stop;
+
+{$APPTYPE CONSOLE}
+
+uses
+  Windows,
+  SysUtils,
+  shellApi,
+  tlhelp32;
+
+{**
+ *
+ *}
+function KillTask(ExeFileName: string): Integer;
+const
+  PROCESS_TERMINATE = $0001;
+var
+  ContinueLoop: BOOL;
+  FSnapshotHandle: THandle;
+  FProcessEntry32: TProcessEntry32;
+begin
+  Result := 0;
+  FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+  FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
+  ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
+  while Integer(ContinueLoop) <> 0 do
+  begin
+    if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = 
UpperCase(ExeFileName)) or
+         (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then
+    begin
+      Result :=
+        Integer(
+          TerminateProcess(
+            OpenProcess(
+              PROCESS_TERMINATE,
+              BOOL(0),
+              FProcessEntry32.th32ProcessID
+            ),
+            0
+          )
+        );
+    end;
+    ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
+  end;
+  CloseHandle(FSnapshotHandle);
+end;
+
+begin
+  KillTask('pyTDFS.exe');
+end.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to