{"id":64,"date":"1999-09-14T00:00:00","date_gmt":"1999-09-13T15:00:00","guid":{"rendered":"http:\/\/localhost\/blog\/?p=54"},"modified":"2014-08-14T16:24:35","modified_gmt":"2014-08-14T07:24:35","slug":"%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a9%e3%82%a4%e3%83%b3%e8%b5%b7%e5%8b%95","status":"publish","type":"post","link":"https:\/\/denasu.com\/blog\/1999\/09\/diary64","title":{"rendered":"\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u8d77\u52d5"},"content":{"rendered":"<p>\u30b3\u30f3\u30bd\u30fc\u30eb\u30a2\u30d7\u30ea\u3092\uff0cDOS \u7a93\u306a\u3057\u3067 GUI \u304b\u3089\u547c\u3073\u51fa\u3059\u3002<\/p>\n<pre class=\"brush:cpp\">\r\n\/\/ \u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\r\nLPTSTR lpCommandLine;\r\nlpCommandLine = \"app.exe\";\r\n\r\n\/\/ \u30d1\u30a4\u30d7\u306e\u4f5c\u6210\r\nHANDLE hReadPipe, hWritePipe;\r\nSECURITY_ATTRIBUTES sa;\r\nsa.nLength = sizeof(SECURITY_ATTRIBUTES);\r\nsa.lpSecurityDescriptor = NULL;\r\nsa.bInheritHandle = TRUE;\r\n::CreatePipe(&hReadPipe, &hWritePipe, &sa, 0);\r\n\r\n\/\/ STARTUPINFO\r\nstatic STARTUPINFO StartupInfo;\r\nstatic PROCESS_INFORMATION ProcessInfo;\r\n\r\n::ZeroMemory(&StartupInfo, sizeof(STARTUPINFO));\r\nStartupInfo.cb = sizeof(STARTUPINFO);\r\nStartupInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;\r\nStartupInfo.wShowWindow = SW_HIDE;\r\nStartupInfo.hStdOutput = hWritePipe;\r\n\r\n::CreateProcess(\r\n    NULL,\r\n    lpCommandLine,\r\n    NULL,\r\n    NULL,\r\n    FALSE,\r\n    0,\r\n    NULL,\r\n    NULL,\r\n    &StartupInfo, &ProcessInfo);\r\n\r\nchar buf[255];\r\nunsigned long num;\r\n::ReadFile(hReadPipe, buf, 255, &num, NULL);\r\nif(::WaitForSingleObject(ProcessInfo.hProcess, INFINITE) == WAIT_OBJECT_0)\r\n{\r\n    DWORD res;\r\n    ::GetExitCodeProcess(ProcessInfo.hProcess, &res);\r\n    CloseHandle(ProcessInfo.hProcess);\r\n}\r\n::CloseHandle(hWritePipe);\r\n::CloseHandle(hReadPipe);\r\n<\/pre>\n<p>\u3053\u308c\u3092\u4f7f\u3048\u3070 Java \u30b3\u30f3\u30d1\u30a4\u30e9\u3092\u547c\u3073\u51fa\u3057\u305f\u308a\u3068\u304b\u3067\u7d71\u5408\u74b0\u5883\u3092\u4f5c\u3063\u305f\u308a\u3067\u304d\u308b\u304b\u306a\u3002\u3044\u3064\u304b\u3084\u3063\u3066\u307f\u305f\u3044\u3002<\/p>\n<p class=\"comment\"># <a href=\"diary200005.html\">2000.05<\/a>\u306b\u3082\u3046\u5c11\u3057\u3061\u3083\u3093\u3068\u3057\u305f\u3082\u306e\u3092\u8f09\u305b\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b3\u30f3\u30bd\u30fc\u30eb\u30a2\u30d7\u30ea\u3092\uff0cDOS \u7a93\u306a\u3057\u3067 GUI \u304b\u3089\u547c\u3073\u51fa\u3059\u3002 \/\/ \u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3 LPTSTR lpCommandLine; lpCommandLine = &#8220;app.exe&#8221;; \/\/ \u30d1\u30a4\u30d7\u306e\u4f5c\u6210 HANDLE hReadPipe, hWritePipe; SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; ::CreatePipe(&#038;hReadPipe, &#038;hWritePipe, &#038;sa, 0); \/\/ STARTUPINFO static STARTUPINFO StartupInfo; static PROCESS_INFORMATION ProcessInfo; ::ZeroMemory(&#038;StartupInfo, sizeof(STARTUPINFO)); StartupInfo.cb = sizeof(STARTUPINFO); StartupInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; StartupInfo.wShowWindow = SW_HIDE; StartupInfo.hStdOutput = hWritePipe; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2],"tags":[22],"class_list":["post-64","post","type-post","status-publish","format-standard","hentry","category-programming","tag-win32"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4ZThs-12","_links":{"self":[{"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/posts\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":3,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"predecessor-version":[{"id":2556,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/posts\/64\/revisions\/2556"}],"wp:attachment":[{"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/denasu.com\/blog\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}