English
Forum

Done: 2 Things at the same time run out let

 
- Page 1 -



Jac
de
Lad
Hm, I know none, where I begin should...

my trouble is the following: I have one Program, that next to the normalen term too The whole Time (once per second updated) The Uhrzeit and the Speicherverbrauch in the Statusbar Show should. I habs yet with the Thread.pcu made. but iF rät of it ex, zurecht. Gaaaaanz seldom comes it to, that at terminate to a Error Message comes, because the benötigte Memory-Variable faster disposed becomes as the Thread terminates (very said becomes each second a Message created, The then whom Bilschirm fill).

so, now has the iF said, that The PCU superfluously is, there it Yes in XProfan 11 Subclassing gives. and he's itself too any trouble given me the To explain, but I habs not understood. therefore times the question: has someone Perhaps an example for a Program, the either in the Waitinput stick (to that example one anklickbarer Button) and over 2 functions something outputs or another?

Jac
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
03/27/08  
 



 
- Page 1 -



Andreas
Miethe


IntervalProc coming To late

already ready with the example.

Statement moreover. it go 2 Files needed, once the eigentliche Program, to that others the what whom Loop contains.
The Loop-Program must compiled his.
the Hauptprogramm launch itself simply yourself with Parameters (Loop-Program) new. the whole functions only if both programs compiled are !

is Perhaps yet verbesserungswürdig, functions but first !

Loop-Program ( as timer.prf Save and kompilieren )
CompileMarkSeparation
Als Timer.prf speichern und kompilieren !
 $H windows.ph

If %parCount > 0

    Declare WND&
    Var X& = 0
    WND& = Val(Par$(2))

    whileloop 0,1000000

        If X& = 0

            UseCursor 0
            X& = 1

        Endif

        ~InvalidateRect(wnd&,0,0)
        SetText Wnd&,Str$(&Loop)
        Sleep 10

    endwhile

Endif


Hauptprogramm
CompileMarkSeparation
#########################################
Thread started, pausieren let, terminate
Andreas Miethe 28.03.2008
#########################################
BEACHTE : started as EXE or STRG+F8
#########################################
 $IFDEF Compiler
 $H windows.ph
 $H Structs.ph
 $H Messages.ph
Struct StartupInfo = ~STARTUPINFO
Struct ProcessInfo = ~PROCESS_INFORMATION
Struct MEMORYSTATUS = ~MEMORYSTATUS
Var Ende& = 0
cls ~GetSysColor(~COLOR_BTNFACE)
Declare ProcessHandle&,Processhandle1&
Declare ThreadHandle&,Threadhandle1&

