• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetWindowThreadProcessId函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetWindowThreadProcessId函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowThreadProcessId函数的具体用法?C++ GetWindowThreadProcessId怎么用?C++ GetWindowThreadProcessId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetWindowThreadProcessId函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: close_alert_window_enum

BOOL CALLBACK close_alert_window_enum( HWND hwnd, LPARAM lParam )
{
    char buf[ 7 ] = { 0 };
    PROCESS_HANDLE_ID p = *( (PROCESS_HANDLE_ID *)lParam );
    DWORD pid = 0;
    DWORD tid = 0;

    /* We want to find and close any window that:
     *  1. is visible and
     *  2. is a dialog and
     *  3. is displayed by any of our child processes
     */
    if ( !IsWindowVisible( hwnd ) )
        return TRUE;

    if ( !GetClassNameA( hwnd, buf, sizeof( buf ) ) )
        return TRUE;  /* Failed to read class name; presume it is not a dialog. */

    if ( strcmp( buf, "#32770" ) )
        return TRUE;  /* Not a dialog */

    /* GetWindowThreadProcessId() returns 0 on error, otherwise thread id of
     * window message pump thread.
     */
    tid = GetWindowThreadProcessId( hwnd, &pid );

    if ( tid && is_parent_child( p.pid, pid ) )
    {
        /* Ask really nice. */
        PostMessageA( hwnd, WM_CLOSE, 0, 0 );
        /* Now wait and see if it worked. If not, insist. */
        if ( WaitForSingleObject( p.h, 200 ) == WAIT_TIMEOUT )
        {
            PostThreadMessageA( tid, WM_QUIT, 0, 0 );
            WaitForSingleObject( p.h, 300 );
        }

        /* Done, we do not want to check any other window now. */
        return FALSE;
    }

    return TRUE;
}
开发者ID:4ukuta,项目名称:core,代码行数:43,代码来源:execnt.c


示例2: EnumWindowsCallback

static BOOL CALLBACK EnumWindowsCallback(HWND windowHandle, LPARAM lParam)
{
    DWORD pid;
    GetWindowThreadProcessId(windowHandle, &pid);
    if (pid == lParam)
    {
        // This window belongs to the process
        if (!windowTitle.empty())
            return TRUE;
        TCHAR text[256];
        GetWindowText(windowHandle, text, sizeof(text));
        if ((GetWindowLong(windowHandle, GWL_STYLE) & WS_VISIBLE))
        {
            windowTitle = text;
            return FALSE;
        }
    }
    return TRUE;
}
开发者ID:pampersrocker,项目名称:G-CVSNT,代码行数:19,代码来源:TortoiseSetupHelper.cpp


示例3: EnumWindowsProc

BOOL CALLBACK EnumWindowsProc( HWND hwnd, LONG lParam )

{
    DWORD             pid = 0;
    DWORD             i;
    CHAR              buf[TITLE_SIZE];
    PTASK_LIST_ENUM   te = (PTASK_LIST_ENUM)lParam;
    PTASK_LIST        tlist = te->tlist;
    DWORD             numTasks = te->numtasks;


    //
    // get the processid for this window
    //
    if (!GetWindowThreadProcessId( hwnd, &pid )) {
        return TRUE;
    }

    //
    // look for the task in the task list for this window
    //
    for (i=0; i<numTasks; i++) {
        if (tlist[i].dwProcessId == pid) {
            tlist[i].hwnd = hwnd;
            //
       // we found the task so lets try to get the
            // window text
            //
            if (GetWindowText( tlist[i].hwnd, buf, zsizeof(buf) )) {
                //
      // got it, so lets save it
                //
                strcpy( (LPSTR)tlist[i].WindowTitle, buf );
            }
            break;
        }
    }

    //
    // continue the enumeration
    //
    return TRUE;
}
开发者ID:DeegC,项目名称:10d,代码行数:43,代码来源:common.cpp


示例4: WriteC3CMemory

