16274.html

来自「以电子书的形式收集了VB一些常见问题解决方法,可以很方便的查找自己需要解决的问题」· HTML 代码 · 共 23 行

HTML
23
字号
<html>
  <head>
    <title>Re: 或者用....</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>Re: 或者用....</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by <a href="mailto:chyeu@gcn.net.tw">阿雨</a> on July 27, 1999 at 23:25:36:<p>
In Reply to: <a href="16248.html">是这样的,本人要在隔1us向PRINTPORT 输出数据,不知该如何控制1us</a> posted by Hanting on July 27, 1999 at 15:04:07:<p>
本段文章取自王国荣网站的技巧集http://www.kj.com.tw<p>可以改用 Windows API 的 timeGetTime 函数, 此一函数会传回 Windows 开机以来所经过的时间,时间单位是 1/1000 秒, 举例来说, 开机经过 2 分钟, 则传回值等于 2*60*1000, timeGetTime 的优点是时间可以精确到 1/1000 秒, 所以可以用来解决上述的问题,细节如下:<p>1. API 的宣告:<p>Private Declare Function timeGetTime Lib "winmm.dll" Alias "timeGetTime" () As Long <p>注:如果以上的宣告放在「一般模组」底下, 应将 Declare 之前的 Private 保留字去掉。<p>2. 程式范例:<p>Dim tm1 As Long<br>Do<br>    tm1 = timeGetTime<br>    While timeGetTime - tm1 < 5  ' 等于 5/1000 = 0.005 秒<br>        DoEvents<br>    Wend <br>    ...做某一件工作<br>Loop<br>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 16274-->
</ul><!--end: 16274-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?