Jump to content

DllCall() with C example - struct in call


Skysnake
 Share

Recommended Posts

bool SMSAPI_sendsms(
const LPSMSAPI_NETWORKCONFIGURATION lpNetConfig, 
const LPSMSAPI_ACCOUNTINFO lpAccInfo, 
const LPSMSAPI_MESSAGEINFO lpMsgInfo, 
LPSMSAPI_RESPONSEINFO lpResponseInfo);

How does one call this in an AutoIt DllCall() - I do not see "const" conversions and how does one insert the pointers?

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

You should do something like this.

;~ First declare your structures
Local $tnetworkConfiguration=DllStructCreate($sTagSMSAPI_NETWORKCONFIGURATION)
Local $taccountInfo=DllStructCreate($sTagSMSAPI_ACCOUNTINFO)
Local $tmessageInfo=DllStructCreate($sTagSMSAPI_MESSAGEINFO)
Local $tresponseInfo=DllStructCreate($sTagSMSAPI_RESPONSEINFO)

;~ Set defaults values initialize_defaults

DllCall($h_smstxt32,"bool","sms_initialize_defaults","ptr",DllStructGetPtr($tnetworkConfiguration),"int",DllStructGetSize($tnetworkConfiguration))
DllCall($h_smstxt32,"bool","sms_initialize_defaults","ptr",DllStructGetPtr( $taccountInfo),"int",DllStructGetSize($taccountInfo))
DllCall($h_smstxt32,"bool","sms_initialize_defaults","ptr",DllStructGetPtr($tmessageInfo),"int",DllStructGetSize($tmessageInfo))
DllCall($h_smstxt32,"bool","sms_initialize_defaults","ptr",DllStructGetPtr($tresponseInfo),"int",DllStructGetSize($tresponseInfo))



;~ set some details
$tnetworkConfiguration.nIdealPort = 80;                 //-- use the standard HTTP internet port
$taccountInfo.defaultServerID = (SMSAPI_SERVER)serverID;    //-- connect to the South Africa commerce server
$taccountInfo.szSMSAPIUsername,lpszUsername);       //-- set the bulksms account username
$taccountInfo.szSMSAPIPassword,lpszPassword);       //-- set the bulksms account password   
$tmessageInfo.szMessageText,lpszMessage);           //-- set the message text
$tmessageInfo.lpszCommaSeperatedMobileList = lpszMobile;    //-- set the message recipient list (comma seperated)

;~ then call sendsms

DllCall($h_smstxt32,"bool","sms_sendsms","ptr",DllStructGetPtr($tnetworkConfiguration),"ptr",DllStructGetPtr($taccountInfo),"ptr",DllStructGetPtr($tmessageInfo),"ptr",DllStructGetPtr($tresponseInfo))

Saludos

Edited by Danyfirex
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

×
×
  • Create New...