Barcode Xpress如何在Visual C++中作为COM对象使用(2)
2013-09-25 00:00
363 查看
在前面的文章
《
Barcode Xpress使用教程:如何在Visual C++中作为COM对象使用(1)》中已经对在Visual C++中如何将
Barcode Xpress作为一个导入的COM 对象使用的步骤做了一些讲解,下面将继续上文。
三、初始化COM
在COM函数可以被调用之前,这个必须先初始化COM库,并且在程序退出之前必须关闭。在ReadBarcodeFromDIB.cpp文件中像下面这样说明:
[cpp]
view plain
copy
// 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
>>>
完整代码
四、创建BarcodeXpress COM对象
要使用BarcodeXpress,需要创建一个BarcodeXpress COM实例。在对象被创建之后,对象的属性和方法可以用于创建你的扫描应用程序。在ReadBarcodeFromDIB项目中,这个COM对象在 ReadBarcodeFromDIBDlg.cpp文件中如下创建:
[cpp]
view plain
copy
// 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);
}
>>>完整代码
>>>Barcode Xpress 下载
《
Barcode Xpress使用教程:如何在Visual C++中作为COM对象使用(1)》中已经对在Visual C++中如何将
Barcode Xpress作为一个导入的COM 对象使用的步骤做了一些讲解,下面将继续上文。
三、初始化COM
在COM函数可以被调用之前,这个必须先初始化COM库,并且在程序退出之前必须关闭。在ReadBarcodeFromDIB.cpp文件中像下面这样说明:
[cpp]
view plain
copy
// 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
>>>
完整代码
四、创建BarcodeXpress COM对象
要使用BarcodeXpress,需要创建一个BarcodeXpress COM实例。在对象被创建之后,对象的属性和方法可以用于创建你的扫描应用程序。在ReadBarcodeFromDIB项目中,这个COM对象在 ReadBarcodeFromDIBDlg.cpp文件中如下创建:
[cpp]
view plain
copy
// 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);
}
>>>完整代码
>>>Barcode Xpress 下载
相关文章推荐
- 专业视频制作的软件 Avid Xpress Pro HD v5.6.3英文版
- BarCode条形码基于C# GDI+ 的实现方法详解
- C#绘制条码CODE39和CODE39全码模式
- 微软终止2D条码:条形码是否前景堪忧
- 条码读写控件Barcode Xpress如何进行条形码识别
- 如何将ImagXpress对象的图像数据转移到Barcode Xpress对象上
- Barcode Xpress如何在Visual C++中作为COM对象使用(1)
- 条形码在交互式PDF表单中的应用 推荐
- ZBar Barcode Reader
- 【更新】条形码组件Aspose.BarCode 10月新版V17.10发布 | 附下载
- 条形码研究-EAN13 条形码
- Java onbarcode和barcode4j生成条形码实例
- Barcode Xpress如何为条码识别获取图像
- 条码控件Barcode Xpress如何获得条码检测结果
- Barcode Xpress如何在Visual C++中作为COM对象使用(3)
- C语言打印圣诞树
- 编程基础------C和C++函数的相互引用----C++中extern “C”含义
- LIB和DLL的区别与使用
- VC++ win32 多线程 一边画圆一边画矩形
- 走进C++程序世界------继承和派生