Home > Back-end >  Prompt access violation at address 00 d2460b module in 'BORLNDMM. DLL' mistakes
Prompt access violation at address 00 d2460b module in 'BORLNDMM. DLL' mistakes

Time:09-28

Retrieve the time key, as there is no problem for the first time, press the second will prompt wrong, which help under, follows the c + + BUILDER6 source


 void __fastcall TfrmMain: : btnGetTimeClick (TObject * Sender) 
{
LONG iMachineId=1;

LONG iYear=0;
LONG * pYear=& amp; IYear;

LONG iMonth=0;
LONG * pMonth=& amp; IMonth;

LONG iDay=0;
LONG * pDay=& amp; IDay;

LONG iHour=0;
LONG * pHour=& amp; IHour;

LONG iMinute=0;
LONG * pMinute=& amp; IMinute;

LONG iSecond=0;
LONG * pSecond=& amp; ISecond;

AnsiString sTimeMsg="";

WideString sIP="";
Would be * wpIP=NULL;
for(int i=0; i{
If (CheckListBoxDevs - & gt; Checked [I])
{
AddMsg (" you have chosen: "+ CheckListBoxDevs - & gt; The Items - & gt; Strings [I]);
SIP=CheckListBoxDevs - & gt; The Items - & gt; Strings [I];
WpIP=sIP;

If (CZKEM1 - & gt; Connect_Net (wpIP, 4370))
{
AddMsg (" equipment connection success!" );
CZKEM1 - & gt; GetDeviceTime (iMachineId pYear, pMonth pDay, pHour, pMinute, pSecond);
STimeMsg=IntToStr (iYear) + "-" + IntToStr (iMonth) + "-" + IntToStr (iDay) + "" + IntToStr (iHour) +" : "+ IntToStr (iMinute) +" : "+ IntToStr (iSecond);
AddMsg (" equipment time: "+ sTimeMsg);
}
The else
{
AddMsg (" equipment connection fails! IP is: "+ CheckListBoxDevs - & gt; The Items - & gt; Strings [I]);
}
CZKEM1 - & gt; Disconnect ();
}
}
if(NULL !=wpIP)
{
Delete the wpIP;
}

}

CodePudding user response:

WpIP=sIP;
It is sheer nonsense, remove the wpIP sample shut all
If (CZKEM1 - & gt; Connect_Net (wpIP, 4370))
Change
If (CZKEM1 - & gt; Connect_Net (sIP) c_bstr (), 4370))
Can,
In addition, GetDeviceTime function in the iYear/iMonth etc directly to the variables plus & amp; Direct generation inside is ok, don't gild the lily to define so many LONG * object,
  • Related