Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Pausing timer, Save paused time

timer

This topic has been archived. This means that you cannot reply to this topic.
8 replies to this topic

#1 Opcode

Opcode

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 87 posts

Posted 13 November 2013 - 12:14 PM

I have this timer, it reads from memory to get its time, i want to add a section to this app that lets me pause the timer on key press

then take that paused time and put it in a list of intervals

so everytime i press space for example it makes a new interval, while the main timer still goes?

how would i do this


Edited by Roger, 15 November 2013 - 07:54 AM.
added codetags


#2 zeroGiven

zeroGiven

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 61 posts

Posted 13 November 2013 - 12:51 PM

Not exactly sure this is what you mean but, could you just store the labels.text property at the time the space was pressed. You could send it to a listbox or generic list(of string) or something similar. This would let the timer continue counting but your interval at the press of the space would be logged. Or am I completely misunderstanding what you mean?



#3 Opcode

Opcode

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 87 posts

Posted 13 November 2013 - 01:07 PM

  • Quote

     

    Not exactly sure this is what you mean but, could you just store the labels.text property at the time the space was pressed. You could send it to a listbox or generic list(of string) or something similar. This would let the timer continue counting but your interval at the press of the space would be logged. Or am I completely misunderstanding what you mean?

    No your correct, i just did this it kinda does what i want


Problem at the moment is it does not work outside the app, meaning i want it to work even when im using another process?


Edited by Opcode, 13 November 2013 - 09:12 PM.


#4 zeroGiven

zeroGiven

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 61 posts

Posted 13 November 2013 - 01:14 PM

I think you will need to use getasynckeystate to do this from outside the app. http://www.maxvb.com/post-8.html



#5 Opcode

Opcode

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 87 posts

Posted 13 November 2013 - 02:52 PM

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer

Private Sub List1_KeyPress(KeyAscii As Integer)

If GetAsyncKeyState(32) Then
List1.AddItem (FRM_MAIN.LBL_TIME.Caption)
End If
End Sub

 

Works similar to as before but its still not registering when i have another process open =[


Edited by Opcode, 13 November 2013 - 09:12 PM.


#6 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 13 November 2013 - 07:47 PM

I assume you have a global timer that you start on form load or something.

 

So, you need to hook the onKeyPressed event (however it's called) and do the

 

TimerVariable.Enabled = false
TimerVariable.Stop()

 

And that's it.



#7 Opcode

Opcode

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 87 posts

Posted 14 November 2013 - 10:20 AM

Seem's the key only responds when i have its form open =[



#8 Opcode

Opcode

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 87 posts

Posted 20 November 2013 - 02:13 PM

Is it because im using VB 6.0 that this wont work?

Ive been at this for days now, the only thing from stopping my app from being completed is This hotkey problem



#9 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts

Posted 21 November 2013 - 06:44 AM

Wait, somebody's still teaching VB 6.0? I thought that was completely dead by now. VB 6 and VB.Net are completely different animals with very similar syntax.


Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download