{"id":16951,"date":"2018-08-31T15:35:22","date_gmt":"2018-08-31T06:35:22","guid":{"rendered":"http:\/\/www.ricka.co.jp\/?p=16951"},"modified":"2018-08-31T15:35:22","modified_gmt":"2018-08-31T06:35:22","slug":"vc-find-ctreectrl-items","status":"publish","type":"post","link":"https:\/\/ricka.co.jp\/?p=16951","title":{"rendered":"VC CTreeCtrl\u306e\u9078\u629e\u3055\u308c\u305f\u30a2\u30a4\u30c6\u30e0\u3092\u8d77\u70b9\u306b\u691c\u7d22\u3059\u308b"},"content":{"rendered":"<p>&nbsp;<\/p>\n\n<h2 class=\"wp-block-heading\">\u306f\u3058\u3081\u306b<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">CTreeCtrl\u306eItem\u3092\u9078\u629e\u3055\u308c\u305f\u3068\u3053\u308d\u304b\u3089\u691c\u7d22\u3057\u305f\u3044\u306a\u3068\u601d\u3044\u307e\u3057\u305f\u3002<br \/>\u30a4\u30e1\u30fc\u30b8\u3068\u3057\u3066\u306f\u30ec\u30b8\u30b9\u30c8\u30ea\u30a8\u30c7\u30a3\u30bf\u306e\u691c\u7d22\u307f\u305f\u3044\u306a\u611f\u3058\u3067\u3059\u3002<br \/>\u6b21\u3078\u3068\u3084\u308b\u3068\u9078\u629e\u3055\u308c\u305f\u3068\u3053\u308d\u304b\u3089\u4e0b\u3092\u63a2\u3057\u3066\u3001\u89aa\u3092\u305f\u3069\u3063\u3066\u4e0b\u307e\u3067\u884c\u3063\u305f\u3089\u307e\u305f\u623b\u3063\u3066\u304f\u308b\u307f\u305f\u3044\u306a\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u3068\u307e\u30fc\u3001\u30c4\u30ea\u30fc\u3068\u8a00\u3048\u3070\u518d\u5e30\u3067\u66f8\u3051\u3070\u697d\u52dd\u3067\u3057\u3087\u2026<br \/>\u3068\u5b89\u76f4\u306b\u601d\u3063\u305f\u3093\u3067\u3059\u3002<br \/>\u305d\u3057\u305f\u3089\u3001\u3059\u3054\u3044\u306f\u307e\u3063\u3066\u3057\u307e\u3063\u305f\u3093\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u691c\u7d22\u3059\u308b\u3068\u304d\u306b\u4f7f\u3046CTreeCtrl\u306e\u30e1\u30bd\u30c3\u30c9<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">HTREEITEM\u3092CTreeCtrl\u306b\u6e21\u3057\u3066\u5024\u306e\u53d6\u5f97\u3084\u89aa\u5b50\u5144\u5f1f\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<br \/>\u57fa\u672c\u3001\u4e0b\u306e\u95a2\u6570\u3060\u3051\u3042\u308c\u3070\u691c\u7d22\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">HTREEITEM GetRootItem()<br \/>-&gt; \u30c4\u30ea\u30fc\u306e\u30eb\u30fc\u30c8\u30a2\u30a4\u30c6\u30e0\u3092\u53d6\u5f97\u3059\u308b<br \/>HTREEITEM GetSelectedItem()<br \/>-&gt; \u73fe\u5728\u9078\u629e\u3055\u308c\u3066\u3044\u308b\u30a2\u30a4\u30c6\u30e0\u3092\u53d6\u5f97\u3059\u308b<br \/>CString GetItemText(HTREEITEM)<br \/>-&gt; HTREEITEM\u306e\u30e9\u30d9\u30eb\u3092\u53d6\u5f97\u3059\u308b<br \/>DWORD_PTR GetItemData(HTREEITEM)<br \/>-&gt; HTREEITEM\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">HTREEITEM GetChildItem(HTREEITEM)<br \/>-&gt; HTREEITEM\u306e\u5b50\u3092\u53d6\u5f97\u3059\u308b<br \/>HTREEITEM GetNextSiblingItem(HTREEITEM)<br \/>-&gt; HTREEITEM\u306e\u5144\u5f1f\u3092\u53d6\u5f97\u3059\u308b<br \/>HTREEITEM GetParentItem(HTREEITEM)<br \/>-&gt; HTREEITEM\u306e\u89aa\u3092\u53d6\u5f97\u3059\u308b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u3057\u304b\u3057\u3001\u3053\u306e\u89aa\u5b50\u5144\u5f1f\u95a2\u4fc2\u30011\u500b\u305a\u3064\u3057\u304b\u53d6\u308c\u306a\u3044\u306e\u3067\u3059\u3002<br \/>\u3051\u3063\u3053\u3046\u7656\u304c\u3042\u308a\u307e\u3059\u306d\u2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u51e6\u7406\u8aac\u660e<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u81ea\u5206\u3068\u5144\u5f1f\u304b\u3089\u4e0b\u306e\u30ce\u30fc\u30c9\u3068\u30ea\u30fc\u30d5\u306b\u5bfe\u3057\u3066\u51e6\u7406\u3092\u884c\u3046\u3002<br \/>\u7d42\u308f\u3063\u305f\u3089\u3001\u89aa\u306e\u53d6\u5f97\u3092\u884c\u3063\u3066\u3044\u304f\u3002<br \/>\u51e6\u7406\u5bfe\u8c61\u306f\u89aa\u306e\u5144\u5f1f\u304b\u3089\u3002<br \/>\u4ee5\u964d\u3001\u3058\u3044\u3061\u3083\u3093\u3001\u3072\u3044\u3058\u3044\u3061\u3083\u3093\u3068\u78ba\u8a8d\u3057\u3066\u3044\u304f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u547c\u3073\u5074<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u73fe\u5728\u9078\u629e\u4f4d\u7f6e\u304b\u3089\u691c\u7d22\u3057\u3066\u3001S_FALSE\u3060\u3063\u305f\u3089\u518d\u5ea6<br \/>\u30eb\u30fc\u30c8\u304b\u3089\u691c\u7d22\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HRESULT XXXXX::FindItem(HTREEITEM hItem, CString KeyWord, bool bParentSearch)\n{\n\tHRESULT result = S_FALSE;\n\tif (hItem == NULL) { return S_FALSE; }\n\n\tHTREEITEM hSibling = hItem;\n\twhile (hSibling != NULL)\n\t{\n\t\t\/\/\n\t\t\/\/ \u691c\u7d22\u51e6\u7406\u306a\u3069start\n\t\t\/\/ \u3053\u3053\u3067\u306f\u3001KeyWord\u306e\u30e9\u30d9\u30eb\u306a\u3089\u9078\u629e\u72b6\u614b\u306b\u3059\u308b\n\t\t\/\/ DWORD_PTR dword = m_pTreeCtrl-&gt;GetItemData(hSibling);\n\t\tCString itemLabel = m_pTreeCtrl-&gt;GetItemText(hSibling);\n\t\tif (itemLabel == KeyWord &amp;&amp; hSibling != m_pTreeCtrl-&gt;GetSelectedItem())\n\t\t{\n\t\t\tm_pTreeCtrl-&gt;SelectItem(hSibling);\n\t\t\tm_pTreeCtrl-&gt;DoProperActions(true);\n\t\t\treturn S_OK; \/\/ &lt;-\u7d42\u308f\u3063\u305f\u3089S_OK\u3067\u623b\u3059\n\t\t}\n\t\t\/\/ \u691c\u7d22\u51e6\u7406\u306a\u3069end\n\t\t\/\/ \n\n\t\t\/\/ \u5b50\u3092\u51e6\u7406\u3059\u308b\n\t\tHTREEITEM hChild = m_pTreeCtrl-&gt;GetChildItem(hSibling);\n\t\tif (hChild == m_pTreeCtrl-&gt;GetSelectedItem()) { return E_FAIL; }\n\n\t\tresult = FindItem(hChild, KeyWord, false);\n\t\tif (result != S_FALSE) { return result; }\n\n\t\t\/\/ \u5144\u5f1f\u3092\u51e6\u7406\u3059\u308b\n\t\thSibling = m_pTreeCtrl-&gt;GetNextSiblingItem(hSibling);\n\t\tif (hSibling == m_pTreeCtrl-&gt;GetSelectedItem()) { return E_FAIL; }\n\t}\n\n\tif (bParentSearch)\n\t{\n\t\t\/\/ \u81ea\u5206\u306e\u89aa\u3092\u53d6\u5f97\u3059\u308b\n\t\tHTREEITEM hParent = m_pTreeCtrl-&gt;GetParentItem(hItem);\n\t\twhile (hParent != NULL)\n\t\t{\n\t\t\tHTREEITEM hParentSibling = hParent;\n\t\t\twhile (hParentSibling != NULL)\n\t\t\t{\n\t\t\t\t\/\/ \u81ea\u5206\u306e\u89aa\u306f\u51e6\u7406\u305b\u305a\u89aa\u306e\u5f1f\u59b9\u3092\u51e6\u7406\u3059\u308b\n\t\t\t\t\/\/ \u5144\u59c9\u306f\u51e6\u7406\u3057\u306a\u3044\n\t\t\t\thParentSibling = m_pTreeCtrl-&gt;GetNextSiblingItem(hParentSibling);\n\t\t\t\tif (hParent == m_pTreeCtrl-&gt;GetSelectedItem()) { return E_FAIL; }\n\t\t\t\t\/\/ \u672b\u3063\u5b50\u306e\u78ba\u8a8d\u672b\u3063\u5b50\u306a\u3089\u3001\u89aa\u63a2\u3057\u30d5\u30e9\u30b0\u3092\u305f\u3066\u308b\n\t\t\t\tHTREEITEM terminat = m_pTreeCtrl-&gt;GetNextSiblingItem(hParentSibling);\n\t\t\t\tresult = FindItem(hParentSibling, KeyWord, bParentSearch &amp;&amp; terminat == NULL);\n\t\t\t\tif (result != S_FALSE) { return result; }\n\t\t\t}\n\t\t\t\/\/ \u81ea\u5206\u306e\u89aa\u306e\u3058\u3044\u3061\u3083\u3093\u3092\u53d6\u5f97\u3059\u308b\n\t\t\thParent = m_pTreeCtrl-&gt;GetParentItem(hParent);\n\t\t}\n\t}\n\n\treturn result;\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\tHRESULT result = FindItem(m_pTreeCtrl-&gt;GetSelectedItem(), KeyWord, true);\n\tif (result == S_FALSE) \n\t{\n\t\tresult = FindItem(m_pTreeCtrl-&gt;GetRootItem(), KeyWord, false);\n\t}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u7d42\u308f\u308a\u306b<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u30eb\u30fc\u30c8\u304b\u3089\u3060\u3051\u306a\u3089\u30011\u500b\u76ee\u306ewhile\u3060\u3051\u3067\u4e8b\u8db3\u308a\u305d\u3046\u3067\u3059\u306d\u3002<br \/>\u3053\u308c\u306b\u3001\u5148\u4ee3\u3092\u9061\u308b\u3068\u3084\u3084\u3053\u3057\u304f\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u3002<br \/>\u81ea\u5206\u304c\u306f\u307e\u3063\u305f\u30dd\u30a4\u30f3\u30c8\u3067\u3059&#8230;<br \/>\u3082\u3046\u5c11\u3057\u7c21\u5358\u306b\u66f8\u3051\u305d\u3046\u306a\u6c17\u304c\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u81ea\u5206\u306f\u3053\u308c\u304c\u9650\u754c\u306e\u69d8\u3067\u3059&#8230;<\/p>\n\n<p>&nbsp;<\/p>    \t<div class=\"veu_socialSet veu_socialSet-position-after veu_contentAddSection\"><script>window.twttr=(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src=\"https:\/\/platform.twitter.com\/widgets.js\";fjs.parentNode.insertBefore(js,fjs);t._e=[];t.ready=function(f){t._e.push(f);};return t;}(document,\"script\",\"twitter-wjs\"));<\/script><ul><li class=\"sb_facebook sb_icon\"><a href=\"\/\/www.facebook.com\/sharer.php?src=bm&u=https%3A%2F%2Fricka.co.jp%2F%3Fp%3D16951&amp;t=VC+CTreeCtrl%E3%81%AE%E9%81%B8%E6%8A%9E%E3%81%95%E3%82%8C%E3%81%9F%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%82%92%E8%B5%B7%E7%82%B9%E3%81%AB%E6%A4%9C%E7%B4%A2%E3%81%99%E3%82%8B+%7C+%E6%A0%AA%E5%BC%8F%E4%BC%9A%E7%A4%BE%E3%83%AA%E3%83%83%E3%82%AB\" target=\"_blank\" onclick=\"window.open(this.href,'FBwindow','width=650,height=450,menubar=no,toolbar=no,scrollbars=yes');return false;\"><span class=\"vk_icon_w_r_sns_fb icon_sns\"><\/span><span class=\"sns_txt\">Facebook<\/span><span class=\"veu_count_sns_fb\"><\/span><\/a><\/li><li class=\"sb_twitter sb_icon\"><a href=\"\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fricka.co.jp%2F%3Fp%3D16951&amp;text=VC+CTreeCtrl%E3%81%AE%E9%81%B8%E6%8A%9E%E3%81%95%E3%82%8C%E3%81%9F%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%82%92%E8%B5%B7%E7%82%B9%E3%81%AB%E6%A4%9C%E7%B4%A2%E3%81%99%E3%82%8B+%7C+%E6%A0%AA%E5%BC%8F%E4%BC%9A%E7%A4%BE%E3%83%AA%E3%83%83%E3%82%AB\" target=\"_blank\" ><span class=\"vk_icon_w_r_sns_twitter icon_sns\"><\/span><span class=\"sns_txt\">twitter<\/span><\/a><\/li><li class=\"sb_hatena sb_icon\"><a href=\"\/\/b.hatena.ne.jp\/add?mode=confirm&url=https%3A%2F%2Fricka.co.jp%2F%3Fp%3D16951&amp;title=VC+CTreeCtrl%E3%81%AE%E9%81%B8%E6%8A%9E%E3%81%95%E3%82%8C%E3%81%9F%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%82%92%E8%B5%B7%E7%82%B9%E3%81%AB%E6%A4%9C%E7%B4%A2%E3%81%99%E3%82%8B+%7C+%E6%A0%AA%E5%BC%8F%E4%BC%9A%E7%A4%BE%E3%83%AA%E3%83%83%E3%82%AB\" target=\"_blank\"  onclick=\"window.open(this.href,'Hatenawindow','width=650,height=450,menubar=no,toolbar=no,scrollbars=yes');return false;\"><span class=\"vk_icon_w_r_sns_hatena icon_sns\"><\/span><span class=\"sns_txt\">Hatena<\/span><span class=\"veu_count_sns_hb\"><\/span><\/a><\/li><li class=\"sb_pocket sb_icon\"><a href=\"\/\/getpocket.com\/edit?url=https%3A%2F%2Fricka.co.jp%2F%3Fp%3D16951&title=VC+CTreeCtrl%E3%81%AE%E9%81%B8%E6%8A%9E%E3%81%95%E3%82%8C%E3%81%9F%E3%82%A2%E3%82%A4%E3%83%86%E3%83%A0%E3%82%92%E8%B5%B7%E7%82%B9%E3%81%AB%E6%A4%9C%E7%B4%A2%E3%81%99%E3%82%8B+%7C+%E6%A0%AA%E5%BC%8F%E4%BC%9A%E7%A4%BE%E3%83%AA%E3%83%83%E3%82%AB\" target=\"_blank\"  onclick=\"window.open(this.href,'Pokcetwindow','width=650,height=450,menubar=no,toolbar=no,scrollbars=yes');return false;\"><span class=\"vk_icon_w_r_sns_pocket icon_sns\"><\/span><span class=\"sns_txt\">Pocket<\/span><span class=\"veu_count_sns_pocket\"><\/span><\/a><\/li><\/ul><\/div><!-- [ \/.socialSet ] -->","protected":false},"excerpt":{"rendered":"<p>&nbsp; \u306f\u3058\u3081\u306b CTreeCtrl\u306eItem\u3092\u9078\u629e\u3055\u308c\u305f\u3068\u3053\u308d\u304b\u3089\u691c\u7d22\u3057\u305f\u3044\u306a\u3068\u601d\u3044\u307e\u3057\u305f\u3002\u30a4\u30e1\u30fc\u30b8\u3068\u3057\u3066\u306f\u30ec\u30b8\u30b9\u30c8\u30ea\u30a8\u30c7\u30a3\u30bf\u306e\u691c\u7d22\u307f\u305f\u3044\u306a\u611f\u3058\u3067\u3059\u3002\u6b21\u3078\u3068\u3084\u308b\u3068\u9078\u629e\u3055\u308c\u305f\u3068\u3053\u308d\u304b\u3089\u4e0b\u3092\u63a2\u3057\u3066\u3001\u89aa\u3092\u305f\u3069\u3063\u3066\u4e0b\u307e\u3067 [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":17393,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,4],"tags":[],"class_list":["post-16951","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cpp","category-blog"],"_links":{"self":[{"href":"https:\/\/ricka.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/16951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ricka.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ricka.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ricka.co.jp\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/ricka.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16951"}],"version-history":[{"count":0,"href":"https:\/\/ricka.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/16951\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ricka.co.jp\/index.php?rest_route=\/wp\/v2\/media\/17393"}],"wp:attachment":[{"href":"https:\/\/ricka.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ricka.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ricka.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}