English
Forum

Done: 2 Things at the same time run out let

 

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  
 



I faith The Test4.Prf from the ProgressControl-pkg does something like...

Nachtrag: 2 Things at the same time run out let if you the serious mean then benötigst You a 2. Process there imho threads in XProfan otherwise only again procaddr-Problems raise. (if at all possible)
 
03/27/08  
 




Andreas
Miethe



CompileMarkSeparation
#############################
XProfan11 RC2 Beispiel
Andreas Miethe, 28.03.2008
#############################
 $H Windows.ph
 $H Messages.ph
 $H Structs.ph
Struct MEMORYSTATUS = ~MEMORYSTATUS
Var Ende& = 0
CLS ~GetSysColor(~COLOR_BTNFACE)
SubClass %hwnd,1 SubClassing einschalten
Var Statusbar& = Create(StatusWindow,%hwnd,)
UpdateStatus(Statusbar&)
SubClass StatusBar&,1 SubClassing einschalten
~SetTimer(StatusBar&,1,1000,0)Timer an die Statusbar hängen
Var Button& = Create(Button,%hwnd,Warte auf Aktion,10,10,120,24)
SendMessage(Button&,~WM_SETFONT,~GetStockObject(~ANSI_VAR_FONT),1)
##########################################

Whilenot Ende&

    Waitinput

    If Clicked(Button&)

        ~KillTimer(StatusBar&,1)
        Ende& = 1

    Endif

EndWhile

SubClass StatusBar&,0
SubClass %hwnd,0
End
##########################################

Proc UpdateStatus

    Parameters Statusbar&
    Declare MemStatus#
    Dim Memstatus#,MEMORYSTATUS
    MemStatus#.dwLength& = SizeOf(MemStatus#)
    ~GlobalMemoryStatus(MemStatus#)
    SetText Statusbar&,Jetzt : +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

../../Function-References/XProfan/endproc/'>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  
 




Jac
de
Lad
@Andreas: so I had me the too virtual. Stell you to, that the Button what x-arbitrary power How...
CompileMarkSeparation
whileloop 0,10000000

    SetTExt button&,Str$(&Loop)
    Sleep 10

endwhi

...so works not.
 
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  
 



had we but already...

you become in Your Loop too UpdateStatus(&sWnd) Call must!

building you a helferProc which updateStatus only aufruft if z.B. 200 Millisekunden vergangen are...
 
03/28/08  
 




Jac
de
Lad
I versteh only not, Why The Thread.pcu the automatically power and it no others Possibility for gitb. anyway no, The functions and the i see.
 
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  
 




Andreas
Miethe


This will neither really help! becomes Yes only The Statusbar upgedatet.
The remainder the program depends in the Loop, as long as tappt im dunkeln not run down is.
the helps only one Thread wriklich moreover.

I mach there time an example ready !
Have there already a idea in the back of the head How to the employ could. without Callbacks and ProcAddr !
 
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  
 




Jac
de
Lad
Vielen Thanks in the ahead.
 
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  
 



No plainer - I take your Sourcecode for a example:
CompileMarkSeparation
#############################
XProfan11 RC2 Beispiel
Andreas Miethe, 28.03.2008
#############################
 $H Windows.ph
 $H Messages.ph
 $H Structs.ph
Struct MEMORYSTATUS = ~MEMORYSTATUS
Var intervalProcData&=&getTickCount
Var Ende& = 0
CLS ~GetSysColor(~COLOR_BTNFACE)
SubClass %hwnd,1SubClassing einschalten
Var Statusbar& = Create(StatusWindow,%hwnd,)
SubClass StatusBar&,1SubClassing einschalten
~SetTimer(StatusBar&,1,1000,0)Timer an die Statusbar hängen
Var Button& = Create(Button,%hwnd,Warte auf Aktion,10,10,120,24)
SendMessage(Button&,~WM_SETFONT,~GetStockObject(~ANSI_VAR_FONT),1)
##########################################

Whilenot Ende&

    Waitinput

    If Clicked(Button&)

        EnableWindow Button&,0

        WhileLoop 20000 heidy, ein könnte länger dauern loop?

            intervalProc()drum hier auch?! im Programm verteilen wo nötig!
            SetText Button&,str$(&getTickCount)
            ...

        EndWhile

        EnableWindow Button&,1
        ~KillTimer(StatusBar&,1)
        Ende& = 1

    Endif

EndWhile

SubClass StatusBar&,0
SubClass %hwnd,0
End
##########################################

Proc UpdateStatus

    Parameters Statusbar&
    Declare MemStatus#
    Dim Memstatus#,MEMORYSTATUS
    MemStatus#.dwLength& = SizeOf(MemStatus#)
    ~GlobalMemoryStatus(MemStatus#)
    SetText Statusbar&,Jetzt : +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)

        intervalProc()

    Endif

EndProc

Proc intervalProc

    if intervalProcData&<&getTickCount

        intervalProcData&=intervalProcData&+200 MILLISEKUNDEN
        hier würd getüddelt
        UpdateStatus(%hWnd)
        UpdateStatus(StatusBar&)

    E
a> ENDPROC

reacted How Jac it wish and is Ressourcen/hoisted-sparender and gezielter einsetzbar as one 2. (künstlicher) Thread the for such a thing not at all really necessary is.

1.018 kB
Hochgeladen:03/28/08
Downloadcounter83
Download
 
03/28/08  
 




Jac
de
Lad
@iF: Why understand You the because not? I know The Solution already, we've already zigmal above talked. but I thought on something without IntervalProc, as it The Thread.pcu momentarily power...
 
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  
 



and very this is the point where I genaustens understand what You gladly would have, I But not create you To explain the it in the Result the same is with the benefit: Gezielter einsetzbar and ressourcenschonender and particularly: sure. its sozusagen a question the Ablaufverständnisses - I know not How I it yet differently verständlich can make.
 
03/28/08  
 




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  
 




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.276 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