{"id":527,"date":"2012-11-23T14:44:39","date_gmt":"2012-11-23T14:44:39","guid":{"rendered":"http:\/\/www.bardecode.com\/en1\/?p=527"},"modified":"2013-03-05T11:37:02","modified_gmt":"2013-03-05T11:37:02","slug":"code-snippets-for-visual-c","status":"publish","type":"post","link":"https:\/\/www.bardecode.com\/en1\/code-snippets-for-visual-c\/","title":{"rendered":"Code snippets for Visual C++"},"content":{"rendered":"<p>This article shows 2 simple visual c++ code snippets that use either the standard windows dll or the com object for the toolkit.<\/p>\n<p><strong>Standard Windows DLL<\/strong><\/p>\n<p><strong>hBarcode = mtCreateBarcodeInstance() ;<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>\/\/Set properties<\/p>\n<p>mtSetReadCode128 (hBarcode, 1) ;<\/p>\n<p>\/\/Read barcodes<br \/>\nint nBarCodes = mtScanBarCode(hBarcode, m_ImageFile) ;<\/p>\n<p>\/\/Get results<br \/>\nfor (int i = 1; i &lt;= nBarCodes; i++)<br \/>\nCString strBarCode = mtGetBarString(hBarcode, i) ;<\/p>\n<p>mtDestroyBarcodeInstance(hBarcode) ;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>ActiveX\/OCX Interface<\/strong><\/p>\n<p>\/\/Set properties<br \/>\nm_barcode.SetReadCode128 (1) ;<\/p>\n<p>\/\/Read barcodes<br \/>\nint nBarCodes = m_barcode.ScanBarCode(m_ImageFile) ;<\/p>\n<p>\/\/Get results<br \/>\nfor (int i = 1; i &lt;= nBarCodes; i++)<br \/>\nCString strBarCode = m_barcode.GetBarString(i) ;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article shows 2 simple visual c++ code snippets that use either the standard windows dll or the com object for the toolkit. Standard Windows DLL hBarcode = mtCreateBarcodeInstance() ; &nbsp; \/\/Set properties mtSetReadCode128 (hBarcode, 1) ; \/\/Read barcodes int nBarCodes = mtScanBarCode(hBarcode, m_ImageFile) ; \/\/Get results for (int i = 1; i &lt;= nBarCodes;<\/p>\n<p><a href=\"https:\/\/www.bardecode.com\/en1\/code-snippets-for-visual-c\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":330,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,31],"tags":[67,19,58,66,64,65,62,63],"class_list":["post-527","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledge-base","category-software-development-kits","tag-activex","tag-barcode","tag-code","tag-development","tag-microsoft","tag-sdk-2","tag-software","tag-visual-c"],"_links":{"self":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/527"}],"collection":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/comments?post=527"}],"version-history":[{"count":3,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/527\/revisions"}],"predecessor-version":[{"id":529,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/527\/revisions\/529"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media\/330"}],"wp:attachment":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media?parent=527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/categories?post=527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/tags?post=527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}