Track down, looked at why a memory, a not allocated yet
Problem description: call shandong telecom SMS, MMS interface telecom server in c # development, I call succeeds in c #, BCB XE7 below problems,
Other interface invocation is successful, the wrong SMS - this one interface & gt; BathSendSms (),
Part of the code:
_di_ISmsOperator SMS=GetISmsOperator ();
TStringDynArray a;
A. ength=1;
A [0]="13791678080";
DynamicArray
DynamicArray
//lead to the following error
MtMessageArray [0]=new mtMessage ();
MtMessageArray [0] - & gt; PhoneNumber=a;
MtMessageArray [0] - & gt; The content="13791678080 batch send";
SMS - & gt; BathSendSms (Edit1 - & gt; Text, EncodeStr (Edit2 - & gt; The Text), "", mtMessageArray);
CodePudding user response:
MtMessageArray. Length=1; Allocate space, no?CodePudding user response:
MtMessageArray. Length=1 in this step tracking is empty, see FRM, he can,
CodePudding user response:
MtMessageArray. Length=1This statement is executed, then check mtMessageArray information
MtMessage what type is it
CodePudding user response:
mtMessage define the import automatically generated when//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
//XML: mtMessage, global, & lt; ComplexType>
//Namespace: http://sms.jwsserver.server.ema.ctc.com/
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
The class mtMessage: public TRemotable {
Private:
UnicodeString Fcontent;
Bool Fcontent_Specified;
UnicodeString Fdemo;
Bool Fdemo_Specified;
Array_Of_string FphoneNumber;
Bool FphoneNumber_Specified;
TXSDateTime * FsendTime;
Bool FsendTime_Specified;
UnicodeString FsmsId;
Bool FsmsId_Specified;
UnicodeString FsubCode;
Bool FsubCode_Specified;
Void __fastcall Setcontent (int Index, UnicodeString _prop_val)
{Fcontent=_prop_val; Fcontent_Specified=true; }
Bool __fastcall content_Specified (int Index)
{return Fcontent_Specified; }
Void __fastcall Setdemo (int Index, UnicodeString _prop_val)
{Fdemo=_prop_val; Fdemo_Specified=true; }
Bool __fastcall demo_Specified (int Index)
{return Fdemo_Specified; }
Void __fastcall SetphoneNumber (int Index, Array_Of_string _prop_val)
{FphoneNumber=_prop_val; FphoneNumber_Specified=true; }
Bool __fastcall phoneNumber_Specified (int Index)
{return FphoneNumber_Specified; }
Void __fastcall SetsendTime (int Index, TXSDateTime * _prop_val)
{FsendTime=_prop_val; FsendTime_Specified=true; }
Bool __fastcall sendTime_Specified (int Index)
{return FsendTime_Specified; }
Void __fastcall SetsmsId (int Index, UnicodeString _prop_val)
{FsmsId=_prop_val; FsmsId_Specified=true; }
Bool __fastcall smsId_Specified (int Index)
{return FsmsId_Specified; }
Void __fastcall SetsubCode (int Index, UnicodeString _prop_val)
{FsubCode=_prop_val; FsubCode_Specified=true; }
Bool __fastcall subCode_Specified (int Index)
{return FsubCode_Specified; }
Public:
__fastcall ~ mtMessage ();
__published:
__property UnicodeString content={index=(IS_OPTN | IS_UNQL), read=Fcontent, write=Setcontent, stored=content_Specified};
__property UnicodeString demo={index=(IS_OPTN | IS_UNQL), read=Fdemo, write=Setdemo, stored=demo_Specified};
__property Array_Of_string phoneNumber={index=(IS_OPTN | IS_UNBD | IS_NLBL | IS_UNQL), read=FphoneNumber, write=SetphoneNumber, stored=phoneNumber_Specified};
__property TXSDateTime * sendTime={index=(IS_OPTN | IS_UNQL), read=FsendTime, write=SetsendTime, stored=sendTime_Specified};
__property UnicodeString smsId={index=(IS_OPTN | IS_UNQL), read=FsmsId, write=SetsmsId, stored=smsId_Specified};
__property UnicodeString subCode={index=(IS_OPTN | IS_UNQL), read=FsubCode, write=SetsubCode, stored=subCode_Specified};
};
CodePudding user response:
Don't use dynamic array to see? New an object directly try will have a problem?CodePudding user response:
MtMessageArray. Length=1After the statement execution, mtMessageArray is empty
CodePudding user response:
New Ok directly