| |
|
|
Jörg Sellmeyer | Hi,
How could I a counter release, the quasi with voller speed counts, during my Hauptprogramm in the Waitinput on a input wait? with folgendem small code standing the counter. If I but the mouse move raging it go. These speed bräuchte I dauernd. gives it a Message, The dauernd übermittelt becomes? One Timer is In any drop too slow.
|
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 09/27/11 ▲ |
|
|
|
|
Nico Madysa | In XProfan X2 would the well with Multiprozessing To solve.
RGH
so would about The often asked Time in the Headline resolved go:
otherwise wären Threads a Solution. have with XPSE and NProcs something hingezimmert get, the about the power, what You want:
{$cleq}
Cls
nproc Timer
parameters addr&
whilenot Long(addr&,0) < 0
Sleep(1)
Long addr&,0 = Long(addr&,0) + 1
SetText %hWnd,st$(Long(addr&,0))
if Long(addr&,0) >= 385
Long addr&,0 = 0
BitBlt(%hDC,0,0,4000,500,%hDC,0,0,WHITENESS)
endif
wend
ExitThread(0)
ENDPROC
var id& = 0
var exit& = 0
declare count#
dim count#,4
CreateThread(0,0,ProcAddr(Timer,1),count#,0,Addr(id&))
Screen 4000,500
While 1
WaitInput
Window Title Str $(Long(count#,0))
If IsKey($20)
DrawText Long(count#,0) * 10,40,"!"
ElseIf IsKey(27)
Long count#,0 = -10
Break
EndIf
Wend
if GetExitCodeThread(id&,Addr(exit&)) = STILL_ACTIVE
whileloop 5
print "Thread yet active ..."
Sleep 100
casenot GetExitCodeThread(id&,Addr(exit&)) = STILL_ACTIVE : break
EndWhile
case GetExitCodeThread(id&,Addr(exit&)) = STILL_ACTIVE : TerminateThread(id&,0)
endif
Dispose count#
end
naturally are some Dummejungenfehler drin, but at least by me functions it. here The Exe: Download external Download |
|
|
| |
|
|
|
| @Jörg: windows counts already always z.B. in getTickCount ^^ -
if you you means to that Time X whom getTickCount merkst then can always by difference determined how far ("im Hintergrund") counted watts.
Jörg Sellmeyer (27.09.11)
These speed bräuchte I dauernd. gives it a Message, The dauernd übermittelt becomes?
Noe -
the program would otherwise too "immer" busy. ^^ |
|
|
| |
|
|
|
RGH | Why not one own Process:
Declare hFileMap&, Buffer#, Counter%
Dim Buffer#, 5' Space for a LongInt + 1 CLS-Flag
Proc Counter
' Eigener Process, therefore no globaler Variablenzugriff
Declare c_hFileMap&, c_Buffer#, c_Counter%
Dim c_Buffer#, 5' Space for a LongInt
c_hFileMap& = FileMap("Open", "Counter")
c_Counter% = 0
' Speicherdate existing: go goes's with count
If c_hFileMap&
c_Buffer# = FileMap("Map", c_hFileMap&)
Long c_Buffer#, 0 = c_Counter%
byte c_Buffer#, 4 = 0' CLS-Flag on 0
While 1
Sleep 10' for Testzwecke to that better Understand
Inc c_Counter%
If c_Counter% = 385
c_Counter% = 1
byte c_Buffer#, 4 = 1' CLS-Flag on 1
EndIf
Long c_Buffer#, 0 = c_Counter%
EndWhile
Dispose c_Buffer#
FileMap("Close", c_hFileMap&)
Else
MessageBox("Speicherdatei couldn't opened go!", "MAP-Hinweis", 48)
EndIf
ENDPROC
CLS
Screen 4000,500
counter% = 0
hFileMap& = Create("FileMap", "Counter", 4)
If hFileMap&
Buffer# = FileMap("Map", hFileMap&)
Else
MessageBox("Speicherdatei couldn't prepares go!", "Hinweis", 48)
EndIf
' Speicherdatei is prepared: The Process Conter can launched go
var hCounter& = PExec("|Counter")
While 1
WaitInput
Counter% = Long(Buffer#, 0)
If byte(Buffer#, 4 = 1)
CLS
byte Buffer#, 4 = 0' CLS-Flag zurücksetzen
EndIf
Window Title Str $(Counter%)
If IsKey($20)
DrawText Counter% * 10,40,"!"
ElseIf IsKey(27)
Break
EndIf
EndWhile
' Conter-Process terminate!
process("kill", hCounter&, 0)
Dispose Buffer#
FileMap("Close", hFileMap&)
End
Greeting Roland
EDIT: there was someone faster, if something differently ... |
|
|
| XProfan X2Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 09/27/11 ▲ |
|
|
|
|
| RGH (27.09.11)
Why not one own Process:
The Initialisierung is unfortunately very Systemlastig! |
|
|
| |
|
|
|
Nico Madysa | RGH (27.09.11)
Why not one own Process:
because I since the Adressen not so simply had transfer can. I have whom code only fix to the lunch hingepinselt and wished me not still in Filemaps reading. but so, How du's made have, geht's naturally too. |
|
|
| |
|
|
|
Jörg Sellmeyer | I hab's me already virtual. time schaun, what itself there make can. I had hoped, the ließe itself (Thanks Wunderwaffe Subclassing) in a Program manage. thanks for suggestions and Codes! |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 09/28/11 ▲ |
|
|
|
|
| how'bout with Opcode on The createThread-API transfer so You at a Speicherstelle always a Zählerwert have? |
|
|
| |
|
|
|
Jörg Sellmeyer | the says me nothing |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 09/28/11 ▲ |
|
|
|
|
| How quick should because counted go? I take not on the You with 100% CPU-Last "zählen" want and so I the question. I could then z.B. simply bisl nativen Opcode in a area write and the by createThread to process indicate. |
|
|
| |
|
|
|
Jörg Sellmeyer | Ah Yes. I faith, that with the count functions so already. in the momentum nervt me something other. Register again. |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ... | 09/29/11 ▲ |
|
|
|