This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / 在VB中,如何判断一个变量是不是Nothing? 我现在用typeof(obj)="Nothing", 看起来很笨。有没有办法让程序暂停一段时间?比如2秒钟?
-miketany(MIKE老狼);
2002-8-11
(#686004@0)
-
1,if objSth is nothing then
2, sleep API or
dim dtVar as date
dtVar=dateadd("s", 3, now)
do while now<dtVar
' sleep 3 second
loop
-gugu(GuGu);
2002-8-11
(#686012@0)
-
谢谢! 这个sleep方法很管用,就是太占CPU了,循环过程中一直100% :)
-miketany(MIKE老狼);
2002-8-11
(#686029@0)
-
你指API 还是指那个循环?
-gugu(GuGu);
2002-8-11
(#686033@0)
-
doesn't matter. coz' i used the similar solution before, the loop will not release the message handle to other programs, that's why the cpu usage is 100%
-speed(如风);
2002-8-11
(#686049@0)
-
循环过程中可以加Doevents让系统有机会响应用户操作。我只是觉得奇怪,VB中怎么没有简单的函数可以Sleep一段时间呢?我觉得Basic里好像都有
-miketany(MIKE老狼);
2002-8-11
(#686092@0)
-
sleep shouldn't occup cpu, but just block current thread, if you use it in work thread, it's perfect.
-bigdesk(nothing);
2002-8-11
(#686159@0)
-
yes
-gugu(GuGu);
2002-8-11
(#686246@0)
-
sorry没说清楚,我是说用循环来sleep, 不是用sleepAPI。我一直认为在VB中调用Win32API是使程序兼容性稳定性变坏的最好办法,所以我尽量不用
-miketany(MIKE老狼);
2002-8-11
(#686286@0)
-
without winapi you can't build magic ui with only poor vb functions. actually winapi has nothing to do the app stabilities, the way how to use it does.
-bigdesk(nothing);
2002-8-11
(#686332@0)
-
你想要Magic UI,你用VB干什么?
-miketany(MIKE老狼);
2002-8-11
(#686370@0)
-
yes you are right
-bigdesk(nothing);
2002-8-11
(#686387@0)