没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
原创|行业资讯|编辑:郝浩|2013-09-25 10:12:10.000|阅读 261 次
概述:在提供了容器支持如Visual Basic或Visual C++的开发环境中,barcode Xpress可以被作为一个ActiveX控件使用。在Visual C++中如何将Barcode Xpress作为一个导入的COM 对象使用呢?下面来具体的讨论一下。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
在前面的文章《Barcode Xpress使用教程:如何在Visual C++中作为COM对象使用(1)》中已经对在Visual C++中如何将Barcode Xpress作为一个导入的COM 对象使用的步骤做了一些讲解,下面将继续上文。
三、初始化COM
在COM函数可以被调用之前,这个必须先初始化COM库,并且在程序退出之前必须关闭。在ReadBarcodeFromDIB.cpp文件中像下面这样说明:
// CReadBarcodeFromDIBApp initialization BOOL CReadBarcodeFromDIBApp::InitInstance() { // Initialize the COM library on the current apartment and identify // the currency model as single-thread apartment (STA). Applications // must initialize the COM // library before they can call COM library functions other than // CoGetMalloc and memory allocation functions. HRESULT hRes = CoInitialize(NULL); AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif CReadBarcodeFromDIBDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Closes the COM library on the current apartment, // unloads all DLLs loaded by apartment, // frees any other resources that the apartment maintains, and // forces all RPC connections on the apartment to close. CoUninitialize(); // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
四、创建BarcodeXpress COM对象
要使用BarcodeXpress,需要创建一个BarcodeXpress COM实例。在对象被创建之后,对象的属性和方法可以用于创建你的扫描应用程序。在ReadBarcodeFromDIB项目中,这个COM对象在 ReadBarcodeFromDIBDlg.cpp文件中如下创建:
// CReadBarcodeFromDIBDlg message handlers BOOL CReadBarcodeFromDIBDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here CWnd* pControl = NULL; pControl = GetDlgItem(Description); if (pControl) { pControl->SetWindowText(lpctstrDescription); } CRect oIXArea; oIXArea.left = 25; oIXArea.top = 215; oIXArea.right = 725; oIXArea.bottom = 636; // Create an ImagXpress Object m_ppCImagXpress = new CImagXpress(this, 1, (long) m_hWnd, oIXArea.left, oIXArea.top, oIXArea.Width(), oIXArea.Height()); m_pImagXpress = m_ppCImagXpress->pImagXpress; m_pImagXpress->PutCtlVisible(true); m_pImagXpress->AutoSize = ISIZE_BestFit; m_pImagXpress->ScrollBars = SB_Both; m_pImagXpress->MenuSetEnabled(Menu_Context,TOOL_None, true); // **Initialize Barcode. You must call BC_Open before // **creating the first BarcodeXpress COM object. You cannot distribute applications using // **BarcodeXpress COM objects without valid unlock codes. // Create a BarcodeXpress class object. The BarcodeXpress // class object automatically creates a Barcode Xpress // COM object. m_ppIBarcodeXpress = new CBarcodeXpress(this, 1); // The SetSolutionName, SetSolutionKey and possibly the SetOEMLicenseKey method must be // called to distribute the runtime. Note that the SolutionName, SolutionKey and // OEMLicenseKey values shown below are only examples. // //m_pBarcodeXpress->SetSolutionName("YourSolutionName"); //m_pBarcodeXpress->SetSolutionKey(12345, 12345, 12345, 12345); //m_pBarcodeXpress->SetOEMLicenseKey("1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation..."); // //m_pImagXpress->SetSolutionName("YourSolutionName"); //m_pImagXpress->SetSolutionKey(12345, 12345, 12345, 12345); //m_pImagXpress->SetOEMLicenseKey("1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation..."); // Get the pointer to the created BarcodeXpress Barcode COM object. // This is the pointer that you will use to access BarcodeXpress // Barcode properties and methods. m_pBarcodeXpress = m_ppIBarcodeXpress->pBarcodeXpress; // Close the BarcodeXpress Barcode initialization. // You must call this AFTER creating the first BarcodeXpress Barcode // COM object m_1D.SetCheck(BST_CHECKED); m_selection = 0; m_pImagXpress->FileName = "..\\..\\..\\..\\..\\..\\Common\\Images\\Barcode All Supported Types.tif"; return TRUE; // return TRUE unless you set the focus to a control }>>>Barcode Xpress 下载
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@obta.cn
文章转载自:慧都控件在自动化GUI测试领域,面对日益复杂的动态Web界面和频繁变化的软件控件,传统的单一对象识别技术和脆弱易碎的测试脚本已成为效率提升的主要瓶颈。Web测试工具TestComplete通过完整的对象识别引擎以及AI驱动的自我修复来降低维护成本,保障大规模自动化测试套件的长期可靠运行。本文将介绍这些技术以及其在实际场景中的应用。
还在为脆弱的测试环境、强外部依赖和低效的测试复用拖慢交付而头疼?尤其在银行、医疗、制造等关键领域,传统的端到端测试常因环境不稳、接口难模拟、用例难共享而举步维艰。灰盒级SOA测试工具Parasoft SOAtest以可视化编排简化复杂测试流程,用环境虚拟化消除外部依赖,更通过组件复用实现跨国测试资产共享,让端到端测试从被动排查转变为主动防御。
作为面向工程软件开发者的高级渲染解决方案,HOOPS Luminate将先进的实时渲染与物理级光线追踪完美结合,助力开发团队打造超越预期的视觉体验与交互性能。
HOOPS SDK产品组合为船舶及海工软件提供从CAD数据访问、可视化到跨平台协作的全流程支持。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@obta.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