Click here to Skip to main content
15,912,578 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: service status Pin
Arcrest23-Mar-04 17:00
Arcrest23-Mar-04 17:00 
GeneralHandle Leak : HKLM\SYSTEM\ControlSet001\Services\DnsCache\Parameters Pin
cmk23-Mar-04 13:03
cmk23-Mar-04 13:03 
GeneralA question about reading non-data CDs Pin
Roger Wright23-Mar-04 12:20
professionalRoger Wright23-Mar-04 12:20 
GeneralRe: A question about reading non-data CDs Pin
Shog923-Mar-04 19:56
sitebuilderShog923-Mar-04 19:56 
GeneralRe: A question about reading non-data CDs Pin
Roger Wright23-Mar-04 20:52
professionalRoger Wright23-Mar-04 20:52 
GeneralRe: A question about reading non-data CDs Pin
Ceri24-Mar-04 2:54
Ceri24-Mar-04 2:54 
GeneralRe: A question about reading non-data CDs Pin
Roger Wright24-Mar-04 4:39
professionalRoger Wright24-Mar-04 4:39 
GeneralGetting a window to come forward on XP Pin
Tom Wright23-Mar-04 12:01
Tom Wright23-Mar-04 12:01 
I'm writing an app that when a certain event is received it brings itself forward to the top window on the z-order. However I cannot get this to happen on a win xp pro environment.

I tried this example that I found but this does not work
AttachThreadInput(<br />
    GetWindowThreadProcessId(<br />
        ::GetForegroundWindow(),NULL),<br />
    GetCurrentThreadId(),TRUE);<br />
<br />
//Do our stuff here ;-)<br />
SetForegroundWindow();<br />
SetFocus(); //Just playing safe<br />
<br />
//Detach the attached thread<br />
AttachThreadInput(<br />
    GetWindowThreadProcessId(<br />
        ::GetForegroundWindow(),NULL),<br />
    GetCurrentThreadId(),FALSE);



I've also tried this:
    <br />
//Attach ourselves to the thread<br />
::AttachThreadInput(GetWindowThreadProcessId(hWnd, NULL) ,GetCurrentThreadId(), TRUE);<br />
//Set window<br />
::DefWindowProc(hWnd, WM_SYSCOMMAND, SC_RESTORE, NULL);<br />
::SetForegroundWindow(hWnd);<br />
::SetFocus(hWnd);<br />
::ShowWindow(hWnd, SW_SHOWNORMAL);<br />
//detach ourselves from the thread<br />
::AttachThreadInput(GetWindowThreadProcessId(hWnd, NULL) ,GetCurrentThreadId(), FALSE);<br />


Still does not being itself forward.

Does anyone have any suggestions?

Thanks


Tom Wright
tawright915@yahoo.com
GeneralRe: Getting a window to come forward on XP Pin
Antony M Kancidrowski23-Mar-04 12:38
Antony M Kancidrowski23-Mar-04 12:38 
GeneralRe: Getting a window to come forward on XP Pin
Christian Graus23-Mar-04 16:18
protectorChristian Graus23-Mar-04 16:18 
GeneralRe: Getting a window to come forward on XP Pin
Mike Dimmick24-Mar-04 2:59
Mike Dimmick24-Mar-04 2:59 
GeneralRe: Getting a window to come forward on XP Pin
Tom Wright24-Mar-04 5:56
Tom Wright24-Mar-04 5:56 
GeneralCListCtrl - Sort Pin
jcplatt23-Mar-04 11:59
jcplatt23-Mar-04 11:59 
GeneralRe: CListCtrl - Sort Pin
David Crow24-Mar-04 2:08
David Crow24-Mar-04 2:08 
GeneralRe: CListCtrl - Sort Pin
jcplatt25-Mar-04 8:46
jcplatt25-Mar-04 8:46 
GeneralCan't write to HKEY_CURRENT_USER when impersonating (new problem) Pin
ICantChangeMyAcct23-Mar-04 10:02
ICantChangeMyAcct23-Mar-04 10:02 
GeneralRe: Can't write to HKEY_CURRENT_USER when impersonating (new problem) Pin
David Crow23-Mar-04 10:29
David Crow23-Mar-04 10:29 
GeneralRe: Can't write to HKEY_CURRENT_USER when impersonating (new problem) Pin
ICantChangeMyAcct23-Mar-04 11:06
ICantChangeMyAcct23-Mar-04 11:06 
GeneralPrevent to open program multiplie times Pin
Snillet2k23-Mar-04 9:52
Snillet2k23-Mar-04 9:52 
GeneralRe: Prevent to open program multiplie times Pin
David Crow23-Mar-04 9:55
David Crow23-Mar-04 9:55 
GeneralGetLastError problem Pin
rmnowick23-Mar-04 9:20
rmnowick23-Mar-04 9:20 
GeneralRe: GetLastError problem Pin
David Crow23-Mar-04 9:53
David Crow23-Mar-04 9:53 
GeneralRe: GetLastError problem Pin
rmnowick23-Mar-04 11:35
rmnowick23-Mar-04 11:35 
GeneralRe: GetLastError problem Pin
Neville Franks23-Mar-04 9:59
Neville Franks23-Mar-04 9:59 
GeneralRe: GetLastError problem Pin
rmnowick23-Mar-04 11:47
rmnowick23-Mar-04 11:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.