CyberiaPC.com Community Forums Main Page
RSS Feeds: Late(st) News | Zenith Picture Gallery | Most Recent Community Topics | Tips, Tricks and Other Useful Stuff

Welcome Guest ( Log In | Register )

Reply to this topicStart new topic
> Sleep in VB
MaD_cOw
post Mar 29 2007, 11:42 PM
Post #1


No way... It compiles? SHIP IT!
Group Icon

Group: Moderators
Posts: 609
Joined: 27-December 04
From: Thunder Bay, Ontario Canada
Member No.: 2,133

Canada




I know this is an extremely n00bish Question,

but how would I use the sleep command in VB?


--------------------
-Mad_cow
Go to the top of the page
 
+Quote Post
amir
post Mar 30 2007, 12:27 AM
Post #2


SuperNova III Member
Group Icon

Group: Support Team
Posts: 2,141
Joined: 2-November 02
From: Toronto
Member No.: 302

Canada




vb6
if you are on vb.net, use System.Threading.Thread.Sleep(10000) for a 10 sec sleep.

it is odd i couldn't find the function documentations for vb6 on msdn but u should always first try msdn.
Go to the top of the page
 
+Quote Post
MaD_cOw
post Mar 30 2007, 02:15 AM
Post #3


No way... It compiles? SHIP IT!
Group Icon

Group: Moderators
Posts: 609
Joined: 27-December 04
From: Thunder Bay, Ontario Canada
Member No.: 2,133

Canada




I know I looked everywhere for this, and all the examples didn't work.

Thanks for the help.


--------------------
-Mad_cow
Go to the top of the page
 
+Quote Post
amir
post Mar 30 2007, 02:07 PM
Post #4


SuperNova III Member
Group Icon

Group: Support Team
Posts: 2,141
Joined: 2-November 02
From: Toronto
Member No.: 302

Canada




unless u r writing a console application, sleep usually doesn't do what u need. it freezes the main Thread which is ur UI Thread and UI freezing is not desirable.

if i want to delay some event i use a Timer in .Net (or start a new Thread) there should be such thing in VB6 too.

a code fragment will help.

somewhere i read that u need to declare an entry point to Sleep defintion in kernel32.dll. sounds like Sleep is not a vb function. (add at the top of ur page). actually u can name it whatever u want.

CODE
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Go to the top of the page
 
+Quote Post
MaD_cOw
post Mar 30 2007, 03:29 PM
Post #5


No way... It compiles? SHIP IT!
Group Icon

Group: Moderators
Posts: 609
Joined: 27-December 04
From: Thunder Bay, Ontario Canada
Member No.: 2,133

Canada




This code worked fine, because it was in a duckhunt game, and I wanted the duck to delay for 300 miliseconds but nothing else had to work while it was delayed,

Thanks again.


--------------------
-Mad_cow
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 25th May 2013 - 05:31 AM