Quote Originally Posted by mesajflaviu View Post
In fact, the app has single instance pattern. So, the issue occur when app is already started, and when user try to start another instance and a system tray balloon is shown, and user click on this volume, and then is fired code from the first post. And didn't work ok, instead of MDI get focus, I saw the app flash the task bar icon few times. So, I have tried this code too:
Code:
	ShowWindow(SW_RESTORE);

	HWND hForegdWnd = ::GetForegroundWindow();
	DWORD dwCurID = ::GetCurrentThreadId();
	DWORD dwForeID = ::GetWindowThreadProcessId(hForegdWnd, NULL);

	::AttachThreadInput(dwCurID, dwForeID, TRUE);
	::SetForegroundWindow(m_hWnd);
	::SetFocus(m_hWnd);
	::AttachThreadInput(dwCurID, dwForeID, FALSE);
with the same result.
So what started out as a post wondering why focus can't be set on an MDI application has now turned into a single instance tray notify application?

Clearly it's a bit more complex. That being the case, Victor's ask of a sample app that repros the behavior is probably your best chance of receiving help.