[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 251
  • Last Modified:

Need a simple behind the scenes counter to use as a pause for an asp page

Is there a simple way to pause an ASP page? I'm thinking maybe having a simple VB6 dll  i could call from an ASP page so the processor doesn't get pinned.

i'm currently using
Sub Sleep(intSeconds)
    dteStart = Time()
    dteEnd = DateAdd("s", intSeconds, dteStart)
    While dteEnd > Time()
         DoNothing
    Wend
End Sub

Open in new window


This works fine seeing as the page runs locally on a kiosk, the only problem is that the loader image i'm using won't paint... processors go to 50% each and the page basically comes back to life after the delay has expired.

can someone provide a simple bit-o-code for this vb timer i'm thinking of or give a better solution
0
cyberdyne_dev
Asked:
cyberdyne_dev
  • 2
  • 2
2 Solutions
 
käµfm³d 👽Commented:
Have you considered using the sleep API function?
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

...

Sleep(intSeconds)


' If this is an int like '5', then multiply by 1000 because Sleep() expects milliseconds to sleep. e.g.

Sleep(intSeconds * 1000)

Open in new window

0
 
käµfm³d 👽Commented:
P.S.

So you know, the Sleep() API function causes the thread calling it to sleep, allowing other threads to continue processing. It is designed to allow the processor to do other work while some thread is sleeping.
0
 
ArkCommented:
>>having a simple VB6 dll <<   
It is not necessary to invent a bicycle. Such dll already exists:
<script language="VBScript">
      set WshShell = WScript.CreateObject("WScript.Shell")
      WScript.Sleep 1000 'sleep 1 sec
 </script>
<script language="JScript">
      var WshShell = WScript.CreateObject("WScript.Shell");
      WScript.Sleep(1000);
</script>
0
 
ArkCommented:
PS
If WScript.Sleep won't work with ASP, you can use;
<script language="VBScript">
Sub Delay( seconds )
    Dim wshShell
    Set wshShell = CreateObject( "WScript.Shell" )
    wshShell.Run "ping -n " & ( seconds + 1 ) & " 127.0.0.1", 0, True
    Set wshShell = Nothing
End Sub
 </script>
0
 
cyberdyne_devAuthor Commented:
where and how would i use the API function? example please
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now