{"id":5144,"date":"2016-02-24T15:52:30","date_gmt":"2016-02-24T06:52:30","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=5144"},"modified":"2016-02-24T15:52:30","modified_gmt":"2016-02-24T06:52:30","slug":"windowsapigettickcounttimegettime","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/windowsapigettickcounttimegettime\/","title":{"rendered":"Windows API\uff1a\u6642\u9593\u3092\u8a08\u6e2c\uff08GetTickCount\u3001timeGetTime\uff09"},"content":{"rendered":"<h2>\u30df\u30ea\u79d2\u5358\u4f4d\u306e\u6642\u9593\u3092\u8a08\u6e2c<\/h2>\n<div class=\"m30-l\">\n<p><strong>Windows API<\/strong> \u306e <strong>GetTickCount<\/strong> \u3084 <strong>timeGetTime<\/strong> \u3092\u4f7f\u3046\u3068\u30df\u30ea\u79d2\u5358\u4f4d\u3067\u7d4c\u904e\u6642\u9593\u3092\u8a08\u6e2c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<strong>VBA<\/strong> \u3067\u3001\u7d4c\u904e\u6642\u9593\u306e\u8a08\u6e2c\u3092\u884c\u3046\u306b\u306f\u3001<a href=\"https:\/\/excelwork.info\/excel\/current_time\/\">Now \u95a2\u6570<\/a> \u3092\u5229\u7528\u3057\u305f\u308a\u3001<a href=\"https:\/\/excelwork.info\/excel\/timer\/\">Timer \u95a2\u6570<\/a> \u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<br \/>\n<h3>GetTickCount<\/h3>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u5ba3\u8a00\uff1e<\/strong><\/span><br \/>\n    <strong>Declare Function GetTickCount Lib &#8220;kernel32&#8221; () As Long<\/strong><\/p>\n<p>    <strong>GetTickCount<\/strong><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>\u623b\u308a\u5024&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30b7\u30b9\u30c6\u30e0\u3092\u8d77\u52d5\u3057\u305f\u5f8c\u306e\u7d4c\u904e\u6642\u9593\uff08\u30df\u30ea\u79d2\uff08ms\uff09\u5358\u4f4d\u3067\u53d6\u5f97\uff09\u3092\u8868\u3059 DWORD \u578b\u306e\u5024\uff08VBA \u3067\u306f\u3001Long \u578b \u306b\u8a72\u5f53\uff09\u3002<\/li>\n<\/ul><\/div>\n<br \/>\n<h3>timeGetTime<\/h3>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u5ba3\u8a00\uff1e<\/strong><\/span><br \/>\n    <strong>Declare Function timeGetTime Lib &#8220;winmm.dll&#8221; () As Long<\/strong><\/p>\n<p>    <strong>timeGetTime<\/strong><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>\u623b\u308a\u5024&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;Windows \u304c\u8d77\u52d5\u3057\u3066\u304b\u3089\u7d4c\u904e\u3057\u305f\u6642\u9593\uff08\u30df\u30ea\u79d2\uff08ms\uff09\u5358\u4f4d\u3067\u53d6\u5f97\uff09\u3092\u8868\u3059 DWORD \u578b\u306e\u5024\uff08VBA \u3067\u306f\u3001Long \u578b \u306b\u8a72\u5f53\uff09\u3002<\/li>\n<\/ul><\/div>\n<br \/>\n<p class=\"caution4\">Windows API \u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306e\u5ba3\u8a00\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/excelwork.info\/excel\/windowsapideclare\/\">Windows API \u3092\u4f7f\u3046\uff08Declare \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\uff09<\/a> \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<\/div>\n<br \/><br \/>\n<h2>GetTickCount\u30fbtimeGetTime \u3067\u3001\u6642\u9593\u3092\u8a08\u6e2c\u3059\u308b\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9 1<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"GetTickCount \u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\n'WindowsAPI \u306e GetTickCount \u95a2\u6570\u3092\u5ba3\u8a00\r\nDeclare Function GetTickCount Lib \"kernel32\" () As Long\r\n\r\n\r\nSub Sample_WindowsAPI_GetTickCount()\r\n \r\n    Dim StartTime\r\n    Dim EndTime\r\n \r\n    '\u958b\u59cb\u6642\u9593\u306e\u53d6\u5f97\r\n    StartTime = GetTickCount\r\n    '\u7d42\u4e86\u6642\u9593\u306e\u8a2d\u5b9a\r\n    EndTime = 20\r\n    \r\n    '\u7d4c\u904e\u6642\u9593\u3092\u300cA1\u300d\u30bb\u30eb\u306b\u8868\u793a\r\n    With Sheets(\"Sheet1\")\r\n        \r\n        .Cells(1, 1).Value = \"\"\r\n    \r\n        Do Until .Cells(1, 1).Value > 20\r\n            .Cells(1, 1).Value = (GetTickCount - StartTime) \/ 1000\r\n            DoEvents\r\n        Loop\r\n    \r\n    End With\r\n \r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c 1<\/h3>\n<p><a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/02\/windowsapigettickcount01.jpg?ssl=1\" rel=\"lightbox[5144]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/02\/windowsapigettickcount01.jpg?resize=399%2C248&#038;ssl=1\" alt=\"WindowsAPI GetTickCount\" width=\"399\" height=\"248\" class=\"alignnone size-full wp-image-5152\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/><br \/>\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9 2<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"timeGetTime \u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\n'WindowsAPI \u306e timeGetTime \u95a2\u6570\uff08\u30b7\u30b9\u30c6\u30e0\u6642\u523b\u3092\u30df\u30ea\u79d2\u5358\u4f4d\u3067\u53d6\u5f97\uff09\u3092\u5ba3\u8a00\r\nDeclare Function timeGetTime Lib \"winmm.dll\" () As Long\r\n\r\n\r\nSub Sample_WindowsAPI_timeGetTime()\r\n\r\n    Dim TStart As Long\r\n    Dim TEnd As Long\r\n    Dim i As Long, j As Long, cnt As Long\r\n    \r\n    '\u51e6\u7406\u958b\u59cb\u6642\u9593\u306e\u53d6\u5f97\r\n    TStart = timeGetTime\r\n    \r\n    For i = 1 To 30\r\n        For j = 1 To 15\r\n            cnt = cnt + 1\r\n            Cells(i, j) = cnt\r\n        Next j\r\n    Next i\r\n    \r\n    '\u51e6\u7406\u958b\u7d42\u4e86\u9593\u306e\u53d6\u5f97\r\n    TEnd = timeGetTime\r\n    \r\n    '\u51e6\u7406\u7d4c\u904e\u6642\u9593\u3092\u8868\u793a\r\n    MsgBox \"\u51e6\u7406\u6642\u9593\uff1a\" & (TEnd - TStart) \/ 1000 & \" \u79d2\"\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c 2<\/h3>\n<p>  <a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/02\/windowsapideclare01.jpg?ssl=1\" rel=\"lightbox[5144]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/02\/windowsapideclare01.jpg?resize=580%2C309&#038;ssl=1\" alt=\"Declare \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\" width=\"580\" height=\"309\" class=\"alignnone size-large wp-image-5142\" srcset=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/02\/windowsapideclare01.jpg?resize=580%2C309&amp;ssl=1 580w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/02\/windowsapideclare01.jpg?resize=400%2C213&amp;ssl=1 400w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/02\/windowsapideclare01.jpg?resize=768%2C409&amp;ssl=1 768w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/02\/windowsapideclare01.jpg?w=1052&amp;ssl=1 1052w\" sizes=\"(max-width: 580px) 100vw, 580px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>\u30df\u30ea\u79d2\u5358\u4f4d\u306e\u6642\u9593\u3092\u8a08\u6e2c Windows API \u306e GetTickCount \u3084 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":5152,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[813],"tags":[816,817,818,814,815,38],"jetpack_featured_media_url":"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/02\/windowsapigettickcount01.jpg?fit=399%2C248&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-1kY","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5144"}],"collection":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/comments?post=5144"}],"version-history":[{"count":8,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5144\/revisions"}],"predecessor-version":[{"id":5193,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5144\/revisions\/5193"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/5152"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=5144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=5144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=5144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}