I have the same problem with this code:
[DllImport("camapi.dll", CharSet = CharSet.Unicode)] private static extern CSTATUS_T CWRAPPER_GetFriendlyName(IntPtr pCameraBus, string sCamID, out StringBuilder sFriendlyName, uint uBufferSizeInWords); public static string CWRAPPER_GetFriendlyName(IntPtr pCameraBus, string sCamID) { var sFriendlyName = new StringBuilder(256); var status = CWRAPPER_GetFriendlyName(pCameraBus, sCamID, out sFriendlyName, (uint)s.Capacity + 1); return (status == CSTATUS_T.CSTATUS_SUCCESS) ? sFriendlyName.ToString() : ""; }
The problem was the keyword "out". In the example on MSDN there is no "out".
Hope someone helps ... Simon
Simon source share