Hardware, BIOS, OS and Distro info
|
|
void GetSystemInfo(String &manufacturer, String &productName, String &version, int &numberOfProcessors, String &mbSerial)
Returns hardware information including computer manufacturer, productName, version, numberOfProcessors and mbSerial (motherboard serial number).
void GetBiosInfo(String &biosVersion, Date &biosReleaseDate, String &biosSerial)
Returns bios information including biosVersion, biosReleaseDate.and biosSerial.
bool GetProcessorInfo(int number, String &vendor, String &identifier, String &architecture, int &speed)
Returns information about the different cpu cores.
number is the core number to get the information
vendor is the core vendor
identifier is the core identifier
architecture is the core architecture (32, 64)
speed.is the core speed in MHz.
int GetCpuSpeed()
Gets the real time main CPU speed in MHz.
This data is directly calculated by the function.
bool GetVideoInfo(Array <Value> &name, Array <Value> &description, Array <Value> &videoProcessor, Array <Value> &ram, Array <Value> &videoMode)
If true gets information about video systems installed:
name is the video system name
description is the video description
videoProcessor is the processor used
ram is the available memory in the video hardware in Mb
videoMode is the video mode actually selected including screen resolution and number of colors
Only available in Windows
bool GetPackagesInfo(Upp::Array<Value>& name, Upp::Array<Value>& version, Upp::Array<Value>& vendor, Upp::Array<Value>& installDate, Upp::Array<Value>& caption, Upp::Array<Value>& description, Upp::Array<Value>& state, Upp::Array<Value>& path)
If true gets information about installed software:
name
version
vendor
installDate
caption is a summary of the software description
description
state is the status of the software. Values are:
- "Bad Configuration"
- "Invalid Argument"
- "Unknown Package"
- "Advertised"
- "Absent"
- "Ok"
path
Only available in Windows. Now deprecated, because it is very slow.
double GetCpuTemperature()
Returns CPU temperature in degrees Celsius.
It does not work in all computers.
bool GetNetworkInfo(String &name, String &domain, String &ip4, String &ip6)
Returns the local computer network name, domain, ip4 and ip6.
String GetMacAddress()
Returns the MAC address in uppercase hexadecimal formated like "0A:0B:0C:0C:0D:0E" or Null.
This function is deprecated by GetAdapterInfo().
Array <NetAdapter> GetAdapterInfo()
Gets an array of type NetAdapter with all the network adapters installed.
NetAdapter contains:
String description: Adapter description
String fullname: Adapter name
String mac: Adapter MAC address if available
String type; Adapter type. Some of the included types are:
"ETHERNET" Ethernet
"TOKENRING" Token Ring
"MODEM" Point to Point Protocol
"SOFTWARE_LOOPBACK" Software loopback
"ATM" Asynchronous Transfer Mode
"IEEE80211" WIFI
"TUNNEL" Tunnel encapsulation
"IEEE1394" Firewire
bool GetNetworkInfo(String &name, String &domain)
Returns the local computer network name and domain.
int GetAvailableSocketPort(int from = 49152)
Returns the first available socket port from from or Null if there is an error.
String GetHDSerial()
Returns the hard disk physical serial number or Null. This code is not affected by disk formatting.
Only available in Windows
bool GetMemoryInfo(int &memoryLoad, uint64 &totalPhys, uint64 &freePhys, uint64 &totalPageFile, uint64 &freePageFile, uint64 &totalVirtual, uint64 &freeVirtual)
Gets information about the system memory:
memoryLoad is the percent of memory in use
totalPhys is the total physical memory
freePhys is the free physical memory
totalPageFile is the total paging file
freePageFile is the free paging file
totalVirtual is the total virtual memory
freeVirtual is the free virtual memory.
bool GetOsInfo(String &kernel, String &kerVersion, String &kerArchitecture, String &distro, String &distVersion, String &desktop, String &deskVersion)
Gets many information to identify the operating system and Desktop where the application is being run.
kernel: Kernel name
kerVersion: Kernel version
kerArchitecture: Kernel architecture
distro: Distro name
distVersion: Distro version
desktop: Desktop manager name
deskVersion.: Desktop manager version
bool GetDriveSpace(String drive, uint64 &freeBytesUser, uint64 &totalBytesUser, uint64 &totalFreeBytes)
Gets drive space.
freeBytesUser: Amount of free bytes available to the user
totalBytesUser: Size of drive visible for the user
totalFreeBytes: Amount of free bytes.
Returns false if drive is not mounted or it is not accessible
bool GetDriveInformation(String drive, String &type, String &volume, int &maxName, String &fileSystem)
Gets drive information
type: Gets the type of the drive.
Available types are "Hard", "Network", "Optical", "RAM", "Removable".
volume: Gets the name of the drive
maxName: Gets the maximum length permitted for a file name
fileSystem: Gets the drive formatting system.
Returns false if drive is not mounted or it is not accessible
void GetCompilerInfo(String &name, int &version, Time &time, String &mode, int &bits)
Returns compiling information, like compiler name, compiler version, program compilation time, compiling mode and bits.
bool GetBatteryStatus(bool &discharging, int &percentage, int &remainingMin)
Gets battery information like if it is discharging or connected to the grid, percentage of charging where 100% means full charge, and number of expected computer running minutes in remainingMin.
Returns true if the values got are valid.
bool GetBatteryInfo(bool &present )
Gets if battery is present or not.
Returns true if the values got are valid.
void OpenCDTray()
Ejects CD/DVD tray.
void CloseCDTray()
Closes CD/DVD tray if possible
void GetWindowsList(Array<int64> &hWnd, Array<int64> &processId, Array<String> &name, Array<String> &fileName, Array<String> &caption, bool getAll)
Gets arrays with handles to all the opened windows with additional info as:
wid: Handle to the the window
pid: Handle to the process that manages the window
name: Window name
fileName: Window process program file name
title: Window title (caption)
Array<int64> GetWindowsList()
Gets an array with handles to all the opened windows.
bool GetProcessList(Array<int64> &pid, Array<String> &pNames)
Gets arrays with handles to all the opened processes pid and process names pNames.
Array<int64> GetProcessList()
Gets an array with handles to all the opened processes
String GetProcessName(int64 pid)
Returns the process name for a process with handle pid.
String GetProcessFileName(int64 pid)
Gets the program file name of a process with handle pid.
int GetProcessCPUUsage(int64 pid)
Gets the percentage of CPU usage for process pid.
Only available in Windows
int64 GetProcessIdFromName(String name)
Gets the process handle of a program named name.
int64 GetProcessIdFromWindowCaption(String windowCaption, bool exactMatch = false)
Gets the process handle of a program with a window with title windowCaption.
If exactMatch.is true it only returns the process handle of a process with a window title that is equal to windowCaption. If it is false then the handle is returned if only part of the window title matches with windowCaption.
int64 GetWindowIdFromCaption(String windowCaption, bool exactMatch = false)
Gets the window handle of a program with a window with title windowCaption.
If exactMatch.is true it only returns the process handle of a process with a window title that is equal to windowCaption. If it is false then the handle is returned if only part of the window title matches with windowCaption.
int64 GetProcessIdFromWindowId(int64 wid)
Returns the process handle of a program with window handle wid.
int64 GetWindowIdFromProcessId(int64 pid)
Returns the window handle of a program with process handle pid.
bool ProcessTerminate(int64 pid, int timeout = 500)
Ends the program with handle pid.
If after asking the process to end timeout is over, it will kill the process by different means in order of increasing "agressivity".
For example in Posix it will send the process first a SIGTERM, if the process does not stop it will send a SIGKILL, and if the process remains running it will simply call WindowKill() to do the dirty job.
int GetProcessPriority(int64 pid)
Gets the process priority of the process with handle pid as a number from 0 (minimum) to 10 (maximum), if possible.
bool SetProcessPriority(int64 pid, int priority)
Sets the process priority to priority of the process with handle pid as a number from 0 (minimum) to 10 (maximum), if possible.
bool ProcessExists(int64 pid)
Returns true if a process with handle pid exists.
int64 GetProcessId()
Gets actual running process handle.
bool Shutdown(String action)
Tries to logoff, reboot or shutdown the actual running session.
Actual valid action values are "logoff", "reboot" and "shutdown".
bool Window_GetRect(int64 windowId, long &left, long &top, long &right, long &bottom)
Giving this function the windowId, it returns the window location in the screen in left, top, right and bottom.
Returns true if the values got are valid.
bool Window_SetRect(int64 windowId, long left, long top, long right, long bottom)
Giving this function the windowId, it sets the window location in the screen in left, top, right and bottom.
Returns true if the values got are valid.
void Window_Bottom(int64 windowId)
Moves windowId to the bottom of all windows.
void Window_Top(int64 windowId)
Moves windowId to the top of the windows.
void Window_TopMost(int64 windowId)
Moves windowId as the topmost window.
Mouse and keyboard handling
|
|
bool Mouse_GetPos(int &x, int &y)
Gets the mouse position x, y.in screen pixels where upper left corner is (0, 0).
Returns true if the operation has been done successfully.
bool Mouse_SetPos(int x, int y, int64 windowId)
Sets the mouse position to x y referenced to the upper left vertex of window with window handle windowId.
Returns true if the operation has been done successfully.
void Mouse_LeftClick()
Simulates by software a mouse click with the left button as if it would have been done with the mouse.
void Mouse_MiddleClick()
Simulates by software a mouse click with the middle button as if it would have been done with the mouse.
void Mouse_RightClick()
Simulates by software a mouse click with the right button as if it would have been done with the mouse.
void Mouse_LeftDblClick()
Simulates by software a mouse double click with the left button as if it would have been done with the mouse.
void Mouse_MiddleDblClick()
Simulates by software a mouse double click with the middle button as if it would have been done with the mouse.
void Mouse_RightDblClick()
Simulates by software a mouse double click with the right button as if it would have been done with the mouse.
void Mouse_LeftDown()
Simulates by software a mouse press with the left button as if it would have been done with the mouse.
Caution: The button will remain pressed after this function.
void Mouse_LeftUp()
Simulates by software a mouse release with the left button as if it would have been done with the mouse.
void Mouse_RightDown()
Simulates by software a mouse press with the right button as if it would have been done with the mouse.
Caution: The button will remain pressed after this function.
void Mouse_RightUp()
Simulates by software a mouse release with the right button as if it would have been done with the mouse.
void Mouse_MiddleDown()
Simulates by software a mouse press with the middle button as if it would have been done with the mouse.
Caution: The button will remain pressed after this function.
void Mouse_MiddleUp()
Simulates by software a mouse release with the middle button as if it would have been done with the mouse.
void Keyb_SendKeys(String text, long finalDelay = 100, long delayBetweenKeys = 50)
Simulates by software a text entered using the keyboard as if it would have been entered with the keyboard.
To really simulate manual key typing the function lets to enter delays between keys and after entering the text.
text: Is the text to be entered
finalDelay: Is the delay in ms that is forced after entering text
delayBetweenKeys: Is the delay in ms that is forced between text keys.
void GetKeyLockStatus(bool &caps, bool &num, bool &scroll)
Gets the status of keys caps lock, num lock and scroll lock. Not fully functional in Linux.
void SetKeyLockStatus(bool caps, bool num, bool scroll)
Sets the status of keys caps lock, num lock and scroll lock. Not fully functional in Linux.
bool Snap_Desktop(String fileName)
Saves the desktop in fileName.as an image file.
Allowed formats are:
Posix: xwd
Windows: bmp, png, jpg
Rect GetDesktopRect()
Gets the Desktop dimensions.
bool Snap_DesktopRectangle(String fileName, int left, int top, int width, int height)
Saves a rectangle of the desktop defined by left, top, width and height.in fileName as an image file.
Allowed formats are:
Posix: xwd
Windows: bmp, png, jpg
bool Snap_Window(String fileName, int64 handle)
Saves a window defined by its handle in fileName as an image file.
Allowed formats are:
Posix: xwd
Windows: bmp, png, jpg
Image Snap_Desktop()
Returns the desktop image.
Image Snap_DesktopRectangle(int left, int top, int width, int height)
Returns the image of a desktop rectangle defined by left, top, width and height.
Image Snap_Window(int64 handle)
Returns a window image defined by its handle.
bool Record_Desktop(String fileName, int duration, int secsFrame = 1, bool viewMouse = true)
Records the desktop activity in fileName as a video file of duration in seconds with secsFrame seconds between frames and recording also mouse movement if viewMouse.is true.
Allowed formats are:
Windows: Uncompressed .avi
Only available in Windows
bool Record_DesktopRectangle(String fileName, int duration, int left, int top, int width, int height, int secsFrame = 1, bool viewMouse = true)
Records the desktop activity in the rectangle defined by left, top, width and height. in fileName as a video file of duration in seconds with secsFrame seconds between frames and recording also mouse movement if viewMouse.is true.
Allowed formats are:
Windows: Uncompressed .avi
Only available in Windows
bool Record_Window(String fileName, int duration, int64 handle, int secsFrame = 1, bool viewMouse = true)
Records the activity of a window defined by its handle in fileName as a video file of duration in seconds with secsFrame seconds between frames and recording also mouse movement if viewMouse.is true.
Allowed formats are:
Windows: Uncompressed .avi
Only available in Windows
void SetDesktopWallPaper(char *path)
Sets path.file as desktop wallpaper. Supports Gnome, Kde v3 and Windows desktops.
In Gnome, path has to be .png
In Kde, path has to be .png, .gif or .jpg
In Windows, path has to be .bmp
If path.is empty, the desktop wallpaper is removed.
|