|
Copy Code
|
|
|---|---|
#include "MyForm.h" using namespace System; using namespace System::Windows::Forms; [STAThread] void main(array<String^>^ args) { Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); BXTutorial::MyForm form; Application::Run(%form); } |
|
|
Copy Code
|
|
|---|---|
private: System::Void mnuOpen_Click(System::Object^ sender, System::EventArgs^ e) { if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK) { axImagXpress1->FileName = openFileDialog1->FileName; } } |
|
|
Copy Code
|
|
|---|---|
private: System::Void mnuExit_Click(System::Object^ sender, System::EventArgs^ e) {
Application::Exit();
}
|
|
|
Copy Code
|
|
|---|---|
private: System::Void btnReadBarcode_Click(System::Object^ sender, System::EventArgs^ e) { //Set barcode type to all1D. axBarcodeXpress1->BarcodeType = 0; // Set the read region of interest to all zero // so the entire images is searched. axBarcodeXpress1->ReaderAreaHeight = 0; axBarcodeXpress1->ReaderAreaWidth = 0; axBarcodeXpress1->ReaderAreaX = 0; axBarcodeXpress1->ReaderAreaY = 0; if (axImagXpress1->hDIB == 0) { MessageBox::Show("Error: You must select an image!"); return; } axBarcodeXpress1->AnalyzehDib(axImagXpress1->hDIB); int numBC = axBarcodeXpress1->NumBarcodes; String^ bcName; String^ bcResult; String^ result; for (int i = 0; i < numBC; i++) { axBarcodeXpress1->GetBarcode(i); bcName = axBarcodeXpress1->BarcodeCodeName; bcResult = axBarcodeXpress1->BarcodeResult; result += "#" + i.ToString() + " Type: " + bcName + " Value: " + bcResult + "\n"; } MessageBox::Show(result); } |
|
|
Copy Code
|
|
|---|---|
MyForm(void) { InitializeComponent(); // 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. //axBarcodeXpress1->SetSolutionName("YourSolutionName"); //axBarcodeXpress1->SetSolutionKey(12345, 12345, 12345, 12345); //axBarcodeXpress1->SetOEMLicenseKey("1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation..."); //axImagXpress1->SetSolutionName("YourSolutionName"); //axImagXpress1->SetSolutionKey(12345, 12345, 12345, 12345); //axImagXpress1->SetOEMLicenseKey("1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation..."); } |
|
|
Copy Code
|
|
|---|---|
Private Sub mnuOpen_Click()
With CommonDialog1
.CancelError = True
.DialogTitle = "Open 1-bit, 8-bit or 24-bit Image File"
.Filter = "TIFF (*.tif)|*.tif|BMP (*.bmp)|*.bmp|All Files (*.*) |*.*"
.InitDir = App.Path & "\..\..\..\..\..\..\Common\Images\"
.Action = 1
End With
With ImagXpress1
.FileName = CommonDialog1.FileName
If .FileName = "" Then
MsgBox "Please pick a filename"
End If
'.Width = 6900
'.Height = 4000
End With
End Sub
|
|
|
Copy Code
|
|
|---|---|
Private Sub mnuExit_Click()
End
End Sub
|
|
|
Copy Code
|
|
|---|---|
Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long
|
|
|
Copy Code
|
|
|---|---|
Private Sub btnRead1DBarcode_Click()
Dim result As String
Dim i As Long
Dim hDib As Long
If ImagXpress1.hDib = 0 Then
MsgBox ("No file loaded")
Else
Me.MousePointer = vbHourglass
DoEvents
hDib = ImagXpress1.CopyDIB
BarcodeXpress1.AnalyzehDib hDib
BarcodeXpress1.BarcodeType = 0 'set barcode type to all1D
If BarcodeXpress1.NumBarcodes > 0 Then
For i = 0 To BarcodeXpress1.NumBarcodes - 1
BarcodeXpress1.GetBarcode i
result = result & "Barcode #" & i & Chr$(13) & _
"Barcode value = " & BarcodeXpress1.BarcodeResult & Chr$(13) & _
"Barcode type = " & BarcodeXpress1.BarcodeCodeName & Chr$(13)
Next i
MsgBox result
Else
MsgBox "No barcodes were found. Error = " & BarcodeXpress1.SSError & ". " & BarcodeXpress1.SSErrorMsg, , _
"Smartscan Xprebarcodexpress1 Barcode Sample"
End If
'*****Call the GlobalFree function to "free" the barcode hDib
GlobalFree hDib
Me.MousePointer = vbDefault
DoEvents
End If
End Sub
|
|
|
Copy Code
|
|
|---|---|
Private Sub Form_Load()
' 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.
'BarcodeXpress1.SetSolutionName "YourSolutionName"
'BarcodeXpress1.SetSolutionKey 12345, 12345, 12345, 12345
'BarcodeXpress1.SetOEMLicenseKey "1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation..."
'
'ImagXpress1.SetSolutionName "YourSolutionName"
'ImagXpress1.SetSolutionKey 12345, 12345, 12345, 12345
'ImagXpress1.SetOEMLicenseKey "1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation..."
End Sub
|
|