int WriteC3CMemory(uint32_t lpAddress, void *buf, int len)
{
    if (hwnd) {
        DWORD pid;
        GetWindowThreadProcessId(hwnd, &pid);
        HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
        SIZE_T wlen;
        WriteProcessMemory(hProc, (void *) lpAddress, buf, len, &wlen);
        CloseHandle(hProc);
        if (len == wlen) {
            return TRUE;
        } else {
            fprintf(stderr, "Memory write error\n");
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
开发者ID:CoreDumpling,项目名称:c3me,代码行数:19,代码来源:c3c.c


示例5: GetWindowThreadProcessId

//! Entrypoint used to make another window become subclassed.
bool BlueWindow::SubclassNewWindow(HWND hwnd)
{
    DWORD windowpid;
    
    if (hwnd != NULL && IsWindow(hwnd) && 
        GetWindowThreadProcessId(hwnd, &windowpid) && 
        windowpid == GetCurrentProcessId() &&
        OldWindowProcs.find(hwnd) == OldWindowProcs.end())
    {
        // Found the window that is from our process.  Subclass it.
        WNDPROC lpfnOldWindowProc = (WNDPROC) LongToPtr(GetWindowLongPtr(hwnd, GWL_WNDPROC));
        OldWindowProcs.insert(std::make_pair<HWND, WNDPROC>(hwnd, lpfnOldWindowProc));
        SetWindowLongPtr(hwnd, GWL_WNDPROC, PtrToLong(BlueWindow::SubclassProc));
        ForceNonclientRepaint(hwnd);
        return true;
    }

    return false;       // could not successfully subclass specified window.
}
开发者ID:bovine,项目名称:stuntour,代码行数:20,代码来源:stunmirc.cpp


示例6: check_console

/* See if we were launched from a console window. */
bool check_console() {
  /* If we're running in a service context there will be no console window. */
  HWND console = GetConsoleWindow();
  if (! console) return false;

  unsigned long pid;
  if (! GetWindowThreadProcessId(console, &pid)) return false;

  /*
    If the process associated with the console window handle is the same as
    this process, we were not launched from an existing console.  The user
    probably double-clicked our executable.
  */
  if (GetCurrentProcessId() != pid) return true;

  /* We close our new console so that subsequent messages appear in a popup. */
  FreeConsole();
  return false;
}
开发者ID:kirillkovalenko,项目名称:nssm,代码行数:20,代码来源:console.cpp


示例7: TimerFunc

void CALLBACK TimerFunc(HWND hWnd,UINT nMsg,UINT_PTR nTimerid,DWORD dwTime)
{
(void) hWnd;
(void) nMsg;
(void) dwTime;
DWORD wso;
	wso = WaitForSingleObject(hSynhroMutex, 0);
	if (wso == WAIT_OBJECT_0 || wso == WAIT_ABANDONED) {
		KillTimer(0, nTimerid);
		TimerID = 0;
		while( 1 ) {
			POINT curPt;
			HWND targetWnd;
			DWORD winProcessID = 0;

			if( !GetCursorPos( &curPt ) ) 
				break;

			if( GlobalData == NULL || GlobalData->LastPt.x != curPt.x || GlobalData->LastPt.y != curPt.y) 
				break;

			if( ( targetWnd = GetWindowFromPoint( curPt ) ) == NULL )
				break;

			if( GlobalData->LastWND != targetWnd ) 
				break;

			GetWindowThreadProcessId( targetWnd, &winProcessID );
			if( winProcessID != ourProcessID ) {
				char className[64];
				if( !GetClassName( targetWnd, className, sizeof(className) ) )
					break;
				if( lstrcmpi( className, "ConsoleWindowClass" ) != 0 )
					break;
			}

			SendWordToServer();

			break;
		}
		ReleaseMutex(hSynhroMutex);
	}
}
开发者ID:5w1tch,项目名称:goldendict,代码行数:43,代码来源:TextOutSpy.c


示例8: EnumFindProcessWnd

BOOL CALLBACK EnumFindProcessWnd(HWND hwnd, LPARAM lParam)
{
    DWORD procid = 0;
    TCHAR WindowClass [40];
    GetWindowThreadProcessId(hwnd, &procid);
    GetClassName(hwnd, WindowClass, countof(WindowClass));

    if (procid == GetCurrentProcessId() &&
            (_tcscmp(WindowClass, _l("MediaPlayerClassicW")) == 0 || // MPC-HC window
             _tcscmp(WindowClass, _l("WMPlayerApp")) == 0 || // WMPlayer window
             _tcscmp(WindowClass, _l("eHome Render Window")) == 0 // WMC window
            )
       ) {
        HWND* pWnd = (HWND*) lParam;
        *pWnd = hwnd;
        return FALSE;
    }
    return TRUE;
}
开发者ID:TheRyuu,项目名称:ffdshow,代码行数:19,代码来源:TvideoCodecLibavcodecDxva.cpp


示例9: resizeWindow

void
resizeWindow(HWND hWnd, int width, int height) {
    RECT rClient;
    GetClientRect(hWnd, &rClient);
    if (width  == rClient.right  - rClient.left &&
        height == rClient.bottom - rClient.top) {
        return;
    }

    RECT rWindow;
    GetWindowRect(hWnd, &rWindow);
    width  += (rWindow.right  - rWindow.left) - rClient.right;
    height += (rWindow.bottom - rWindow.top)  - rClient.bottom;

    // SetWindowPos will hang if this ever happens.
    assert(GetCurrentThreadId() == GetWindowThreadProcessId(hWnd, NULL));

    SetWindowPos(hWnd, NULL, rWindow.left, rWindow.top, width, height, SWP_NOMOVE);
}
开发者ID:Acidburn0zzz,项目名称:apitrace,代码行数:19,代码来源:d3dretrace_ws.cpp


示例10: GetConsoleWindowProc

static BOOL CALLBACK GetConsoleWindowProc(HWND hWnd, LPARAM lParam)
{
   const char cConsoleClassName[] = "ConsoleWindowClass";
   DWORD dwPid = (DWORD)-1;
   char cBuf[sizeof(cConsoleClassName)] = "";

   GetWindowThreadProcessId(hWnd, &dwPid);
   if (dwPid != GetCurrentProcessId())
      return TRUE;

   if (GetClassName(hWnd, cBuf, sizeof cBuf) != sizeof(cConsoleClassName)-1)
      return TRUE;

   if (strcmp(cConsoleClassName, cBuf) != 0)
      return TRUE;

   *(HWND*)lParam = hWnd;
   return FALSE;
}
开发者ID:richardneish,项目名称:ltrdata,代码行数:19,代码来源:wconwin.c


示例11: FindWindow

FB::VariantList btlauncherAPI::stopRunning(const std::wstring& val) {
	FB::VariantList list;
	if (wcsstr(val.c_str(), _T(BT_HEXCODE)) || wcsstr(val.c_str(), _T(BTLIVE_CODE))) {
		HWND hWnd = FindWindow( val.c_str(), NULL );
		DWORD pid;
		DWORD parent;
		parent = GetWindowThreadProcessId(hWnd, &pid);
		HANDLE pHandle = OpenProcess(PROCESS_TERMINATE, NULL, pid);
		if (! pHandle) {
			list.push_back("could not open process");
			list.push_back(GetLastError());
		} else {
			BOOL result = TerminateProcess(pHandle, 0);
			list.push_back("ok");
			list.push_back(result);
		}
	}
	return list;
}
开发者ID:bbarrows,项目名称:btlauncher,代码行数:19,代码来源:btlauncherAPI.cpp


示例12: AttachGuiWindow

void AttachGuiWindow(HWND hOurWindow)
{
	_ASSERTEX(gbAttachGuiClient); // Уже должен был быть установлен?
	gnAttachMsgId = RegisterWindowMessageW(L"ConEmu:Attach2Gui");
	if (gnAttachMsgId)
	{
		DWORD nWndTID = GetWindowThreadProcessId(hOurWindow, NULL);
		ghAttachMsgHook = SetWindowsHookExW(WH_CALLWNDPROC, AttachGuiWindowCallback, NULL, nWndTID);

		// Поскольку аттач хорошо бы выполнять в той нити, в которой крутится окно - то через хук
		AttachMsgArg args = {gnAttachMsgId, 0, ghConEmuWnd, hOurWindow};
		LRESULT lRc = SendMessageW(hOurWindow, gnAttachMsgId, gnAttachMsgId, (LPARAM)&args);
		_ASSERTEX(args.Result == gnAttachMsgId);
		UNREFERENCED_PARAMETER(lRc);

		UnhookWindowsHookEx(ghAttachMsgHook);
		ghAttachMsgHook = NULL;
	}
}
开发者ID:isleon,项目名称:ConEmu,代码行数:19,代码来源:GuiAttach.cpp


示例13: while

bool Input::Initialize()
{
	bool debug = false;
	int i = 0;
	while (!Vars.bActive)
	{
		if (i >= 300)
		{
			MessageBox(0, "Failed to set hooks, exiting!", "D2Etal", 0);
			return false;
		}

		if (fpGetHwnd() && (MENU::ClientState() == ClientStateMenu || MENU::ClientState() == ClientStateInGame))
		{
			if (!Vars.oldWNDPROC)
				Vars.oldWNDPROC = (WNDPROC)SetWindowLong(fpGetHwnd(), GWL_WNDPROC, (LONG)Input::WndProc);
			if (!Vars.oldWNDPROC)
				continue;

			DWORD _mainThread = GetWindowThreadProcessId(fpGetHwnd(), 0);
			if (_mainThread)
			{
				if (!Vars.hKeybHook)
					Vars.hKeybHook = SetWindowsHookEx(WH_KEYBOARD, Input::KeyPress, NULL, _mainThread);
				if (!Vars.hMouseHook)
					Vars.hMouseHook = SetWindowsHookEx(WH_MOUSE, Input::MouseMove, NULL, _mainThread);
			}
		}
		else
			continue;
		if (Vars.hKeybHook && Vars.hMouseHook)
		{
			Vars.bActive = TRUE;
		}
		if (debug && Vars.oldWNDPROC && Vars.hKeybHook && Vars.hMouseHook) {
			MessageBox(0, "All Hooks Set!", "D2Etal", 0);
		}
		Sleep(50);
		i++;
	}
	return true;
}
开发者ID:Nedkali,项目名称:V8EtalDl,代码行数:42,代码来源:Input.cpp


示例14: GetWindowThreadProcessId

BOOL LowLevelHook::Initialize(HWND hwndMain)
{
TRY_CATCH
	//Store our window's handle
	g_hwndVNCViewer = hwndMain;
	if (0 == g_Instances)
	{
		++g_Instances;
		HINSTANCE hInstance = NULL ;
		g_fHookActive = TRUE;
		g_VncProcessID = 0 ;
		g_HookID = 0 ;
		g_fGlobalScrollLock = FALSE ;


		//Receive the HInstacne of this window
		//(required because LowLevel-Keyboard-Hook must be global, 
		// and need the HMODULE parameter in SetWindowsHookEx)
		hInstance = (HINSTANCE)GetWindowLong(g_hwndVNCViewer,GWL_HINSTANCE);
		if (hInstance==NULL)
		{
			return FALSE;
		}

		//Store the ProcessID of the VNC window.
		//this will prevent the keyboard hook procedure to interfere
		//with keypressed in other processes' windows
		GetWindowThreadProcessId(g_hwndVNCViewer,&g_VncProcessID);

		//Try to set the hook procedure
		g_HookID = SetWindowsHookEx(WH_KEYBOARD_LL,VncLowLevelKbHookProc,hInstance,0);
		if (0 == g_HookID) 
		{
			Log.WinError(_ERROR_,_T("Failed to SetWindowsHookEx "));
			return FALSE ;
		}
		return TRUE;
	} 
	++g_Instances;
	return TRUE;
CATCH_THROW()
}
开发者ID:uvbs,项目名称:SupportCenter,代码行数:42,代码来源:LowLevelHook.cpp


示例15: ExplorerExecution

void ExplorerExecution (HWND hwnd, LPARAM lParam){
	DWORD hwndid;
    int i;


	GetWindowThreadProcessId(hwnd,&hwndid);

	if (hwndid == pid){
    /*
      Replace keybd_event with SendMessage() and PostMessage() calls 
    */
        printf("HANDLE Found. Attacking =)\n");
        SetForegroundWindow(hwnd);
        keybd_event(VK_LWIN,1,0,0);
        keybd_event(VkKeyScan('r'),1,0,0);
        keybd_event(VK_LWIN,1,KEYEVENTF_KEYUP,0);
        keybd_event(VkKeyScan('r'),1,KEYEVENTF_KEYUP,0);
        for(i=0;i<strlen(buf);i++) {
            if (buf[i]==':') {
                keybd_event(VK_SHIFT,1,0,0);
                keybd_event(VkKeyScan(buf[i]),1,0,0);
                keybd_event(VK_SHIFT,1,KEYEVENTF_KEYUP,0);
                keybd_event(VkKeyScan(buf[i]),1,KEYEVENTF_KEYUP,0);
            } else {
                if (buf[i]=='\\') {
                    keybd_event(VK_LMENU,1,0,0);
                    keybd_event(VK_CONTROL,1,0,0);
                    keybd_event(VkKeyScan('º'),1,0,0);
                    keybd_event(VK_LMENU,1,KEYEVENTF_KEYUP,0);
                    keybd_event(VK_CONTROL,1,KEYEVENTF_KEYUP,0);
                    keybd_event(VkKeyScan('º'),1,KEYEVENTF_KEYUP,0);
                } else {
                    keybd_event(VkKeyScan(buf[i]),1,0,0);
                    keybd_event(VkKeyScan(buf[i]),1,KEYEVENTF_KEYUP,0);
                }
            }
        }
        keybd_event(VK_RETURN,1,0,0);
        keybd_event(VK_RETURN,1,KEYEVENTF_KEYUP,0);
        exit(1);
    }
}
开发者ID:0x24bin,项目名称:exploit-database,代码行数:42,代码来源:1197.c


示例16: GetScrollLockState

BOOL LowLevelHook::Initialize(HWND hwndMain)
{
        HINSTANCE hInstance = NULL ;

        g_hwndVNCViewer = NULL ;
        g_fHookActive = GetScrollLockState() ;
        g_VncProcessID = 0 ;
        g_HookID = 0 ;
        g_fGlobalScrollLock = FALSE ;

        //Store our window's handle
        g_hwndVNCViewer = hwndMain;
        if (g_hwndVNCViewer==NULL)
                return FALSE;


        //Get the HInstacne of this window
        //(required because LowLevel-Keyboard-Hook must be global, 
        // and need the HMODULE parameter in SetWindowsHookEx)
        hInstance = helper::SafeGetWindowInstance(g_hwndVNCViewer);
        if (hInstance==NULL)
                return FALSE;

        //
        //Store the ProcessID of the VNC window.
        //this will prevent the keyboard hook procedure to interfere
        //with keypressed in other processes' windows
        GetWindowThreadProcessId(g_hwndVNCViewer,&g_VncProcessID);

        //Try to set the hook procedure
        g_HookID = SetWindowsHookEx(WH_KEYBOARD_LL,VncLowLevelKbHookProc,hInstance,0);
        if (g_HookID==0) {

                DWORD dw = GetLastError();

                //TODO:
                //Analyze why the error occured (might be because we're under Win98/95/ME?)
                return FALSE ;
        }
        
        return TRUE;
}
开发者ID:HippoRemote,项目名称:WinHippoVNC,代码行数:42,代码来源:LowLevelHook.cpp


示例17: EnumWindowsProc

static BOOL CALLBACK EnumWindowsProc(HWND Window, LPARAM Param)
{
	const auto Info = reinterpret_cast<ProcInfo*>(Param);

	try
	{
		if (!is_alttab_window(Window))
			return true;

		string WindowTitle;
		os::GetWindowText(Window, WindowTitle);

		DWORD ProcID;
		GetWindowThreadProcessId(Window, &ProcID);

		string MenuItem;

		if (Info->ShowImage)
		{
			if (const auto Process = os::handle(OpenProcess(imports.QueryFullProcessImageNameW? PROCESS_QUERY_LIMITED_INFORMATION : PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, ProcID)))
				// BUGBUG check result
				(void)os::fs::GetModuleFileName(Process.native_handle(), nullptr, MenuItem);

			if (MenuItem.empty())
				MenuItem = L"???"s;
		}
		else
		{
			MenuItem = WindowTitle;
		}

		MenuItemEx NewItem(format(L"{0:9} {1} {2}"sv, ProcID, BoxSymbols[BS_V1], MenuItem));
		// for sorting
		NewItem.ComplexUserData = menu_data{ WindowTitle, ProcID, Window };
		Info->procList->AddItem(NewItem);

		return true;
	}
	CATCH_AND_SAVE_EXCEPTION_TO(Info->ExceptionPtr)

	return false;
}
开发者ID:FarGroup,项目名称:FarManager,代码行数:42,代码来源:plist.cpp


示例18: procEnumWindows

//======================================================================
BOOL CALLBACK procEnumWindows(HWND hwnd, LPARAM lParam) //find window for PID
{
//	LONG_PTR iLevel = lParam;	//change
	iLevel++;

	TCHAR caption[MAX_PATH];
	TCHAR classname[MAX_PATH];
	TCHAR procname[MAX_PATH];
	TCHAR* szName; szName = (TCHAR*)malloc (MAX_PATH);
	GetClassName(hwnd, classname, MAX_PATH);
	//hack as it hangs for "Button"
	if(wcscmp(classname,L"Button")==0){
		wsprintf(caption, L"");
	}
	else{
		if ( GetWindowTextLength(hwnd)>0 )
			GetWindowText(hwnd, caption, MAX_PATH);
		else
			wsprintf(caption, L"");
	}
	DWORD dwProcID=0;
	GetWindowThreadProcessId(hwnd, &dwProcID);
	
	//dimensions and position
	RECT rect;
	GetWindowRect(hwnd, &rect);
	TCHAR szRect[64];
	wsprintf(szRect, L"%i;%i/%i;%i (%ix%i)", rect.left, rect.top, rect.right, rect.bottom, rect.right-rect.left, rect.bottom-rect.top);

	////visible?, MINIMIZED not supported
	DWORD dwStyle = GetWindowLong(hwnd, GWL_STYLE);
	TCHAR szStyle[64];
	wsprintf(szStyle, L"[%s]", dwStyle&WS_VISIBLE ? L"visible":L"hidden" );

	wsprintf(procname, L"%s", getProcessName(dwProcID, szName));
	DEBUGMSG(1, (L"%i\t0x%08x\t0x%08x\t('%s')\t'%s'\t'%s'\t%s\t%s\n", iLevel, hwnd, dwProcID, procname, classname, caption, szRect, szStyle));
	nclog(L"%i\t0x%08x\t0x%08x\t('%s')\t'%s'\t'%s'\t%s\t%s\n", iLevel, hwnd, dwProcID, procname, classname, caption, szRect, szStyle);

	free(szName);
	//return FALSE; // to stop iteration before end of window list
	return true;
}
开发者ID:rodrigonh,项目名称:logging_ce,代码行数:43,代码来源:showFullScreen.cpp


示例19: check_window

static BOOL CALLBACK
check_window(HWND hwnd, LPARAM lParam)
{
    DWORD window_pid = 0;
    GetWindowThreadProcessId(hwnd, &window_pid);
    if (window_pid != target_pid)
        return TRUE; // TRUE tells EnumWindows keep enumerating

    window_found = true;

    // if debugging's on, print the name and window handle of the process we're killing
    //
    wchar_t szName[MAX_PATH] = {0};
    if (debug_fp != NULL) {
        HANDLE hproc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, target_pid);
        if (hproc == NULL) {
            debug(L"OpenProcess error: %u\n", GetLastError());
        } else {
            if (GetModuleBaseName(hproc, NULL, szName, sizeof(szName)/sizeof(szName[0])) == 0) {
                debug(L"GetModuleBaseName error: %u\n", GetLastError());
            }
            CloseHandle(hproc);
        }
        SetLastError(ERROR_SUCCESS);

        debug(L"posting WM_CLOSE to %s %sWindow 0x%X  pid %u\n",
              szName, lParam ? (LPWSTR)lParam : L"", hwnd, target_pid);
    }

    // post the WM_CLOSE message
    //
    if (PostMessage(hwnd, WM_CLOSE, 0, 0) == TRUE) {
        message_posted = true;
    } else {
        debug(L"PostMessage error: %u\n", GetLastError());
    }

    // return FALSE so we stop enumerating
    //
    SetLastError(ERROR_SUCCESS);
    return FALSE;
}
开发者ID:blueskyll,项目名称:condor,代码行数:42,代码来源:condor_softkill.WINDOWS.cpp


示例20: HookProc

void HookProc( POINT *ppt )
{
HWND WND;
TCHAR wClassName[64];
DWORD winProcessID;
	WND = GetWindowFromPoint( *ppt );
	if(WND == NULL) return;

	if ( !GetClassName(WND, wClassName, sizeof(wClassName) / sizeof(TCHAR)) ) 
		return;

	GetWindowThreadProcessId( WND, &winProcessID );

	if( winProcessID != ourProcessID && lstrcmpi( wClassName, _T("ConsoleWindowClass") ) != 0 )
		return;

	if(TimerID && ( GlobalData->LastPt.x != ppt->x || GlobalData->LastPt.y != ppt->y ) ) 
	{
		KillTimer(0, TimerID);
		TimerID = 0;
	}

	const char* DisableClasses[] = {
				"gdkWindowChild",
				"gdkWindowTemp",
				"Progman",
				"WorkerW",
				};
	int i;
	for (i=0; i<4; i++) {
		if (lstrcmp(wClassName, DisableClasses[i])==0)
			break;
	}
	if (i<4) return;

	if(GlobalData->LastPt.x != ppt->x || GlobalData->LastPt.y != ppt->y || GlobalData->LastWND != WND ) 
	{
		GlobalData->LastWND = WND;
		GlobalData->LastPt = *ppt;
		TimerID = SetTimer(0, TimerID, MOUSEOVER_INTERVAL, TimerFunc);
	}
}
开发者ID:JasonXJ,项目名称:goldendict,代码行数:42,代码来源:TextOutSpy.c



注:本文中的GetWindowThreadProcessId函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetWindowsDirectory函数代码示例发布时间:2022-05-30
下一篇:
C++ GetWindowTheme函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap