English
Source / code snippets

active Exe Process Verify

 
Michael Dell
whether a EXE carryed out becomes sees one herewith:
CompileMarkSeparation
Suchen und beenden von Prozessen (Programmen)
1.) Parameter = DateiName$ (ohne Pfad)
2.) Parameter = 0 - Prozess nicht beenden / 1 - Prozess beenden  (falls vorhanden)
Autor: nicht bekannt!
Bearbeitet: Michael Dell
Def ProcessSnapshot(2)  !KERNEL32.DLL,CreateToolhelp32Snapshot
Def ProcessFirst(2)     !KERNEL32.DLL,Process32First
Def ProcessNext(2)      !KERNEL32.DLL,Process32Next
Def GetLastError(0)     !KERNEL32.DLL,GetLastError
Def OpenProcess(3)      !KERNEL32.DLL,OpenProcess
Def TerminateProcess(2) !KERNEL32.DLL,TerminateProcess
Def CloseHandle(1)      !KERNEL32.DLL,CloseHandle
Struct FOKP_PROCENTR32 = dwSize&,cntUsage&,th32ProcessID&,th32DefaultHeapID&,th32ModuleID&,cntThreads&,
th32ParentProcessID&,pcPriClassBase&,dwFlags&,szExeFile$(260)

Proc FindOrKillProcess

    Parameters FOKP_Process$,FOKP_Delete&
    Declare FOKP_NameLng&,FOKP_hSnapshot&,FOKP_Result&,FOKP_hProcess&,FOKP_ProcAnz&,FOKP_TermOk&,FOKP_PROCENTR#
    Dim FOKP_PROCENTR#,FOKP_PROCENTR32
    Clear FOKP_NameLng&,FOKP_hSnapshot&,FOKP_Result&,FOKP_hProcess&,FOKP_ProcAnz&,FOKP_TermOk&,FOKP_PROCENTR#
    Long FOKP_PROCENTR#,0 = SizeOf(FOKP_PROCENTR#)
    FOKP_NameLng&   = Len(FOKP_Process$)
    FOKP_Process$   = Lower$(FOKP_Process$)
    FOKP_hSnapshot& = ProcessSnapshot(2, 0)

    IfNot FOKP_hSnapshot& = -1

        FOKP_Result& = ProcessFirst(FOKP_hSnapshot&, FOKP_PROCENTR#)

        While FOKP_Result&

            If  Lower$(Right$(FOKP_PROCENTR#.szExeFile$,FOKP_NameLng&)) = FOKP_Process$

                If FOKP_Delete& = 1

                    FOKP_hProcess& = OpenProcess(1, 0, FOKP_PROCENTR#.th32ProcessID&)
                    FOKP_TermOk& = TerminateProcess(FOKP_hProcess&, 0)
                    CloseHandle(FOKP_hProcess&)
                    sleep 100

                EndIf

                FOKP_ProcAnz& = FOKP_ProcAnz& + (FOKP_Delete&<>1) + FOKP_TermOk&

            EndIf

            FOKP_Result& = ProcessNext(FOKP_hSnapshot&, FOKP_PROCENTR#)

        EndWhile

    EndIf

    CloseHandle(FOKP_hSnapshot&)
    Dispose FOKP_PROCENTR#
    Return Int(FOKP_ProcAnz&)

EndProc

Declare GL_DateiName$,GL_ProzessAnz&
GL_DateiName$ = TESTX.EXE
Cls
GL_ProzessAnz& = FindOrKillProcess(GL_DateiName$,0)

If GL_ProzessAnz&

    Print (GL_DateiName$ +  ist Aktiv)

Else

    Print (GL_DateiName$ +  ist Inaktiv)

EndIf

Print
Print
Print (Anzahl der Prozesse von q + GL_DateiName$ + q im Speicher:  + Str$(GL_ProzessAnz&))
Wai
End
 
11/18/07  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.178 Views

Untitledvor 0 min.
Jürgen Strahl05/09/20
AndreasS01/06/19
Klaus Ernst08/25/14
boh101/08/14
More...

Themeninformationen

this Topic has 1 subscriber:

iF (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie