Forum | | | | Bernd Lies | Hello.
unfortunately plagt me again trouble. In one Hauptprogramm starte I by Pexec a parallel to that Hauptprogramm ongoing Procedure. Sometime is these Procedure exits and gives a Message by MessageBox from. How can I now in the Hauptprogramm inquire, whether The Procedure exits is. The reason: it must yet further activities, related on The Results the Procedure, in the Hauptprogramm erfolgen.
gives it The Possibility a Parameter as Rückgabecode from the aufgerufenen Procedure To get?
Would cool if someone its Help offer would. |
| | | | |
| | H.Brill | do you need only in the Help pExec() to look. naturally must You The Process-ID (PID) having. The get You, if You pExec() a worth give back can : CompileMarkSeparation If you getExitCode() in your Hauptprogrammschleife permanent query, ought to it weg.
If you of what the Proc give back want, can You the over FileMap solve. another simple Possibility would the Clipboard. |
| | | Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 06/18/14 ▲ |
| |
| | Bernd Lies | Hello H.Brill,
many Thanks for your response. i'll your indicated debug. will be moreover but first into next Meet come. self-evident I will over the Result informieren. |
| | | | |
| | Bernd Lies | Hello H. Brill,
here my Result: That the Process-ID do not have worked, but for The Version with the Clipboard. accordingly is my trouble resolved. Vielen Thanks for Help. |
| | | | |
| | H.Brill | Well, comes integrally on it on, what You make want. Evtl. do you need too the Clipboard none.
enclosed time an example, like a Process through Übergabe one lever, a GridBOX filling.
thereby becomes too The Process - ID quizzed. CompileMarkSeparationDeclare runp&, btn1&, btn2&, btn3&, btn4&, st&, lb&, pid&
Declare Memory b
Dim b, 4
Long b, 0 = 200
runp& = 0
WindowStyle 512 + 2 + 8
WindowTitle "Mein Fenster"
Window 600, 400
btn1& = @Create("Button", %HWnd, "Start", 10, 10, 60, 25)
btn2& = @Create("Button", %HWnd, "Stop", 100, 10, 60, 25)
btn3& = @Create("Button", %HWnd, "Clear", 190, 10, 60, 25)
btn4& = @Create("Button", %HWnd, "Ende", 280, 10, 60, 25)
lb& = @Create("Gridbox",%HWnd, "Spalte 1;0;120;Spalte 2;0;120;Spalte 3;0;120", 0, 10, 50, 400, 150)
st& = @Create("StatusWindow", %HWnd, "", 3, b)
pid& = pExec("|RunProzess", %HWnd, lb&)
If pid& <> 0
runp& = 1
EnableWindow btn1&, 0
SetText st&, 0, "Prozess läuft !"
EndIf
WhileNot @Clicked(btn4&)
WaitInput
If @Clicked(btn1&)
If runp& = 0
runp& = 1
pid& = pExec("|RunProzess", %HWnd, lb&)
SetText st&, 0, "Prozess läuft !"
EnableWindow btn1&, 0
Else
MessageBox("Prozess läuft bereits !", "Info", 0)
EndIf
ElseIf @Clicked(btn2&)
If runp& = 1
Process("Kill", pid&, 0)
EnableWindow btn1&, 1
runp& = 0
SetText st&, 0, "Prozess beendet !"
Else
MessageBox("Prozess läuft nicht !", "Info", 0)
EndIf
ElseIf @Clicked(btn3&)
ClearList lb&
EndIf
Case %Key = 2 : Break
If getExitCode(pid&) <> 259
SetText st&, 0, "Prozess läuft nicht mehr !"
EndIf
EndWhile
Dispose b
End
Proc RunProzess
Parameters win&, dlgwin&
Declare ende%
Clear ende%
WhileNot ende%
Randomize
AddString(dlgwin&, Str$(Rnd(100)) + "|" + Str$(Rnd(1000)) + "|" + Str$(Rnd(10000)) )
Sleep 2000
case getText$(win&) = "" : ende% = 1
ENDPROC
|
| | | Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 06/19/14 ▲ |
| |
| | Bernd Lies | your example have I understood and tested and my Codesammlung moved . my trouble was, the in the Process a Time expires, The ever when then on 0 goes. If this drop entering, had I the in the Hptprg. know. means simply one Flag in that Cipboard staid and then in the Hptprg quizzed. |
| | | | |
| | Nico Madysa | nice thing, but What is, if the users in the interim the clipboard self using?
of my insight to would it sinnvoller, either a) a Filemap To use (The XProfan-Help white More) or b) simply of Unterprozess a Message on whom Oberprozess To Send.
what here The einfachere Possibility is should one simply time try. |
| | | | |
| | H.Brill | To a) What is, if one other Program runs and this whom equal names the Filemap using ? Nr. b) find I then on the sinnvollsten.
or supra How in my code on the lever one Controls in the Hauptprogramm Send. |
| | | Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 06/20/14 ▲ |
| |
| | H.Brill | Perhaps can itself with the what begin. If your Process not too long lasts : CompileMarkSeparation $H Windows.ph
Declare runp&, btn1&, btn2&, btn3&, btn4&, st&, lb&, pid&
Declare Memory b
Declare Grid&
Dim b, 4
Long b, 0 = 200
runp& = 0
WindowStyle 512 + 2 + 8
WindowTitle "Mein Fenster"
Window 600, 400
btn1& = @Create("Button", %HWnd, "Start", 10, 10, 60, 25)
btn2& = @Create("Button", %HWnd, "Stop", 100, 10, 60, 25)
btn3& = @Create("Button", %HWnd, "Clear", 190, 10, 60, 25)
btn4& = @Create("Button", %HWnd, "Ende", 280, 10, 60, 25)
lb& = @Create("Gridbox",%HWnd, "Spalte 1;0;120;Spalte 2;0;120;Spalte 3;0;120", 0, 10, 50, 400, 150)
st& = @Create("StatusWindow", %HWnd, "", 3, b)
Grid& = @Create("Grid", 1, 0)
pid& = pExec("|RunProzess", %HWnd, lb&, Grid&)
If pid& <> 0
runp& = 1
EnableWindow btn1&, 0
SetText st&, 0, "Prozess läuft !"
EndIf
WhileNot @Clicked(btn4&)
WaitInput
If @Clicked(btn1&)
If runp& = 0
runp& = 1
pid& = pExec("|RunProzess", %HWnd, lb&, Grid&)
SetText st&, 0, "Prozess läuft !"
EnableWindow btn1&, 0
Else
MessageBox("Prozess läuft bereits !", "Info", 0)
EndIf
ElseIf @Clicked(btn2&)
If runp& = 1
Process("Kill", pid&, 1000)
EnableWindow btn1&, 1
runp& = 0
SetText st&, 0, "Prozess beendet !"
Else
MessageBox("Prozess läuft nicht !", "Info", 0)
EndIf
ElseIf @Clicked(btn3&)
ClearList lb&
EndIf
Case %Key = 2 : Break
If getExitCode(pid&) = 1000
SetText st&, 0, "Prozess läuft nicht mehr !"
Messagebox(GetString$(Grid&, 0), "", 0)
EndIf
EndWhile
Dispose b
End
Proc RunProzess
Parameters win&, dlgwin&, g&
Declare ende%
Clear ende%
ClearList g&
WhileNot ende%
Randomize
AddString(dlgwin&, Str$(Rnd(100)) + "|" + Str$(Rnd(1000)) + "|" + Str$(Rnd(10000)) )
AddString(g&, "Astalavista !!!")
Sleep 2000
case getText$(win&) = "" : ende% = 1
EndWhile
ENDPROC
To consider would too, if one Space has : one prepares To Programmbegin one Editfeld and power it with ShowWindow invisible. which lever commit one then the Process, the then with SetText what reinschreibt. If one then in the Hauptprogramm whom Exitcode abfragt, could one still with GetText$() the Editfeld . Read
ought to one time try. |
| | | Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 06/20/14 ▲ |
| |
| | E.T. | H.Brill (20.06.14)
To a) What is, if one other Program runs and this whom equal names the Filemap using ? ...
hm, How probably is is these Konstellation ...jaja, say never never...
Kollisionen could one indeed bypass, if one z.B. the Speicherdatei as name The PID the erzeugenden Program gives (mach I so), or a of Program generierten unique name, or, or... gives it the Opportunities many, I had there yet never Problems... |
| | | Grüße aus Sachsen... Mario WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte... | 06/21/14 ▲ |
| |
| | H.Brill | do you know little more over Filemapping ? Why goes the following Program only once with Program Start ? CompileMarkSeparationDeclare runp&, btn1&, btn2&, btn3&, btn4&, st&, pid&
Declare Memory b
Declare m#
Declare hfm&
Dim m#, 1000
Dim b, 4
Long b, 0 = 300
runp& = 0
WindowStyle 512
Window 800, 600
btn1& = @Create("Button", %HWnd, "Start", 10, 10, 60, 25)
btn2& = @Create("Button", %HWnd, "Ende", 100, 10, 60, 25)
st& = @Create("StatusWindow", %HWnd, "", 3, b)
hfm& = @Create("Filemap", "Zahl", 1000)
WhileNot @Clicked(btn2&)
WaitInput
If @Clicked(btn1&)
If runp& = 0
runp& = 1
pid& = pExec("|RunProzess", %HWnd)
SetText st&, 0, "Prozess läuft !"
EnableWindow btn1&, 0
Else
MessageBox("Prozess läuft bereits !", "Info", 0)
EndIf
Case %Key = 2 : Break
EndIf
If getExitCode(pid&) <> 259
SetText st&, 0, "Prozess beendet"
runp& = 0
EnableWindow btn1&, 1
Clear m#
hfm& = FileMap("Open", "Zahl")
m# = FileMap("Map", hfm&)
FileMap("Close", hfm&)
SetText st&, 0, String$(m#, 0)
EndIf
EndWhile
Dispose b, m#
Proc RunProzess
Parameters win&
Declare mf&, ok&, a&, buffer#
Dim buffer#, 1000
mf& = FileMap("Open", "Zahl")
WhileLoop 1, 100
a& = &LOOP
case getText$(win&) = "" : Break
Sleep 10
EndWhile
buffer# = FileMap("Map", mf&)
String buffer#, 0 = Str$(a&) + " Schritte im Prozess verarbeitet !!!"
Dispose buffer#
ok& = FileMap("Close", mf&)
End a>
End
If I the Button Start to that 2. time press, becomes nothing More in the Statuszeile displayed. too must I first with the mouse in that Window clicking (probably through waitinput).
might one a Click simulate ? |
| | | Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 06/21/14 ▲ |
| |
| | E.T. | Have time bissel played (ExitCode the aufgerufenen Program,Statuszeile, Show...) CompileMarkSeparationDeclare runp&, btn1&, btn2&, btn3&, btn4&, st&, pid&, ec&
Declare b#
Declare m#
Declare hfm&, hfmx&
Dim m#, 1000
Dim b#, 12
Long b#, 0 = 200,500,-1
runp& = 0
WindowStyle 512
Window 800, 600
btn1& = @Create("Button", %HWnd, "Start", 10, 10, 60, 25)
btn2& = @Create("Button", %HWnd, "Ende", 100, 10, 60, 25)
st& = @Create("StatusWindow", %HWnd, "STATUS", 3, b#)
hfm& = @Create("Filemap", "Zahl", 1000)
WhileNot @Clicked(btn2&)
Waitinput 100
If @Clicked(btn1&)
If runp& = 0
locate 20,0
print " "
SetText st&, 1, "...warte"
runp& = 1
Clear pid&
' pid& = pExec("|RunProzess", %HWnd)
$IFDEF INTERPRETER
pid& = PExec("|RunProzess")
$ELSE
pid& = PExec("|RunProzess")
$ENDIF
SetText st&, 0, "Prozess läuft !"
EnableWindow btn1&, 0
Else
MessageBox("Prozess läuft bereits !", "Info", 0)
EndIf
Case %Key = 2 : Break
EndIf
If ec& = 777
SetText st&, 0, "Prozess beendet"
runp& = 0
EnableWindow btn1&, 1
hfmx& = FileMap("Open", "Zahl")
If hfmx&
m# = FileMap("Map", hfmx&)
FileMap("Close", hfmx&)
locate 20,0
print STRING$(m#,0)
SetText st&, 1, String$(m#,0)
Else
MessageBox("Speicherdatei konnte nicht geöffnet werden!", "MAP-Hinweis", 48)
EndIf
Clear ec&, pid&
EndIf
ec& = getExitCode(pid&)
SetText st&, 2, str$(pid&) + ", " + str$(ec&)
EndWhile
Dispose b#, m#
Proc RunProzess
Parameters win&
Declare mf&, ok&, a&, buffer#
Dim buffer#, 1000
mf& = FileMap("Open", "Zahl")
WhileLoop 1, 100
a& = &LOOP
' case getText$(win&) = "" : Break ????Nur ein durchlauf !!
Sleep 10
EndWhile
buffer# = FileMap("Map", mf&)
'String buffer#, 0 = Str$(a&) + " Schritte im Prozess verarbeitet !!!"
String buffer#, 0 = "Fertig : " + @dt("DateTimeStr", "c", !now)
Dispose buffer#
ok& = FileMap("Close", mf&)
End 777
ENDPROC
End
Bei'm read and Show have you got hfm& (The ID the Mapdatei) überschrieben: CompileMarkSeparationhfm& = @Create("Filemap", "Zahl", 1000)
...
hfm& = FileMap("Open", "Zahl")
...
Habs simply time adjusted, and already working it always and over ands over again: CompileMarkSeparation...
hfmx& = FileMap("Open", "Zahl")
...
...on the side even time a Click simulate |
| | | Grüße aus Sachsen... Mario WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte... | 06/22/14 ▲ |
| |
|
AnswerTopic-Options | 14.292 Views |
Themeninformationenthis Topic has 4 subscriber: |