Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The LMX_Hostid function retrieves the HostID values from the computer system.

Prototype

Code Block
languagecpp
LMX_STATUS LMX_Hostid
(
   LMX_HANDLE LmxHandle,
   LMX_HOSTID_TYPE eHostidType,
   LMX_HOSTID *lpHostid,
   int *npHostids
);

Parameters

LmxHandle
[in/out] LM-X handle.

...

npHostids
[out] Pointer to a variable that will hold the number of HostIDs of a specific type retrieved. If no HostIDs are available of the type requested, this variable will be set to zero.

Return values

On success, this function returns the status code LMX_SUCCESS.

On failure, this function returns an error code in the format described in Return codes.

Remarks

To make use of custom HostIDs, you must set a callback function using LMX_SetOption with the flag LMX_OPT_CUSTOM_HOSTID_FUNCTION.

...

Code Block
languagecpp
#include <lmx.h>
#include <stdio.h>

LMX_HANDLE h;

int main() 
{
  LMX_HOSTID hostID[LMX_MAX_HOSTIDS];
  int nbHosts, i;

  exit_on_error(LMX_Init(&h));
  exit_on_error(LMX_Hostid(h, LMX_HOSTID_ALL, hostID, &nbHosts));
  printf("HostIDs found: %d\n", nbHosts);
  
  for(i = 0; i < nbHosts; ++i) 
  {
    printf("Host Type: %d\n", hostID[i].eHostidType);
    printf("Description: %s\n", hostID[i].szDescription);
    printf("Value: %s\n\n", hostID[i].szValue);
  }

  return 0;
}

...