News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Destruction

Started by oex, March 01, 2012, 06:32:53 PM

Previous topic - Next topic

oex

I'm sure I'm missing something obvious but maybe one of you genius' could help me

I create a window
CreateWindowEx, WS_EX_OVERLAPPEDWINDOW, chr$("P2D"), chr$("P2D"), WS_EX_OVERLAPPEDWINDOW or WS_VISIBLE, 0, 0, 1366, 768, 0, 0, 400000h, 0
I create an Edit Control

CreateWindowEx, WS_EX_CLIENTEDGE, chr$("EDIT"), oexText, WS_VISIBLE or WS_CHILDWINDOW or ES_AUTOHSCROLL, oexLeft, oexTop, oexWidth, oexHeight, oexParenthWnd, oexID, hInstance, 0

; On Button Command (Submit)
.elseif uMsg == WM_COMMAND
mov eax, wParam
mov edx, eax
shr edx, 16

.if dx == BN_CLICKED && ax == 500

I try everything to destroy Child Window (Edit Control)
ShowWindow, oexChildhWnd, SW_HIDE
SendMessage, oexChildhWnd, WM_CLOSE, 0, 0
DestroyWindow, oexChildhWnd


I refresh the parent window
UpdateWindow, oexParenthWnd

I can still see the Child Control.... :(????



Obviously the code is a bit more complicated than this.... I just need to be sure I'm understanding the process right.... there are many Controls with ChildhWnds saved to a buffer which is looped and all controls are meant to be destroyed.... I dont think there is a problem there.... I dont want to reuse the controls Just delete them after the form has completed.... Any issues here?
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

dedndave

what ? - you didn't try CloseHandle ???   :lol

DestroyWindow should work, unless you are trying to do it from a different thread than the one that created it

oex

Quote from: dedndave on March 01, 2012, 06:50:35 PM
what ? - you didn't try CloseHandle ???   :lol

DestroyWindow should work, unless you are trying to do it from a different thread than the one that created it

I have tried the DIEDIEDIE!!! function but that doesnt work either.... Same thread....

I'll check some more that I am passing the correct hWnd handles but I think I am :(
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

dedndave

if you destroy a window or dialog, it will (should) destroy all children, as well

perhaps the WndProc for the edit control is not handling default message processing correctly ?

oex

I am trying to destroy the child and not the parent.... Whatever the default on a static/edit control is what is being processed I havent subclassed the edit control yet
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

jj2007

Works perfectly... your problem must be elsewhere. What's your error message?

Button1 proc
invoke DestroyWindow, hButton2
MsgBox 0, LastError$(), "Button 2 is gone:", MB_OK
ret
Button1 endp

oex

No error message just the form still appears (*but I can't click in the edit boxes....*)

This works:
.elseif uMsg==WM_PARENTNOTIFY
mov eax, wParam
mov edx, eax
shr edx, 16

.if ax == 2
invoke MessageBox,0,"Control Deleted","Action",MB_OK
.endif
xor eax, eax
ret


The Parent hWnd does not refresh properly with UpdateWindow?

Is there something I am doing wrong to Update/Refresh the ParenthWnd?
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

jj2007

Quote from: oex on March 01, 2012, 06:55:47 PM
The Parent hWnd does not refresh properly with UpdateWindow?

Try an InvalidateRect before.

oex

Quote from: jj2007 on March 01, 2012, 07:10:20 PM
Quote from: oex on March 01, 2012, 06:55:47 PM
The Parent hWnd does not refresh properly with UpdateWindow?

Try an InvalidateRect before.

no joy
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

dedndave

Peter, you may have to show us more code - or perhaps attach

oex

Yeah I'll keep at it for a while and see if I can fix it.... There is a lot of code :(.... At least I have basically confirmed I have the process correct, I'm now testing all my inputs :'(

Thanks for your help I'll keep you posted
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

qWord

maybe you are creating several controls about each other ...
FPU in a trice: SmplMath
It's that simple!

oex

I think I must had a more annoying issue somewhere WM_PARENTNOTIFY just failed to be called in testing....

Going to take it all to pieces again and then put it back together with the missing screw ::)

That'll teach me to paint a picture with all the paint brushes at the same time
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

oex

Yes cheers guys, idiot error somewhere, it's all working now it seems.... :red

We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

dedndave

what was it ???   :red