Click here to Skip to main content
16,010,876 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionmigrate to different DBMS using ODBC? Pin
Maverick5-Aug-05 0:03
Maverick5-Aug-05 0:03 
AnswerRe: migrate to different DBMS using ODBC? Pin
Marc Soleda5-Aug-05 0:20
Marc Soleda5-Aug-05 0:20 
AnswerRe: migrate to different DBMS using ODBC? Pin
BlackDice5-Aug-05 2:54
BlackDice5-Aug-05 2:54 
GeneralOffice XP style menu (non-MFC) Pin
Defenestration4-Aug-05 23:40
Defenestration4-Aug-05 23:40 
GeneralRe: Office XP style menu (non-MFC) Pin
toxcct4-Aug-05 23:53
toxcct4-Aug-05 23:53 
Generalwriting datetime in TextBox Pin
rajeevktripathi4-Aug-05 23:31
rajeevktripathi4-Aug-05 23:31 
GeneralRe: writing datetime in TextBox Pin
Marc Soleda4-Aug-05 23:40
Marc Soleda4-Aug-05 23:40 
GeneralRe: writing datetime in TextBox Pin
rajeevktripathi5-Aug-05 0:40
rajeevktripathi5-Aug-05 0:40 
The Code snippet is as follows
Here I am using Win32_OperatingSystem Class to access LastBootUpTime property and want to print it in text box, But it gives error.


Although I am able to take other properties of String data type of same class.


So please tell me solution.







IEnumWbemClassObject * pEnumObjectOS = NULL;
HRESULT hResOS;
BSTR strQueryBI = (L"Select * from Win32_OperatingSystem");
BSTR strQLOS = (L"WQL");
hResOS = pWbemServices->ExecQuery(strQLOS, StrQueryOS,WBEM_FLAG_RETURN_IMMEDIATELY,NULL,&pEnumObjectOS);

if(hResOS != S_OK)
{
MessageBox("Could not execute Query");
return;
}

ULONG uCountOS = 1, uReturnedOS;
IWbemClassObject * pClassObjectOS = NULL;


hResOS = pEnumObjectOS->Reset();

if(hResOS != S_OK)
{
MessageBox("Could not Enumerate");
return;
}

hResOS = pEnumObjectOS->Next(WBEM_INFINITE,uCountOS, &pClassObjectOS, &uReturnedOS);

if(hResOS != S_OK)
{
MessageBox("Could not Enumerate");
return;
}


VARIANT vOS;

//CString szStr;

BSTR strClassPropOS = SysAllocString(L"LastBootUpTime");



hResOS = pClassObjectOS->Get(strClassPropOS, 0, &vOS, 0, 0);
if(hResOS != S_OK)
{
MessageBox("Could not Get Value");
return;
}

SysFreeString(strClassPropOS);

_bstr_t bstrPathBIOS = &vOS; //Just to convert BSTR to ANSI
//char* strPath=(char*)bstrPath;

//COleDateTime dateTime(vBIOS.date);
// szStr=dateTime.Format("%H%M%S");

if (SUCCEEDED(hResOS))
SetDlgItemText(IDC_EDIT1,(char*)bstrPathOS);//MessageBox(strPath);
else
MessageBox("Error in getting object");

VariantClear( &vOS );



Thanks.


GeneralRe: writing datetime in TextBox Pin
Marc Soleda5-Aug-05 3:38
Marc Soleda5-Aug-05 3:38 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
Bob Stanneveld5-Aug-05 0:50
Bob Stanneveld5-Aug-05 0:50 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
Sreekanth Muralidharan5-Aug-05 22:54
Sreekanth Muralidharan5-Aug-05 22:54 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
Bob Stanneveld7-Aug-05 1:24
Bob Stanneveld7-Aug-05 1:24 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
Tim Smith5-Aug-05 3:15
Tim Smith5-Aug-05 3:15 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
Tim Smith5-Aug-05 3:16
Tim Smith5-Aug-05 3:16 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
ThatsAlok5-Aug-05 3:16
ThatsAlok5-Aug-05 3:16 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
Tim Smith5-Aug-05 3:26
Tim Smith5-Aug-05 3:26 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
Abebe5-Aug-05 3:38
Abebe5-Aug-05 3:38 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
ThatsAlok5-Aug-05 20:21
ThatsAlok5-Aug-05 20:21 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
Sreekanth Muralidharan10-Aug-05 23:07
Sreekanth Muralidharan10-Aug-05 23:07 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
Sreekanth Muralidharan5-Aug-05 23:11
Sreekanth Muralidharan5-Aug-05 23:11 
GeneralRe: EMERGENCY !! Project in crash landing !! Pin
Trollslayer5-Aug-05 4:03
mentorTrollslayer5-Aug-05 4:03 
Questionwhich one is better? Pin
Smith#4-Aug-05 22:31
Smith#4-Aug-05 22:31 
AnswerRe: which one is better? Pin
Bob Stanneveld4-Aug-05 22:36
Bob Stanneveld4-Aug-05 22:36 
GeneralRe: which one is better? Pin
Smith#4-Aug-05 22:49
Smith#4-Aug-05 22:49 
GeneralRe: which one is better? Pin
Bob Stanneveld5-Aug-05 0:46
Bob Stanneveld5-Aug-05 0:46 

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.