Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to activate window? 1

Status
Not open for further replies.

ZakiMaksyutov

Programmer
Feb 28, 2001
87
0
0
RU
Hi!

My application should activate itself when something occurs
(when it receives a message). But I do know how to do it.
May be someone helps?

Thanks a lot!
 
DWORD dwResult;
if( ::IsIconic( your_HWND )) {
//Open Icon
::SendMessageTimeout( your_HWND, WM_QUERYOPEN, (WPARAM) 0, (LPARAM) 0, SMTO_NORMAL, 4000, &dwResult );
}
if(!::SetForegroundWindow( your_HWND )) {
ShowError("Can't activate Window!");
//Try so - it sometimes works too
::SendMessageTimeout( m_Dest_HWND, WM_SETFOCUS , (WPARAM) 0, (LPARAM) 0,SMTO_NORMAL, 4000, &dwResult );
}
else {
//It will be not bad
::SendMessageTimeout( your_HWND, WM_SETFOCUS , (WPARAM) 0, (LPARAM) 0,SMTO_NORMAL, 4000, &dwResult );
}
Of course, You can use SendMessage() instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top