I wrote a C++ program that is designed to run on a workstation connected to the domain controller in the Active Directory set-up. It works great, except the following situation.
Say, a user installs it on a laptop that is connect to the DC, but then moves that laptop away from the Active Directory environment (say, goes home with it where DC is not accessible.)
Is there any way to detect this from my software?
I’d try to bind to or search for a known object in the AD. If binding succeeds we should be in the domain. Assuming the user is logged in with an off-line AD profile, you could try to bind to the current user:
Have a look at ADSI documentation in MSDN, most of it works only when you have access to AD.