Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Kill a process
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00890217
Message ID:
00891140
Vues:
30
Ok, maybe you guys will think I am a not very experienced programmer, and let me tell you that you're totally correct. I know much much less than you all do.Now let me explain what I want, and what I have.
I have an application named Wavelink, it is a set of com objects I am using to develop for wireless devices. what I do is to build an VFP aplication and use the wavelink com's for performing some task in the wireless device. now for effect of what my problem is, this doesn't matter, I just wantedto give you some background.
This wavelink comes with a wavelink server wich is encharged of running the VFP aplication everytime a wireless device makes a call to a particular port. this port in the wavelink server is "linked" to a VFP application or exe. so what the wavelink server does is to create another instance of the exe, thus, if ten devices connect to the wavelink server 10 instances of the vfp exe will be created. got that?
The problem I have is that for any unknonwn reason some vfp application hang and the application remains in the task manager of the server causing the server go out of resource, and / or run out of licences for the wavelink. this causes me lot of problem because all the wireles devices got disconnected becuase of the licences or the application crahsed because the server crashed due to the CPU usage. right?

so far I worked something out, I made a routine that the very first thing it does is to gfet the process ID for the current process or app, then check a table for the existance of the ip of the device. if it is there then check for the Process ID assigned, if it is diferent than the current then first kill the old process and replace the fieldwith the new one. so far so good, this is working just neat. know the problem:
we first were running the wavelink server in a WIN2K server but fue to the problems we thought of moving it to a Win XP professional OS, but the problems remained, so I found an utility tom kill the process, but this only works in XP. now we need to move back the wavelink server to the Win2K, but don't have the Kill thing.

this is the code I am using in XP
**************************************************************************
*:Function to Kill sessions
**************************************************************************
PROCEDURE Verifyprocess

SET EXCLUSIVE OFF
SET DELETED ON 
SET TALK OFF 

SELECT 0
USE \\ck01server\apps\data\wlprocessid order ipaddress SHARED 

LOCAL lnPID, gcTerminalId , WLTerminalInfo

#define SW_SHOW_HIDDEN 0
#define SW_SHOW_NORMAL 1
#define SW_SHOW_MINIMIZED 2
#define SW_SHOW_MAXIMIZED 3

DECLARE INTEGER GetCurrentProcessId IN kernel32
oShell = createobject("WScript.Shell")
lnPID = GetCurrentProcessId()

*:Storing the handHeld IP address
WLTerminalInfo	= CREATEOBJECT("WAVELINKOLE.RFTERMINAL")
gcTerminalId = WLTerminalInfo.TerminalId()

IF SEEK(gcTerminalId,'wlprocessid') THEN 
	IF wlprocessid.ProcessId <> lnPID AND !EMPTY(wlprocessid.ProcessId) THEN 
		oShell.Run("TaskKill /PID " + ALLTRIM(STR(wlprocessid.ProcessId)) + ' /F',SW_SHOW_HIDDEN,.T.)	
	ENDIF 
ELSE 
	APPEND BLANK 
	replace ipaddress WITH gcTerminalId
ENDIF 
replace processid WITH lnPID
USE 

RELEASE lnPID, gcTerminalId , WLTerminalInfo

RETURN 
so back to the main question: how do I do this in Win2K. the name or the caption of the window isn't an option since all the windows have the same name. and they are invisible, they're only seen in the task manager
.......
DO WHILE .T.
      ME.Work()
ENDDO
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform