本文整理汇总了C++中AttachThreadInput函数的典型用法代码示例。如果您正苦于以下问题:C++ AttachThreadInput函数的具体用法?C++ AttachThreadInput怎么用?C++ AttachThreadInput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AttachThreadInput函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: bring_to_top
void bring_to_top(GtkWidget *win){
#ifdef __WIN32__
HWND hWnd;
int nTargetID, nForegroundID;
BOOL res;
hWnd = GDK_WINDOW_HWND (win->window);
/* From http://techtips.belution.com/ja/vc/0012/ */
nForegroundID = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
nTargetID = GetWindowThreadProcessId(hWnd, NULL );
AttachThreadInput(nTargetID, nForegroundID, TRUE );
// SPI_GETFOREGROUNDLOCKTIMEOUT will be undefined. Why ?
/*
SystemParametersInfo( SPI_GETFOREGROUNDLOCKTIMEOUT,0,&sp_time,0);
SystemParametersInfo( SPI_SETFOREGROUNDLOCKTIMEOUT,0,(LPVOID)0,0);
SetForegroundWindow(hWnd);
SystemParametersInfo( SPI_SETFOREGROUNDLOCKTIMEOUT,0,sp_time,0);
*/
res = SetForegroundWindow(hWnd);
AttachThreadInput(nTargetID, nForegroundID, FALSE);
if(!res){
SetFocus(hWnd);
}
#else
gdk_window_show(GTK_WIDGET(win)->window);
gdk_window_focus(GTK_WIDGET(win)->window, gtk_get_current_event_time());
#endif
}
开发者ID:fujii,项目名称:ebview,代码行数:35,代码来源:selection.c
示例2: SetForegroundWindowInternal
// http://www.codeproject.com/Tips/76427/How-to-bring-window-to-top-with-SetForegroundWindo
void SetForegroundWindowInternal(HWND hWnd)
{
SetWindowPos(hWnd,HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
SetWindowPos(hWnd,HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
SetWindowPos(hWnd,HWND_NOTOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
return;
//relation time of SetForegroundWindow lock
DWORD lockTimeOut = 0;
HWND hCurrWnd = GetForegroundWindow();
DWORD dwThisTID = GetCurrentThreadId(),
dwCurrTID = GetWindowThreadProcessId(hCurrWnd, 0);
//we need to bypass some limitations from Microsoft :)
if (dwThisTID != dwCurrTID)
{
AttachThreadInput(dwThisTID, dwCurrTID, TRUE);
SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &lockTimeOut, 0);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 0, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
AllowSetForegroundWindow(ASFW_ANY);
}
SetForegroundWindow(hWnd);
if (dwThisTID != dwCurrTID)
{
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (PVOID)lockTimeOut, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
AttachThreadInput(dwThisTID, dwCurrTID, FALSE);
}
}
开发者ID:Dergash,项目名称:homm3tools,代码行数:32,代码来源:rmg.c
示例3: activateGame
XBool activateGame(HWND h)
{
//方案1://不行
//return BringWindowToTop(XEG.getHWND());
//方案2://可以
//typedef void (WINAPI *PROCSWITCHTOTHISWINDOW) (HWND, BOOL);
//PROCSWITCHTOTHISWINDOW SwitchToThisWindow;
//HMODULE hUser32 = GetModuleHandle("user32");
//SwitchToThisWindow = ( PROCSWITCHTOTHISWINDOW)GetProcAddress(hUser32, "SwitchToThisWindow");
//if(SwitchToThisWindow == NULL) return false;
////接下来只要用任何现存窗口的句柄调用这个函数即可,第二个参数指定如果窗口极小化,是否恢复其原状态。
//SwitchToThisWindow(XEG.getHWND(), TRUE);
//return true;
//方案3://可行
HWND hCurWnd = GetForegroundWindow();
DWORD dwMyID = GetCurrentThreadId();
DWORD dwCurID = GetWindowThreadProcessId(hCurWnd, NULL);
AttachThreadInput(dwCurID, dwMyID, TRUE);
SetForegroundWindow(h);
AttachThreadInput(dwCurID, dwMyID, FALSE);
return true;
//方法4://可行
//ShowWindow(XEG.getHWND(),SW_SHOWNA);//简单的显示主窗口完事儿
//SetActiveWindow(XEG.getHWND());
//SetForegroundWindow(XEG.getHWND());
////this->SetWindowPos(this,LOWORD(lParam),HIWORD(lParam),c.Width(),c.Height(),SWP_NOACTIVATE);
//BringWindowToTop(XEG.getHWND());
//return true;
}
开发者ID:xiajiaonly,项目名称:XEffect2D,代码行数:29,代码来源:XEngineCommon.cpp
示例4: set_foreground
static DWORD set_foreground(HWND hwnd)
{
HWND hwnd_fore;
DWORD set_id, fore_id, ret;
char win_text[1024];
hwnd_fore = GetForegroundWindow();
GetWindowTextA(hwnd_fore, win_text, 1024);
set_id = GetWindowThreadProcessId(hwnd, NULL);
fore_id = GetWindowThreadProcessId(hwnd_fore, NULL);
trace("\"%s\" %p %08x hwnd %p %08x\n", win_text, hwnd_fore, fore_id, hwnd, set_id);
ret = AttachThreadInput(set_id, fore_id, TRUE);
trace("AttachThreadInput returned %08x\n", ret);
ret = ShowWindow(hwnd, SW_SHOWNORMAL);
trace("ShowWindow returned %08x\n", ret);
ret = SetWindowPos(hwnd, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
trace("set topmost returned %08x\n", ret);
ret = SetWindowPos(hwnd, HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
trace("set notopmost returned %08x\n", ret);
ret = SetForegroundWindow(hwnd);
trace("SetForegroundWindow returned %08x\n", ret);
Sleep(250);
AttachThreadInput(set_id, fore_id, FALSE);
return ret;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:25,代码来源:winstation.c
示例5: DoFocus
void DoFocus(BOOL bUseCurrent,HWND hwndFocus)
{
HWND hwndEdit;
char WinClass[256];
DWORD OtherAppThreadID;
DWORD OtherAppProcessID;
DWORD TrayThreadID;
if(bUseCurrent)
{
TrayThreadID=GetCurrentThreadId();
hwndEdit=hwndFocus;
GetClassName(hwndEdit,WinClass,255);
OtherAppThreadID = GetWindowThreadProcessId( hwndEdit,
&OtherAppProcessID);
AttachThreadInput( TrayThreadID, OtherAppThreadID, TRUE );
// We can key off WinClass if something else
// needs to be done
SetFocus(hwndEdit);
AttachThreadInput( TrayThreadID, OtherAppThreadID, FALSE );
}
}
开发者ID:ysangkok,项目名称:pgp-win32-6.5.8,代码行数:27,代码来源:Utils.c
示例6: SetForegroundWindowInternal
BOOL SetForegroundWindowInternal(HWND hWnd) {
BOOL ret = false;
if (!IsWindow(hWnd)) return ret;
//relation time of SetForegroundWindow lock
DWORD lockTimeOut = 0;
HWND hCurrWnd = GetForegroundWindow();
DWORD dwThisTID = GetCurrentThreadId(),
dwCurrTID = GetWindowThreadProcessId(hCurrWnd, 0);
//we need to bypass some limitations from Microsoft :)
if (dwThisTID != dwCurrTID)
{
AttachThreadInput(dwThisTID, dwCurrTID, TRUE);
SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &lockTimeOut, 0);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 0, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
AllowSetForegroundWindow(ASFW_ANY);
}
ret = SetForegroundWindow(hWnd);
if (dwThisTID != dwCurrTID)
{
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (PVOID)lockTimeOut, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
AttachThreadInput(dwThisTID, dwCurrTID, FALSE);
}
return ret;
}
开发者ID:morrisslutsky,项目名称:NowUGo,代码行数:31,代码来源:Popup.cpp
示例7: WaitForReleaseVkKeys
void WaitForReleaseVkKeys(DWORD dwThreadCurrent, DWORD dwThreadTarget, DWORD dwTimeout)
{
DWORD dwStart=GetTickCount();
BYTE lpKeyState[256];
int i;
Loop:
if (dwTimeout == INFINITE || GetTickCount() - dwStart < dwTimeout)
{
AttachThreadInput(dwThreadCurrent, dwThreadTarget, FALSE);
if (AttachThreadInput(dwThreadCurrent, dwThreadTarget, TRUE))
{
Sleep(0);
if (GetKeyboardState(lpKeyState))
{
for (i=0; i < 256; ++i)
{
if (lpKeyState[i] & 0x80)
goto Loop;
}
}
}
}
}
开发者ID:embassy,项目名称:AkelPad,代码行数:26,代码来源:Clipboard.c
示例8: _SetForegroundWindowEx
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
COMMONEXPORT BOOL _SetForegroundWindowEx ( HWND hWnd )
{
if (hWnd == NULL)
return FALSE;
// determine current foreground window
HWND hWndForeground = ::GetForegroundWindow ();
if (hWndForeground == NULL)
return ::SetForegroundWindow (hWnd);
// check whether it is able to pump messages to avoid deadlocks
DWORD dwResult = 0;
if ( SendMessageTimeout ( hWndForeground, WM_NULL, 0, 0, SMTO_NORMAL, 1000, &dwResult ) == 0 )
return FALSE;
int iTID = ::GetWindowThreadProcessId ( hWnd, 0 );
int iForegroundTID = ::GetWindowThreadProcessId ( hWndForeground, 0 );
AttachThreadInput (iTID, iForegroundTID, TRUE);
::SetForegroundWindow (hWnd);
AttachThreadInput (iTID, iForegroundTID, FALSE);
return TRUE;
}
开发者ID:hackshields,项目名称:antivirus,代码行数:31,代码来源:popup.cpp
示例9: EnsureValid
HRESULT CSysProgressDlg::ShowModeless(HWND hWndParent, BOOL immediately)
{
EnsureValid();
m_hWndProgDlg = nullptr;
if (!IsValid())
return E_FAIL;
m_hWndParent = hWndParent;
auto winId = GetWindowThreadProcessId(m_hWndParent, 0);
auto threadId = GetCurrentThreadId();
if (winId != threadId)
AttachThreadInput(winId, threadId, TRUE);
m_hWndFocus = GetFocus();
if (winId != threadId)
AttachThreadInput(winId, threadId, FALSE);
HRESULT hr = m_pIDlg->StartProgressDialog(hWndParent, nullptr, m_dwDlgFlags, nullptr);
if(FAILED(hr))
return hr;
ATL::CComPtr<IOleWindow> pOleWindow;
HRESULT hr2 = m_pIDlg.QueryInterface(&pOleWindow);
if(SUCCEEDED(hr2))
{
hr2 = pOleWindow->GetWindow(&m_hWndProgDlg);
if(SUCCEEDED(hr2))
{
if (immediately)
ShowWindow(m_hWndProgDlg, SW_SHOW);
}
}
m_isVisible = true;
return hr;
}
开发者ID:tribis,项目名称:TortoiseGit,代码行数:32,代码来源:SysProgressDlg.cpp
示例10: bringToFront
void
bringToFront()
{
#if defined(Q_WS_X11)
{
qDebug() << Q_FUNC_INFO;
QWidget* widget = tomahawkWindow();
if ( !widget )
return;
widget->show();
widget->activateWindow();
widget->raise();
WId wid = widget->winId();
NETWM::init();
XEvent e;
e.xclient.type = ClientMessage;
e.xclient.message_type = NETWM::NET_ACTIVE_WINDOW;
e.xclient.display = QX11Info::display();
e.xclient.window = wid;
e.xclient.format = 32;
e.xclient.data.l[0] = 2;
e.xclient.data.l[1] = QX11Info::appTime();
e.xclient.data.l[2] = 0;
e.xclient.data.l[3] = 0l;
e.xclient.data.l[4] = 0l;
XSendEvent( QX11Info::display(), RootWindow( QX11Info::display(), DefaultScreen( QX11Info::display() ) ), False, SubstructureRedirectMask | SubstructureNotifyMask, &e );
}
#elif defined(Q_WS_WIN)
{
qDebug() << Q_FUNC_INFO;
QWidget* widget = tomahawkWindow();
if ( !widget )
return;
widget->show();
widget->activateWindow();
widget->raise();
WId wid = widget->winId();
HWND hwndActiveWin = GetForegroundWindow();
int idActive = GetWindowThreadProcessId(hwndActiveWin, NULL);
if ( AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) )
{
SetForegroundWindow( wid );
SetFocus( wid );
AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
}
}
#endif
}
开发者ID:demelziraptor,项目名称:tomahawk,代码行数:57,代码来源:TomahawkUtilsGui.cpp
示例11: SetFocusTClockMain
/*------------------------------------------------
set keyboard focus to the main window forcedly
--------------------------------------------------*/
void SetFocusTClockMain(HWND hwnd)
{
DWORD pid, curthread, mythread;
curthread = GetWindowThreadProcessId(GetForegroundWindow(), &pid);
mythread = GetCurrentThreadId();
AttachThreadInput(mythread, curthread, TRUE);
SetForegroundWindow(hwnd);
SetFocus(hwnd);
AttachThreadInput(mythread, curthread, FALSE);
}
开发者ID:k-takata,项目名称:TClockLight,代码行数:14,代码来源:menu.c
示例12: GetForegroundWindow
HRESULT VegasFSRender::writeData(ISfProgress* progress) {
BOOL useAudio = (m_pIAudioStream &&
m_pTemplate->pAudioTemplate &&
m_pTemplate->pAudioTemplate->cNumAStreams);
BOOL useVideo = (m_pIVideoStream &&
m_pTemplate->pVideoTemplate &&
m_pTemplate->pVideoTemplate->cNumVStreams);
if (!useVideo)
return SF_E_NOVIDEO;
HWND activewnd = GetForegroundWindow();
DWORD threadid = GetWindowThreadProcessId(activewnd, NULL);
AttachThreadInput(GetCurrentThreadId(), threadid, TRUE);
ZeroMemory(&FfpHeader, NUMBYTES(FfpHeader));
LPTSTR pszFileName;
#ifdef UNICODE
pszFileName = m_szFileName;
#else
TCHAR szFileName[MAX_PATH];
SfMBFromWC(szFileName, m_szFileName, MAX_PATH);
pszFileName = szFileName;
#endif
HRESULT hr = S_OK;
hr = m_pIVideoStream->GetFrameCount(&FfpHeader.Video.cfTotal);
hr = m_pIVideoStream->GetFrameRate(&FfpHeader.Video.dFPS);
FfpHeader.Video.ntLength = SfVideo_FramesToTime(
FfpHeader.Video.cfTotal, FfpHeader.Video.dFPS);
FfpHeader.Video.bih = *m_pTemplate->pVideoTemplate->pbihCodec;
FfpHeader.Video.cbFrameSize = FSDibImageBytes(&FfpHeader.Video.bih);
if (useAudio) {
hr = m_pIAudioStream->GetSampleCount(&FfpHeader.Audio.ccTotal);
FfpHeader.Audio.wfx = m_pTemplate->pAudioTemplate->wfx;
hr = m_pIAudioStream->GetStreamLength(&FfpHeader.Audio.ntLength);
FfpHeader.Audio.ntLength = SfAudio_CellsToTime(FfpHeader.Audio.ccTotal,
FfpHeader.Audio.wfx.nSamplesPerSec);
}
Init(!!useAudio, FfpHeader.Audio.wfx.nSamplesPerSec,
FfpHeader.Audio.wfx.wBitsPerSample, FfpHeader.Audio.wfx.nChannels,
(DWORD)FfpHeader.Video.cfTotal, FfpHeader.Video.dFPS,
FfpHeader.Video.bih.biWidth, FfpHeader.Video.bih.biHeight, activewnd, pszFileName);
hr = S_OK;
if (!Run())
hr = SF_E_CANCEL;
EnableWindow(activewnd, TRUE);
SetForegroundWindow(activewnd);
AttachThreadInput(GetCurrentThreadId(), threadid, FALSE);
return hr;
}
开发者ID:spylfy,项目名称:frame-server,代码行数:54,代码来源:VegasFSRender.cpp
示例13: fsSetForegroundWindow
void fsSetForegroundWindow (HWND hWnd)
{
HWND hFor = GetForegroundWindow ();
int iMyTID = GetCurrentThreadId ();
int iCurrTID = GetWindowThreadProcessId (hFor, NULL);
AttachThreadInput (iMyTID, iCurrTID, TRUE);
SetForegroundWindow (hWnd);
AttachThreadInput (iMyTID, iCurrTID, FALSE);
}
开发者ID:HackLinux,项目名称:Free-Download-Manager-vs2010,代码行数:12,代码来源:system.cpp
示例14: handle_task_timer
void handle_task_timer(void) {
KillTimer(m_hwnd, TASK_RISE_TIMER);
if (NULL == task_over) return;
DWORD ThreadID1 = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
DWORD ThreadID2 = GetCurrentThreadId();
if (ThreadID1 != ThreadID2) {
AttachThreadInput(ThreadID1, ThreadID2, TRUE);
SetForegroundWindow(m_hwnd);
AttachThreadInput(ThreadID1, ThreadID2, FALSE);
}
PostMessage(GetBBWnd(), BB_BRINGTOFRONT, 0, (LPARAM)task_over);
}
开发者ID:Jmos,项目名称:bbclean-xzero450,代码行数:13,代码来源:TinyDropTarg.cpp
示例15: GetWindowThreadProcessId
void UIScreenCaptureMgr::forceForgroundWindow(__in HWND hWnd)
{
HWND hForegroundWnd = ::GetForegroundWindow();
DWORD dwPid = GetWindowThreadProcessId(hForegroundWnd, NULL);
if (!AttachThreadInput(dwPid, GetCurrentThreadId(), TRUE)
|| !::SetForegroundWindow(hWnd)
|| !::BringWindowToTop(hWnd))
{
return;
}
SwitchToThisWindow(hWnd, TRUE);
AttachThreadInput(dwPid, GetCurrentThreadId(), FALSE);
}
开发者ID:heavenopener,项目名称:TeamTalk,代码行数:14,代码来源:UIMgr.cpp
示例16: SetForegroundWindowEx
void SetForegroundWindowEx(HWND hWnd)
{
// Attach foreground window thread to our thread
const DWORD foreGroundID = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
const DWORD currentID = GetCurrentThreadId();
AttachThreadInput(foreGroundID, currentID, TRUE);
// Do our stuff here
HWND lastActivePopupWnd = GetLastActivePopup(hWnd);
SetForegroundWindow(lastActivePopupWnd);
// Detach the attached thread
AttachThreadInput(foreGroundID, currentID, FALSE);
}
开发者ID:stream009,项目名称:launchy,代码行数:14,代码来源:main.cpp
示例17: WindowUtil_setFocus
BOOL WindowUtil_setFocus(HWND hwnd) {
BOOL ret;
// Attach foreground window thread
AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), NULL), GetCurrentThreadId(), TRUE);
ret = SetForegroundWindow(hwnd);
SetFocus(hwnd);
// Detach the attached thread
AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(), NULL), GetCurrentThreadId(), FALSE);
return ret;
}
开发者ID:gvsurenderreddy,项目名称:openulteo,代码行数:14,代码来源:windowUtil.c
示例18: BringWindowToTop
void BringWindowToTop(HWND hwnd ,DWORD type)
{
DWORD dwFGThreadId, dwFGProcessId,dwThisThreadId;
HWND hwndForeground = ::GetForegroundWindow();
dwFGThreadId = GetWindowThreadProcessId(hwndForeground, &dwFGProcessId);
dwThisThreadId = GetCurrentThreadId();
AttachThreadInput(dwThisThreadId, dwFGThreadId,TRUE);
if(type != NULL)
{
::ShowWindow(hwnd,type);
}
::SetForegroundWindow(hwnd);
::BringWindowToTop(hwnd);
AttachThreadInput(dwThisThreadId, dwFGThreadId,FALSE);
}
开发者ID:linjianbjfu,项目名称:PlayBox,代码行数:15,代码来源:tools.cpp
示例19: AttachThreadInput
// 最前面に来るメッセージボックスを表示する
int CCustomBindStatusCallBack::_ActiveMessageBox(const CString& strText, UINT uType)
{
// 最前面プロセスのスレッドIDを取得する
int foregroundID = ::GetWindowThreadProcessId( ::GetForegroundWindow(), NULL);
// 最前面アプリケーションの入力処理機構に接続する
AttachThreadInput( ::GetCurrentThreadId(), foregroundID, TRUE);
// 最前面ウィンドウを変更する
::SetForegroundWindow(m_hWndDLing);
int nReturn = MessageBox(m_hWndDLing, strText, NULL, uType);
// 接続を解除する
AttachThreadInput( ::GetCurrentThreadId(), foregroundID, FALSE);
return nReturn;
}
开发者ID:amate,项目名称:unChromium,代码行数:16,代码来源:CustomBindStatusCallBack.cpp
示例20: OnExitMenuLoop
/*------------------------------------------------
WM_EXITMENULOOP message
--------------------------------------------------*/
void OnExitMenuLoop(HWND hwnd)
{
HWND hwndBar;
DWORD pid, clockthread, mythread;
hwndBar = GetTaskbarWindow();
if(hwndBar)
{
clockthread = GetWindowThreadProcessId(hwndBar, &pid);
mythread = GetCurrentThreadId();
AttachThreadInput(clockthread, mythread, TRUE);
SetFocus(hwndBar);
AttachThreadInput(clockthread, mythread, FALSE);
}
}
开发者ID:k-takata,项目名称:TClockLight,代码行数:18,代码来源:menu.c
注:本文中的AttachThreadInput函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论