{"id":5140,"date":"2016-02-23T09:25:05","date_gmt":"2016-02-23T00:25:05","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=5140"},"modified":"2016-02-23T09:25:05","modified_gmt":"2016-02-23T00:25:05","slug":"windowsapideclare","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/windowsapideclare\/","title":{"rendered":"Windows API \u3092\u4f7f\u3046\uff08Declare \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\uff09"},"content":{"rendered":"<h2>Windows API \u3092\u4f7f\u3046<\/h2>\n<div class=\"m30-l\">\n<p>VBA \u304b\u3089 <strong>Windows API\uff08Application Programming Interface\uff09<\/strong> \u306e\u95a2\u6570\u3092\u547c\u3073\u51fa\u3057\u3066\u4f7f\u7528\u3059\u308b\u3068\u3001Windows \u306e\u6a5f\u80fd\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<strong>Windows API<\/strong> \u3092\u4f7f\u7528\u3059\u308b\u306b\u306f\u3001<strong>Declare \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/strong>\u3092\u4f7f\u3063\u3066\u5ba3\u8a00\u3092\u3057\u307e\u3059\u3002<\/p>\n<p class=\"caution8\">64Bit\u7248\u306e Microsoft Office \u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u3001<strong>PtrSafe \u30ad\u30fc\u30ef\u30fc\u30c9<\/strong>\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<br \/>\n<h3>Declare \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/h3>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u69cb\u6587\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1cSub\uff1e<\/strong><\/span><br \/>\n    [ <strong>Public<\/strong> | <strong>Private<\/strong> ] <strong>Declare<\/strong> <strong>Sub<\/strong> <em>name<\/em> <strong>Lib<\/strong> &#8220;<em>libname<\/em>&#8221; [ <strong>Alias<\/strong> &#8220;<em>aliasname<\/em>&#8221; ] [( <em>arglist<\/em> )]<\/p>\n<p>    <span class=\"red\"><strong>\uff1cFunction\uff1e<\/strong><\/span><br \/>\n    [ <strong>Public<\/strong> | <strong>Private<\/strong> ] <strong>Declare<\/strong> <strong>Function<\/strong> <em>name<\/em> <strong>Lib<\/strong> &#8220;<em>libname<\/em>&#8221; [ <strong>Alias<\/strong> &#8220;<em>aliasname<\/em>&#8221; ] [( <em>arglist<\/em> )] [ <strong>As<\/strong> <em>type<\/em> ]<\/p><\/div>\n<br \/>\n<h3>Declare \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\uff0864bit\u7248 Microsoft Office \u3092\u4f7f\u7528\uff09<\/h3>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u69cb\u6587\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1cSub\uff1e<\/strong><\/span><br \/>\n    [ <strong>Public<\/strong> | <strong>Private<\/strong> ] <strong>Declare<\/strong> <strong>PtrSafe<\/strong> <strong>Sub<\/strong> <em>name<\/em> <strong>Lib<\/strong> &#8220;<em>libname<\/em>&#8221; [ <strong>Alias<\/strong> &#8220;<em>aliasname<\/em>&#8221; ] [( <em>arglist<\/em> )]<\/p>\n<p>    <span class=\"red\"><strong>\uff1cFunction\uff1e<\/strong><\/span><br \/>\n    [ <strong>Public<\/strong> | <strong>Private<\/strong> ] <strong>Declare<\/strong> <strong>PtrSafe<\/strong> <strong>Function<\/strong> <em>name<\/em> <strong>Lib<\/strong> &#8220;<em>libname<\/em>&#8221; [ <strong>Alias<\/strong> &#8220;<em>aliasname<\/em>&#8221; ] [( <em>arglist<\/em> )] [ <strong>As<\/strong> <em>type<\/em> ]<\/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>PtrSafe&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;64bit\u7248\u306e Excel \u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u5fc5\u305a\u6307\u5b9a\u3057\u307e\u3059\u3002<strong>PtrSafe \u30ad\u30fc\u30ef\u30fc\u30c9<\/strong>\u306f\u3001<strong>Declare \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/strong>\u304c 64bit\u7248\u306e Microsoft Office \u3067\u5b89\u5168\u306b\u5b9f\u884c\u3055\u308c\u308b\u3053\u3068\u3092\u4e3b\u5f35\u3057\u307e\u3059\u3002<\/li>\n<li>name&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u540d\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u7701\u7565\u4e0d\u53ef\uff09\u3002<\/li>\n<li>libname&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<em>name<\/em> \u3067\u6307\u5b9a\u3057\u305f\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u304c\u542b\u307e\u308c\u308b <strong>DLL<\/strong> \u307e\u305f\u306f\u3001<strong>\u30b3\u30fc\u30c9\u30ea\u30bd\u30fc\u30b9<\/strong>\u306e\u540d\u524d\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u7701\u7565\u4e0d\u53ef\uff09\u3002<\/li>\n<li>aliasname&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u540d\u3068\u306f\u7570\u306a\u308b\u540d\u524d\uff08\u5225\u540d\uff09\u3067\u3001\u95a2\u6570\u3092\u4f7f\u7528\u3057\u305f\u3044\u5834\u5408\u306b\u306e\u307f\u4f7f\u7528\u3057\u307e\u3059\u3002<br \/>\n\t\u203b <em>name<\/em> \u306b\u3001\u5225\u540d\u3092\u6307\u5b9a\u3057\u3001<em>aliasname<\/em> \u306b\u3001\u5b9f\u969b\u306e\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u540d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>arglist&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306b\u6e21\u3059\u5f15\u6570\u306e\u30ea\u30b9\u30c8\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u7701\u7565\u53ef\uff09\u3002<\/li>\n<li>type&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306e\u623b\u308a\u5024\u306e\u578b\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u7701\u7565\u53ef\uff09\u3002<\/li>\n<\/ul>\n<br \/><\/div>\n<\/div>\n<br \/><br \/>\n<h2>Windows API \u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"Windows API \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<\/h3>\n<p><a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/02\/windowsapideclare01.jpg?ssl=1\" rel=\"lightbox[5140]\"><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>Windows API \u3092\u4f7f\u3046 VBA \u304b\u3089 Windows API\uff08Appli &#8230; <\/p>\n","protected":false},"author":1,"featured_media":5182,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[813],"tags":[816,814,815,38],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/02\/windowsapideclare01-580x309-1.jpg?fit=580%2C309&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-1kU","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5140"}],"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=5140"}],"version-history":[{"count":3,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5140\/revisions"}],"predecessor-version":[{"id":5183,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5140\/revisions\/5183"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/5182"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=5140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=5140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=5140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}