Search Results

Search found 5 results on 1 pages for 'chekalin v'.

Page 1/1 | 1 

  • How get Win32_OperatingSystem.LastBootUpTime in datetime format

    - by chekalin-v
    I have been trying to get LastBootUpTime using Win32_OperatingSystem class (WMI). HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn); if(0 == uReturn) { break; } VARIANT vtProp; // Get the value of the Name property hr = pclsObj->Get(L"LastBootUpTime", 0, &vtProp, 0, 0); VariantClear(&vtProp); I want to write this time to CTime or COleDateTime variable. But variable vtProp has BSTR type and look like 20100302185848.499768+300 Also any datetime property of any WMI class have BSTR type How can I put datetime property of WMI class to CTime?

    Read the article

  • Cannot convert CString to BYTE array

    - by chekalin-v
    I need to convert CString to BYTE array. I don't know why, but everything that I found in internet does not work :( For example, I have CString str = _T("string"); I've been trying so 1) BYTE *pbBuffer = (BYTE*)(LPCTSTR)str; 2) BYTE *pbBuffer = new BYTE[str.GetLength()+1]; memcpy(pbBuffer, (VOID*)(LPCTSTR)StrRegID, str.GetLength()); 3) BYTE *pbBuffer = (BYTE*)str.GetString(); And always pbBuffer contains just first letter of str DWORD dwBufferLen = strlen((char *)pbBuffer)+1; is 2 But if I use const string: BYTE *pbBuffer = (BYTE*)"string"; pbBuffer contains whole string Where is my mistake?

    Read the article

  • Using DLL that using COM in C#

    - by chekalin-v
    I have been writing DLL on C++, that will be use in C#. DLL have some function, where I call hres = CoInitializeEx(NULL, COINIT_MULTITHREADED); and next call hres = CoInitializeSecurity( NULL, -1, // COM authentication NULL, // Authentication services NULL, // Reserved RPC_C_AUTHN_LEVEL_PKT, // Default authentication RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation NULL, // Authentication info EOAC_NONE, // Additional capabilities NULL // Reserved ); There are no error then I trying to use this dll in C++. But if I call function from DLL via C# application I see Error (80010106) Cannot change thread mode after it is set. I changed hres = CoInitializeEx(NULL, COINIT_MULTITHREADED); to hres = CoInitialize(NULL); After this changes error appear after CoInitializeSecurity: (80010119) Security must be initialized before any interfaces are marshalled or unmarshalled. It cannot be changed once initialized. How resolve this trouble?

    Read the article

  • How to read some bytes from BYTE*

    - by chekalin-v
    I have BYTE pointer. For example the length of this BYTE array is 10. How can I read 4 bytes from 3 position BYTE array? Now I doing it so BYTE *source = "1234567890\0"; BYTE* tmp = new BYTE[4+1](); for(int i=0; i<4; i++) { tmp[i] = source[i+3]; }

    Read the article

1