{"id":881,"date":"2017-02-03T22:09:21","date_gmt":"2017-02-03T13:09:21","guid":{"rendered":"http:\/\/okamurax.com\/?p=881"},"modified":"2022-04-05T08:46:31","modified_gmt":"2022-04-04T23:46:31","slug":"c-win32api%e5%88%a9%e7%94%a8","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=881","title":{"rendered":"C# Beep(Win32API)"},"content":{"rendered":"<pre class=\"lang:c# decode:true \">using System;\r\nusing System.Windows.Forms;\r\n\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace WindowsFormsApplication1\r\n{\r\n    public partial class Form1 : Form\r\n    {\r\n        \/\/https:\/\/msdn.microsoft.com\/ja-jp\/library\/cc428923.aspx\r\n\r\n        \/\/\u95a2\u6570\u306e\u5b58\u5728\u3059\u308bdll\u3092\u6307\u5b9a\u3002\r\n        [DllImport(\"kernel32.dll\")]\r\n\r\n        \/\/\u95a2\u6570\u306e\u5b9f\u4f53\u304c\u5916\u90e8\u306b\u3042\u308b\u3053\u3068\u3092\u793a\u3059\u3002\r\n        extern static bool Beep(uint dwFreq, uint dwDuration);\r\n\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n\r\n            button1.Click += new EventHandler((object sender, EventArgs e) =&gt; {\r\n                Beep(262, 500);\r\n            });\r\n        }\r\n    }\r\n}\r\n\r\n\/*\r\n\r\nWin32API \/ .NET\r\n\r\nHANDLE (void *)               System.IntPtr\r\nBYTE (unsigned char)          byte (System.Byte)\r\nSHORT (short)                 short (System.Int16)\r\nWORD (unsigned short)         ushort (System.UInt16)\r\nINT (int)                     int (System.Int32)\r\nLONG (long)\r\nUINT (unsigned int)           uint (System.UInt32)\r\nDWORD, ULONG (unsigned long)\r\nBOOL (long)                   bool (System.Boolean)\r\nCHAR (char)                   char (System.Char)\r\nLPSTR (char *)                System.Text.StringBuilder\r\nLPWSTR (wchar_t *)\r\nLPCSTR (const char *)         string (System.String)\r\nLPCWSTR (const wchar_t *)\r\nFLOAT (float)                 float (System.Single)\r\nDOUBLE (double)               double (System.Double)\r\n\r\n*\/\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>using System; using System.Windows.Forms; using System.Runtime.InteropServices; namespace WindowsFormsApplicat &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=881\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;C# Beep(Win32API)&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9],"class_list":["post-881","post","type-post","status-publish","format-standard","hentry","category-1","tag-c-net"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=881"}],"version-history":[{"count":2,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/881\/revisions"}],"predecessor-version":[{"id":4998,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/881\/revisions\/4998"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}