Win32API 我的窗口如何跟随现有窗口
致所有 Win32 专业人士。假设我们已经完成了带有 window 的现有应用程序。任务是用(我的)窗口编写另一个应用程序。当用户在屏幕上移动现有窗口时,我的窗口必须始终将其左边缘与现有窗口右边缘对齐(用户不允许移动我的窗口)。
前提条件: a) 现有窗口不能被子类化 b) Windows 挂钩不是一个案例。
是的,看起来不错。如果这不是一个问题,我不会问这个问题。忘了说操作系统是Vista 2,应用程序是IE。我尝试制作一个跟随 IE 主窗口的应用程序,将其边缘对齐。不允许 IE 子类化,并且 SetWindowsHook 在普通用户下无法正常工作(当用户具有管理员权限时应用程序可以正常工作)。你们所谈论的这种方式可以在 Vista 之前的 Windows 下运行。
看起来没有简单的方法可以解决这个任务。谢谢大家。
To all Win32 professionals. Let's say we have completed existing application with window. The task is to write another application with (my) window. My window must always align its left edge to existing window right edge while user moves existing window across the screen (my window not allowed to move by user).
Precondition: a) Existing window can not be subclassed b) Windows hooks are not a case.
Yes, looks right. I'd not asked this question if it not become a problem. Forgot to say that OS is Vista 2, application is IE. I try to make an application that follows IE main window, align it edge. Subclassing of IE not allowed, and SetWindowsHook not works correctly under regular user (when user have admin privileges application works normally). Such way as all of you talking about works under Windows prior to Vista.
And looks like there is no trivial way to solve this task. Thank you all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为没有钩子就不行。 SetWindowLong 允许您设置 WndProc,但如果窗口属于不同的应用程序,则这将不起作用。
I think you can't without a hook. SetWindowLong allows you to set a WndProc, but this won't work if the window belongs to a different application.
如果您不想/不能子类化或设置全局挂钩,您可以查看以下内容:
If you dont want/cant subclass or set global hooks, you can look into the following: