Jump to content

C++ DLL function call with return parameters


Einoss
 Share

Recommended Posts

I have a C++ DLL with some functions and below is one of them:

Quote

int api_RequestFunction (BYTE *bIPAddress, BYTE *bPort, BYTE* inRBuff, int *inRLen, int txtype, BYTE* panNo, BYTE* purAmount, BYTE *stanNo, BYTE *dataTime,
BYTE* expDate, BYTE* trxRrn, BYTE* aCode, BYTE* rCode, BYTE* tId, BYTE*
sId, BYTE* mId, BYTE* adAmnt, BYTE* ecrrefno, BYTE* version,
wchar_t* outresp, int* outRspLen)

 

  • The first 5 paramters are the input: bIPAddress, bPort, inReqBuff, inReqLen, txtype ("192.168.1.1" , "5000" , "100;100;200!" ,  "12" , 0)
  • The other paramters will contain the response.

my question is how can I call this function and access the response paramters values? I have tries many ways and followed a nice DLL handling tutorial found here but no luck! I'am still not good and try to learn the DLL handling with autoit

Thank you

Link to comment
Share on other sites

// Below is a reformatted version of what you originally posted, for readability.  
// No changes were made to the content.

int api_RequestFunction (
	BYTE  *bIPAddress,
	BYTE  *bPort,
	BYTE* inRBuff,
	int   *inRLen,
	int   txtype,
	BYTE* panNo,
	BYTE* purAmount,
	BYTE  *stanNo,
	BYTE  *dataTime,
	BYTE* expDate,
	BYTE* trxRrn,
	BYTE* aCode,
	BYTE* rCode,
	BYTE* tId,
	BYTE* sId,
	BYTE* mId,
	BYTE* adAmnt,
	BYTE* ecrrefno,
	BYTE* version,
	wchar_t* outresp,
	int* outRspLen
)

In terms of trying to help you, I'm not sure where to start.  Are you new to AutoIt, C/C++, or both?  Since you didn't post any AutoIt code to show what you've tried, I have no idea how skilled you are in AutoIt or where to begin.  Did you write the function that you posted?  If so, why are almost all of the strings defined as BYTE* instead of wchar*?  Why are some of the fields that appear to be numeric, defined as BYTE* instead of some numeric data type?  Have you tested/debugged this function to confirm that it produces the expected results?  If not, I suggest that you do that first.  When you know it is working, then you can go about getting a DllCall() working in AutoIt.  Since you are new to DLLs, I would also suggest starting with a small "test" exported DLL function that has only a few fields (of different data types) working before trying to work with a function that defines 20+ fields.  That way you can more easily learn the intricacies of how to get & set different data type values using the DllCall() function in AutoIt.

Edited by TheXman
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...