当前位置: 首页>>代码示例>>C#>>正文


C# EnumWindowProc类代码示例

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


EnumWindowProc类属于命名空间,在下文中一共展示了EnumWindowProc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindChildClassHwnd

 /**/
 /// <summary>
 /// Find the child window, if found m_classname will be assigned 
 /// </summary>
 /// <param name="hwndParent">parent's handle</param>
 /// <param name="lParam">the application value, nonuse</param>
 /// <returns>found or not found</returns>
 //The C++ code is that  lParam is the instance of FindWindow class , if found assign the instance's m_hWnd
 private bool FindChildClassHwnd(IntPtr hwndParent, IntPtr lParam)
 {
     EnumWindowProc childProc = new EnumWindowProc(FindChildClassHwnd);
     IntPtr hwnd = FindWindowEx(hwndParent, IntPtr.Zero, this.m_classname, string.Empty);
     if (hwnd != IntPtr.Zero)
     {
         this.m_hWnd = hwnd; // found: save it
         return false; // stop enumerating
     }
     EnumChildWindows(hwndParent, childProc, IntPtr.Zero); // recurse  redo FindChildClassHwnd
     return true;// keep looking
 }
开发者ID:krishnakanthms,项目名称:recordanywhere,代码行数:20,代码来源:FindWindow.cs

示例2: FindChildClassHwnd

 private bool FindChildClassHwnd(IntPtr hwndParent, IntPtr lParam)
 {
     EnumWindowProc callback = new EnumWindowProc(this.FindChildClassHwnd);
     IntPtr ptr = FindWindowEx(hwndParent, IntPtr.Zero, this.m_classname, string.Empty);
     if (ptr != IntPtr.Zero)
     {
         this.m_hWnd = ptr;
         callback = null;
         return false;
     }
     EnumChildWindows(hwndParent, callback, IntPtr.Zero);
     callback = null;
     return true;
 }
开发者ID:purplecow,项目名称:AutoBroswer,代码行数:14,代码来源:FindSubWindow.cs

示例3: TryFindHandle

        /// <summary>
        /// Chrome's message-loop Window isn't created synchronously, so this may not find it.
        /// If so, you need to wait and try again later.
        /// </summary>
        public static bool TryFindHandle(IntPtr browserHandle, out IntPtr chromeWidgetHostHandle)
        {
            var classDetails = new ClassDetails();
            var gcHandle = GCHandle.Alloc(classDetails);

            var childProc = new EnumWindowProc(EnumWindow);
            EnumChildWindows(browserHandle, childProc, GCHandle.ToIntPtr(gcHandle));

            chromeWidgetHostHandle = classDetails.DescendantFound;

            gcHandle.Free();

            return classDetails.DescendantFound != IntPtr.Zero;
        }
开发者ID:Creo1402,项目名称:CefSharp,代码行数:18,代码来源:ChromeWidgetMessageInterceptor.cs

示例4: EnumDesktopWindows

 public static extern bool EnumDesktopWindows(IntPtr hDesktop, EnumWindowProc lpfn, IntPtr lParam);
开发者ID:notsonormal,项目名称:AstoundingDock,代码行数:1,代码来源:Win32Window.cs

示例5: GetChildWindows

 /// <summary>
 /// Returns a list of child windows
 /// </summary>
 /// <param name="parent">Parent of the windows to return</param>
 /// <returns>List of child windows</returns>
 public static List<IntPtr> GetChildWindows(IntPtr parent)
 {
     List<IntPtr> result = new List<IntPtr>();
     GCHandle listHandle = GCHandle.Alloc(result);
     try {
         EnumWindowProc childProc = new EnumWindowProc(EnumWindow);
         EnumChildWindows(parent, childProc, GCHandle.ToIntPtr(listHandle));
     }
     finally {
         if (listHandle.IsAllocated)
             listHandle.Free();
     }
     return result;
 }
开发者ID:ToxicBakery,项目名称:Audio-Switcher,代码行数:19,代码来源:AudioSwitcherForm.cs

示例6: GetAllChildHandles

        // Bir List<IntPtr> listesi yarat ve istenilen uygulamaya ait ana window altındaki tüm çocuk 
        // window'ların handle kimliklerini listeye doldur.
        public List<IntPtr> GetAllChildHandles()
        {
            List<IntPtr> childHandles = new List<IntPtr>();
            GCHandle gcChildhandlesList = GCHandle.Alloc(childHandles);
            IntPtr pointerChildHandlesList = GCHandle.ToIntPtr(gcChildhandlesList);

            try
            {
                EnumWindowProc childProc = new EnumWindowProc(EnumWindow);
                EnumChildWindows(this.m_MainHandle, childProc, pointerChildHandlesList);
            }
            finally
            {
                gcChildhandlesList.Free();
            }

            return childHandles;
        }
开发者ID:sabuncu,项目名称:TestWinAPI,代码行数:20,代码来源:WindowHandleInfo.cs

