Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    l4sth4ck3r's Avatar
    Join Date
    Dec 2007
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    0
    My Mood
    Pensive

    Post [Help]Thread.Sleep alternative[Solved]

    Hi.

    as you know , sleep freeze everything in the application.


    i need the same thing but not freezing everything.

    because im making something for msn.

    my code in timer1 is ( interval 2000 )
    Code:
    sendkeys.send(richtextbox1.text)
    sendkeys.send(textbox2.text)
    sleep(2000)
    sendkeys.send(F8)
    my code in timer2 is ( interval 350 )
    Code:
    Randomize()
    TextBox2.Text = CStr(Int(Rnd() * 999))

    the problem is after " sendkeys.send(richtextbox.text) " the whole application freeze for 2 sec ( 2000ms ) so my timer2 stop generating random number and it send over 2 time the same number

    what can i do ??

    thx

  2. #2
    MJLover's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Neverland
    Posts
    759
    Reputation
    33
    Thanks
    110
    My Mood
    Cheerful
    Quote Originally Posted by l4sth4ck3r View Post
    Hi.

    as you know , sleep freeze everything in the application.


    i need the same thing but not freezing everything.

    because im making something for msn.

    my code in timer1 is ( interval 2000 )
    Code:
    sendkeys.send(richtextbox1.text)
    sendkeys.send(textbox2.text)
    sleep(2000)
    sendkeys.send(F8)
    my code in timer2 is ( interval 350 )
    Code:
    Randomize()
    TextBox2.Text = CStr(Int(Rnd() * 999))

    the problem is after " sendkeys.send(richtextbox.text) " the whole application freeze for 2 sec ( 2000ms ) so my timer2 stop generating random number and it send over 2 time the same number

    what can i do ??

    thx
    First thing that I don't understand. Why are you using two timers, when you can do this just by using 1 ??

    The easy solution would be to put this code before sending the keys:
    Code:
    Randomize()
    TextBox2.Text = CStr(Int(Rnd() * 999))
    Because Timer2 has nothing to do with sending, means the timer1 will send the keys of the text written in textbox2. So, its a better solution. Also put this code before sleep(2000):
    Code:
    Application.DoEvents()
    This causes the application to perform events even if the program hangs !!

    Nextgen1 wrote some piece of custom sleeping. If my method doesn't help you, you can ask him for that !!

    Regards

  3. #3
    l4sth4ck3r's Avatar
    Join Date
    Dec 2007
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    0
    My Mood
    Pensive
    ok thanks ill try this.

    why 2 timer ? ANSWER : timer 1 is for sendkey at 2000ms i cant make it faster ( reliability )
    timer 1 is generating new number each 350ms. i will have other timer that will use random number too but with different interval ( 7000 ) so i keep it a 350 so that way anything using it get new number .

    anywya thx ill give you news about it.

  4. #4
    l4sth4ck3r's Avatar
    Join Date
    Dec 2007
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    0
    My Mood
    Pensive
    ok so i tryed.
    nothing change.

    the sleep still freeze the whole app.

    see the new project i amde just to try it

    Code:
    Imports System.Threading.Thread
    Public Class Form1
    
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            Randomize()
            TextBox1.Text = CStr(Int(Rnd() * 999))
            Application.DoEvents()
            Sleep(1000)
        End Sub
    
        Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
            Randomize()
            TextBox2.Text = CStr(Int(Rnd() * 99999))
        End Sub
    End Class
    NextGen1: OutSide Link Removed.

    both timer set to 100 ms

    still freeze whole app so the Random 2 sleep with the Random 1

    yes for this one i could have used only 1 timer but my other project realy need more timer .
    Last edited by NextGen1; 03-25-2010 at 06:55 AM.

  5. #5
    l4sth4ck3r's Avatar
    Join Date
    Dec 2007
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    0
    My Mood
    Pensive
    ok i found wht thing you was talking about
    Code:
    Private Sub Sleep(ByVal PauseTime As Double)
    
            Dim Tind As Int16
            For Tind = 1 To PauseTime / 50
                Threading.Thread.Sleep(50)
                Application.DoEvents()
            Next
    
        End Sub
    dont seem to work.

  6. #6
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    So you got a interval of 2000 why do you then let it sleep again?

    I don't get that part...



  7. #7
    l4sth4ck3r's Avatar
    Join Date
    Dec 2007
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    0
    My Mood
    Pensive
    Quote Originally Posted by Blubb1337 View Post
    So you got a interval of 2000 why do you then let it sleep again?

    I don't get that part...


    if i dont sleep it it keep sending it again and again and again and again non-stop = huge ressource or crash. so i need to pose it a bit then he restart himself after 2 second

  8. #8
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    My pc/program does not even crash with a interval of 50 without sleep....



  9. #9
    l4sth4ck3r's Avatar
    Join Date
    Dec 2007
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    0
    My Mood
    Pensive
    Quote Originally Posted by Blubb1337 View Post
    My pc/program does not even crash with a interval of 50 without sleep....
    READ dude..

    its for msn. typing too fast in msn = crash.

    my brother have high-end computer fresh install and when he start the app after 2 minute msn crash.

    not sur what his comp but i know :
    processor intel I7
    8Gb ram DDR3
    2x 1TB hd.

    i must say this app isnt typing in blocnote but in msn.. dont ask too much lol

  10. #10
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed


    That's My code from the snippets from the snippets Vault and it works fine

    what you have to do is use

    Sleep(2000)

    I have tested it, and so has a few others

    @ Other stuff
    Your New, So....

    A. I Removed your outside link, Outside Links our not allowed without permission.

    B. Watch the Double posts, use the Edit Button


    Last edited by NextGen1; 03-25-2010 at 06:58 AM.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  11. #11
    Taylor Swift's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Location
    Spangdahlem, Germany
    Posts
    6,438
    Reputation
    357
    Thanks
    651
    My Mood
    Yeehaw
    cant you just use Hibernate? lol

  12. #12
    l4sth4ck3r's Avatar
    Join Date
    Dec 2007
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    0
    My Mood
    Pensive
    Quote Originally Posted by NextGen1 View Post


    That's My code from the snippets from the snippets Vault and it works fine

    what you have to do is use

    Sleep(2000)

    I have tested it, and so has a few others

    @ Other stuff
    Your New, So....

    A. I Removed your outside link, Outside Links our not allowed without permission.

    B. Watch the Double posts, use the Edit Button



    i tryed your snipet but didnt worked.
    it was only sleeping 50ms and again for everything.

    if you could make a little project that i can have a look and make some try ?

  13. #13
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Sure, One Second I will upload it here in this post

    Edit:

    Attached, It is nothing more then a Button which will

    set label1.text + 1 then sleep for 3 seconds then + 1 and sleep for 3 more seconds.

    with application.doevents.


    It is attached:
    Here is Virus scan
    https://www.virustotal.com/analisis/1...0a9-1269523087

    Last edited by NextGen1; 03-25-2010 at 08:17 AM.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  14. #14
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Quote Originally Posted by l4sth4ck3r View Post
    READ dude..

    its for msn. typing too fast in msn = crash.

    my brother have high-end computer fresh install and when he start the app after 2 minute msn crash.

    not sur what his comp but i know :
    processor intel I7
    8Gb ram DDR3
    2x 1TB hd.

    i must say this app isnt typing in blocnote but in msn.. dont ask too much lol
    Well, I tried it on msn too and it was working fine. nvm then...



  15. The Following User Says Thank You to Blubb1337 For This Useful Post:

    MJLover (03-25-2010)

  16. #15
    MJLover's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Neverland
    Posts
    759
    Reputation
    33
    Thanks
    110
    My Mood
    Cheerful
    Ya, works perfect for me too, may be you have an issue with your MSN !!
    Last edited by MJLover; 03-25-2010 at 09:12 AM.

Page 1 of 2 12 LastLast

Similar Threads

  1. [SOLVED] Help thread
    By ♪~ ᕕ(ᐛ)ᕗ in forum Call of Duty Modern Warfare 2 Help
    Replies: 7
    Last Post: 07-21-2010, 10:33 PM
  2. [SOLVED] Yes, a help thread coming from my direction
    By Archangel in forum Call of Duty Modern Warfare 2 Help
    Replies: 16
    Last Post: 07-05-2010, 07:46 AM
  3. [Help]Sleep/Pause[Solved]
    By jakobkorber in forum Visual Basic Programming
    Replies: 11
    Last Post: 03-13-2010, 06:27 AM
  4. ADMINS CROSS OUT SOLVED HELP THREADS!
    By tenko in forum Combat Arms Discussions
    Replies: 1
    Last Post: 10-02-2009, 04:44 AM
  5. HELP THREAD(post ANY questions here)
    By Obama in forum Combat Arms Hacks & Cheats
    Replies: 1490
    Last Post: 08-23-2009, 11:31 AM