如何找到笔记本电脑是否插入扩展坞 [英] How to find if a laptop is pluged to the docking station

查看:425
本文介绍了如何找到笔记本电脑是否插入扩展坞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



这就是我在C#中制作Windows服务,监控笔记本电脑是否连接到扩展坞,但是我对这部分有一些问题。我已经查看了如果有一个注册表项,我刚刚找到了DockingState,但是值永远不会改变,还有其他方法吗?也许使用ManagementObjectSearcher?



Thx!



M

Hello everyone!

Here is the thing, I''m making a windows service in C# that monitors if the laptop is connected to the docking station, but I´m having some problems with this part. I had already look in the if there is a registry entry, I just found DockingState, but the value never change, is there other way? Maybe with the ManagementObjectSearcher?

Thx!

M

推荐答案

嗯,有趣。 AFAIK,对接/取消对接是驱动程序而不是操作系统的功能。可能有办法获得状态,检查这是否有帮助



CM_Is_Dock_Station_Present [ ^ ]



CM_Is_Dock_Station_Present_Ex [ ^ ]
Hmm, interesting. AFAIK, docking / undocking is the function of a driver not the OS. May be there is a way to get the state, check if this helps

CM_Is_Dock_Station_Present[^]

CM_Is_Dock_Station_Present_Ex [^]


查看笔记本电脑后面。如果它被插入扩展坞,它就会非常明显。



说真的,你可以用WMI做到这一点。没有保证,谷歌是你的朋友。



编辑===============



哦加油!从什么时候开始,我们不能为我们的答案添加一点幽默?我跟进为这个人提供了一个线索。
Look behind the laptop. If it''s plugged into the docking station, it''ll be pretty obvious.

Seriously though, you might be able to do it with WMI. No guarantees, and google is your friend.

EDIT ===============

Oh come on! Since when can''t we add a little humor to our answers? I followed up by providing a lead for the guy.


DockingState是一个枚举值,如果值为0则永远不会改变。如果值为3,则可能需要笔记本电脑制造商提供的驱动程序。




正如Yusef所说,它是驱动程序的功能,而不是操作系统。



DockingState is an enumerated value, if the value is 0 it will never change. If the value is 3 you prbably need the driver from the manufacturer of the laptop.


As Yusef has already stated, it is a function of the driver, not the OS.

typedef enum  {
  DockStateUnsupported   = 0,
  DockStateUnDocked      = 1,
  DockStateDocked        = 2,
  DockStateUnknown       = 3
} DOCKING_STATE;



这篇关于如何找到笔记本电脑是否插入扩展坞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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