Click here to Skip to main content
15,888,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWindows 10 - find last logon time in C++ ?? Pin
Derell Licht5-Jun-21 16:28
professionalDerell Licht5-Jun-21 16:28 
QuestionRe: Windows 10 - find last logon time in C++ ?? Pin
David Crow5-Jun-21 16:53
David Crow5-Jun-21 16:53 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht5-Jun-21 17:06
professionalDerell Licht5-Jun-21 17:06 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht5-Jun-21 17:11
professionalDerell Licht5-Jun-21 17:11 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Randor 6-Jun-21 5:21
professional Randor 6-Jun-21 5:21 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht6-Jun-21 6:27
professionalDerell Licht6-Jun-21 6:27 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Randor 6-Jun-21 7:26
professional Randor 6-Jun-21 7:26 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht6-Jun-21 7:44
professionalDerell Licht6-Jun-21 7:44 
Ahhh!! So you *are using 64-bit compiler then ?!?!
mingw-w64 is the 64-bit compiler... and in my 64-bit compiler, they are also present, but not in the 32-bit compiler...

Actually, though, I found a way to make this work with Mingw32...
I found the clue in a page for gkrellm application, which has a support file to add support for system functions which are missing in default MinGW-32 package...

What he did is use LoadLibrary() to load and obtain a handle for secur32.dll,
then used GetProcAddress() to get pointers to the required functions:

hSecur32 = LoadLibraryW(L"secur32.dll");
if (hSecur32 != NULL)
   {
   pfLELS = (pfLsaEnumerateLogonSessions)GetProcAddress(hSecur32, "LsaEnumerateLogonSessions");
   if (pfLELS == NULL)
      {
      wprintf(L"Could not get address for LsaEnumerateLogonSessions() in secur32.dll\n");
      }


That worked beautifully for me!!
And yes, your code *does* in fact return the login times that I was looking for; Thank You again!!
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Randor 6-Jun-21 8:11
professional Randor 6-Jun-21 8:11 
AnswerRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht6-Jun-21 15:20
professionalDerell Licht6-Jun-21 15:20 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Richard MacCutchan6-Jun-21 21:16
mveRichard MacCutchan6-Jun-21 21:16 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Derell Licht7-Jun-21 3:14
professionalDerell Licht7-Jun-21 3:14 
GeneralRe: Windows 10 - find last logon time in C++ ?? Pin
Maximilien7-Jun-21 9:15
Maximilien7-Jun-21 9:15 
Questionurgent question Pin
MAHMOUD ALI Jun20215-Jun-21 1:03
MAHMOUD ALI Jun20215-Jun-21 1:03 
AnswerRe: urgent question Pin
Victor Nijegorodov5-Jun-21 1:24
Victor Nijegorodov5-Jun-21 1:24 
GeneralRe: urgent question Pin
MAHMOUD ALI Jun20215-Jun-21 1:37
MAHMOUD ALI Jun20215-Jun-21 1:37 
GeneralRe: urgent question Pin
Victor Nijegorodov5-Jun-21 1:41
Victor Nijegorodov5-Jun-21 1:41 
AnswerRe: urgent question Pin
Richard MacCutchan5-Jun-21 2:20
mveRichard MacCutchan5-Jun-21 2:20 
AnswerRe: urgent question Pin
David Crow5-Jun-21 4:03
David Crow5-Jun-21 4:03 
AnswerRe: urgent question Pin
Dave Kreskowiak5-Jun-21 4:22
mveDave Kreskowiak5-Jun-21 4:22 
AnswerRe: urgent question Pin
enhzflep10-Jun-21 21:13
enhzflep10-Jun-21 21:13 
AnswerRe: urgent question Pin
SeeSharp211-Jun-21 1:23
SeeSharp211-Jun-21 1:23 
QuestionC++/MFC Parameterizing a Recordset (ODBC), having problem with passing UNICODE parameter Value Pin
Zouaoui Billel31-May-21 8:05
Zouaoui Billel31-May-21 8:05 
AnswerRe: C++/MFC Parameterizing a Recordset (ODBC), having problem with passing UNICODE parameter Value Pin
Richard MacCutchan31-May-21 9:11
mveRichard MacCutchan31-May-21 9:11 
AnswerRe: C++/MFC Parameterizing a Recordset (ODBC), having problem with passing UNICODE parameter Value Pin
Dave Kreskowiak31-May-21 11:51
mveDave Kreskowiak31-May-21 11:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.