Click here to Skip to main content
15,886,851 members
Articles / Programming Languages / VBScript

ProSysLib: Dissecting the Process

Rate me:
Please Sign up or sign in to vote.
4.84/5 (69 votes)
22 Nov 2010CPOL12 min read 128.2K   2.6K   174  
Access detailed information about the current process the easiest way.
///////////////////////////////////////////////////
// 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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Sibedge IT
Ireland Ireland
My online CV: cv.vitalytomilov.com

Comments and Discussions