Thread: Weird error killing a child window

  1. #1
    Registered User
    Join Date
    Sep 2002

    Weird error killing a child window

    Hi guys, me again,

    I haven't had this error before, but it could be that I haven't used property sheets before.

    Basically I need to be able to edit subitems in a reportview listview with about 10 columns (so LVS_EDITLABELS won't do).

    I watch for double clicking then I create an editbox with a border around the subitem which I want to edit, but it will only be displayed and in the correct position if I use the listview as the parent when using CreateWindowEx(). If I press 'enter' I've managed to make it accept the text and not skip to the next page in the property sheet by making it multiline, want return and setting up a function which I call using SetWindowLong(). What I can't get to happen is trap 'esc' so when pressed the editing of the subitem is cancelled, it just destroys the listbox (parent of the editbox).

    I've tried 'return' ing when receiving the WM_DESTROY message, I've tried using WM_CHAR and (TCHAR)wParam == VK_ESCAPE but it still won't work, I've also tried creating another control that's hidden and using SetParent() to change the parent, but the editbox is still invisible and I can't get it visible.

    I'm using Windows XP, Visual Studio, writing in C (I know, outdated, but I won't go into why I'm still using this rather than C++ or

    Any help would be greatly appreciated.

    - Daniel Wallace

  2. #2
    train spotter
    Join Date
    Aug 2001
    near a computer
    Try destroying the Edit control when it loses focus (WM_KILLFOCUS msg).

    Have code for exactly this at home in a combo of MFC and WIN32.

    Let me know if you still need help and I will post it.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Sep 2002
    Thanks for replying.

    That does pretty much the same thing as checking for WM_NOTIFY and using ((LPNMLISTVIEW)lParam)->hdr.code == NM_CLICK (which is how I'm doing at the moment).

    The reason I wanted the escape key to cancel and either enter or clicking somewhere else to confirm is there will be multiple people using this program, I prefer pressing enter to confirm, though they prefer clicking somewhere else, I might have to tell them to deal I guess, though if you have any ideas, I would greatly appreciate hearing them
    - Daniel Wallace

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM