Win API:挂钩每个窗口显示或进程执行 [英] Win API: Hook every window show or process execution

查看:28
本文介绍了Win API:挂钩每个窗口显示或进程执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们计划在我们的应用中构建某种单点登录功能.

We're planning to build some sort of single sign-on feature inside our app.

我很清楚,我必须使用 Windows API 来实现从旧应用程序控件的读取和写入,但据我搜索和测试,这并不是工作中最难的部分.

It's clear to me that I'll have to go depp with Windows API to achieve reading and writing from legacy applications controls, but as far as I've searched and tested that's not the hardest part of the job.

然而,有一点直到现在我才弄清楚如何继续:每次 UI 中弹出新窗口时,我如何挂钩"系统以得到通知?例如:当我启动计算器或在 calc 中打开关于"窗口时.

There's a point, however, that I couldn't figure out until now how to proceed with: how can I "hook" the system to be notified every time a new window pops up in the UI? By example: when I start my calculator or when, inside calc, the About window is open.

有没有办法接收这种通知?如果是,如何?如果没有,是否有任何解决方法可以达到相同的结果?

Is there a way to receive this kind of notification? If yes, how? If no, is there any workaround to achieve the same result?

先谢谢你,

菲利普

推荐答案

你需要一个 windows 系统钩子,特别是一个 WH_CBT 钩子,监视 HCBT_CREATEWND 事件.这东西有点毛茸茸的,但可能.

You need a windows system hook, specifically a WH_CBT hook, watching the HCBT_CREATEWND event. This stuff is a bit hairy, but possible.

此处开始:

这篇关于Win API:挂钩每个窗口显示或进程执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