c++ - How to bring another window forward that is not owned by the program -


i'm struggling find way of bringing forward programs window.

for example, use findwindow find handle of notepad. try bring window forward using setwindowpos(hwnd, 0,0, 0, 0, 0, swp_showwindow|swp_nosize|swp_nomove);

but doesnt work!! showwindow doesnt either!

can please , maybe show me snippet of code?

thanks

dunno if same thing or not, @ point in windows development microsoft added too-clever-by-half "anti-popup" code prevent program not have focus un-minimizing windows... instead, window's entry in programs-bar blink. perhaps there similar logic preventing non-foreground program bringing window forward?

in case, here code try, might or might not help:

 // check see if foreground thread  dword foregroundthreadid = getwindowthreadprocessid(getforegroundwindow(), null);  dword ourthreadid = getcurrentthreadid();   // if not, attach our thread's 'input' foreground thread's  if (foregroundthreadid != ourthreadid) attachthreadinput(foregroundthreadid, ourthreadid, true);   // bring our window foreground  setforegroundwindow(hwnd);   // if attached our thread, detach  if (foregroundthreadid != ourthreadid) attachthreadinput(foregroundthreadid, ourthreadid, false);   // force our window redraw  invalidaterect(hwnd, null, true); 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -