{"id":618,"date":"2012-11-27T09:59:12","date_gmt":"2012-11-27T09:59:12","guid":{"rendered":"http:\/\/www.bardecode.com\/en1\/?p=618"},"modified":"2013-02-26T11:29:35","modified_gmt":"2013-02-26T11:29:35","slug":"using-the-multi-threaded-set-of-dll-functions","status":"publish","type":"post","link":"https:\/\/www.bardecode.com\/en1\/using-the-multi-threaded-set-of-dll-functions\/","title":{"rendered":"Using the Multi-Threaded set of dll functions"},"content":{"rendered":"<p>The SoftekBarcode.dll includes a set of functions suitable for use in multi-threaded applications. The multi-threaded functions all require a handle to the toolkit. This is created using the mtCreateBarcodeSession function and released using the mtDestroyBarcodeSession function:<\/p>\n<address>hBarcode = mtCreateBarcodeInstance()<\/address>\n<address>nBarcodes = mtScanBarCode(hBarcode, \u201cinput.tif\u201d)<\/address>\n<address>&#8230;process the result in some way<\/address>\n<address>mtDestroyBarcodeInstance(hBarcode)<\/address>\n<p>&nbsp;<\/p>\n<p>All the multi-threaded functions begin with &#8220;mt&#8221; and exactly mirror the &#8220;st&#8221; set of functions. For example, the function stSetReadCode39(bool value) can be used to control whether the sdk reads Code 39 barcodes, and the multi-threaded version is mtSetReadCode39(handle hBarcode, bool value). Similarly, the function stScanBarCode(string filePath) is used to scan an image file for a barcode, and the multi-threaded version is mtScanBarCode(handle hBarcode, bool value).<\/p>\n<p><strong>CreateBarcodeInstance<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Syntax<\/strong><\/p>\n<p><strong>mtCreateBarcodeInstance<\/strong>()<\/p>\n<p><strong>Return Value<\/strong><\/p>\n<p>Handle to an instance of the barcode toolkit (dll only).<\/p>\n<p><strong>Remarks<\/strong><\/p>\n<p>CreateBarcodeInstance creates an instance of the barcode toolkit and returns a handle that may be used with other functions in the win32 dll interface. Please note that this function is not applicable to other interfaces for the toolkit. This function only exists in the dll interface to the SDK.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>Dim hBarcode As System.IntPtr<br \/>\nhBarcode = mtCreateBarcodeInstance()<br \/>\nmtSetReadCode39(hBarcode,\u00a0 True)<\/p>\n<p><strong>Win32 dll declarations:<\/strong><\/p>\n<p><strong>VB.Net:<\/strong><\/p>\n<p>Private Declare Function mtCreateBarcodeInstance Lib &#8220;Softekbarcode&#8221; () As System.IntPtr<br \/>\n<strong>Visual C++:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>extern &#8220;C&#8221; {<br \/>\nHANDLE __stdcall mtCreateBarcodeInstance() ;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>DestroyBarcodeInstance<\/strong><\/p>\n<p><strong>Syntax<\/strong><\/p>\n<p><strong>mtDestroyBarcodeInstance<\/strong>(hBarcode)<\/p>\n<p><strong>Parameters<\/strong><\/p>\n<p>hBarcode Handle to an instance of the barcode toolkit.<\/p>\n<p><strong>Return Value<\/strong><\/p>\n<p>1\/True on success and 0\/False on failure.<\/p>\n<p><strong>Remarks<\/strong><\/p>\n<p>DestroyBarcodeInstance destroys an instance of the barcode toolkit and releases any resources used by the toolkit. This function only exists in the dll interface to the SDK.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>Dim hBarcode As System.IntPtr<br \/>\nhBarcode = mtCreateBarcodeInstance()<br \/>\nmtDestroyBarcodeInstance(hBarcode)<\/p>\n<p><strong>Win32 dll declarations:<\/strong><\/p>\n<p><strong>VB.Net:<\/strong><\/p>\n<p>Private Declare Function mtDestroyBarcodeInstance Lib &#8220;Softekbarcode&#8221; (ByVal hBarcode As System.IntPtr) As Short<br \/>\n<strong>Visual C++:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>extern &#8220;C&#8221; {<br \/>\nshort __stdcall mtDestroyBarcodeInstance(HANDLE hBarcode) ;<\/p>\n<p>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The SoftekBarcode.dll includes a set of functions suitable for use in multi-threaded applications. The multi-threaded functions all require a handle to the toolkit. This is created using the mtCreateBarcodeSession function and released using the mtDestroyBarcodeSession function: hBarcode = mtCreateBarcodeInstance() nBarcodes = mtScanBarCode(hBarcode, \u201cinput.tif\u201d) &#8230;process the result in some way mtDestroyBarcodeInstance(hBarcode) &nbsp; All the multi-threaded functions<\/p>\n<p><a href=\"https:\/\/www.bardecode.com\/en1\/using-the-multi-threaded-set-of-dll-functions\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":337,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[32,140,19,58,131,48],"class_list":["post-618","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development-kits","tag-dll","tag-application","tag-barcode","tag-code","tag-reader","tag-toolkit"],"_links":{"self":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/618"}],"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=618"}],"version-history":[{"count":3,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/618\/revisions"}],"predecessor-version":[{"id":1564,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/618\/revisions\/1564"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media\/337"}],"wp:attachment":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media?parent=618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/categories?post=618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/tags?post=618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}