wiaaut.dll in Nav2009/SP1

mklijbergmklijberg Member Posts: 5
I am currently trying to link a camera to NAV2009 (Windows 7 Enterprise) so users can photograph incoming items. I have found a code sample using wiaaut.dll:

Globals:
- DeviceManager Automation 'Microsoft Windows Image Acquisition Library v2.0'.DeviceManager
- DeviceInfo Automation 'Microsoft Windows Image Acquisition Library v2.0'.DeviceInfo
- Device Automation 'Microsoft Windows Image Acquisition Library v2.0'.Device
- Item Automation 'Microsoft Windows Image Acquisition Library v2.0'.Item
- ImageFile Automation 'Microsoft Windows Image Acquisition Library v2.0'.ImageFile
- Index Integer

OnRun()
// Create the WIA device manager
CREATE(DeviceManager);

// Return the device info for the first WIA-compatible device;
Index := 1;
DeviceInfo := DeviceManager.DeviceInfos.Item(Index);

// Connect to the first device
Device := DeviceInfo.Connect;

// Take picture
Item := Device.ExecuteCommand(wiaCommandTakePicture);

// Store the image file
ImageFile := Item.Transfer;
ImageFile.SaveFile('c:\temp\test.bmp');

procedure wiaCommandTakePicture() : Text[50]
EXIT('{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}');


The sample runs just fine up until the 'store image' section. There, I get an error on the 'ImageFile := Item.Transfer' statement, saying that no instance of the automation variable has been created. I added the statement CREATE(Item), but this returns an error as well. Although I can select the Windows Image Acquisition v2.0 library in the automation list, the library doesn't show in the Custom Controls list, nor can I register wiaaut.dll there. Does anyone have an idea what is going on here?

Comments

  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ara3nara3n Member Posts: 9,256
    It looks like Item.Transfer is returning NULL (no image). Thus ImageFile is uninitialized.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ta5ta5 Member Posts: 1,164
    Classic or RTC?
  • mklijbergmklijberg Member Posts: 5
    Problem mentioned occurs with Classic client (haven't tried RTC because I don't expect RTC to 'see' the device).

    "Item.Transfer is returning NULL": I gathered as much, question is why?

    Thanks for your help.
  • ta5ta5 Member Posts: 1,164
    To find out whether it is a problem of NAV or not, you can try to use wiaaut.dll in VB.NET/C# program.
    Hope this helps
    Thomas
  • ara3nara3n Member Posts: 9,256
    This I would try.

    Change Index to different Number


    Change the code to

    Device := DeviceManager.DeviceInfos.Item(Index).Connect;
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.