Re: How to remotely activate Ctrl-C ?

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Jack (replyto_at_newsgroup)
Date: 03/30/04


Date: Tue, 30 Mar 2004 10:41:20 -0500

I read about that Sleep function and I am a little confused.
In my program (telephony application) I am using quite often the time delays
loops.
The time delay function I am using looks like that:

Public Start as Single
Public Sub DelayTimer(TimeDelay As Single)
    Start = Timer ' Set start time.
    Do While Timer < Start + TimeDelay
    Loop
End Sub

and 'interactive' time delay function:

Public Sub DelayTimerInter(TimeDelay As Single)
    Start = Timer ' Set start time.
    Do While Timer < Start + TimeDelay
          DoEvents
    Loop
End Sub

How these above compare with the Sleep function? What is better to use?
I am not a professional programmer but I like to do things the right way :)
Jack

"J French" <erewhon@nowhere.com> wrote in message
news:40691ba0.80933856@news.btclick.com...
> On Tue, 30 Mar 2004 01:15:35 -0500, "Jack" <replyto@newsgroup> wrote:
>
> >Interesting.
> >I do not have Sleep function in my vbasic5 and I just put some time delay
> >loop to no avail.
>
> You'll hav it in a minute
>
> >But, when I use DoEvents just before getting clipboard data there is not
> >error anymore :)
>
> Great
>
> >I do this:
> > DoEvents
> > lname = Clipboard.GetText
> >How about that?
>
> That looks fine.
>
> Now you are in for a shock.
>
> VB sits on top of Windows and most of what it really does is make
> Calls into Subs and Functions that Windows provides.
> - these are called APIs - Application Programmer Interfaces
>
> There are hundreds, or rather thousands of APIs
>
> Here is one of them
> - stick it at the top of your Form and presto
> ... you have Sleep( 250 ) in VB5
>
> Private Declare Sub Sleep _
> Lib "kernel32.dll" _
> (ByVal dwMilliseconds As Long)
>
> There is a superb downloadable API Guide at:
> www.AllAPI.net
>
> It is full of easy to test examples
>
> Easily the most useful programming resource I have ever found
> ( although it is best used in conjunction with the Win32 Programmer's
> Reference Help Files and MSDN )
>
> I recommend that you put Sleep(250) in after the DoEvents because
> DoEvents processes all /your/ outstanding Windows Messages in /your/
> message queue
> - but Sleep(250) hand over the CPU to the other Apps running on the
> system for 1/4 of a second, which gives the App that you are pumping
> key presses at a chance to do its Clipboard copy and close the
> Clipboard
> - probably just belt and braces, but still good practice
>
> I rather suspect that you will have some fun with the API Guide
>
> Good Luck



Relevant Pages

  • Re: Syntax Problem...
    ... >> I'm tring to write a script that verifies if the time of the last ... sub Check_Mod ... But it runs in an infinite loop that I would only like to run every 60 ... Do I have the sleep function in the correct place, ...
    (comp.lang.perl.misc)
  • Re: Retarded propagation of magnetic field leads to contradiction
    ... there will be a time delay. ... The current in the loop ... Let one frame be the magnet and the other frame be ... | Exp 1. ...
    (sci.physics.relativity)
  • Re: Retarded propagation of magnetic field leads to contradiction
    ... there will be a time delay. ... The current in the loop ... Let one frame be the magnet and the other frame be the ... Exp 1. ...
    (sci.physics.relativity)
  • RE: ASP.NET question about datagrid row changes
    ... I have been looking into trying the time delay, but I don't really see how ... b/c the page has posted back for the RowChanged function. ... >> Protected Sub RowChanged(ByVal sender As System.Object, ... except that the RowChanged sub only fires when the row ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: A better way to Read Bytes until Done ?
    ... bytes at serial port to be the same on two sequential checks. ... You have no time delay in the loop; on a modern computer it will cycle ... the number of arrived characters can only change every 1.04 ...
    (comp.lang.labview)