locked
Differences between Windows and Desktop VS2013 with regard to DLLs

    Question

  • Hi There,

    I've been trying to get a win32 DLL to work with some code in a VS2013 Windows C++ program with no success so I changed tack.

    I built two C# programs, one in VS2013 Windows and the other in VS2013 Desktop.  In both I used the same DLL and imported it using DLLImport attributes.  Both compiled correctly however only the Desktop version worked, the Windows version does the same as the above mentioned C++ program.

    The DLL in question controls a USB peripheral called a K8055 and I suspect that in Windows apps actions that do not use USB communications work but actions that do need that do not.  This suggests some kind of permission issue? Neither program knows how to do the communication with the device as that is done in the DLL but only the windows one blocks it.

    I've tried forcing Win32 build and I've looked through the options but have not found a way to make this work.  If anyone out there has made this work or can point me at what is blocking the access to the USB I'd be greatful.  Been banging my head on this for a while.

    Trev

    Friday, April 18, 2014 4:43 PM

Answers

  • Without knowing the details of the DLL I can't say for sure, but from what you describe it is likely that it is not valid for Windows Store apps and you'll need to rewrite it. Depending on what it does you may be able to replace most of the functionality with the Windows.Devices.USB classes, although if it has high level functionality that would need to be recreated.

    --Rob

    Wednesday, April 23, 2014 10:45 PM
    Owner
  • Ta Rob.

    I think that I'll wait on them to get around to it themselves.  It did take a long while for them to get Windows 7 compatible though  :-(

    Thursday, April 24, 2014 8:09 PM

All replies

  • Windows Store apps run sandboxed with limited access to the system. See http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx for information on calling win 32 API from Windows store apps. Being in a DLL or in the main app assembly will have the same behavior.

    To access USB from a Windows store app see the Windows. Devices. USB namespace.

    Friday, April 18, 2014 5:16 PM
    Owner
  • Thanks Rob,

    So from that can I assume that this DLL I have will be unable to access the system without re-writing?  If so I am once again in the hands of the providers of my bit of kit :-(  Gotta love it when this sort of stuff keeps happening.  Last time when I moved to windows 7 I had to knock up something that used HID  to make this thing work, I'd been hoping to avoid all that effort again...

    Thanks for coming back to me though, apologies for not noticing your reply for a couple of days.

    Trevor

    Tuesday, April 22, 2014 8:52 PM
  • Without knowing the details of the DLL I can't say for sure, but from what you describe it is likely that it is not valid for Windows Store apps and you'll need to rewrite it. Depending on what it does you may be able to replace most of the functionality with the Windows.Devices.USB classes, although if it has high level functionality that would need to be recreated.

    --Rob

    Wednesday, April 23, 2014 10:45 PM
    Owner
  • Ta Rob.

    I think that I'll wait on them to get around to it themselves.  It did take a long while for them to get Windows 7 compatible though  :-(

    Thursday, April 24, 2014 8:09 PM