Jump to content
Sign in to follow this  
eagle4life69

Detecting Dock state of laptop

Recommended Posts

So I am looking to write something that would detect if a laptop is docked or not. I am thinking the simple way is to detect if a certain nic card is present since all of my docks have the same hardware device type for the nic.

What I need help with is how to make this work to read when the laptop is docked and undocked. and how to make the program run without eating memory I found sleeping isn't effective but maybe that's me

thanks for the help

UPDATE 1:
Maybe looking at the key will work better for docking. But how to make it know when the state changes from a 1 to a 2?

HKLM\SYSTEM\CurrentControlSet\Control\IDConfigDB\CurrentDockInfo\DockingState

 

Edited by eagle4life69

Share this post


Link to post
Share on other sites
3 minutes ago, JLogan3o13 said:

@eagle4life69 Dog ate your help file? Look at RegRead in the help file.

I understand how to read the registry but how do I loop it over and over again? so about 1000 checks a minute?

at some point would I not just eat memory? I'm looking for better programming than just doing a while loop with a sleep(50)

Edited by eagle4life69

Share this post


Link to post
Share on other sites

Maybe a While Loop?

While RegRead(<KeyName>, <ValueName>) = "Value"
    Sleep(100)
WEnd

MsgBox(0, "", "Value Changed!")

 


"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

It shouldn't eat memory, it would reuse a limited amount.


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...