Для Builder'а не знаю, но для VisualC можно так
Файл "aosmgr.h"
X++:
#ifndef _AOSMGR_H_
#define _AOSMGR_H_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <windef.h>
typedef UINT (CALLBACK * LPFNDLLAOSSTATUS)(char* Host, char* AOSname);
typedef UINT (CALLBACK * LPFNDLLAOSSTART)(char* Host, char* AOSname);
typedef UINT (CALLBACK * LPFNDLLAOSSTOP)(char* Host, char* AOSname);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
файл "AxAosMgr.cpp" - пример консольного приложения, выводящего информацию о статусе AOS. Использование функций старта/остановки AOS аналогично
X++:
// AxAosMgr.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <malloc.h>
#include "aosmgr.h"
char * GetStatusStr(int _status)
{
switch (_status)
{
case 1:
return "AOS остановлен";
case 2:
return "AOS запускается";
case 3:
return "AOS останавливается";
case 4:
return "AOS запущен";
case -1:
return "Connection timed out";
case -2:
return "Connection refused";
case -3:
return "Protocol error";
case -4:
return "Server manager not started";
case -5:
return "AOS stopped";
case -6:
return "AOS start pending";
case -7:
return "AOS stop pending";
case -8:
return "AOS running";
case -9:
return "AOS not found on server";
case -10:
return "Cannot assign requested address";
case -11:
return "Unknown TCP error";
case -12:
return "AOS unknown status";
case -13:
return "Access denied";
case -14:
return "Service error";
case -15:
return "Invalid Axapta Service Name";
case -16:
return "Service Does Not Exist";
case -17:
return "Service Not Started";
case -18:
return "Server Unavailable";
default:
return "Unknown status";
}
}
int _tmain(int argc, _TCHAR* argv[])
{
HINSTANCE hDLL;
LPFNDLLAOSSTATUS AOSStatus;
LPFNDLLAOSSTART AOSStart;
LPFNDLLAOSSTOP AOSStop;
char* msg;
hDLL = LoadLibrary("AosMgr.dll");
if (hDLL != NULL)
{
AOSStatus = (LPFNDLLAOSSTATUS)GetProcAddress(hDLL, "AosStatus");
if (!AOSStatus)
{
FreeLibrary(hDLL);
return -1;
}
/* AOSStart = (LPFNDLLAOSSTART)GetProcAddress(hDLL, "AosStart");
AOSStop = (LPFNDLLAOSSTOP)GetProcAddress(hDLL, "AosStop");*/
msg = GetStatusStr(AOSStatus("Axapta", "Axapta"));
if (msg)
{
char * buf = (char*) malloc(strlen(msg)+1);
strcpy(buf, msg);
CharToOem(buf, buf);
printf("%s\n", buf);
free(buf);
}
}
return 0;
}