zoukankan      html  css  js  c++  java
  • 遍历window所有窗口句柄

    #include <iostream.h>
    #include 
    <string.h>

    #include 
    <windows.h>



    BOOL CALLBACK EnumFunc(HWND hwnd,LPARAM lParam);
    BOOL CALLBACK EnumChildFunc(HWND hwnd,LPARAM lParam);

    int main(int argc, char *argv[])
    {
      LPARAM lParam 
    = 0;
      EnumWindows(EnumFunc,lParam);
      system(
    "PAUSE");    
      
    return 0;
    }



    #include 
    <iostream.h>
    BOOL CALLBACK EnumFunc(HWND hwnd,LPARAM lParam)
    {
             
    static int count = 0;
          LPTSTR  pszFileName 
    = new char [100];

             GetWindowText(hwnd,pszFileName,
    100);
             cout
    <<"main hwnd"<<count++<<""<<hwnd<<"  "<<pszFileName<<endl

        EnumChildWindows(hwnd,EnumChildFunc,lParam); 
        system(
    "pause");
            
    return true;
    }


    BOOL CALLBACK EnumChildFunc(HWND hwnd,LPARAM lParam)
    {
        
    static int count = 0;
        LPTSTR pszFileName 
    = (LPTSTR) new char [250];

        GetWindowText(hwnd,pszFileName,
    250);
        cout
    <<" child hwnd "<<hwnd<<count++<<""<<pszFileName<<endl;
        
    return true;
    }

     
    /*
    *
    * Copyright (c) 2011 Ubunoon.
    * All rights reserved.
    *
    * email: netubu#gmail.com replace '#' to '@'
    * http://www.cnblogs.com/ubunoon
    * 欢迎来邮件定制各类验证码识别,条码识别,图像处理等软件
    * 推荐不错的珍珠饰品,欢迎订购 * 宜臣珍珠(淡水好珍珠) */
  • 相关阅读:
    Django 基础教程
    Python之路【第十七篇】:Django【进阶篇 】
    Python之路【第十六篇】:Django【基础篇】
    Python之路【第十五篇】:Web框架
    AngularJS 教程
    jQuery
    最小公倍数生成树
    51nod 1743 雪之国度
    codeforces 633F The Chocolate Spree
    hihocoder 1246 王胖浩与环
  • 原文地址:https://www.cnblogs.com/ubunoon/p/2058956.html
Copyright © 2011-2022 走看看