• WinCE进程ID获取窗口句柄


    HWND hwndFind = NULL;
    
    /*
    1、枚举所有顶层窗口(不包括子窗口),并将窗口句柄依次传给回调函数
    2、枚举结束条件:枚举完成或回调函数返回FALSE
    */ BOOL bRt = EnumWindows(EnumWindowsProc, dwProcessId); //回调函数 BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) { DWORD dwPI; GetWindowThreadProcessId(hwnd, &dwPI); if ( dwPI == (DWORD)lParam ) { hwndFind = hwnd; return FALSE; } return TRUE; }

    MSDN说明:

    • The EnumWindows function does not enumerate child windows. 

    • This function is more reliable than calling the GetWindow function in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed

  • 相关阅读:
    Java 多态
    Java 继承与抽象类
    Java 接口
    关于Oracle数据库故障诊断基础架构
    监控性能
    监视错误和警报
    内存管理参考
    使用自动内存管理
    内存架构概述
    关于内存管理
  • 原文地址:https://www.cnblogs.com/dahai/p/2792259.html
Copyright © 2020-2023  润新知