I create a child window (child of background window) that has a button. When the button is pressed, in the event WM_NOTIFY_PARENT/WM_NOTIFICATION_RELEASED I call WM_SendMessage() to send a custom message to main/background window.
During processing this custom message (in the callback of background window), I want to call WM_DeleteWindow() to delete the child window. Is it possible? It seems it works, but after some tests it seems there are some memory leaks.
I can't call WM_DeleteWindow() from the child window, because only background window knows if it's time to delete the child window.
I'm using 5.32.
C
static void
cbBackgroundWindow(WM_MESSAGE *pMsg)
{
switch(pMsg->MsgId) {
...
case WM_MYMESSAGE: {
WM_DeleteWindow_ex(pMsg->hWinSrc);
break;
}
default:
WM_DefaultProc(pMsg);
}
}
static void
cbChildWindow(WM_MESSAGE *pMsg)
{
switch(pMsg->MsgId) {
...
case WM_NOTIFY_PARENT: {
int i = WM_GetId(pMsg->hWinSrc);
switch(pMsg->Data.v) {
case WM_NOTIFICATION_RELEASED: {
if (i == BTN_ID_CANCEL) {
WM_MESSAGE msg = { .MsgId = WM_MYMESSAGE, .hWinSrc = hWin };
WM_SendMessage(WM_HBKWIN, &msg);
}
}
}
}
default:
WM_DefaultProc(pMsg);
}
}
Display More