English
Source / code snippets

Sleep 10000 with discontinue within this Time

 
- Page 1 -



RudiB.
Hello together,

have time again a question.
ifnot end%

    Sleep 1000 * interval%

Endif


can I during the SLEEP's a discontinue of Sleep force ?
z.B. with wm_Timer function ??
 
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
04/28/20  
 



« this Posting watts as Solution marked. »


Georg
Teles
have something rumgespielt, here quite simply
Declare e%, oWndProc&
Declare new%, terminate%
Declare trigger&, wartezeit&
Declare question%, response%
Declare question$, response$
Declare time%
Def GetWindowLong(2)!"USER32","GetWindowLongA"
Def SetWindowLong(3)!"USER32","SetWindowLongA"
Def KillTimer32(2)!"USER32","KillTimer"
Def SetTimer32(4)!"USER32","SetTimer"
CLS
frage$ = "Frage: how much is 44 * 5 ?"
antwort$ = "Lösung: 220"
frage% = Create("Text",%hWnd,question$,5,5,255,20)
antwort% = Create("Text",%hWnd,"Lösung:",5,30,255,20)
zeit% = Create("Text",%hWnd,"",100,61,65,20)
neu% = Create("Button",%hWnd,"näch. Frage",5,60,90,20)
beenden% = Create("Button",%hWnd,"beenden",170,60,90,20)

Proc tmpr

    Inc wartezeit&

    If trigger& = 1

        SetText response%,response$+" (through ESC triggered)"
        wartezeit& = 0
        SetText time%,""

    Else

        SetText time%,Str $(10-(wartezeit&)\3)+" Sek."

    EndIf

    If wartezeit& >= 3*10

        SetText response%,response$+" (Wartezeit past)"
        wartezeit& = 0
        SetText time%,""

    EndIf

ENDPROC

SetTimer32(%hWnd,1,333,ProcAddr("tmpr",0))
oWndProc& = GetWindowLong(%hWnd,-4)
Clear e%, trigger&, wartezeit&

WhileNot e%

    Waitinput
    ' Trigger trigger

    If (%Key = 27) or (%Key = 2)

        locate 1,1
        trigger& = 1

    EndIf

    ' next question + Trigger on 0

    If Clicked(new%)

        question$ = "Frage: Hauptstadt of Germany ?"
        response$ = "Lösung: Berlin"
        SetText question%,question$
        SetText response%,"Lösung:"
        Clear trigger&, wartezeit&
        SetFocus(%hWnd)

    EndIf

    ' Program directly terminate

    If Clicked(terminate%)

        Inc e%

    EndIf

EndWhile

KillTimer32(%hWnd,1)
SetWindowLong(%hWnd,-4,oWndProc&)

here with Arrays as question/Solution
Declare e%, oWndProc&
Declare new%, terminate%
Declare trigger&, wartezeit&
Declare question%, response%
Declare ask$, Answer$
Declare question$[], response$[]
Declare zufall&, time%
Def GetWindowLong(2)!"USER32","GetWindowLongA"
Def SetWindowLong(3)!"USER32","SetWindowLongA"
Def KillTimer32(2)!"USER32","KillTimer"
Def SetTimer32(4)!"USER32","SetTimer"
Randomize
CLS
fragen$ = "Wieviel is 44 * 5 ?;Hauptstadt of Germany ?;2^4 - 2 ?;Wurzel from 27 ?"
antworten$ = "220;Berlin;14;3"
frage$[] = explode(ask$,";")
antwort$[] = explode(Answer$,";")
zufall& = Rnd(4)
frage% = Create("Text",%hWnd,question$[zufall&],5,5,255,20)
antwort% = Create("Text",%hWnd,"",5,30,700,20)
zeit% = Create("Text",%hWnd,"",100,61,65,20)
neu% = Create("Button",%hWnd,"näch. Frage",5,60,90,20)
beenden% = Create("Button",%hWnd,"beenden",170,60,90,20)

Proc tmpr

    Inc wartezeit&

    If trigger& = 1

        SetText response%,response$[zufall&]+" (through ESC triggered) or Wartezeit past s. \qAUSLÖSER\q"
        wartezeit& = 0
        SetText time%,""

    Else

        SetText time%,Str $(10-(wartezeit&)\3)+" Sek."' of 10 sec Time take away

    EndIf

    If wartezeit& >= 3*10' 10 sec

        ' so The Time not any more backward runs, can this step boisterously and be
        ' only trigger = 1 staid, there Solution too supra displayed becomes, see supra
        trigger& = 1'AUSLÖSER
        'SetText response%,response$[zufall&]+" (Wartezeit past)"
        'wartezeit& = 0
        'SetText time%,""

    EndIf

ENDPROC

SetTimer32(%hWnd,1,333,ProcAddr("tmpr",0))
oWndProc& = GetWindowLong(%hWnd,-4)
Clear e%, trigger&, wartezeit&

