Click here to Skip to main content
15,905,414 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why make a function 'static'? Pin
Chris Meech2-May-05 2:11
Chris Meech2-May-05 2:11 
AnswerRe: Why make a function 'static'? Pin
BambooMoon29-Apr-05 9:50
BambooMoon29-Apr-05 9:50 
AnswerRe: Why make a function 'static'? Pin
Blake Miller29-Apr-05 10:44
Blake Miller29-Apr-05 10:44 
GeneralRe: Why make a function 'static'? Pin
Chris Meech2-May-05 2:16
Chris Meech2-May-05 2:16 
GeneralWMI Pin
Alex_Y29-Apr-05 9:01
Alex_Y29-Apr-05 9:01 
GeneralRe: WMI Pin
Alexander M.,29-Apr-05 9:04
Alexander M.,29-Apr-05 9:04 
GeneralRe: WMI Pin
Alex_Y2-May-05 2:12
Alex_Y2-May-05 2:12 
GeneralRe: WMI Pin
David Crow29-Apr-05 9:35
David Crow29-Apr-05 9:35 
Something like:

HRESULT                 hr;
_variant_t              v;
ULONG                   ulReturned;
DWORD                   dwAuthLevel;
IWbemLocator            *pLocator;
IWbemServices           *pService = NULL;
IEnumWbemClassObject    *pEnum = NULL;
IWbemClassObject        *pClass;
 
hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pLocator);
if (S_OK == hr)
{
    hr = pLocator->ConnectServer(_bstr_t(L"root\\cimv2"), NULL, NULL, NULL, NULL, 0, NULL, &pService);
    if (WBEM_S_NO_ERROR == hr)
    {
        hr = CoQueryProxyBlanket(pService, NULL, NULL, NULL, &dwAuthLevel, NULL, NULL, NULL);
        hr = CoSetProxyBlanket(pService, RPC_C_AUTHN_DEFAULT, RPC_C_AUTHZ_NONE, NULL, dwAuthLevel, 
                 RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE);
 
        hr = pService->CreateInstanceEnum(_bstr_t("Win32_PerfFormattedData_PerfProc_Thread"), 
                 WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY, NULL, &pEnum);
        if (WBEM_S_NO_ERROR == hr)
        {
            do
            {
                hr = pEnum->Next(WBEM_INFINITE, 1, &pClass, &ulReturned);
                if (WBEM_S_NO_ERROR == hr)
                {
                    hr = pClass->Get(L"Caption", 0, &v, NULL, NULL);
                    if (VT_NULL != v.vt)
                        TRACE("Caption = %s\n", V_BSTR(&v));
                }
            } while (WBEM_S_NO_ERROR == hr);
            
            pEnum->Release();
        }
 
        pService->Release();
    }
 
    pLocator->Release();
}



"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown


GeneralRe: WMI Pin
Alex_Y2-May-05 2:11
Alex_Y2-May-05 2:11 
GeneralEasy Way to Hide Taskbar Button Pin
Anonymous29-Apr-05 8:49
Anonymous29-Apr-05 8:49 
GeneralColors Pin
Anonymous29-Apr-05 7:27
Anonymous29-Apr-05 7:27 
GeneralRe: Colors Pin
Alexander M.,29-Apr-05 9:17
Alexander M.,29-Apr-05 9:17 
GeneralRe: Colors Pin
David Crow29-Apr-05 9:39
David Crow29-Apr-05 9:39 
GeneralUrgent Help Needed on "Multiple Monitors" and "Monitor Tiling" Pin
King 149340029-Apr-05 7:09
King 149340029-Apr-05 7:09 
Generalregistering filetypes for internet explorer Pin
Steve Kearon29-Apr-05 7:05
Steve Kearon29-Apr-05 7:05 
GeneralRe: registering filetypes for internet explorer Pin
David Crow29-Apr-05 9:44
David Crow29-Apr-05 9:44 
GeneralRe: registering filetypes for internet explorer Pin
Steve Kearon29-Apr-05 10:46
Steve Kearon29-Apr-05 10:46 
GeneralCopying project settings Pin
KingOfTheFaireys29-Apr-05 6:56
KingOfTheFaireys29-Apr-05 6:56 
Generalhelp in com wrapper Pin
smarty1229-Apr-05 6:36
smarty1229-Apr-05 6:36 
GeneralRe: help in com wrapper Pin
BlackDice29-Apr-05 11:01
BlackDice29-Apr-05 11:01 
GeneralRe: help in com wrapper Pin
ThatsAlok29-Apr-05 19:50
ThatsAlok29-Apr-05 19:50 
GeneralAbout ADO Command object's prepared attribute Pin
Finix29-Apr-05 6:00
Finix29-Apr-05 6:00 
GeneralAdding Dialog to mdi mfc app Pin
os3omaha29-Apr-05 5:20
os3omaha29-Apr-05 5:20 
GeneralRe: Adding Dialog to mdi mfc app Pin
Wes Aday29-Apr-05 9:38
professionalWes Aday29-Apr-05 9:38 
GeneralRe: Adding Dialog to mdi mfc app Pin
Gary R. Wheeler30-Apr-05 3:11
Gary R. Wheeler30-Apr-05 3:11 

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.