English
Forum

Commands in XProfan

 

Blue
Max
Very honored dames and gentlemen,

I write one Program, from the from one other Program launched go should. now should XProfan 8.0 first then continue, if the launched Program exits watts. this could I former with the %Getrusage commands achieve. now existing this commands not any more.
gives it a function, The this commands %Getrusage supplant?

Greeting
Blue Max
 
05/31/05  
 




Dietmar
Horn
Hi,

for this object might WinExecWait your friend his.

Greeting
Dietmar
 
Multimedia für Jugendliche und junge Erwachsene - MMJ Hoyerswerda e.V.  [...] 

Windows 95 bis Windows 7
Profan² 6.6 bis XProfan X2 mit XPSE

Das große XProfan-Lehrbuch:  [...] 
05/31/05  
 



Hello Blue Max...

in the API Library become dun in the area processes some finde´n, what you help on becomes. here time an example:
CompileMarkSeparation
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


and this is yet schöner:
CompileMarkSeparation
DEF CreateProcessA(10)    ! "Kernel32","CreateProcessA"
DEF GetExitCodeProcess(2) ! "Kernel32","GetExitCodeProcess"
DEF TerminateProcess(2)   ! "Kernel32","TerminateProcess"
DEF ZeroMemory(2)         ! "Kernel32","RtlZeroMemory"
DEF CloseHandle(1)        ! "Kernel32","CloseHandle"
Declare lpCommandLine#
Declare lpStartupInfo#
Declare lpProcessInformation#
Declare ExitCode#
Declare Process$

Proc CreateProcess

    Parameters CommandLine$
    Declare hProcess&
    Dim lpCommandLine#,Len(CommandLine$)+1
    Dim lpStartupInfo#,68
    ZeroMemory(lpStartupinfo#,68)
    Long lpStartupInfo#,0=68
    Long lpStartupInfo#,44=1 Flag, which shares of Startupinfo berücksichtigt go should
    Word lpStartupInfo#,48=1 SHOWParameter of WinExec
    Dim lpProcessInformation#,16
    ZeroMemory(lpProcessInformation#,16)
    String lpCommandLine#,0=CommandLine$
    CreateProcessA(0,lpCommandLine#,0,0,0,0,0,0,lpStartupInfo#,lpProcessInformation# )
    hProcess&=Long(lpProcessInformation#,0)
    Dispose lpCommandLine#
    Dispose lpStartupInfo#
    Dispose lpProcessInformation#
    Return hProcess&

ENDPROC

Proc ProcessStatus

    parameters prozid&
    declare status&
    GetExitCodeProcess(prozid&,Exitcode#)
    status& = long(Exitcode#,0)
    return status&

endproc

Declare hProcess&
LET PROZESS$=@LOADFILE$("Datei auswählen","*.EXE")
CASE PROZESS$="" : END
Dim exitcode#,4
createprocess PROZESS$
LET hProcess& = @&(0)
Windowstyle 31+512
Window Title "Prozess überwachen"
Window 0,0-640,440

while %MENUITEM<>-2

    Sleep 100
    ProcessStatus hProcess&
    print @&(0)
    print hex$(long(Exitcode#,0))

endwhile


If you whom cover the Mainwindow know, can you whom Process (the program) too with the Profanfunktion FindWindow to supervise - the have so did i already made...
 
05/31/05  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.649 Views

Untitledvor 0 min.
Walter02/17/19
Peter Max Müller06/09/15

Themeninformationen



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