Login& Logout Time
-
Using COM it's possible, though I haven't used it at all, just did a quick search and found this for you...
IADsUser
COM interface provides these methods for you, google for more information...get_LastLogin
get_LastLogoffNibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
You might look into the
ISensLogon
interface."Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Using COM it's possible, though I haven't used it at all, just did a quick search and found this for you...
IADsUser
COM interface provides these methods for you, google for more information...get_LastLogin
get_LastLogoffNibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
Using COM it's possible, though I haven't used it at all, just did a quick search and found this for you...
IADsUser
COM interface provides these methods for you, google for more information...get_LastLogin
get_LastLogoffNibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
leonigah wrote:
thanx, its working
Welcome. I am curious to see the code! Is it possible? :)
Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
#include #include #include #pragma comment (lib, "ActiveDS.lib") #pragma comment (lib, "Adsiid.lib") void CSysInfoDlg::OnOK() { IADsContainer *pCont = NULL; CString str = "WinNT://DOMEN_NAME"; HRESULT hr = ADsGetObject(str.AllocSysString(), IID_IADsContainer, (void**) &pCont ); if(!SUCCEEDED(hr)) return; ULONG ulFetched = 0L; _variant_t var; _variant_t vChild; IEnumVARIANTPtr pEnum; ADsBuildEnumerator(pCont,&pEnum); while((SUCCEEDED(ADsEnumerateNext(pEnum, 1, &vChild, &ulFetched)) && ulFetched==1)) { IADsUser* pADs = NULL; hr = V_DISPATCH(&vChild)->QueryInterface(IID_IADsUser, (void**)&pADs); if(hr!=S_OK) break; DATE din = 0; pADs->get_LastLogin(&din); COleDateTime d(din); CString strIn = d.Format("%d-%m-%Y %H:%M"); DATE dout = 0; pADs->get_LastLogoff(&dout); COleDateTime d1(dout); CString strOut = d1.Format("%d-%m-%Y %H:%M"); BSTR bstrName; pADs->get_Name(&bstrName); CString strName = bstrName; SysFreeString(bstrName); pADs->Release(); pADs = NULL; MessageBox(strIn+"=="+strOut, strName); } if(pCont) pCont->Release(); }
Nigah M Manzoor