KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: The 4D Open APIs - Part V: Displaying Information about the processes Running on
PRODUCT: 4D | VERSION: 6.7 | PLATFORM: Mac & Win
Published On: August 3, 2001
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

void DisplayProcessInfo(void)

{

ListProcessHandle hList = 0L;

ListProcessPtr pList;

int2 i;


Check(_4D_GetNbUsers(hConnect, &i),"_4D_GetNbUsers\0");

printf("GetNbUsers : %d\n", i);

Check(_4D_GetNbUserProcesses(hConnect, &i),"_4D_GetNbUserProcesses\0");

printf("GetNbUserProcesses : %d\n", i);

Check(_4D_GetListProcess(hConnect, &hList),"_4D_GetListProcess\0");

pList = (ListProcessPtr) Lock4DHandle((Handle4D)hList);

for ( i = 0 ; i < pList->NB_Process ; i ++ ) {

printf("GetListProcess_ProcessInfo[%d]_UserName : %s\n", i, PversCstring(pList->Processes[i].UserName));

printf("GetListProcess_ProcessInfo[%d]_StationName : %s\n", i, PversCstring(pList->Processes[i].StationName));

printf("GetListProcess_ProcessInfo[%d]_Taskname : %s\n", i, PversCstring(pList->Processes[i].Taskname));

printf("GetListProcess_ProcessInfo[%d]_TotalTimeSpent : %ld ticks\n", i, pList->Processes[i].TotalTimeSpent);

printf("GetListProcess_ProcessInfo[%d]_State : %d\n", i, pList->Processes[i].State);

}

Unlock4DHandle((Handle4D)hList);

Free4DHandle((Handle4D)hList);

}

void main(void)

{

initialisation();

_4D_Init4DWS();

printf("4D Server Version number is: %ld\n", (_4D_GetVersionNumber()>>16));

printf("The number of network components used is %ld\n",_4D_NB_NetworkComponent());

printf("\n");

hNetworkComponent= _4D_InitNetworkComponent(KNC);

if(hNetworkComponent)

{

if(!StartWSConnection())

{

DisplayServerInfo();

DisplayProcessInfo();

DisplayStructureInfo();

CloseWSConnection();

}

_4D_DeInitNetworkComponent(KNC,hNetworkComponent);

}

_4D_DeInit4DWS();

}