My environment: C++ Builder XE4
I am working on hiding/showing one application from other application, both built using XE4.
Two project
- UnitShow: to show/hide UnitHide
- UnitHide: to be shown/hidden from UnitShow
The code for UnitShow is as follows:
void __fastcall TFormShow::B_showClick(TObject *Sender)
{
HWND hwnd = GetDesktopWindow();
hwnd = FindWindowEx(hwnd, NULL, L"TFormHide", NULL);
ShowWindow(hwnd, SW_SHOWNORMAL);
}
The code for UnitHide is as follows:
void __fastcall TFormHide::B_hideClick(TObject *Sender)
{
this->Hide();
}
With above, I tried followings.
- On UnitHide, click B_hide >> UnitHide is hidden
- On UnitShow, click B_show >> UnitHide is shown
- On UnitHide, click B_hide >> UnitHide is not hidden
I expected that the 2nd B_hide button push will hide UnitHide.
What is the cause of this problem?