我在完全理解AttachThreadInput时遇到了一点问题。我知道它正在“连接”2个线程的消息队列,这(我想做的)允许我在前台强制我的窗口(winforms)。我可以用这个方法做什么:privatevoidSetForegroundWindowEx(IntPtrhWnd){uintSW_SHOW=5;uintappThread=GetCurrentThreadId();uintforegroundThread=GetWindowThreadProcessId(GetForegroundWindow(),IntPtr.Zero);if(foregroundThread!=appThr
我有VisualStudio2010UltimateSP1,我的项目基于MFC。当我调试项目的下一个代码时,VisualStudio挂起:CWnd*_window=CWnd::FromHandle(_hwnd_);if(_window){DWORDnForeThread,nAppThread;nForeThread=::GetWindowThreadProcessId(::GetForegroundWindow(),0);nAppThread=GetCurrentThreadId();if(nForeThread!=nAppThread){AttachThreadInput(nFore