CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2011
    Posts
    73

    [RESOLVED] CONVERT FROM C# vs2010 - FOR SCAN

    Hi,
    I am using the following code in C# to find the scanner & scan the image. But in Visual C++ windows forms I cannot find WIA reference. Once I add reference Microsoft Windows Image Acquisition Library v2.0 then I can found WIA on project references. But
    in Visual C++ Once I add COM references, its showing in Interop.WIA.1.0.dll

    And I used the following code in C#
    Code:
            private void button3_Click(object sender, EventArgs e)
            {
                var devicemanager = new DeviceManager();
                WIA.DeviceInfo FirstScannerAvailable = null;
                for (int j = 1; j <= devicemanager.DeviceInfos.Count; j++)
                {
                    if (devicemanager.DeviceInfos[j].Type != WiaDeviceType.ScannerDeviceType)
                    {
                        continue;
                    }
                    FirstScannerAvailable = devicemanager.DeviceInfos[j];
                    break;
                }
            }
    Does Anybody can help me.
    Thanks
    Last edited by 2kaud; April 1st, 2018 at 06:09 AM. Reason: Fixed code tags

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: CONVERT FROM C# vs2010 - FOR SCAN

    Are you adding the correct COM reference in VC++? How are you adding the COM reference?

  3. #3
    Join Date
    Dec 2011
    Posts
    73

    Re: CONVERT FROM C# vs2010 - FOR SCAN

    Thanks Arjay, Added & Found the solution. Thanks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured