zoukankan      html  css  js  c++  java
  • 怎么获得任一窗口的指针

    你创建的IDD_Dialog1对话框,调用的实例如果是dlg
    就用dlg.GetDlgItem(控件ID)
    如果实例是指针,就用dlg->GetDlgItem(控件ID)
    还有一个更加万能的方法,就是从桌面开始一层一层的找你要找的窗口句柄,提供一段代码供参考:
    hWnd = ::GetWindow( ::GetDesktopWindow(), GW_CHILD );
    while ( hWnd != NULL)
    {
    memset( szTittleInfo , NULL , 255 );
    ::GetWindowText( hWnd, szTittleInfo , 255 );
    szInfo.Format( "%s" , szTittleInfo ) ;
    if( szInfo.GetLength() > 0 )
    {
    if( szInfo.CompareNoCase( "YabooPanoramic - [四分镜头]") == 0 )
    {
    TarghWnd = hWnd ;
    break ;
    }
    }
    hWnd =::GetWindow( hWnd , GW_HWNDNEXT );
    }

    if( TarghWnd == NULL && m_CameraNo < 5 && m_nRunMode == 1 )
    {
    AfxMessageBox( "没有找到应用程序!" );

    OnOK();
    //return FALSE ;

    return TRUE ;
    }

    m_AppHWnd = TarghWnd ;

    //MdiClient ;
    hWnd = ::GetWindow( TarghWnd , GW_CHILD );
    //子框架句柄
    hWnd = ::GetWindow( hWnd , GW_CHILD );
    //视图句柄
    TarghWnd = ::GetWindow( hWnd , GW_CHILD );

    int nValue ;
    hWnd = ::GetWindow( TarghWnd , GW_CHILD );
    while( hWnd != NULL )
    {
    szInfo.Format( "%d" , hWnd ) ;
    nValue = atoi( szInfo );
    if( nValueA == nValue )
    {
    m_wndCameraA = hWnd ;
    break ;
    }
    hWnd = ::GetWindow( hWnd , GW_HWNDNEXT );
    }

    hWnd = ::GetWindow( TarghWnd , GW_CHILD );
    while( hWnd != NULL )
    {
    szInfo.Format( "%d" , hWnd ) ;
    nValue = atoi( szInfo );
    if( nValueB == nValue )
    {
    m_wndCameraB = hWnd ;
    break ;
    }

    hWnd = ::GetWindow( hWnd , GW_HWNDNEXT );
    }

    hWnd = ::GetWindow( TarghWnd , GW_CHILD );
    while( hWnd != NULL )
    {
    szInfo.Format( "%d" , hWnd ) ;
    nValue = atoi( szInfo );
    if( nValueA2 == nValue )
    {
    m_wndCameraA2 = hWnd ;
    break ;
    }
    hWnd = ::GetWindow( hWnd , GW_HWNDNEXT );
    }

    hWnd = ::GetWindow( TarghWnd , GW_CHILD );
    while( hWnd != NULL )
    {
    szInfo.Format( "%d" , hWnd ) ;
    nValue = atoi( szInfo );
    if( nValueB2 == nValue )
    {
    m_wndCameraB2 = hWnd ;
    break ;
    }

    hWnd = ::GetWindow( hWnd , GW_HWNDNEXT );
    }
  • 相关阅读:
    自己做的关于select工具根据属性进行选择
    ae中栅格数据转为矢量数据
    影像图配准代码实现
    ae中最短路径分析
    AE常见接口之间的关系+常见概念 .
    GIS重要概念与术语(转)
    点线面缓冲分析(转自esri中国社区)
    ae中矢量数据转换成栅格数据
    单例模式
    利用gp自己做的生成缓冲区的代码
  • 原文地址:https://www.cnblogs.com/ransn/p/8110852.html
Copyright © 2011-2022 走看看