Proc CreateThread

    Parameters Param$
    Declare StartupInfo#,CommandString$,ProcessInfo#
    Declare Retval&,Processhandle&,ThreadHandle&
    CommandString$ = Par$(0) +   + Param$
    Dim StartupInfo#,StartupInfo
    Clear StartupInfo#
    StartupInfo#.cb& = SizeOf(StartupInfo#)
    Dim ProcessInfo#,ProcessInfo
    Clear ProcessInfo#
    ~CreateProcess(0,Addr(CommandString$),0,0,0,0,0,0,StartupInfo#,ProcessInfo#)
    ProcessHandle& = ProcessInfo#.hProcess&
    ThreadHandle&  = ProcessInfo#.hThread&
    Dispose StartupInfo#
    Dispose ProcessInfo#
    Return Str $(ProcessHandle&)+,+Str $(ThreadHandle&)

ENDPROC

Proc TerminateThread

    Parameters ProcessHandle&
    Declare ExitCode&
    ~GetExitCodeProcess(Processhandle&,Addr(ExitCode&))
    ~TerminateProcess(Processhandle&,ExitCode&)

ENDPROC

Proc PauseThread

    Parameters Threadhandle&
    ~SuspendThread(Threadhandle&)

ENDPROC

Proc ResumeThread

    Parameters Threadhandle&
    ~ResumeThread(Threadhandle&)

ENDPROC

Var Handles$ =
Var Start& = Create(Button,%hwnd,Start,10,10,80,24)
Var Pause& = Create(Button,%hwnd,interval,10,40,80,24)
Var Resume& = Create(Button,%hwnd,continue,10,70,80,24)
Var Terminate& = Create(Button,%hwnd,end,10,100,80,24)
Var Empfang& = Create(TEXT,%hwnd,,10,130,80,24)
SendMessage(Start&,~WM_SETFONT,~GetStockObject(~ANSI_VAR_FONT),1)
SendMessage(Pause&,~WM_SETFONT,~GetStockObject(~ANSI_VAR_FONT),1)
SendMessage(Resume&,~WM_SETFONT,~GetStockObject(~ANSI_VAR_FONT),1)
SendMessage(Terminate&,~WM_SETFONT,~GetStockObject(~ANSI_VAR_FONT),1)
SendMessage(Empfang&,~WM_SETFONT,~GetStockObject(~ANSI_VAR_FONT),1)
EnableWindow Pause&,0
EnableWindow Resume&,0
EnableWindow Terminate&,0
Var Statusbar& = Create(Status Window,%hwnd,)
UpdateStatus(Statusbar&)
SubClass StatusBar&,1SubClassing on
~SetTimer(StatusBar&,1,1000,0)Timer on The Statusbar hang
SubClass %hwnd,1SubClassing on
User Messages ~wm_close

WhileNot Ende&

    Waitinput

    If Clicked(Start&)

        The Exe launch itself yourself yet once with Parameters
        the Parameter, the here expects becomes is one one Compilations ( PRC-File )
        Handles$ = CreateThread(Timer.prc +st$(Empfang&))
        ProcessHandle1& = Val(Substr$(Handles$,1,,))
        ThreadHandle1& = Val(Substr$(Handles$,2,,))
        EnableWindow Pause&,1
        EnableWindow Terminate&,1
        EnableWindow Start&,0

    Elseif Clicked(Pause&)

        PauseThread(ThreadHandle1&)
        EnableWindow Pause&,0
        EnableWindow Resume&,1

    ElseIf Clicked(Resume&)

        ResumeThread(ThreadHandle1&)
        EnableWindow Pause&,1
        EnableWindow Resume&,0

    ElseIf Clicked(Terminate&)

        EnableWindow Pause&,0
        EnableWindow Resume&,0
        EnableWindow Terminate&,0
        EnableWindow Start&,1
        TerminateThread(ProcessHandle1&)

    Endif

    If %Umessage = ~wm_close

        if TerminateThread() not with End of program called becomes,
        runs the 2.Program moreover !
        TerminateThread(ProcessHandle1&)
        Ende& = 1

    Endif

EndWhile

SubClass StatusBar&,0
SubClass %hwnd,0
end

Proc UpdateStatus

    Parameters Statusbar&
    Declare MemStatus#
    Dim Memstatus#,MEMORYSTATUS
    MemStatus#.dwLength& = SizeOf(MemStatus#)
    ~Global memory status(MemStatus#)
    SetText Statusbar&,now : +time$(0)+:+Left$(time$(1),2)+  -  Speicherverbrauch : +Str $(MemStatus#.dwMemoryLoad&)+%
    Dispose MemStatus#

ENDPROC

SubClassProc

    If SubClassMessage(%hwnd, ~WM_SIZE)

        SetWindowPos Statusbar& = 0,0-0,0

    ElseIf SubClassMessage(Statusbar&, ~WM_TIMER)

        UpdateStatus(&sWnd)

    Endif

ENDPROC

 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
03/28/08  
 



 
- Page 2 -



Jac
de
Lad
but here go 2 programs needed, this is Mist.
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
03/28/08  
 



but Perhaps is it grade therefore again one Denkanstoß the one truer 2. Thread for your think about (alike How verpackt) simply uneffizient is, time independent of it the Andreas there a super Prozessverpackung vormacht The copies to Codesnippets heard!
 
03/28/08  
 




Jac
de
Lad
say wirs time so: I see the one. Aaaaaaber, I can in my Prog not 500 SetStatus() install.
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
03/28/08  
 




Jörg
Sellmeyer
From Uwe Pascal Niemeyer (or wars Sebastian king?) there were time an example, in the with Assembler a watch in the Statusbar gesteuert becomes.
I habs now not parat, but Perhaps can You Yes time on its HP search.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
03/28/08  
 




Frank
Abbing

From Uwe Pascal Niemeyer (or wars Sebastian king?) there were time an example, in the with Assembler a watch in the Statusbar gesteuert becomes.
I habs now not parat, but Perhaps can You Yes time on its HP search.


there becomes by Assembler one Thread launched. therein can but no Profancode run out. Jac, something like is with XPIA very simply possible.
 
03/29/08  
 




Jac
de
Lad
Hm...I seh here nothing around through...I mean I lasses, is To tricky only for ne watch and ne Speicheranzeige...
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
03/29/08  
 




Frank
Abbing
Hm, straight this example Permanente watch is still with XPIA thereby...
CompileMarkSeparation

1.029 kB
Hochgeladen:03/29/08
Downloadcounter74
Download
 
03/29/08  
 




Frank
Abbing
the same in reinem Profan, only with TimerProc in lieu of one own Threads:
CompileMarkSeparation
 
03/30/08  
 




Jac
de
Lad
very something like Have I sought.
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
03/30/08  
 



Jac
very something like Have I sought.


very something like becomes you sure plenty joy bring!
 
03/30/08  
 



Jac de Lad, Beitrag=39020, Zeitpunkt=27.03.2008
Hm, I know none, where I begin should...

...

therefore times the question: has someone Perhaps an example for a Program, the either in the Waitinput stick (to that example one anklickbarer Button) and over 2 functions something outputs or another?

Jac

CompileMarkSeparation

347 kB
Hochgeladen:10/28/09
Downloadcounter21
Download
 
10/26/09  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.221 Views

Untitledvor 0 min.
Tango07/14/17
Ernst03/02/15
iF05/19/13
Juergen Baier02/15/12

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