you can use this piece of code after grabbing the window handle of the desired window.

Code:
  ::SendMessage(hwnd, WM_SYSCOMMAND, SC_HOTKEY, (LPARAM) hwnd);
  ::SendMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, (LPARAM) hwnd);
  
  ::ShowWindow(hwnd, SW_SHOW);
  ::SetForegroundWindow(hwnd);
  ::SetFocus(hwnd);