Dynamsoft Home|Product Home

The Hello World Sample

The purpose of this sample is to provide the basic idea about what the Dynamic TWAIN ActiveX Control looks like.

  1. Start the Microsoft Visual Basic 6. Create a "Standard EXE" application.
  2. From the "Project" menu, click "Component".
  3. In the "Components" dialog box, check "Dynamic TWAIN V4.0 By DynamSoft". Click "Ok" to close the dialog box.
  4. Add a Image Control to the form. Change the Name Property to "ImgAcquiredImage". Change the Stretch Property to "True".
  5. Add a CommandButton Control to the form. Change the Caption Property to "Acquire". Change the Name Property to "btnAcquire".
  6. Add a Dynamic TWAIN Control to the form.
  7. Add the following code:
    VB Sample:
     Private Sub btnAcquire_Click()
         DynamicTwain1.AcquireImage
     End Sub
     Private Sub DynamicTwain1_OnPostTransfer()
         ImgAcquiredImage.Picture(0) = DynamicTwain1.Picture(0)
     End Sub
    
  8. Run the application. After acquiring an image from a source, it should be like this:

Remarks

  1. From this simple sample, we can see the power of the Dynamic TWAIN. Just with 2 lines of code, an image can be acquired from a source and displayed in a form.
  2. With the built-in Wizard Mode, which handles the TWAIN state transition intelligently, the single line of AcquireImage makes the default data source to be ready for image acquiring.
  3. During the acquiring process, the OnPreAllTransfers Event, OnPreTransfer Event, OnPostTransfer Event and OnPostAllTransfers Event are triggered. In our sample, we only need to handle the OnPostTransfer Event.

  4. The similar samples are available in Visual C++, Visual Basic, Delphi, C# and VB.NET. The name of the sample is TheMinimumSystem.