首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

求:vc++小源码转换DELPHI解决方法

2012-02-29 
求:vc++小源码转换DELPHIvoid CClientDemoDlg::ProcSensorAlarm(WPARAM wParam, LPARAM lParam){//LPLOCAL

求:vc++小源码转换DELPHI
void CClientDemoDlg::ProcSensorAlarm(WPARAM wParam, LPARAM lParam)
{
  //LPLOCAL_ALARM_INFO结构体
  LPLOCAL_ALARM_INFO pAlarmDev = (LPLOCAL_ALARM_INFO)(wParam);
  char *pAlarmInfo = (char *)(lParam);
  //iDeviceIndex结构体中的一个值
  int iDeviceIndex = pAlarmDev->iDeviceIndex;
   
  NET_DVR_SENSOR_ALARM struSensorAlarm = {0};
  memcpy(&struSensorAlarm, pAlarmInfo, sizeof(struSensorAlarm));
   
  memcpy(&m_struSensorAlarm[struSensorAlarm.bySensorChannel - 1], &struSensorAlarm, sizeof(struSensorAlarm));
   
  char szLan[1024] = {0};
   
  sprintf(szLan, "Sensor Alarm:AbsTime[%d]Name[%s]SensorChan[%d]Type[%d]AlramType[%d]AlarmMode[%u]Value[%f]",
  struSensorAlarm.dwAbsTime, struSensorAlarm.byName, struSensorAlarm.bySensorChannel,
  struSensorAlarm.byType, struSensorAlarm.byAlarmType, struSensorAlarm.byAlarmMode, struSensorAlarm.fValue);
  g_pMainDlg->AddLog(iDeviceIndex, ALARM_INFO_T, szLan);
  if (g_pDlgSensor != NULL)
  {
  g_pDlgSensor->SetSensorDate(struSensorAlarm);
  }
   
}

[解决办法]
没有上下文,看不懂
[解决办法]
type 
LPLOCAL_ALARM_INFO=^LOCAL_ALARM_INFO;
LOCAL_ALARM_INFO=record
iDeviceIndex:integer;
lCommand:LongInt;
end;
类似于这样的语句可以这样翻译
1、memcpy(&struSensorAlarm, pAlarmInfo, sizeof(struSensorAlarm));
<===>
Move(struSensorAlarm,pAlarmInfo,sizeof(struSensorAlarm));
2、sprintf函数功能类似于Format函数
其他都是一些数据类型的转换可以参考:
Delphi 与 C/C++ 数据类型对照表
[解决办法]
pAlarmDev:=LPLOCAL_ALARM_INFO(wParam);
第一句是这个,手误了。
[解决办法]
占个位置
继续努力学习中..........
顶顶帖子,接分中........





顶顶帖子,高手们也请多多赐教
http://topic.csdn.net/u/20110913/13/59f92d11-1fb0-4b7e-9c4a-e93d8f19c689.html
http://topic.csdn.net/u/20110611/12/3258c959-4f28-46b7-b5d6-46135d73036b.html
http://topic.csdn.net/u/20110722/14/89f7440b-c4d7-4c9a-a4bb-a503f5135db2.html
http://topic.csdn.net/u/20110729/10/a7bfaf06-0cf9-4580-8e91-d4e0b92066c6.html
http://topic.csdn.net/u/20110811/16/e56e7cc1-d8c9-40af-92e3-c24ca103d17d.html
http://topic.csdn.net/u/20110830/13/dfae4ca5-d2b9-4889-8a3c-6f7fb61936c9.html
http://topic.csdn.net/u/20110905/12/a1161adb-8e5d-491a-b302-c9722edf2dab.html
http://topic.csdn.net/u/20110913/16/2dbcc9db-8f71-40c5-901f-afae9026f7c2.html
http://topic.csdn.net/u/20110913/13/59f92d11-1fb0-4b7e-9c4a-e93d8f19c689.html

热点排行