WhileNot e%

    Waitinput
    ' Trigger trigger

    If (%Key = 27) or (%Key = 2)

        locate 1,1
        trigger& = 1

    EndIf

    ' next question + Trigger on 0

    If Clicked(new%)

        zufall& = Rnd(4)
        SetText question%, question$[zufall&]
        SetText response%,""
        Clear trigger&, wartezeit&
        SetFocus(%hWnd)

    EndIf

    ' Program directly terminate

    If Clicked(terminate%)

        Inc e%

    EndIf

EndWhile

KillTimer32(%hWnd,1)
SetWindowLong(%hWnd,-4,oWndProc&)

Perhaps can You something so begin

Regards Georg
 
XProfan X2
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

05/02/20  
 




RudiB.
has itself already Done...

have a Solution found circa faster / quick from the Sleep rauszukommen.
Whileloop 20

    If @IsKey(27)

        end%=1
        break

    Endif

    Sleep 50 * interval%

EndWhile


 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
04/28/20  
 




Georg
Teles
good day,

aah has Done weiß' Yes not, what You to have, but I having a suggestion, where You rumexperementieren can
Declare e%, t&, oWndProc&
Def GetWindowLong(2)!"USER32","GetWindowLongA"
Def SetWindowLong(3)!"USER32","SetWindowLongA"
Def KillTimer32(2)!"USER32","KillTimer"
Def SetTimer32(4)!"USER32","SetTimer"

Proc tmpr

    Locate 1,1
    print time$(0);":";time$(1);" - ESC pressing, circa Timer To beenden"
    print "verschiebe Window, Timer updated nevertheless this Text"

ENDPROC

CLS
var Button% = Create("Button",%hWNd,"teste",20,50,100,20)
t& = SetTimer32(%hWnd,1,333,ProcAddr("tmpr",0))
oWndProc& = GetWindowLong(%hWnd,-4)
Clear e%

WhileNot e%

    Waitinput

    If (%Key = 27) or (%Key = 2)

        Locate 1,1
        'Case t &:KillTimer32(%hWnd,1)

        If t& = 1

            KillTimer32(%hWnd,1)
            t& = 0

        EndIf

        print space$(23)+"ABBRUCH"+space$(23)
        'Inc e% '= ENDE

    EndIf

    '-------------------------------------------------

    If t& = 0

        ' institute of technology what, if Timer lane is

    EndIf

    ' eleganter here, if Button UND Timer = 1

    If (Clicked(Button%)) AND (t& = 1)

        locate 5,20
        print "nix geschieht"
        SetFocus(%hWnd)

    EndIf

    ' eleganter here, if Button UND Timer = 0

    If (Clicked(Button%)) AND (t& = 0)

        locate 5,20
        print "was now? (X supra right in order to terminate)"

    EndIf

EndWhile

SetWindowLong(%hWnd,-4,oWndProc&)

Regards
 
XProfan X2
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

05/01/20  
 




RudiB.
now Yes, I write straight on eimem Vokabe-coach. an function is here hold How with of/ one "Dia-Show" ...Vokabel becomes displayed and joining after a einstellbaren interval (zw. 1 and 10 sek.) becomes The response eingeblendet. so has one even a gewisse Time the response To consider.
white one The response but immediate, then to the User but not absolutely The filled Pausenzeit "absitzen" must. means out from the interval....with ESC, thereafter hold moreover ...
therefore have I hold The Pausenzeit verkürzt and a Whileloop-Loop laid.
before 10 sek. interval on the Piece and so then hold zoned on 20*0,5sek. with the possibility with ESC auszusteigen.

but your Solution is really super and will be these Solution time extensively testing and safety too with install. integral eleganter....

thanks you Georg

Greeting from munich Rudi
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
05/01/20  
 




Georg
Teles
have something rumgespielt, here quite simply
Declare e%, oWndProc&
Declare new%, terminate%
Declare trigger&, wartezeit&
Declare question%, response%
Declare question$, response$
Declare time%
Def GetWindowLong(2)!"USER32","GetWindowLongA"
Def SetWindowLong(3)!"USER32","SetWindowLongA"
Def KillTimer32(2)!"USER32","KillTimer"
Def SetTimer32(4)!"USER32","SetTimer"
CLS
frage$ = "Frage: how much is 44 * 5 ?"
antwort$ = "Lösung: 220"
frage% = Create("Text",%hWnd,question$,5,5,255,20)
antwort% = Create("Text",%hWnd,"Lösung:",5,30,255,20)
zeit% = Create("Text",%hWnd,"",100,61,65,20)
neu% = Create("Button",%hWnd,"näch. Frage",5,60,90,20)
beenden% = Create("Button",%hWnd,"beenden",170,60,90,20)

Proc tmpr

    Inc wartezeit&

    If trigger& = 1

        SetText response%,response$+" (through ESC triggered)"
        wartezeit& = 0
        SetText time%,""

    Else

        SetText time%,Str $(10-(wartezeit&)\3)+" Sek."

    EndIf

    If wartezeit& >= 3*10

        SetText response%,response$+" (Wartezeit past)"
        wartezeit& = 0
        SetText time%,""

    EndIf

ENDPROC

