tags:

views:

197

answers:

1

Hi,

I need to call hllapi function of pcshll32.dll using delphi. It's works with personal communications of ibm. How can i change the code bellow to delphi ? Thanks !!!

The EHLLAPI entry point (hllapi) is always called with the following four parameters:

  1. EHLLAPI Function Number (input)
  2. Data Buffer (input/output)
  3. Buffer Length (input/output)
  4. Presentation Space Position (input); Return Code (output)

The prototype for IBM Standard EHLLAPI is: [long hllapi (LPWORD, LPSTR, LPWORD, LPWORD); The prototype for IBM Enhanced EHLLAPI is: [long hllapi (LPINT, LPSTR, LPINT, LPINT);

Each parameter is passed by reference not by value. Thus each parameter to the function call must be a pointer to the value, not the value itself. For example, the following is a correct example of calling the EHLLAPI Query Session Status function:

#include "hapi_c.h"
struct HLDQuerySessionStatus QueryData;
int Func, Len, Rc;
long Rc;
memset(QueryData, 0, sizeof(QueryData)); // Init buffer

QueryData.qsst_shortname = ©A©; // Session to query
Func = HA_QUERY_SESSION_STATUS; // Function number
Len = sizeof(QueryData); // Len of buffer
Rc = 0; // Unused on input
hllapi(&Func, (char *)&QueryData, &Len, &Rc); // Call EHLLAPI
if (Rc != 0) { // Check return code
// ...Error handling
}

All the parameters in the hllapi call are pointers and the return code of the EHLLAPI function is returned in the value of the 4th parameter, not as the value of the function.

A: 

You need to convert hapi_c.h to Delphi first (if you have never done that before you might want to start reading here: Rudy's Delphi Corner: Pitfalls of Converting

Remko