{"id":264,"date":"2014-05-04T11:10:44","date_gmt":"2014-05-04T02:10:44","guid":{"rendered":"https:\/\/prg.waou.biz\/?p=264"},"modified":"2018-03-03T08:40:36","modified_gmt":"2018-03-02T23:40:36","slug":"%e3%83%9c%e3%82%bf%e3%83%b3%e3%82%92%e6%8a%bc%e3%81%99%e3%81%a8%e3%83%aa%e3%82%b9%e3%83%88%e3%83%9c%e3%83%83%e3%82%af%e3%82%b9%e3%80%81%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%9c%e3%83%83%e3%82%af","status":"publish","type":"post","link":"https:\/\/prg.waou.biz\/?p=264","title":{"rendered":"\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\u30ea\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u3001\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u6587\u5b57\u5217\u8ffd\u52a0"},"content":{"rendered":"<p>\u89aa\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u898b\u4ed8\u3051\u308b\u3068\u304d\u306f\u5f15\u6570\u3068\u3057\u3066\u30af\u30e9\u30b9\u540d\u3068\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3\u3092\u4e0e\u3048\u308b\u304c<br \/>\n\u6b21\u306e\u3088\u3046\u306b\u3069\u308c\u304b\u3072\u3068\u3064\u3067\u3082\u53ef\u80fd\u3002<\/p>\n<pre class=\"lang:default decode:true \" >hWnd = FindWindow(TEXT(\"Notepad\"),NULL);\r\n\r\nhWnd = FindWindow(NULL,TEXT(\"\u7121\u984c - \u30e1\u30e2\u5e33\"));\r\n\r\nhWnd = FindWindow(TEXT(\"Notepad\"),TEXT(\"\u7121\u984c - \u30e1\u30e2\u5e33\"));\r\n\r\nhWnd3=FindWindowEx(hWnd2,NULL ,\"Edit\",NULL);\r\n\r\nhWnd2=FindWindowEx(hWnd2,NULL ,\"WindowsForms10.EDIT.app.0.2bf8098_r11_ad1\",NULL);\/\/\r\n\r\nhWnd23=FindWindowEx(hWnd2,NULL ,\"WindowsForms10.EDIT.app.0.2bf8098_r11_ad1\",\"\");\/\/\r\n\r\n\/\/ TT.cpp : \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a8\u30f3\u30c8\u30ea \u30dd\u30a4\u30f3\u30c8\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002\r\n\/\/\r\n\r\n#include \"stdafx.h\"\r\n#include \"TT.h\"\r\n\r\n#define MAX_LOADSTRING 100\r\n\r\n#define ID_BUTTON 100\r\n#define ID_EDIT 65\r\n\r\nLPCTSTR strText[] = {\r\nTEXT(\"Kitty on your lap\") ,\r\nTEXT(\"Tokyo mew mew\") ,\r\nTEXT(\"Magical nyan nyan TARUTO\") ,\r\nTEXT(\"Di Gi Charat\") ,\r\nTEXT(\"Nekoneko Zoo\")\r\n};\r\n\r\n\/\/ \u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570:\r\nHINSTANCE hInst; \/\/ \u73fe\u5728\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\r\nTCHAR szTitle[MAX_LOADSTRING]; \/\/ \u30bf\u30a4\u30c8\u30eb \u30d0\u30fc\u306e\u30c6\u30ad\u30b9\u30c8\r\nTCHAR szWindowClass[MAX_LOADSTRING]; \/\/ \u30e1\u30a4\u30f3 \u30a6\u30a3\u30f3\u30c9\u30a6 \u30af\u30e9\u30b9\u540d\r\n\r\n\/\/ \u3053\u306e\u30b3\u30fc\u30c9 \u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u542b\u307e\u308c\u308b\u95a2\u6570\u306e\u5ba3\u8a00\u3092\u8ee2\u9001\u3057\u307e\u3059:\r\nATOM MyRegisterClass(HINSTANCE hInstance);\r\nBOOL InitInstance(HINSTANCE, int);\r\nLRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);\r\nINT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);\r\n\r\nint APIENTRY _tWinMain(HINSTANCE hInstance,\r\nHINSTANCE hPrevInstance,\r\nLPTSTR lpCmdLine,\r\nint nCmdShow)\r\n{\r\nUNREFERENCED_PARAMETER(hPrevInstance);\r\nUNREFERENCED_PARAMETER(lpCmdLine);\r\n\r\n\/\/ TODO: \u3053\u3053\u306b\u30b3\u30fc\u30c9\u3092\u633f\u5165\u3057\u3066\u304f\u3060\u3055\u3044\u3002\r\nMSG msg;\r\nHACCEL hAccelTable;\r\n\r\n\/\/ \u30b0\u30ed\u30fc\u30d0\u30eb\u6587\u5b57\u5217\u3092\u521d\u671f\u5316\u3057\u3066\u3044\u307e\u3059\u3002\r\nLoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);\r\nLoadString(hInstance, IDC_TT, szWindowClass, MAX_LOADSTRING);\r\nMyRegisterClass(hInstance);\r\n\r\n\/\/ \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u521d\u671f\u5316\u3092\u5b9f\u884c\u3057\u307e\u3059:\r\nif (!InitInstance (hInstance, nCmdShow))\r\n{\r\nreturn FALSE;\r\n}\r\n\r\nhAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_TT));\r\n\r\n\/\/ \u30e1\u30a4\u30f3 \u30e1\u30c3\u30bb\u30fc\u30b8 \u30eb\u30fc\u30d7:\r\nwhile (GetMessage(&amp;msg, NULL, 0, 0))\r\n{\r\nif (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg))\r\n{\r\nTranslateMessage(&amp;msg);\r\nDispatchMessage(&amp;msg);\r\n}\r\n}\r\n\r\nreturn (int) msg.wParam;\r\n}\r\n\r\n\/\/\r\n\/\/ \u95a2\u6570: MyRegisterClass()\r\n\/\/\r\n\/\/ \u76ee\u7684: \u30a6\u30a3\u30f3\u30c9\u30a6 \u30af\u30e9\u30b9\u3092\u767b\u9332\u3057\u307e\u3059\u3002\r\n\/\/\r\n\/\/ \u30b3\u30e1\u30f3\u30c8:\r\n\/\/\r\n\/\/ \u3053\u306e\u95a2\u6570\u304a\u3088\u3073\u4f7f\u3044\u65b9\u306f\u3001'RegisterClassEx' \u95a2\u6570\u304c\u8ffd\u52a0\u3055\u308c\u305f\r\n\/\/ Windows 95 \u3088\u308a\u524d\u306e Win32 \u30b7\u30b9\u30c6\u30e0\u3068\u4e92\u63db\u3055\u305b\u308b\u5834\u5408\u306b\u306e\u307f\u5fc5\u8981\u3067\u3059\u3002\r\n\/\/ \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u3001\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\r\n\/\/ \u6b63\u3057\u3044\u5f62\u5f0f\u306e\u5c0f\u3055\u3044\u30a2\u30a4\u30b3\u30f3\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u306b\u306f\u3001\r\n\/\/ \u3053\u306e\u95a2\u6570\u3092\u547c\u3073\u51fa\u3057\u3066\u304f\u3060\u3055\u3044\u3002\r\n\/\/\r\nATOM MyRegisterClass(HINSTANCE hInstance)\r\n{\r\nWNDCLASSEX wcex;\r\n\r\nwcex.cbSize = sizeof(WNDCLASSEX);\r\n\r\nwcex.style = CS_HREDRAW | CS_VREDRAW;\r\nwcex.lpfnWndProc = WndProc;\r\nwcex.cbClsExtra = 0;\r\nwcex.cbWndExtra = 0;\r\nwcex.hInstance = hInstance;\r\nwcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_TT));\r\nwcex.hCursor = LoadCursor(NULL, IDC_ARROW);\r\nwcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);\r\nwcex.lpszMenuName = MAKEINTRESOURCE(IDC_TT);\r\nwcex.lpszClassName = szWindowClass;\r\nwcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));\r\n\r\nreturn RegisterClassEx(&amp;wcex);\r\n}\r\n\r\n\/\/\r\n\/\/ \u95a2\u6570: InitInstance(HINSTANCE, int)\r\n\/\/\r\n\/\/ \u76ee\u7684: \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9 \u30cf\u30f3\u30c9\u30eb\u3092\u4fdd\u5b58\u3057\u3066\u3001\u30e1\u30a4\u30f3 \u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\r\n\/\/\r\n\/\/ \u30b3\u30e1\u30f3\u30c8:\r\n\/\/\r\n\/\/ \u3053\u306e\u95a2\u6570\u3067\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9 \u30cf\u30f3\u30c9\u30eb\u3092\u4fdd\u5b58\u3057\u3001\r\n\/\/ \u30e1\u30a4\u30f3 \u30d7\u30ed\u30b0\u30e9\u30e0 \u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u4f5c\u6210\u304a\u3088\u3073\u8868\u793a\u3057\u307e\u3059\u3002\r\n\/\/\r\nBOOL InitInstance(HINSTANCE hInstance, int nCmdShow)\r\n{\r\nHWND hWnd;\r\n\r\nhInst = hInstance; \/\/ \u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u51e6\u7406\u3092\u683c\u7d0d\u3057\u307e\u3059\u3002\r\n\r\nhWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,\r\nCW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);\r\n\r\nif (!hWnd)\r\n{\r\nreturn FALSE;\r\n}\r\n\r\nShowWindow(hWnd, nCmdShow);\r\nUpdateWindow(hWnd);\r\n\r\nreturn TRUE;\r\n}\r\n\r\nstatic HWND sortList , nonSortList;\r\n\r\nvoid AddListString(){\r\nint i;\r\nfor (i = 0 ; i &lt; 5 ; i++) SendMessage(sortList , LB_ADDSTRING , 0 , (LPARAM)strText[i]); } \/\/ \/\/ \u95a2\u6570: WndProc(HWND, UINT, WPARAM, LPARAM) \/\/ \/\/ \u76ee\u7684: \u30e1\u30a4\u30f3 \u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u51e6\u7406\u3057\u307e\u3059\u3002 \/\/ \/\/ WM_COMMAND - \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \u30e1\u30cb\u30e5\u30fc\u306e\u51e6\u7406 \/\/ WM_PAINT - \u30e1\u30a4\u30f3 \u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u63cf\u753b \/\/ WM_DESTROY - \u4e2d\u6b62\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3057\u3066\u623b\u308b \/\/ \/\/ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; static HWND hBtn, hEdit; int i; switch (message) { case WM_CREATE: sortList = CreateWindow( TEXT(\"LISTBOX\") , NULL , WS_CHILD | WS_VISIBLE | LBS_STANDARD , 0 , 0 , 200 , 100 , hWnd , (HMENU)1 , ((LPCREATESTRUCT)(lParam))-&gt;hInstance , NULL\r\n);\r\nfor (i = 0 ; i &lt; 5 ; i++)\r\nSendMessage(sortList , LB_ADDSTRING , 0 , (LPARAM)strText[i]);\r\n\/\/ \u30a8\u30c7\u30a3\u30c3\u30c8\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3092\u4f5c\u6210\r\nhEdit = CreateWindow(TEXT(\"EDIT\"), TEXT(\"\"),\r\nWS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,\r\n300, 10, 200, 25, hWnd, (HMENU)ID_EDIT, hInst, NULL);\r\n\/\/ \u30dc\u30bf\u30f3\u3092\u4f5c\u6210\r\nhBtn = CreateWindow(TEXT(\"BUTTON\"), TEXT(\"\u62bc\u3059\"),\r\nWS_CHILD | WS_VISIBLE, 285, 45, 50, 30,\r\nhWnd, (HMENU)ID_BUTTON, hInst, NULL);\r\n\/\/ \u30a8\u30c7\u30a3\u30c3\u30c8\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u30d5\u30a9\u30fc\u30ab\u30b9\u3092\u4e0e\u3048\u308b\r\nSendMessage(hEdit, EM_SETLIMITTEXT, (WPARAM)63, 0);\r\n\r\ncase WM_COMMAND:\r\nwmId = LOWORD(wParam);\r\nwmEvent = HIWORD(wParam);\r\n\/\/ \u9078\u629e\u3055\u308c\u305f\u30e1\u30cb\u30e5\u30fc\u306e\u89e3\u6790:\r\nswitch (wmId)\r\n{\r\ncase ID_BUTTON:\r\n\/*GetWindowText(hEdit, szBuf, 64);\r\nMessageBox(hWnd, szBuf,\r\nTEXT(\"\u732b\u3067\u3082\u308f\u304b\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\"), MB_OK);*\/\r\nSetWindowText(hEdit, _T(\"ddddddddddd456 ooo\u304a\u304a\u304a\"));\r\nAddListString();\r\nbreak;\r\ncase IDM_ABOUT:\r\nDialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);\r\nbreak;\r\ncase IDM_EXIT:\r\nDestroyWindow(hWnd);\r\nbreak;\r\ndefault:\r\nreturn DefWindowProc(hWnd, message, wParam, lParam);\r\n}\r\nbreak;\r\ncase WM_PAINT:\r\nhdc = BeginPaint(hWnd, &amp;ps);\r\n\/\/ TODO: \u63cf\u753b\u30b3\u30fc\u30c9\u3092\u3053\u3053\u306b\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044...\r\nEndPaint(hWnd, &amp;ps);\r\nbreak;\r\ncase WM_DESTROY:\r\nPostQuitMessage(0);\r\nbreak;\r\ndefault:\r\nreturn DefWindowProc(hWnd, message, wParam, lParam);\r\n}\r\nreturn 0;\r\n}\r\n\r\n\/\/ \u30d0\u30fc\u30b8\u30e7\u30f3\u60c5\u5831\u30dc\u30c3\u30af\u30b9\u306e\u30e1\u30c3\u30bb\u30fc\u30b8 \u30cf\u30f3\u30c9\u30e9\u30fc\u3067\u3059\u3002\r\nINT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r\n{\r\nUNREFERENCED_PARAMETER(lParam);\r\nswitch (message)\r\n{\r\ncase WM_INITDIALOG:\r\nreturn (INT_PTR)TRUE;\r\n\r\ncase WM_COMMAND:\r\nif (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)\r\n{\r\nEndDialog(hDlg, LOWORD(wParam));\r\nreturn (INT_PTR)TRUE;\r\n}\r\nbreak;\r\n}\r\nreturn (INT_PTR)FALSE;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u89aa\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u898b\u4ed8\u3051\u308b\u3068\u304d\u306f\u5f15\u6570\u3068\u3057\u3066\u30af\u30e9\u30b9\u540d\u3068\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3\u3092\u4e0e\u3048\u308b\u304c \u6b21\u306e\u3088\u3046\u306b\u3069\u308c\u304b\u3072\u3068\u3064\u3067\u3082\u53ef\u80fd\u3002 hWnd = FindWindow(TEXT(&#8220;Notepad&#8221;),NULL); hWnd = FindWindo [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_lightning_design_setting":[],"footnotes":""},"categories":[17],"tags":[],"class_list":["post-264","post","type-post","status-publish","format-standard","hentry","category-windowsapi"],"_links":{"self":[{"href":"https:\/\/prg.waou.biz\/index.php?rest_route=\/wp\/v2\/posts\/264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prg.waou.biz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prg.waou.biz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prg.waou.biz\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/prg.waou.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=264"}],"version-history":[{"count":5,"href":"https:\/\/prg.waou.biz\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions"}],"predecessor-version":[{"id":831,"href":"https:\/\/prg.waou.biz\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions\/831"}],"wp:attachment":[{"href":"https:\/\/prg.waou.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prg.waou.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prg.waou.biz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}