Click here to Skip to main content
15,900,589 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow can I display Dlg Message Box? Pin
sabdalla8022-Oct-08 9:53
sabdalla8022-Oct-08 9:53 
AnswerRe: How can I display Dlg Message Box? Pin
David Crow22-Oct-08 9:58
David Crow22-Oct-08 9:58 
GeneralRe: How can I display Dlg Message Box? Pin
sabdalla8022-Oct-08 10:09
sabdalla8022-Oct-08 10:09 
GeneralRe: How can I display Dlg Message Box? Pin
sabdalla8022-Oct-08 10:22
sabdalla8022-Oct-08 10:22 
QuestionRe: How can I display Dlg Message Box? Pin
David Crow22-Oct-08 10:37
David Crow22-Oct-08 10:37 
AnswerRe: How can I display Dlg Message Box? Pin
sabdalla8022-Oct-08 10:43
sabdalla8022-Oct-08 10:43 
QuestionRe: How can I display Dlg Message Box? Pin
David Crow22-Oct-08 10:47
David Crow22-Oct-08 10:47 
QuestionGetting NULL value from 'Win32_LogonSession' through WMI [modified] Pin
Supriya Tonape22-Oct-08 9:40
Supriya Tonape22-Oct-08 9:40 
Hi,

I am trying to get the logged on user info from 'Win32_LogonSession' Class. However when I try to get the 'Name' field from this Class I am getting NULL value in variable 'vtProp' at below line .
pclsObj->Get(L"Name", 0, &vtProp, 0, 0);

Below is the code snippet.


==================
HRESULT hres = WBEM_S_NO_ERROR;
IEnumWbemClassObject* pEnumerator = NULL;
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT Name FROM Win32_LogonSession WHERE LogonType = 10"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);

if (FAILED(hres))
{
//cout << "Query for operating system name failed."
// << " Error code = 0x"
// << hex << hres << endl;
pSvc->Release();
pLoc->Release();
return 1; // Program has failed.
}


IWbemClassObject *pclsObj;
ULONG uReturn = 0;

while (pEnumerator)
{
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
&pclsObj, &uReturn);

if(0 == uReturn)
{
ErrorInfo(hres,11);
break;
}

VARIANT vtProp;

// Get the value of the Name property
hr = pclsObj->Get(L"Name", 0, &vtProp, 0, 0);
printf(" Logged On User Name : %s",vtProp.bstrVal);
VariantClear(&vtProp);
}
====================

Regards,
Supriya Tonape.

modified on Wednesday, October 22, 2008 3:54 PM

QuestionRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
David Crow22-Oct-08 9:57
David Crow22-Oct-08 9:57 
AnswerRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape22-Oct-08 10:24
Supriya Tonape22-Oct-08 10:24 
QuestionRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
David Crow22-Oct-08 10:35
David Crow22-Oct-08 10:35 
AnswerRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape22-Oct-08 11:23
Supriya Tonape22-Oct-08 11:23 
GeneralRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape22-Oct-08 11:30
Supriya Tonape22-Oct-08 11:30 
GeneralRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery22-Oct-08 14:11
Mark Salsbery22-Oct-08 14:11 
General[Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 8:40
Supriya Tonape23-Oct-08 8:40 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery23-Oct-08 9:33
Mark Salsbery23-Oct-08 9:33 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 12:44
Supriya Tonape23-Oct-08 12:44 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery23-Oct-08 15:31
Mark Salsbery23-Oct-08 15:31 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery23-Oct-08 15:37
Mark Salsbery23-Oct-08 15:37 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 16:55
Supriya Tonape23-Oct-08 16:55 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 17:04
Supriya Tonape23-Oct-08 17:04 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery23-Oct-08 20:06
Mark Salsbery23-Oct-08 20:06 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 20:45
Supriya Tonape23-Oct-08 20:45 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery23-Oct-08 20:49
Mark Salsbery23-Oct-08 20:49 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 21:19
Supriya Tonape23-Oct-08 21:19 

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.