How do you destroy an editbox?
How do you destroy an editbox?
That'll work but is, perhaps, overkill.
DestroyWindow.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Apoligies for confusing answer. I was confused between an EditBox (a window that can use CreateWindow() and DestroyWindow()), and a Menu (which uses CreateMenu() and SetMenu() and DestroyMenu()).
Last edited by Lithorien; 05-12-2005 at 06:16 PM. Reason: Misunderstood OP.
Meow!
Nuked the litter box again. In most cases usually when one wants to destroy a editbox they also want to terminate the proggie? yes? unless it is one of those extra long proggies. or app.
Nuclear is an option? Thought it was obligatorie.
edit:
NukeWindow();
Last edited by kryptkat; 05-12-2005 at 04:54 PM.
I guess I said it wrong or somthing but, I want to destroy the Editbox, but not the window.
Last edited by Queatrix; 05-12-2005 at 05:12 PM.
The editbox is a window. DestroyWindow would destroy it.Originally Posted by Cool-August
That would cause a leak. If you assign a newly created control to your handle, the old control still exists.Then, when you need to destroy your edit box, set hEdit (or whatever you use) to NULL, and call your 'window creation' function again. In practice, all this will do is refresh your window minus the edit box.
Last edited by Dante Shamest; 05-12-2005 at 05:25 PM.
I use this:
When I activate this:Code:HFONT hfDefault; HWND hEdit; CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL, 2, 2, 391, 170, hwnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL); SendMessage(hEdit, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));
Nothing happens.Code:DestroyWindow(hEdit);
What is the value of hEdit?
You've not assigned anything to hEdit.
You just declared it:
Then you created the edit control, but you did not assign the return value to hEdit.Code:HWND hEdit;
Code:CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL, 2, 2, 391, 170, hwnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL); SendMessage(hEdit, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));
Somehow, I knew you were going to ask me that.
Code:hEdit = CreateWindowEx( ...etc... );
Make sure the HWND is static or global if it is declared in the callback (or it will loose scope).
Or use GetDlgItem() ect to get the edits HWND again when needed.
"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