windows登录消息的获取?

ypos 2003-10-14 03:16:10
各版本的windows,从95开始,如何取得登录消息?
...全文
242 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
蒋晟 2003-10-15
  • 打赏
  • 举报
回复
如果系统上启用了终端服务,那么可以监视终端服务的事件。

Platform SDK: DLLs, Processes, and Threads
Receiving Events in a Service
A service that is a console application can register a console control handler to receive notification when a user logs off. However, there is no event sent when an interactive user logs on. To determine whether an interactive user is logged on, verify that the process specified in the following key is running:



HKEY_LOCAL_MACHINE\SOFTWARE\
Microsoft\
Windows NT\
CurrentVersion\
Winlogon


This process is started when an interactive user logs onto a system. Therefore, if this process is running, there is an interactive user logged on. To obtain a list of all running processes, see Enumerating All Processes.

The system broadcasts device change events to all services. These events can be received by a service in a window procedure or in its service control handler. To specify which events your service should receive, use the RegisterDeviceNotification function.

Be sure to handle Plug and Play device events as quickly as possible. Otherwise, the system may become unresponsive. If your event handler is to perform an operation that may block execution (such as I/O), it is best to start another thread to perform the operation asynchronously.

When a service calls RegisterDeviceNotification, the service also specifies either a window handle or a service status handle. If a service specifies a window handle, the window procedure receives the notification events. If a service specifies its service status handle, its service control handler receives the notification events. For more information, see HandlerEx.

Device notification handles returned by RegisterDeviceNotification must be closed by calling the UnregisterDeviceNotification function when they are no longer needed.


Command what is yours
Conquer what is not
lxwq 2003-10-14
  • 打赏
  • 举报
回复
???
lxwq 2003-10-14
  • 打赏
  • 举报
回复
谁告诉我啊?
tonyzhengjq 2003-10-14
  • 打赏
  • 举报
回复
up
lxwq 2003-10-14
  • 打赏
  • 举报
回复
不好意思打搅一下,谁告诉我如何发贴啊?
谢谢
FlyYang 2003-10-14
  • 打赏
  • 举报
回复
登录得时候有消息发出吗

---------
++C++
---------
ypos 2003-10-14
  • 打赏
  • 举报
回复
如果只在2000和XP下,我的要求还不需要重写gina,重写gina会带来很多麻烦。
我是想问有没有什么简单一些的方法可以搞定,例如收到消息什么的。
wuxfBrave 2003-10-14
  • 打赏
  • 举报
回复
我是要在登录的时候做些处理

那就用楼上说法,自己重写gina
http://www.vckbase.com/code/listcode.asp?mclsid=13&sclsid=&page=2
WINDOWS 2000下获得用户登录名和密码
tuwa0803 2003-10-14
  • 打赏
  • 举报
回复
在NT/2000中交互式的登陆支持是由WinLogon调用GINA DLL实现的,GINA DLL提供了一个交互式的界面为用户登陆提供认证请求。WinLogon会和GINA DLL进行交互,缺省是MSGINA.DLL(在System32目录下)。微软同时也为我们提供了接口,我们可以自己编写GINA DLL来代替MSGINA.DLL。

WinLogon初始化时会创建3个桌面:
(1)、winlogon桌面:主要显示Windows 安全等界面,如你按下CTRL+ALT+DEL,登陆的界面等
(2)、应用程序桌面:我们平时见到的那个有我的电脑的界面
(3)、屏幕保护桌面:屏幕保护显示界面。

在默认情况下,GINA显示登陆对话框,用户输入用户名及密码 。所以要获得用户名和密码 ,则可以写一个新的GINA DLL.

GINA 函数一览表

函数 描述
WlxActivateUserShell 激活用户外壳程序
WlxDisplayLockedNotice 允许GINA DLL 显示锁定信息
WlxDisplaySASNotice 当没有用户登陆时,Winlogon调用此函数
WlxDisplayStatusMessage Winlogon 用一个状态信息调用此函数进行显示
WlxGetConsoleSwitchCredentials Winlogon调用此函数读取当前登陆用户的信任信息,并透明地将它们传到目标会话
WlxGetStatusMessage Winlogon 调用此函数获取当前状态信息
WlxInitialize 针对指定的窗口位置进行GINA DLL初始化
WlxIsLockOk 验证工作站正常锁定
WlxIslogoffOk 验证注销正常
WlxLoggedOnSAS 用户已登陆并且工作站没有被加锁,如果此时接收到SAS事件,则Winlogon 调用此函数
WlxLoggedOutSAS 没有用户登陆,如果此时收到SAS事件,则Winlogon 调用此函数, This indicates that a logon attempt should be made 。
WlxLogoff 请求注销操作时通知GINA DLL
WlxNegotiate 表示当前的Winlogon版本是否能使用GINA DLL
WlxNetworkProviderLoad 在加载网络服务提供程序收集了身份和认证信息后,Winlogon 调用此函数
WlxRemoveStatusMessage Winlogon 调用此函数告诉GINA DLL 停止显示状态信息
WlxScreensaverNotify 允许GINA与屏幕保护操作交互
WlxShutdown 在关闭之前Winlogon 调用此函数,允许GINA实现任何关闭任务,例如从读卡器中退出智能卡
WlxStartApplication 当系统需要在用户的上下文中启动应用程序时调用此函数
WlxWkstaLockedSAS 当工作站被锁定,如果接收到一个SAS,则Winlogon 调用此函数

ypos 2003-10-14
  • 打赏
  • 举报
回复
我是要在登录的时候做些处理
wuxfBrave 2003-10-14
  • 打赏
  • 举报
回复
GetUserName获得登陆用户名称

16,472

社区成员

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

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

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