#include<Windows.h>
HWND m_narutoHWND = ::FindWindow(_T("MainView_9F956014-12FC-42d8-80C7-9A90D4D567E3"), _T("火影忍者Online"));//获取火影忍者OL游戏窗口句柄,参数1:为此游戏的类名,游戏窗口名。可以zai再VS工具里选择SPY,拖动小风扇到指定窗口获得他的类名,窗口名
HWND frontWND = ::GetForegroundWindow();//当前窗口句柄
if (frontWND!=m_narutoHWND) {
::SetForegroundWindow(m_narutoHWND);//如何不是火影游戏的窗口就设置当前窗口为游戏窗口
}