{"id":448,"date":"2013-02-23T15:12:23","date_gmt":"2013-02-23T06:12:23","guid":{"rendered":"http:\/\/sorceryforce.net\/WordPress\/?p=448"},"modified":"2013-02-23T15:12:23","modified_gmt":"2013-02-23T06:12:23","slug":"net-%e4%bb%96%e3%81%ae%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab%e3%81%ab%e6%8a%bc%e4%b8%8b%e3%82%ad%e3%83%bc%e3%81%ae%e6%83%85%e5%a0%b1%e3%82%92%e6%b8%a1%e3%81%99","status":"publish","type":"post","link":"https:\/\/blog.sorceryforce.net\/?p=448","title":{"rendered":"[.NET] \u4ed6\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u62bc\u4e0b\u30ad\u30fc\u306e\u60c5\u5831\u3092\u6e21\u3059"},"content":{"rendered":"<p>\t\t\t\t<![CDATA[\n\n<p>\u30a2\u30af\u30c6\u30a3\u30d6\u3067\u306a\u3044\u30a6\u30a3\u30f3\u30c9\u30a6\u3084\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u5bfe\u3057\u3066\u30ad\u30fc\u30dc\u30fc\u30c9\u306e\u30ad\u30fc\u3092\u62bc\u3057\u305f\u304b\u306e\u3088\u3046\u306b\u60c5\u5831\u3092\u9001\u308b\u306b\u306f\u3001\u5bfe\u8c61\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306a\u3069\u306b\u30d5\u30a9\u30fc\u30ab\u30b9\u3092\u5f53\u3066\u3066\u300cSendKeys.Send\u300d\u30e1\u30bd\u30c3\u30c9(\u307e\u305f\u306f SendKeys.SendWait \u30e1\u30bd\u30c3\u30c9)\u3092\u4f7f\u3046\u3053\u3068\u306b\u3088\u3063\u3066\u9001\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n  \n\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u4f8b\u3067\u306f\u30d5\u30a9\u30fc\u30e0\u304c\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u306a\u3063\u3066\u3044\u308b\u72b6\u614b\u3067\u30ad\u30fc\u3092\u62bc\u3057\u305f\u3068\u304d\u306b\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u62bc\u3057\u305f\u30ad\u30fc\u60c5\u5831\u3092\u9001\u3063\u3066\u30c6\u30ad\u30b9\u30c8\u3092\u5165\u529b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002   <\/p>\n\n  \n\n<div id=\"scid:812469c5-0cb0-4c63-8c15-c81123a09de7:aaeed13f-126c-4113-b4e8-593e6e4f4e88\" class=\"wlWriterEditableSmartContent\" style=\"float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px\">\n\n<pre name=\"code\" class=\"c#\">private void form1_KeyPress(object sender, KeyPressEventArgs e)\n{\n  \/\/ \u30a2\u30af\u30c6\u30a3\u30d6\u306a\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u30ad\u30fc\u3092\u9001\u308b\u305f\u3081\u30d5\u30a9\u30fc\u30ab\u30b9\u3092\u5f53\u3066\u308b\n  textBox1.Focus();\n  SendKeys.SendWait(e.KeyChar.ToString());\n}<\/pre>\n\n<\/div>\n\n\n\n\n<p>\u30d5\u30a9\u30fc\u30e0\u3067\u30ad\u30fc\u304c\u62bc\u3055\u308c\u305f\u3068\u304d\u306b Focus \u30e1\u30bd\u30c3\u30c9\u3067\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u30d5\u30a9\u30fc\u30ab\u30b9\u3092\u5f53\u3066\u3001SendKeys \u3067\u62bc\u3055\u308c\u305f\u30ad\u30fc\u3092\u9001\u3063\u3066\u3044\u307e\u3059\u3002\u9001\u3063\u305f\u3042\u3068\u30d5\u30a9\u30fc\u30ab\u30b9\u3092\u623b\u3059\u306e\u304c\u30d9\u30b9\u30c8\u3060\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u5165\u308c\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n\n<p>\u57fa\u672c\u7684\u306a\u30b3\u30fc\u30c9\u306f\u3053\u308c\u3067 OK \u306a\u306e\u3067\u3059\u304c\u3001SendKeys \u3067\u306f\u4e00\u90e8\u306e\u30b3\u30fc\u30c9\u304c\u7279\u6b8a\u306a\u7528\u9014\u306b\u4f7f\u7528\u3055\u308c\u308b\u30ad\u30fc\u3067\u3042\u308b\u305f\u3081\u3001\u3053\u306e\u307e\u307e\u3067\u306f\u9001\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\u5bfe\u8c61\u30ad\u30fc\u3001\u7528\u9014\u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u306e MSDN \u306e SendKeys \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n\n<ul>\n  \n\n<li><a href=\"http:\/\/msdn.microsoft.com\/ja-jp\/library\/system.windows.forms.sendkeys(v=vs.80).aspx\">SendKeys \u30af\u30e9\u30b9<\/a><\/li>\n\n\n<\/ul>\n\n\n\n\n<p>\u7279\u6b8a\u30ad\u30fc\u3092\u901a\u5e38\u306e\u5165\u529b\u30ad\u30fc\u3068\u3057\u3066\u9001\u308b\u306b\u306f\u4e2d\u62ec\u5f27({})\u3067\u56f2\u3080\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3092\u8e0f\u307e\u3048\u308b\u3068\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n\n<p>\n  \n\n<div id=\"scid:812469c5-0cb0-4c63-8c15-c81123a09de7:72fc7624-2cf4-40c1-b24c-6c55ec66ddd8\" class=\"wlWriterEditableSmartContent\" style=\"float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px\">\n\n<pre name=\"code\" class=\"c#\">private void form1_KeyPress(object sender, KeyPressEventArgs e)\n{\n  \/\/ \u30a2\u30af\u30c6\u30a3\u30d6\u306a\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u30ad\u30fc\u3092\u9001\u308b\u305f\u3081\u30d5\u30a9\u30fc\u30ab\u30b9\u3092\u5f53\u3066\u308b\n  textBox1.Focus();\n  switch (e.KeyChar)\n  {\n    case '^':\n    case '+':\n    case '%':\n    case '~':\n    case '(':\n    case ')':\n    case '{':\n    case '}':\n    case '[':\n    case ']':\n      \/\/ \u7279\u6b8a\u8a18\u53f7\u306f\u4e2d\u304b\u3063\u3053\u3067\u56f2\u3063\u3066\u9001\u308b\n      SendKeys.SendWait(\"{\" + e.KeyChar + \"}\");\n      break;\n    default:\n      SendKeys.SendWait(e.KeyChar.ToString());\n      break;\n  }\n}<\/pre>\n\n<\/div>\n\n\n<\/p>\n\n\n\n\n<p>\u3053\u308c\u3067\u4e00\u898b\u5b8c\u6210\u306e\u3088\u3046\u306b\u898b\u3048\u308b\u306e\u3067\u3059\u304c\u3001\u5b9f\u306f\u52d5\u304b\u3057\u3066\u307f\u308b\u3068\u300c^(\u30ab\u30ec\u30c3\u30c8)\u300d\u30ad\u30fc\u3092\u62bc\u3057\u305f\u3068\u304d\u306b\u306a\u305c\u304b\u300c&amp;(\u30a2\u30f3\u30d1\u30b5\u30f3\u30c9)\u300d\u3067\u9001\u3089\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002.NET Framework \u306e\u30d0\u30b0\u304b\u306f\u308f\u304b\u308a\u307e\u305b\u3093\u304c\u3001\u3053\u308c\u3067\u306f\u5b8c\u5168\u3068\u306f\u8a00\u3048\u306a\u3044\u305f\u3081\u5225\u6848\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n\n<p>WSH (Windows Script Host) \u306b\u3082\u540c\u69d8\u306b SendKeys \u306e\u4ed5\u7d44\u307f\u304c\u3042\u308a\u3001\u3053\u3061\u3089\u306f\u6b63\u5e38\u306b\u30ab\u30ec\u30c3\u30c8\u304c\u9001\u308b\u306e\u3067\u3053\u308c\u3092\u4f7f\u3044\u307e\u3059\u3002WSH \u3092\u4f7f\u3046\u306b\u306f\u4ee5\u4e0b\u306e\u624b\u9806\u3092\u884c\u3046\u5fc5\u8981\u304c\u308a\u307e\u3059\u3002\n  <\/p>\n\n\n\n\n<ol>\n  \n\n<li>\u53c2\u7167\u8a2d\u5b9a\u306e\u8ffd\u52a0\u3067\u3001COM \u30bf\u30d6\u304b\u3089\u300cWindows Script Host Object Model\u300d\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/li>\n\n\n  \n\n<li>\u53c2\u7167\u8a2d\u5b9a\u306b\u8ffd\u52a0\u3055\u308c\u305f\u300cIWshRuntimeLibrary\u300d\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u958b\u304d\u3001\u300c\u76f8\u4e92\u904b\u7528\u6a5f\u80fd\u578b\u306e\u57cb\u3081\u8fbc\u307f\u300d\u3092 False \u306b\u8a2d\u5b9a\u3059\u308b\u3002<\/li>\n\n\n<\/ol>\n\n\n\n\n<p>\u305d\u306e\u3046\u3048\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30b3\u30fc\u30c9\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002#if \u306e\u6761\u4ef6\u3092\u5165\u308c\u3066\u3044\u307e\u3059\u304c\u3001WSH \u3092\u4f7f\u3046\u304b\u4f7f\u308f\u306a\u3044\u304b\u3067\u5206\u3051\u3066\u3044\u308b\u3060\u3051\u306a\u306e\u3067\u4e0d\u8981\u3067\u3042\u308c\u3070\u6d88\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n\n<div id=\"scid:812469c5-0cb0-4c63-8c15-c81123a09de7:ca34481d-d9e6-4756-85e5-8beaa1a58bd6\" class=\"wlWriterEditableSmartContent\" style=\"float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px\">\n\n<pre name=\"code\" class=\"c#\">private void form1_KeyPress(object sender, KeyPressEventArgs e)\n{\n  \/\/ \u30a2\u30af\u30c6\u30a3\u30d6\u306a\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u30ad\u30fc\u3092\u9001\u308b\u305f\u3081\u30d5\u30a9\u30fc\u30ab\u30b9\u3092\u5f53\u3066\u308b\n  textBox1.Focus();\n  switch (e.KeyChar)\n  {\n    case '^':\n#if true \/\/ Interop.IWshRuntimeLibrary \u3092\u4f7f\u3063\u3066\u3088\u3044\u5834\u5408\n      (new IWshRuntimeLibrary.WshShellClass()).SendKeys(\"{^}\");\n      break;\n#endif\n    case '+':\n    case '%':\n    case '~':\n    case '(':\n    case ')':\n    case '{':\n    case '}':\n    case '[':\n    case ']':\n      \/\/ \u7279\u6b8a\u8a18\u53f7\u306f\u4e2d\u304b\u3063\u3053\u3067\u56f2\u3063\u3066\u9001\u308b\n      SendKeys.SendWait(\"{\" + e.KeyChar + \"}\");\n      break;\n    default:\n      SendKeys.SendWait(e.KeyChar.ToString());\n      break;\n  }\n}\n<\/pre>\n\n<\/div>\n\n]]>\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\t\t\t\t<![CDATA[]]>\t\t<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[12,90,221,274,399,493,653,973],"class_list":["post-448","post","type-post","status-publish","format-standard","hentry","category-6","tag-net-framework","tag-c","tag-msdn","tag-sendkeys","tag-wsh","tag-493","tag-653","tag-973"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.sorceryforce.net\/index.php?rest_route=\/wp\/v2\/posts\/448"}],"collection":[{"href":"https:\/\/blog.sorceryforce.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sorceryforce.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sorceryforce.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sorceryforce.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=448"}],"version-history":[{"count":0,"href":"https:\/\/blog.sorceryforce.net\/index.php?rest_route=\/wp\/v2\/posts\/448\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.sorceryforce.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sorceryforce.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sorceryforce.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}