没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
原创|行业资讯|编辑:郝浩|2013-09-25 10:12:10.000|阅读 295 次
概述:在提供了容器支持如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@ke049m.cn
文章转载自:慧都控件



Tech Soft 3D 正式整合旗下 SDK 工具包,构建以数据、图形、仿真和建模为核心的 HOOPS 产品体系
在当今的数据驱动时代,Python 开发者经常需要将列表(一种基本的 Python 数据结构)转换为 Excel 电子表格。Excel 作为各行业通用的数据展示、报告生成与信息共享工具,无论是生成业务报告、准备分析数据,还是与非技术人员协作,掌握将 Python 列表导出为 Excel 的高效方法都至关重要。
本篇教程,我们将学习如何使用Aspose.CAD for Python via .NET将 SVG 转换为PNG 。这款 3D CAD SDK 有助于实现单个文件和多个文件格式转换的自动化。我们将编写一个完整的代码示例,以演示Aspose.CAD for Python via .NET的可用性和效率。
在制造业数字化项目中,让数据流动起来,往往比让设备动起来还难。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@ke049m.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
半岛外围网上直营