In our Program we have a Dialog from a separate dll open to display infomation. I need to close this dialog when our system timer causes the system to lock.
I send information to the dll by registering a system message in both my MainFrm and EditDisplayDll
SYSTEMLOCK = RegisterWindowMessage("SystemLock");
When I sent the message via
::PostMessage(GetActiveWindow()->m_hWnd,SYSTEMLOCK,0,0);
The message correctly sends to my EditDisplayDll and closes the dialog when the system locks; however, if I alt tab while waiting for the timeout and use another program(firefox, outlook, etc.) the message never correctly calls to the EditDisplayDll. The MainFrm
and other windows inside of the MainFrm
correctly lockout and hide themselves in either case.
I have tried also using HWND_BROADCAST with PostMessage
and SendNotifyMessage
. I have also tried to use FindWindow()
and FindWindowEx()
to specifically call the EditDisplayDll.
I cannot use something like GetDlgItem()
because my MainFrm.cpp
doesn't have access to this dll.
My decision to use GetActiveWindow()
was because I believe it looks to windows specific to my program no matter what window I am in as seen in the imagery in Foreground Vs Active window
Finally, my question is, is there a way to call all Windows in my program no matter what program I am currently in or is there another way I could get access to the specific IDD of the EditDisplayDll in order to send the SYSTEMLOCK
message to it?