error C2065: 'CTL_CODE' : undeclared identifier

本文介绍在XPSp3系统及VC6.0环境中如何正确包含winioctl.h文件,以实现特定的功能需求。通过加入此头文件,可以为项目增加对Windows设备输入输出控制的支持。

xp sp3,vc6.0

需要加入#include <winioctl.h>

参考:http://bbs3.driverdevelop.com/read.php?tid-30487.html

void CtlWidget::endRtsp() { emit endPlayRtsp(); } void CtlWidget::loadPCDFile() { // 当前可执行程序所在目录 QString curEexPath = QDir::currentPath(); QString selectedFileName = QFileDialog::getOpenFileName(nullptr, tr("PCD文件选择"), curEexPath, "PCD(*.pcd)"); if(selectedFileName.isEmpty()) { QMessageBox::warning(nullptr, "警告", "文件名不能为空"); } else { emit sendSelectedPCDFile(selectedFileName); ui.pclLoadPCDFilePushBtn->setEnabled(false); } } void CtlWidget::allShowOnMainWindow() { emit allShow(); ui.rtspCtlGroup->setEnabled(true); ui.pclMapCtlGroupBox->setEnabled(true); } void CtlWidget::onlyShowPCDOnMainWindow() { emit onlyShowPCD(); ui.rtspCtlGroup->setEnabled(false); ui.pclMapCtlGroupBox->setEnabled(true); } void CtlWidget::onlyShowRtspOnMainWindow() { emit onlyShowRtsp(); ui.rtspCtlGroup->setEnabled(true); ui.pclMapCtlGroupBox->setEnabled(false); } void CtlWidget::onPTZCtl() { QPushButton* senderButton = qobject_cast<QPushButton*>(QObject::sender()); if(senderButton) { GUI_CTL_LOAD_MSG msg; if(senderButton->text() == GlobalConfig::GUI_CTL_PTZ_TO_UP) msg.ucPitch = 2; if(senderButton->text() == GlobalConfig::GUI_CTL_PTZ_TO_DOWN) msg.ucPitch = 1; if(senderButton->text() == GlobalConfig::GUI_CTL_PTZ_TO_LEFT) msg.ucYaw = 1; if(senderButton->text() == GlobalConfig::GUI_CTL_PTZ_TO_RIGHT) msg.ucYaw = 2; if(senderButton->text() == GlobalConfig::GUI_CTL_PTZ_TO_RESET) msg.ucReset = 1; msg.tail.cCheckCode = Gui::common::getXORSumByByte((const char *)&msg, sizeof(msg)); QByteArray data; data.resize(sizeof(msg)); memcpy(data.data(), &msg, sizeof(msg)); DataManage::instance().sendData(data); } } void CtlWidget::onMacNestCtl() { QPushButton* senderButton = qobject_cast<QPushButton*>(QObject::sender()); if(senderButton) { GUI_CTL_MSG_TO_MACNEST msg; msg.ucEnable = 1; // 控制指令 : b000:出舱, b001:入舱, b010:充电, b011:取消充电, b100:换电 if(senderButton->text() == GlobalConfig::GUI_CTL_MACNEST_CHARGE) msg.ucCtlCmd = 2; if(senderButton->text() == GlobalConfig::GUI_CTL_MACNEST_CANCEL_CHARGE) msg.ucCtlCmd = 3; if(senderButton->text() == GlobalConfig::GUI_CTL_MACNEST_ENTER_CABIN) msg.ucCtlCmd = 1; if(senderButton->text() == GlobalConfig::GUI_CTL_MACNEST_OUTER_BATTERY) msg.ucCtlCmd = 0; if(senderButton->text() == GlobalConfig::GUI_CTL_MACNEST_SWAP_BATTERY) msg.ucCtlCmd = 4; msg.tail.cCheckCode = Gui::common::getXORSumByByte((const char *)&msg, sizeof(msg)); QByteArray data; data.resize(sizeof(msg)); memcpy(data.data(), &msg, sizeof(msg)); DataManage::instance().sendData(data, 102); } } void CtlWidget::onSelectedTaskMode() { QPushButton* senderButton = qobject_cast<QPushButton*>(QObject::sender()); if(senderButton) { if(senderButton->text() == GlobalConfig::GUI_CTL_TASK_MODE_MAN_OPERATION) { TaskProcessor::instance().handleMan(); } if(senderButton->text() == GlobalConfig::GUI_CTL_TASK_MODE_NON_SCHEDULED_FIXED_INS) { TaskProcessor::instance().handNonScheduledTaskRoute(); } if(senderButton->text() == GlobalConfig::GUI_CTL_TASK_MODE_SPECIFY_TARGET) { TaskProcessor::instance().handleSpecifyTarget(); } } } void CtlWidget::onTaskControl() { QPushButton* senderButton = qobject_cast<QPushButton*>(QObject::sender()); if(senderButton) { if(senderButton->text() == GlobalConfig::GUI_CTL_TASK_CONTROL_STOP) { TaskProcessor::instance().stopCurTask(); } if(senderButton->text() == GlobalConfig::GUI_CTL_TASK_CONTROL_CONTINU) { TaskProcessor::instance().continuCurTask(); } if(senderButton->text() == GlobalConfig::GUI_CTL_TASK_CONTROL_MODE_RSET) { TaskProcessor::instance().reSetCurTaskMode(); } if(senderButton->text() == GlobalConfig::GUI_CTL_TASK_CONTROL_RETURN_NEST) { TaskProcessor::instance().returnNest(); } } } void CtlWidget::onVoiceCommCtl() { QPushButton* senderButton = qobject_cast<QPushButton*>(QObject::sender()); if(senderButton) { if(senderButton->text() == GlobalConfig::GUI_CTL_VOICE_COMM_START) { emit startAudioComm(); } if(senderButton->text() == GlobalConfig::GUI_CTL_VOICE_COMM_STOP) { emit stopAudioComm(); } if(senderButton->text() == GlobalConfig::GUI_CTL_VOICE_COMM_ONE_CLICK_SHOUTING) { } } } void CtlWidget::initWdtText() { ui.macNestCtlGroupBox->setTitle(GlobalConfig::GUI_CTL_MACNEST); ui.cancelChargePushBtn->setText(GlobalConfig::GUI_CTL_MACNEST_CANCEL_CHARGE); ui.chargePushBtn->setText(GlobalConfig::GUI_CTL_MACNEST_CHARGE); ui.swapBatteryPushBtn->setText(GlobalConfig::GUI_CTL_MACNEST_SWAP_BATTERY); ui.enterCabinPushBtn->setText(GlobalConfig::GUI_CTL_MACNEST_ENTER_CABIN); ui.outerCabinPushBtn->setText(GlobalConfig::GUI_CTL_MACNEST_OUTER_BATTERY); ui.PTZCtlGroupBox->setTitle(GlobalConfig::GUI_CTL_PTZ); ui.toUpPushBtn->setText(GlobalConfig::GUI_CTL_PTZ_TO_UP); ui.toDownPushBtn->setText(GlobalConfig::GUI_CTL_PTZ_TO_DOWN); ui.toLeftPushBtn->setText(GlobalConfig::GUI_CTL_PTZ_TO_LEFT); ui.toRightPushBtn->setText(GlobalConfig::GUI_CTL_PTZ_TO_RIGHT); ui.toMidPushBtn->setText(GlobalConfig::GUI_CTL_PTZ_TO_RESET); ui.taskSettingGroupBox->setTitle(GlobalConfig::GUI_CTL_TASK_SETTING); ui.addTaskRoutePushBtn->setText(GlobalConfig::GUI_CTL_TASK_SETTING_ADD_TASK_ROUTE); ui.taskModeGroupBox->setTitle(GlobalConfig::GUI_CTL_TASK_MODE); ui.manOperationPushBtn->setText(GlobalConfig::GUI_CTL_TASK_MODE_MAN_OPERATION); ui.nonScheduledFixedInsPushBtn->setText(GlobalConfig::GUI_CTL_TASK_MODE_NON_SCHEDULED_FIXED_INS); ui.specifyTargetPushBtn->setText(GlobalConfig::GUI_CTL_TASK_MODE_SPECIFY_TARGET); ui.mainShowgroupBox->setTitle(GlobalConfig::GUI_CTL_MAIN_SHOW); ui.allShowRadioBtn->setText(GlobalConfig::GUI_CTL_MAIN_SHOW_ALL_SHOW); ui.onlyShowRtspRadioBtn->setText(GlobalConfig::GUI_CTL_MAIN_SHOW_ONLY_SHOW_RTSP); ui.onlyShowPCDRadioBtn->setText(GlobalConfig::GUI_CTL_MAIN_SHOW_ONLY_SHOW_PCL); ui.rtspCtlGroup->setTitle(GlobalConfig::GUI_CTL_RTSP); ui.rtspStartPushBtn->setText(GlobalConfig::GUI_CTL_RTSP_START); ui.rtspStopContinuPushBtn->setText(GlobalConfig::GUI_CTL_RTSP_STOP); ui.rtspEndPushBtn->setText(GlobalConfig::GUI_CTL_RTSP_END); ui.rtspURLLineEdit->setText(GlobalConfig::GUI_CTL_RTSP_URL); ui.pclMapCtlGroupBox->setTitle(GlobalConfig::GUI_CTL_PCL); ui.pclResetPushBtn->setText(GlobalConfig::GUI_CTL_PCL_RESET); ui.pclZoomInPushBtn->setText(GlobalConfig::GUI_CTL_PCL_ZOOMIN); ui.pclZoomOutPushBtn->setText(GlobalConfig::GUI_CTL_PCL_ZOOMOUT); ui.pclFrontViewPushBtn->setText(GlobalConfig::GUI_CTL_PCL_FRONT_VIEW); ui.pclLoadPCDFilePushBtn->setText(GlobalConfig::GUI_CTL_PCL_LOAD_PCD_FILE); ui.taskCtlGroupBox->setTitle(GlobalConfig::GUI_CTL_TASK_CONTROL); ui.taskStopPushBtn->setText(GlobalConfig::GUI_CTL_TASK_CONTROL_STOP); ui.taskContinuPushBtn->setText(GlobalConfig::GUI_CTL_TASK_CONTROL_CONTINU); ui.taskModeResetPushBtn->setText(GlobalConfig::GUI_CTL_TASK_CONTROL_MODE_RSET); ui.taskReturnNestPushBtn->setText(GlobalConfig::GUI_CTL_TASK_CONTROL_RETURN_NEST); ui.voiceCommGroupBox->setTitle(GlobalConfig::GUI_CTL_VOICE_COMM); ui.voiceStart->setText(GlobalConfig::GUI_CTL_VOICE_COMM_START); ui.voiceStop->setText(GlobalConfig::GUI_CTL_VOICE_COMM_STOP); ui.voiceOneClickShouting->setText(GlobalConfig::GUI_CTL_VOICE_COMM_ONE_CLICK_SHOUTING); } 注释上述代码并保留原注释
09-12
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值