{"id":2482,"date":"2023-02-01T23:44:54","date_gmt":"2023-02-01T14:44:54","guid":{"rendered":"http:\/\/oreoreki.gotdns.ch\/?p=2482"},"modified":"2023-02-02T00:01:44","modified_gmt":"2023-02-01T15:01:44","slug":"post-2482","status":"publish","type":"post","link":"http:\/\/oreoreki.gotdns.ch\/?p=2482","title":{"rendered":"[VBA MIDI]VBA\u3067\u6210\u7530\u30fb\u30b9\u30ad\u30dd\u30fc\u30eb\u7a7a\u6e2f\u306e\u30c1\u30e3\u30a4\u30e0\u3092\u4f5c\u3063\u3066\u307f\u305f\/Schiphol Omroep Geluid"},"content":{"rendered":"<p>https:\/\/youtube.com\/shorts\/h5cD8F6c_cM<\/p>\n<p><span>Excel VBA\u3067\u30b9\u30ad\u30dd\u30fc\u30eb\u7a7a\u6e2f\u306e\u30c1\u30e3\u30a4\u30e0\u3092\u4f5c\u3063\u3066\u307f\u305f<\/span><br \/>\n<span class=\"bold-red\">\u3053\u306e\u52d5\u753b\u306e\u30de\u30af\u30ed\u306fWindows11\/Office2016\u3067\u4f5c\u6210\u3057\u3066\u307e\u3059\u3002<br \/>\n<\/span><\/p>\n<h2><\/h2>\n<pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>'MIDI API\r\nPrivate Declare PtrSafe Function midiOutGetNumDevs Lib \"winmm\" () As Integer\r\nPrivate Declare PtrSafe Function midiOutOpen Lib \"winmm.dll\" (lphMidiOut As LongPtr, ByVal uDeviceID As Long, ByVal dwCallback As LongPtr, ByVal dwInstance As LongPtr, ByVal dwflags As Long) As Long\r\nPrivate Declare PtrSafe Function midiOutShortMsg Lib \"winmm.dll\" (ByVal hMidiOut As LongPtr, ByVal dwMsg As Long) As Long\r\nPrivate Declare PtrSafe Function midiOutClose Lib \"winmm.dll\" (ByVal hMidiOut As LongPtr) As Long\r\nDim Handle As LongPtr\r\n'Sleep API\r\nPrivate Declare PtrSafe Sub Sleep Lib \"kernel32\" (ByVal dwMilliseconds As LongPtr)\r\nPrivate Declare PtrSafe Function MessageBoxTimeoutA Lib \"User32.dll\" (ByVal hWnd As LongPtr, ByVal lpText As String, ByVal lpCaption As String, ByVal uType As VbMsgBoxStyle, ByVal wLanguageID As Long, ByVal dwMilliseconds As Long) As Long\r\n\r\n\r\nSub test10()\r\n    '\u6700\u521d\u306e\u9805\u76eeXXYY\u3000MIDI\u30e1\u30c3\u30bb\u30fc\u30b8xxC0\u3068\u5f85\u3061\u6642\u9593FFyyyy xx\u306f0-7F\u3067\u697d\u5668\u306e\u30b3\u30fc\u30c9\u3002yyyy\u306fsleep\u306e\u6642\u9593\r\n    '\u4ee5\u964d\u306e\u9805\u76eeZZ\u3000 ZZ:\u771f\u3093\u4e2d\u306e\u30c930,\u30c9#32,\u30ec32,  \u9ad8\u3044\u30c9:3C     \u548c\u97f3\u306e\u5834\u5408:\u3067\u533a\u5207\u308b\u3000\u30c9\u30df\u30bd\u300030:34:37\r\n    'JR\u6210\u7530\u7a7a\u6e2f\u99c5\r\n    MessageBoxTimeoutA 0, \"JR\u6210\u7530\u7a7a\u6e2f\u99c5\/JR Narita airport\", \"\u97f3\", 0, 65536, 1000\r\n    Call PlayMsg2(\"0AC0,FF0110,43,,3B:3E,43,40,,40,,42:39,,40,42,43,,32:37,,\")\r\n    '\u6210\u7530\u7a7a\u6e2f\u30b2\u30fc\u30c8\r\n    MessageBoxTimeoutA 0, \"\u6210\u7530\u7a7a\u6e2f\u30b2\u30fc\u30c8\/Narita lobby\", \"\u97f3\", 0, 65536, 1000\r\n    Call PlayMsg2(\"04C0,FF01FF,45,42,45,4A,,,,,,\")\r\n    '\u6210\u7530\u7a7a\u6e2f\u642d\u4e57\u53e3\r\n    MessageBoxTimeoutA 0, \"\u6210\u7530\u7a7a\u6e2f\u642d\u4e57\u53e3\/Narita gate\", \"\u97f3\", 0, 65536, 1000\r\n    Call PlayMsg2(\"0BC0,FF50,43,45,48,4A,4C,4F,54,56:43,,,,,,,,,,,,,,,,,,,,,,,,,\")\r\n    '\u30b9\u30ad\u30dd\u30fc\u30eb\u7a7a\u6e2f\r\n    MessageBoxTimeoutA 0, \"\u30b9\u30ad\u30dd\u30fc\u30eb\u7a7a\u6e2f\/Schiphol \", \"\u97f3\", 0, 65536, 1000\r\n    Call PlayMsg2(\"0EC0,FF0250,46,42,3D,,,,\")\r\nEnd Sub\r\nPublic Function PlayMsg2(msg_dat)\r\n    Dim Msg As Long\r\n    Dim Ret As Long\r\n    Ret = midiOutGetNumDevs\r\n    If Ret = 0 Then\r\n        MessageBoxTimeoutA 0, \"No MIDI\", \"alert\", 0, 65536, 1000\r\n    Else\r\n        Ret = midiOutOpen(Handle, -1, 0, 0, 0)\r\n        arr_dat = Split(msg_dat, \",\")\r\n        Call midiOutShortMsg(Handle, \"&H\" & Mid(arr_dat(0), 1, 2) & \"C0\")\r\n        sleep_time = 50\r\n        For i = 0 To UBound(arr_dat)\r\n            If InStr(arr_dat(i), \":\") > 0 Or Len(arr_dat(i)) <= 2 Then\r\n                If arr_dat(i) <> \"\" Then\r\n                    arr_dat2 = Split(arr_dat(i), \":\")\r\n                    For j = 0 To UBound(arr_dat2)\r\n                        Msg = Val(\"&H7F\" & arr_dat2(j) & \"90\")\r\n                        Call midiOutShortMsg(Handle, Msg)\r\n                    Next\r\n                End If\r\n                Sleep (sleep_time)\r\n            Else\r\n                If Mid(arr_dat(i), 1, 2) = \"FF\" Then\r\n                    sleep_time = Val(\"&H\" + Mid(arr_dat(i), 3))\r\n                Else\r\n                    Call midiOutShortMsg(Handle, \"&H\" & Mid(arr_dat(0), 1, 2) & \"C0\")\r\n                End If\r\n            End If\r\n            DoEvents\r\n        Next\r\n        Ret = midiOutClose(Handle)\r\n    End If\r\nEnd Function\r\n<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/youtube.com\/shorts\/h5cD8F6c_cM Excel VBA\u3067\u30b9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2484,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[34],"tags":[],"class_list":["post-2482","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vba"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"http:\/\/oreoreki.gotdns.ch\/wp-content\/uploads\/sites\/2\/2023\/02\/excel-vba-1.jpg","jetpack_shortlink":"https:\/\/wp.me\/p9WqRX-E2","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts\/2482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2482"}],"version-history":[{"count":5,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts\/2482\/revisions"}],"predecessor-version":[{"id":2490,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts\/2482\/revisions\/2490"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/media\/2484"}],"wp:attachment":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2482"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}