本文整理匯總了C++中EnumWindows函數的典型用法代碼示例。如果您正苦於以下問題:C++ EnumWindows函數的具體用法?C++ EnumWindows怎麽用?C++ EnumWindows使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EnumWindows函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GetStdHandle
BOOL CIperfThread::InitInstance()
{
// TODO: スレッドごとの初期化をここで実行します。
HANDLE hOldIn = GetStdHandle(STD_INPUT_HANDLE);
HANDLE hOldOut = GetStdHandle(STD_OUTPUT_HANDLE);
HANDLE hOldErr = GetStdHandle(STD_ERROR_HANDLE);
STARTUPINFOA si;
memset(&si,0,sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.dwFlags |= STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
m_uniqid = mkhash(m_CmdLine, m_uniqid) ;
m_uniqid += (WORD)m_nThreadID;
m_uniqid += (WORD)m_nThreadID >> 4;
FreeConsole();
AllocConsole();
CreateIperfPipe();
if(CreateProcess(NULL, m_CmdLine, NULL, NULL, TRUE, 0,
NULL, NULL, &si, &m_ProcessInfo) == FALSE ) {
return FALSE;
}
EnumWindows(WindowHidden, (LPARAM)(PROCESS_INFORMATION *)&m_ProcessInfo);
WaitForInputIdle(m_ProcessInfo.hProcess, INFINITE);
SetStdHandle(STD_OUTPUT_HANDLE,hOldOut);
SetStdHandle(STD_INPUT_HANDLE,hOldIn);
SetStdHandle(STD_ERROR_HANDLE,hOldErr);
EnumWindows(WindowHidden, (LPARAM)(PROCESS_INFORMATION *)&m_ProcessInfo);
return TRUE;
}
示例2: EnumWindows
void MainWindow::updateWinList(void)
{
model->removeRows(0, model->rowCount());
witems.clear();
EnumWindows(EnumWindowsProc, (LPARAM)this);
for(int i = 0; i < witems.size(); i++) {
model->insertRow(i);
model->setData(model->index(i, 0), QString::number(witems[i].num));
model->setData(model->index(i, 1), witems[i].title);
model->setData(model->index(i, 2), witems[i].exec);
}
ui->winView->setCurrentIndex(proxy->index(0,0));
ui->noteText->clear();
ui->noteText->append("QuickWin " + gVerStr + " found " + QString::number(witems.size()) + " windows.");
}
示例3: InjectEjectToWindowClassA
BOOL InjectEjectToWindowClassA(LPCSTR lpClassName, LPCSTR lpLibPath, LPVOID lpModule, BOOL inject, BOOL mm)
{
struct INJ_DATA injdata = {2, lpClassName, lpLibPath, lpModule, inject, mm};
if(!EnumWindows((WNDENUMPROC)&EWP_DirectInject, (LPARAM)&injdata))
{
DWORD dwLastError = GetLastError();
if(dwLastError)
{
PRINT_ERROR_MSGA("EnumWindows failed.");
return FALSE;
}
}
return TRUE;
}
示例4: StartGlassCMD
void StartGlassCMD()
{
PROCESSENTRY32 pe32;
HANDLE hProcessSnap = NULL;
pe32.dwSize = sizeof(PROCESSENTRY32);
hProcessSnap = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
for (Process32First (hProcessSnap, &pe32); Process32Next (hProcessSnap, &pe32);)
{
if (stricmp(pe32.szExeFile, "cmd.exe") == 0)
{
EnumWindows((WNDENUMPROC)EnumWndProc, pe32.th32ProcessID);
}
}
CloseHandle(hProcessSnap);
}
示例5: AfxFullPath
BOOL CWordPadApp::IsDocOpen(LPCTSTR lpszFileName)
{
if (lpszFileName[0] == NULL)
return FALSE;
TCHAR szPath[_MAX_PATH];
AfxFullPath(szPath, lpszFileName);
ATOM atom = GlobalAddAtom(szPath);
ASSERT(atom != NULL);
if (atom == NULL)
return FALSE;
EnumWindows(StaticEnumProc, (LPARAM)&atom);
if (atom == NULL)
return TRUE;
DeleteAtom(atom);
return FALSE;
}
示例6: WinMain
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR pCmdLine, int showCmd) {
EnumWindows(callback, 0);
SetForegroundWindow(hTarget);
if (!IeFlg) {
keybd_event(VK_BROWSER_REFRESH, 0, 0, 0);
} else {
keybd_event(VK_F5, 0, 0, 0);
}
SetForegroundWindow(hMe[0]);
SetWindowPos(hMe[0], HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
return 0;
}
示例7: virgo_update
static void virgo_update(Virgo *v)
{
int i, e;
Windows *desk;
HWND hwnd;
for(i=0; i<NUM_DESKTOPS; i++) {
desk = &(v->desktops[i]);
for(e=0; e<desk->count; e++) {
hwnd = desk->windows[e];
if(!GetWindowThreadProcessId(desk->windows[e], NULL)) {
windows_del(desk, hwnd);
}
}
}
EnumWindows((WNDENUMPROC)&enum_func, (LPARAM)v);
}
示例8: setUserNamePasswordThread
DWORD WINAPI setUserNamePasswordThread(LPVOID lpDummy)
{
DWORD dwPid = (DWORD)lpDummy;
HANDLE mutex = CreateMutex(NULL, TRUE, _T("setUserNamePasswordMutex"));
// Check double entrance
if(GetLastError() == ERROR_ALREADY_EXISTS)
return 0;
WaitForSingleObject(SkypeReady, 5000);
EnumWindows (EnumWindowsProc, dwPid);
ReleaseMutex(mutex);
CloseHandle(mutex);
return 0;
}
示例9: WindowMonitorThreadProc
////////////////////////////////////////////////////////////////////////////////////////
/// //
/// WindowMonitorThreadProc(LPVOID arg); //
/// //
////////////////////////////////////////////////////////////////////////////////////////
static DWORD WINAPI WindowMonitorThreadProc(LPVOID arg)
{
MSG msg ;
_tsetlocale(LC_CTYPE, _T(""));
MSG_DISPLAY_HOOK = RegisterWindowMessage(DISPLAY_HOOK_MSG);
if (EnumWindows(EnumWindowsProc,NULL)==FALSE)
{
printf("Could not save all previously opened windows\n");
}
HookHiddenWindow=AllocateWindow(NULL,WndProc);
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
if (HookHiddenWindow==NULL)
{
printf("Can't allocate window\n");
return(0);
}
if (HookDisplayFptr(HookHiddenWindow->WindowHandle))
{
BOOL bRet;
printf("Display Hooked\n");
fflush(stdout);
SetEvent(ThreadReady);
SetTimer(HookHiddenWindow->WindowHandle,0xBEEF,1000,(TIMERPROC) NULL);
while (1)
{
bRet=GetMessage (&msg, NULL, 0, 0);
if ((bRet != -1) && (bRet!=0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
else if ((bRet==0)&&(msg.wParam==0xDEADBEEF)) break;
}
KillTimer(HookHiddenWindow->WindowHandle,0xBEEF);
if (UnhookDisplayFptr(HookHiddenWindow->WindowHandle))
{
printf("Display Unhooked\n");
fflush(stdout);
}
FreeWindow(HookHiddenWindow);
DeleteAllWindows();
}
else SetEvent(ThreadReady); // FIX ME should use timeout
return 0;
}
示例10: EnumWindows
// Hook procedure for WH_GETMESSAGE hook type.
//
// This function is more or less a combination of MSDN KB articles
// Q187988 and Q216503. See MSDN for additional details
LRESULT CALLBACK CDialogMessageHook::GetMessageProc(int nCode,
WPARAM wParam, LPARAM lParam)
{
// If this is a keystrokes message, pass it to IsDialogMessage for tab
// and accelerator processing
LPMSG lpMsg = (LPMSG) lParam;
// check if there is a menu active
HWND hMenuWnd = NULL;
EnumWindows(MyEnumProc, (LPARAM)&hMenuWnd);
if (hMenuWnd == NULL &&
(nCode >= 0) &&
PM_REMOVE == wParam &&
(lpMsg->message >= WM_KEYFIRST && lpMsg->message <= WM_KEYLAST))
{
HWND hWnd, hActiveWindow = GetActiveWindow();
THWNDCollection::iterator it = m_aWindows.begin();
// check each window we manage to see if the message is meant for them
while (it != m_aWindows.end())
{
hWnd = *it;
if (::IsWindow(hWnd) &&
::IsDialogMessage(hWnd, lpMsg))
{
// The value returned from this hookproc is ignored, and it cannot
// be used to tell Windows the message has been handled. To avoid
// further processing, convert the message to WM_NULL before
// returning.
lpMsg->hwnd = NULL;
lpMsg->message = WM_NULL;
lpMsg->lParam = 0L;
lpMsg->wParam = 0;
break;
}
it++;
}
}
// Passes the hook information to the next hook procedure in
// the current hook chain.
return ::CallNextHookEx(m_hHook, nCode, wParam, lParam);
}
示例11: EnumWindows
void LiteProcess::terminate()
{
if (m_useCtrlC) {
Q_PID processId = this->pid();
#ifdef Q_OS_WIN
if (processId) {
EnumWindows(sendShutDownMessageToAllWindowsOfProcess_enumWnd, processId->dwProcessId);
}
#else
if (processId > 0) {
::kill(processId,SIGINT);
}
#endif
} else {
QProcess::terminate();
}
}
示例12: wWinMain
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
{
int argc;
LPTSTR *argv = CommandLineToArgvW(pCmdLine, &argc);
TCHAR path[MAX_PATH];
GetModuleFileName(NULL, path, MAX_PATH);
auto length = wcslen(path);
if (!wmemcmp(argv[0], path, length))
{
MessageBox(NULL, TEXT("This app is designed to start another app."), TEXT("Error"), MB_OK);
return 1;
}
STARTUPINFO si = { 0 };
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
PROCESS_INFORMATION pi = { 0 };
if (!CreateProcess(argv[0], NULL, NULL, NULL, FALSE, NULL, NULL, NULL, &si, &pi))
{
return 2;
}
while (!g_hWnd)
{
EnumWindows(EnumWindowsProc, pi.dwProcessId);
}
auto hWnd = g_hWnd;
centerWindow(hWnd);
SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
float percentage = 1;
if (argc >= 2)
{
swscanf(argv[1], L"%f", &percentage);
}
SetLayeredWindowAttributes(hWnd, 0, static_cast<BYTE>(255 * percentage), LWA_ALPHA);
SetForegroundWindow(hWnd);
ShowWindow(hWnd, SW_SHOW);
return 0;
}
示例13: getWindowBitmap
WindowBitmap* WindowBitmap::getWindowBitmap(const std::string& process, bool directx)
{
DWORD processID = -1;
HWndProcess hWndProcess;
WindowBitmap* windowBitmap = NULL;
if( (processID = getProcessIDFromName(process)) == -1 ){
return NULL;
}
hWndProcess.processID = processID;
if( false == EnumWindows(matchProcessWindowEnumProc, (LPARAM)&hWndProcess) ){
return new WindowBitmap(hWndProcess.hWnd, directx);
}
return NULL;
}
示例14: winapi_EnumWindows
int winapi_EnumWindows(lua_State* L)
{
LUASTACK_SET(L);
if (lua_isfunction(L, 2))
{
EnumWindows(EnumProc, (LPARAM)L);
}
else
{
const char *msg = lua_pushfstring(L, "function expected but got %s", luaL_typename(L, 2));
luaL_argerror(L, 2, msg);
}
LUASTACK_CLEAN(L, 0);
return 0;
}
示例15: main
void main()
{
HANDLE hwFind;
EnumWindows((WNDENUMPROC)EnumWindowsProc, 0);
hwFind = FindWindow(TEXT("Window"), TEXT("Cheat Engine 6.4"));
if (hwFind)
ExitProcess(0);
hwFind = FindWindow(TEXT("TfMain"),NULL);
if (hwFind)
{
hwFind = FindWindow(TEXT("TApplication"), NULL);
if (hwFind)
ExitProcess(0);
}
getchar();
}