|
///////////////////////////////////////////////////
// This C++ example illustrates simple use and
// deployment for the ProSysLib component.
//
// The sample retrieves property "Caption" from
// WMI class "Win32_OperatingSystem", and then
// prints the value on the screen.
///////////////////////////////////////////////////
#include "stdafx.h"
// File from which we import the type library (just for compilation);
#define PSL_FILE "../../../Bin/PSL32v0.9.dll"
#include "../PSLDeploy.h" // Header that simplifies ProSysLib
// component's deployment;
void main()
{
CPSLDeploy PSLDeploy;
LPCTSTR sPSLPath = _T("../../../../../Bin/PSL32v0.9.dll");
if(sizeof(void*) == 8) // If process is 64-bit;
sPSLPath = _T("../../../../../Bin/PSL64v0.9.dll");
if(!PSLDeploy.Initialize(sPSLPath))
return; // Failed to initialize the library;
// Initializing COM - only because we use WMI interface below,
// because generally it is not needed when using ProSysLib;
::CoInitialize(NULL);
ProSysLib::IPSLSystemPtr sys = PSLDeploy.CreateInstance(); // Creating ProSysLib root namespace;
_bstr_t OSCaption = sys->Tools->WMI->GetValue(_T(""), _T("Win32_OperatingSystem"), _T("Caption"));
_tprintf(OSCaption); // Display full name of the OS on the screen;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.