示例7: Test

        public void Test()
        {
            // ���TextWriter�йܶ��󽫻ᱻ���ݸ�Win32 API����
            // �������һֱ���ڣ�ֱ�����ý���
            TextWriter outputWriter = System.Console.Out;

            // ʹ��GCHandle����ֹTextWriter������������������
            GCHandle gch = GCHandle.Alloc(outputWriter, GCHandleType.Normal);

            EnumWindowProc cb = new EnumWindowProc(DisplayWindowsTitleProc);

            // P/Invoke���ڵ��ý���ǰ���Զ���ֹ����
            // ��������ί�н��л���
            EnumDesktopWindows(IntPtr.Zero, cb, (IntPtr)gch);

            // ��������ҪGCHandleʱ���������Free���������ͷŵ�
            gch.Free();
        }
开发者ID:zhaohengyi,项目名称:dotNet_PInvoke,代码行数:18,代码来源:ManagedObjectInCallback.cs

示例8: FindChildClassHwnd

        /**/
        /// <summary>
        /// Find the child window, if found m_classname will be assigned 
        /// </summary>
        /// <param name="hwndParent">parent's handle</param>
        /// <param name="lParam">the application value, nonuse</param>
        /// <returns>found or not found</returns>
        //The C++ code is that  lParam is the instance of FindWindow class , if found assign the instance's m_hWnd
        private bool FindChildClassHwnd(IntPtr hwndParent, IntPtr lParam)
        {
            EnumWindowProc childProc = new EnumWindowProc(FindChildClassHwnd);
            IntPtr hwnd = FindWindowEx(hwndParent, IntPtr.Zero, m_classname, m_caption);
            if (hwnd != IntPtr.Zero)
            {
                this.m_hWnd = hwnd; // found: save it
                m_IsTimeOut = false;
                return false; // stop enumerating
            }

            DateTime end = DateTime.Now;

            if (start.AddSeconds(m_timeout) < end)
            {
                m_IsTimeOut = true;
                return false;
            }

            EnumChildWindows(hwndParent, childProc, IntPtr.Zero); // recurse  redo FindChildClassHwnd
            return true;// keep looking
        }
开发者ID:3guy,项目名称:testRe,代码行数:30,代码来源:FindWindow.cs

示例9: GetChildWindows

        /// <summary>
        /// </summary>
        /// <param name = "parent"></param>
        /// <returns></returns>
        private static IEnumerable<IntPtr> GetChildWindows( IntPtr parent )
        {
            var windowPointers = new List<IntPtr>();

            GCHandle listHandle = GCHandle.Alloc( windowPointers );

            try
            {
                var childProc = new EnumWindowProc( EnumWindow );

                EnumChildWindows( parent, childProc, GCHandle.ToIntPtr( listHandle ) );
            }
            finally
            {
                if ( listHandle.IsAllocated )
                {
                    listHandle.Free();
                }
            }

            return windowPointers;
        }
开发者ID:jtmueller,项目名称:sqlformat,代码行数:26,代码来源:SaveResultsAs.cs

示例10: EnumThreadWindows

 public static extern bool EnumThreadWindows(int dwThreadId, EnumWindowProc lpfn, IntPtr lParam);
开发者ID:ynyzyfy,项目名称:hbrelog,代码行数:1,代码来源:NativeMethods.cs

示例11: EnumChildWindows

 public static extern bool EnumChildWindows(IntPtr window, EnumWindowProc callback, IntPtr lParam);
开发者ID:WendyH,项目名称:HMSEditor,代码行数:1,代码来源:NativeMethods.cs

示例12: EnumWindows

 public static extern int EnumWindows(EnumWindowProc x, int y);
开发者ID:notsonormal,项目名称:AstoundingDock,代码行数:1,代码来源:Win32Window.cs

示例13: EnumWindows

 public static int EnumWindows(EnumWindowProc lpEnumFunc, IntPtr lParam)
 {
     return -1;
 }
开发者ID:rraguso,项目名称:protone-suite,代码行数:4,代码来源:User32.cs

示例14: Update

        // 子ハンドルのリスト更新
        public void Update()
        {
            hWndList.Clear();
            this.hWnd = GetWindowHandle(windowName);
            if (hWnd.Equals((IntPtr)0))
            {
                this.hWnd = GetWindowHandle(windowName+"*");
                if (hWnd.Equals((IntPtr)0))
                {

                    string str = "\"" + windowName + "\"は起動していません";
                    throw new ApplicationException(str);
                }
                this.windowName = windowName + "*";
            }
            GCHandle listHandle = GCHandle.Alloc(hWndList);
            try
            {
                EnumWindowProc childProc = new EnumWindowProc(EnumWindow);
                EnumChildWindows(hWnd, childProc, GCHandle.ToIntPtr(listHandle));
            }
            finally
            {
                if (listHandle.IsAllocated)
                {
                    listHandle.Free();
                }
            }
        }
开发者ID:blkcatman,项目名称:VoiceroidEx,代码行数:30,代码来源:WindowHandleSearch.cs

示例15: EnumDesktopWindows

 static extern bool EnumDesktopWindows(
     IntPtr desktopHandle, 
     EnumWindowProc cb, 
     IntPtr param);
开发者ID:zhaohengyi,项目名称:dotNet_PInvoke,代码行数:4,代码来源:ManagedObjectInCallback.cs


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