如何使你写的一个自定义的窗口类“MyWndClass“在其他应用程序中都可以使用?

lspbeyond
博客专家认证
2006-08-28 05:23:31
rt
...全文
171 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wxshzf 2006-10-24
  • 打赏
  • 举报
回复
是很麻烦
tgl10 2006-08-28
  • 打赏
  • 举报
回复
还要自己建窗口类啊,累死
思危 2006-08-28
  • 打赏
  • 举报
回复
注册全局窗口类,看MSDN介绍:

Application Global Classes

An application global class is a window class registered by an executable or dynamic-link library (DLL) that is available to all other modules in the process. For example, your .dll can call the RegisterClassEx function to register a window class that defines a custom control as an application global class so that a process that loads the .dll can create instances of the custom control.

Windows NT/Windows 2000/Windows XP: To create a class that can be used in every process, create the window class in a .dll and load the .dll in every process. To load the .dll in every process, add its name to the AppInit_DLLs value in following registry key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Windows

Whenever a process starts, the system loads the specified .dll in the context of the newly started process before calling its entry-point function. The .dll must register the class during its initialization procedure and must specify the CS_GLOBALCLASS style. For more information, see Class Styles.

To remove an application global class and free the storage associated with it, use the UnregisterClass function.

wenbo_ying 2006-08-28
  • 打赏
  • 举报
回复
把.h,.cpp加到其它工程里
再#include不就能用了

16,466

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