Barcode Xpress如何在Visual C++中做爲COM對象使用(3)

  在前面的文章《 Barcode Xpress 教程:如何在Visual C++ 中做爲COM 對象使用》的前兩篇文章中,對於在Visual C++中如何將 Barcode Xpress做爲一個導入的COM 對象使用的給出了部分示例代碼,下面將給出最後的示例代碼。

5、使用BarcodeXpress的COM對象來設置屬性和調用方法 html

    BarcodeXpress COM對象實例建立以後,這個對象能夠用於設置BarcodeXpress屬性和調用BarcodeXpress方法。在 ReadBarcodeFromDIB項目中,會在OnDetectButton函數中像下面這樣子說明。當用戶點擊Recognized Barcode 按鈕時就會調用這個函數。 函數

  1. void CReadBarcodeFromDIBDlg::OnDetectButton()  
  2. {  
  3. // TODO: Add your control notification handler code here  
  4. // Set barcode classification type based on selected radio button  
  5. switch(m_selection)  
  6. {  
  7. case 0:  
  8. {  
  9. barcodetype = 0; //1D  
  10. break;  
  11. }  
  12. case 1:  
  13. {  
  14. barcodetype = 524288; //Patch  
  15. break;  
  16. }  
  17. case 2:  
  18. {  
  19. barcodetype = 0x4000000; //OneCode  
  20. break;  
  21. }  
  22. case 3:  
  23. {  
  24. barcodetype = 2097152; //PDF  
  25. break;  
  26. }  
  27. case 4:  
  28. {  
  29. barcodetype = 4194304; //DataMatrix  
  30. break;  
  31. }  
  32. case 5:  
  33. {  
  34. barcodetype = 0x8000000; //Royal Post  
  35. break;  
  36. }  

>>> 完整示例代碼

6、刪除BarcodeXpress COM對象 spa

     當再也不須要BarcodeXpress COM對象時,就必須刪除它。一般在應用程序退出以前刪除這個對象。在ReadBarcodeFromDIB項目中,這個COM對象能夠像下面這樣刪除。 .net

>>>完整示例代碼 code

>>> Barcode Xpress 下載
相關文章
相關標籤/搜索