SetTimer32(%hWnd,1,333,ProcAddr("tmpr",0))
oWndProc& = GetWindowLong(%hWnd,-4)
Clear e%, trigger&, wartezeit&

WhileNot e%

    Waitinput
    ' Trigger trigger

    If (%Key = 27) or (%Key = 2)

        locate 1,1
        trigger& = 1

    EndIf

    ' next question + Trigger on 0

    If Clicked(new%)

        question$ = "Frage: Hauptstadt of Germany ?"
        response$ = "Lösung: Berlin"
        SetText question%,question$
        SetText response%,"Lösung:"
        Clear trigger&, wartezeit&
        SetFocus(%hWnd)

    EndIf

    ' Program directly terminate

    If Clicked(terminate%)

        Inc e%

    EndIf

EndWhile

KillTimer32(%hWnd,1)
SetWindowLong(%hWnd,-4,oWndProc&)

here with Arrays as question/Solution
Declare e%, oWndProc&
Declare new%, terminate%
Declare trigger&, wartezeit&
Declare question%, response%
Declare ask$, Answer$
Declare question$[], response$[]
Declare zufall&, time%
Def GetWindowLong(2)!"USER32","GetWindowLongA"
Def SetWindowLong(3)!"USER32","SetWindowLongA"
Def KillTimer32(2)!"USER32","KillTimer"
Def SetTimer32(4)!"USER32","SetTimer"
Randomize
CLS
fragen$ = "Wieviel is 44 * 5 ?;Hauptstadt of Germany ?;2^4 - 2 ?;Wurzel from 27 ?"
antworten$ = "220;Berlin;14;3"
frage$[] = explode(ask$,";")
antwort$[] = explode(Answer$,";")
zufall& = Rnd(4)
frage% = Create("Text",%hWnd,question$[zufall&],5,5,255,20)
antwort% = Create("Text",%hWnd,"",5,30,700,20)
zeit% = Create("Text",%hWnd,"",100,61,65,20)
neu% = Create("Button",%hWnd,"näch. Frage",5,60,90,20)
beenden% = Create("Button",%hWnd,"beenden",170,60,90,20)

Proc tmpr

    Inc wartezeit&

    If trigger& = 1

        SetText response%,response$[zufall&]+" (through ESC triggered) or Wartezeit past s. \qAUSLÖSER\q"
        wartezeit& = 0
        SetText time%,""

    Else

        SetText time%,Str $(10-(wartezeit&)\3)+" Sek."' of 10 sec Time take away

    EndIf

    If wartezeit& >= 3*10' 10 sec

        ' so The Time not any more backward runs, can this step boisterously and be
        ' only trigger = 1 staid, there Solution too supra displayed becomes, see supra
        trigger& = 1'AUSLÖSER
        'SetText response%,response$[zufall&]+" (Wartezeit past)"
        'wartezeit& = 0
        'SetText time%,""

    EndIf

ENDPROC

SetTimer32(%hWnd,1,333,ProcAddr("tmpr",0))
oWndProc& = GetWindowLong(%hWnd,-4)
Clear e%, trigger&, wartezeit&

WhileNot e%

    Waitinput
    ' Trigger trigger

    If (%Key = 27) or (%Key = 2)

        locate 1,1
        trigger& = 1

    EndIf

    ' next question + Trigger on 0

    If Clicked(new%)

        zufall& = Rnd(4)
        SetText question%, question$[zufall&]
        SetText response%,""
        Clear trigger&, wartezeit&
        SetFocus(%hWnd)

    EndIf

    ' Program directly terminate

    If Clicked(terminate%)

        Inc e%

    EndIf

EndWhile

KillTimer32(%hWnd,1)
SetWindowLong(%hWnd,-4,oWndProc&)

Perhaps can You something so begin

Regards Georg
 
XProfan X2
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

05/02/20  
 




RudiB.
there can I utterly what with begin, has me still same to a new idea inspired.
must time look How I the now in my Program einbaue without it me To zerschießen.....
the bekomm I already there...

thanks Georg
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
05/03/20  
 




Georg
Teles
perfect

Regards
 
XProfan X2
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

05/03/20  
 



programs, The asynchrone Prozedurenaufrufe on a Proc set, The only for synchrone Enumeration suitable is, can anytime and apparently random jegliche functions the Betriebssystemes Call.

think one, the Call on DeleteFileA is except the address no another, as the on SetPixel - there wealthy to that catastrophe one zeitversetztes xor eax,eax and a couple suitable values on the Stack - plenty Happiness.

Sleep 10000 can You sure with ExitProcess/ TerminateThread etc. "killen"/ should even delegates his/ go/ or. shining not meaningfully inserted To go.

"Nicht blockierendes Warten" by Waitinput, sinngemäß:
 
09/24/20  
 



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

5.568 Views

Untitledvor 0 min.
ScanMaster06/20/24
Walter12/31/22
RudiB.03/08/22
Sven Bader09/22/21
More...

Themeninformationen

this Topic has 3 subscriber:

RudiB. (4x)
Georg Teles (3x)
iF (1x)


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