English
Source / code snippets

Program to supervise

 

CompileMarkSeparation
Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
Programm überwachen
Def @Createtoolhelp32snapshot(2) !kernel32,CreateToolhelp32Snapshot
Def @Process32first(2) !kernel32,Process32First
Def @Process32next(2) !kernel32,Process32Next
Def @Closehandle(1) !kernel32,CloseHandle
Def @Terminateprocess(2) !kernel32,TerminateProcess
Def @Openprocess(3) !kernel32,OpenProcess
Def &Th32cs_snapprocess 2
Def &Process_terminate 1
Declare Processentry#
Struct Processentry32 =Dwsize&,Cntusage&,Th32processid&,Th32defaultheapid&,Th32moduleid&,Cntthreads&,Th32parentprocessid&,Pcpriclassbase&,Dwflags&,Szexefile$(260)

Proc Actua

    Parameters Prozess$, Delete%
    Declare Lenname&
    Declare Hsnapshot&, Result&, Hprocess&, Proz_anzahl&, Term_ok&
    Dim Processentry#, Processentry32
    Long Processentry#,0 =296
    Clear Proz_anzahl&, Term_ok&
    Lenname& = Len(Prozess$)
    Prozess$ = Lower$(Prozess$)
    Hsnapshot& = Createtoolhelp32snapshot(&Th32cs_snapprocess, 0)

    Ifnot Hsnapshot& = -1

        Result& = Process32first(Hsnapshot&, Processentry#)
        messagebox(str$(GetLastError()),Err,48)
        messagebox(str$(Result&),str$(hSnapshot&),48)

        While Result&

            messagebox(Lower$(Right$(PROCESSENTRY#.szExeFile$,lenname&)),,48)

            If Lower$(Right$(Processentry#.Szexefile$,Lenname&)) = Prozess$

                If Delete% = 1

                    Hprocess& = @Openprocess(&Process_terminate, 0, Processentry#.Th32processid&)
                    sendmessage(hProcess&,$0010,0,0)
                    Term_ok& = @Terminateprocess(Hprocess&, 0)
                    @Closehandle(Hprocess&)
                    Sleep 100

                Endif

                Proz_anzahl& = Proz_anzahl& + (Delete%<>1) + Term_ok&

            Endif

            Result& = Process32next(Hsnapshot&, Processentry#)

        Endwhile

    Endif

    @Closehandle(Hsnapshot&)
    Dispose Processentry#
    Return Proz_anzahl&

Endproc

@Winexec(NotePad.exe,1)
Windowstyle 31
Windowtitle Prozess überwachen!

While 0=0

    Window 0,0-640,440
    Sleep 100
    Actua Notepad.exe,0

    If @&(0)>0

        Drawtext 0,0,Notepad noch aktiv: +@Str$(@&(0))+

    Else

        Drawtext 0,0,Notepad gibts nicht mehr!+@Str$(@&(0))+

    Wend

 
07/16/07  
 




CompileMarkSeparation
Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
Programm überwachen
Def @Createtoolhelp32snapshot(2) !kernel32,CreateToolhelp32Snapshot
Def @Process32first(2) !kernel32,Process32First
Def @Process32next(2) !kernel32,Process32Next
Def @Closehandle(1) !kernel32,CloseHandle
Def @Terminateprocess(2) !kernel32,TerminateProcess
Def @Openprocess(3) !kernel32,OpenProcess
Def &Th32cs_snapprocess 2
Def &Process_terminate 1
Declare Processentry#
Struct Processentry32 =Dwsize&,Cntusage&,Th32processid&,Th32defaultheapid&,Th32moduleid&,Cntthreads&,Th32parentprocessid&,Pcpriclassbase&,Dwflags&,Szexefile$(260)

Proc Actua

    Parameters Prozess$, Delete%
    Declare Lenname&
    Declare Hsnapshot&, Result&, Hprocess&, Proz_anzahl&, Term_ok&
    Dim Processentry#, Processentry32
    Long Processentry#,0 =296
    Clear Proz_anzahl&, Term_ok&
    Lenname& = Len(Prozess$)
    Prozess$ = Lower$(Prozess$)
    Hsnapshot& = Createtoolhelp32snapshot(&Th32cs_snapprocess, 0)

    Ifnot Hsnapshot& = -1

        Result& = Process32first(Hsnapshot&, Processentry#)
        messagebox(str$(GetLastError()),Err,48)
        messagebox(str$(Result&),str$(hSnapshot&),48)

        While Result&

            messagebox(Lower$(Right$(PROCESSENTRY#.szExeFile$,lenname&)),,48)

            If Lower$(Right$(Processentry#.Szexefile$,Lenname&)) = Prozess$

                If Delete% = 1

                    Hprocess& = @Openprocess(&Process_terminate, 0, Processentry#.Th32processid&)
                    sendmessage(hProcess&,$0010,0,0)
                    Term_ok& = @Terminateprocess(Hprocess&, 0)
                    @Closehandle(Hprocess&)
                    Sleep 100

                Endif

                Proz_anzahl& = Proz_anzahl& + (Delete%<>1) + Term_ok&

            Endif

            Result& = Process32next(Hsnapshot&, Processentry#)

        Endwhile

    Endif

    @Closehandle(Hsnapshot&)
    Dispose Processentry#
    Return Proz_anzahl&

Endproc

@Winexec(NotePad.exe,1)
Windowstyle 31
Windowtitle Prozess überwachen!

While 0=0

    Window 0,0-640,440
    Sleep 100
    Actua Notepad.exe,0

    If @&(0)>0

        Drawtext 0,0,Notepad noch aktiv: +@Str$(@&(0))+

    Else

        Drawtext 0,0,Notepad gibts nicht mehr!+@Str$(@&(0))+

    Wend

 
07/16/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

2.520 Views

Untitledvor 0 min.
AndreasS01/06/19
Klaus Ernst07/25/14
p.specht11/12/13
Rolf Koch10/28/12
More...

Themeninformationen

this Topic has 1 subscriber:

unbekannt (2x)


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