Click here to Skip to main content
15,887,336 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: dynamic array of strings Pin
jon-8018-Jul-06 10:52
professionaljon-8018-Jul-06 10:52 
GeneralRe: dynamic array of strings Pin
Chris Losinger18-Jul-06 11:33
professionalChris Losinger18-Jul-06 11:33 
QuestionRe: dynamic array of strings Pin
jon-8019-Jul-06 5:39
professionaljon-8019-Jul-06 5:39 
AnswerRe: dynamic array of strings Pin
Chris Losinger19-Jul-06 5:46
professionalChris Losinger19-Jul-06 5:46 
QuestionRe: dynamic array of strings Pin
jon-8019-Jul-06 6:05
professionaljon-8019-Jul-06 6:05 
AnswerRe: dynamic array of strings Pin
Chris Losinger19-Jul-06 6:57
professionalChris Losinger19-Jul-06 6:57 
AnswerRe: dynamic array of strings Pin
Hamid_RT17-Jul-06 19:40
Hamid_RT17-Jul-06 19:40 
QuestionTreeview creation problem Pin
Alex Cutovoi17-Jul-06 8:57
Alex Cutovoi17-Jul-06 8:57 
Hi fellows

I`m trying to create a treeview in my app but I don`t have any sucess.
I`ve read the Microsoft article [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/treeview/treeview.asp[/url]
and I`ve tried to do something like that. The problem is that whem I create a node in a function that I created it returns NULL. I think that my code is right, so what`s going on??
Thanks for the support.

Below is my code?

I created my treeview like this:
<br />
treeViewHwnd = CreateWindowEx(WS_EX_LEFT, WC_TREEVIEW, "theTreeView", WS_CHILD|WS_VISIBLE|TVS_EDITLABELS|TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT, 0, 0, 150, 600, hwnd, NULL, hCurrentInstance, NULL);<br />


treeViewHwnd is a global HWND.

In this part I want to put a node in the treeview
<br />
case WM_CHAR:<br />
{<br />
    switch(wParam)<br />
    {<br />
      case 'a':<br />
      {<br />
          InitCommonControls();<br />
          treeViewHwnd = GetDlgItem(hwnd, IDC_TREE1);<br />
          OpenedWindows(GetForegroundWindow());<br />
          for(int i = 0 ; i < sNameHwnds.size() ; i++)<br />
          { <br />
             InsertNodeInTV(hwnd, sNameHwnds[i], 1);<br />
             MessageBox(NULL, sNameHwnds[i].c_str(), "", MB_OK);<br />
             break;<br />
          }<br />
          break;<br />
      }<br />
.....<br />


And here I create the node:
<br />
#define IDC_TREE1 10<br />
HTREEITEM InsertNodeInTV(HWND tvHwnd, string sNodeName, int iLevel)<br />
{<br />
      static HTREEITEM ParentItem, BeforeItem, RootItem;<br />
      ParentItem = (HTREEITEM)TVI_FIRST;<br />
      BeforeItem = RootItem = NULL;<br />
      TVINSERTSTRUCT treeViewInsert;<br />
      treeViewInsert.item.mask = TVIF_TEXT;<br />
      treeViewInsert.item.pszText = (char*)sNodeName.c_str();<br />
      treeViewInsert.item.cchTextMax = sizeof(treeViewInsert.item.pszText)/treeViewInsert.item.pszText[0];<br />
      treeViewInsert.hInsertAfter = TVI_ROOT;<br />
      treeViewInsert.hParent = NULL;<br />
      ParentItem = (HTREEITEM)SendDlgItemMessage(tvHwnd, IDC_TREE1, TVM_INSERTITEM, 0, (LPARAM)&treeViewInsert);<br />
      if(ParentItem == NULL)MessageBox(NULL, "aaa", "", MB_OK);<br />
      return ParentItem;<br />
}<br />

AnswerRe: Treeview creation problem Pin
led mike17-Jul-06 10:49
led mike17-Jul-06 10:49 
AnswerRe: Treeview creation problem Pin
valikac17-Jul-06 10:56
valikac17-Jul-06 10:56 
GeneralRe: Treeview creation problem Pin
led mike17-Jul-06 11:01
led mike17-Jul-06 11:01 
QuestionClose Dialog Pin
Manjunath S17-Jul-06 8:14
Manjunath S17-Jul-06 8:14 
AnswerRe: Close Dialog Pin
valikac17-Jul-06 8:35
valikac17-Jul-06 8:35 
AnswerRe: Close Dialog Pin
David Crow17-Jul-06 9:49
David Crow17-Jul-06 9:49 
AnswerRe: Close Dialog Pin
Hamid_RT18-Jul-06 19:06
Hamid_RT18-Jul-06 19:06 
QuestionCommunicating with top level form from child forms Pin
mrhonus17-Jul-06 7:53
mrhonus17-Jul-06 7:53 
AnswerRe: Communicating with top level form from child forms Pin
William.Wang17-Jul-06 16:10
William.Wang17-Jul-06 16:10 
AnswerRe: Communicating with top level form from child forms Pin
Hamid_RT17-Jul-06 19:29
Hamid_RT17-Jul-06 19:29 
GeneralRe: Communicating with top level form from child forms Pin
mrhonus18-Jul-06 5:58
mrhonus18-Jul-06 5:58 
QuestionDialog Based ActiveX Control Pin
MissingLinkError17-Jul-06 7:41
MissingLinkError17-Jul-06 7:41 
AnswerRe: Dialog Based ActiveX Control Pin
nguyenvhn17-Jul-06 15:49
nguyenvhn17-Jul-06 15:49 
QuestionDoing print abort with a toolbar button Pin
CodeBrain17-Jul-06 6:40
CodeBrain17-Jul-06 6:40 
AnswerRe: Doing print abort with a toolbar button Pin
led mike17-Jul-06 7:08
led mike17-Jul-06 7:08 
GeneralRe: Doing print abort with a toolbar button Pin
CodeBrain17-Jul-06 8:42
CodeBrain17-Jul-06 8:42 
Questionfstream - reading from a text file Pin
jon-8017-Jul-06 6:28
professionaljon-8017-Jul-06 6:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.