最近公司需要用到在线拍照功能,在网上找了好几个控件,用着都不感觉不好,于是,自己开始动手写。中间遇到些问题。和大家探讨下,希望能得到解决。
使用的是.net4.0框架,新建了一个windows控件库,在网上查资料,说要在assembly.cs文件里加[assembly:AllowPartiallyTrustedCallers()]节点,得到什么权限,但只要我加上,就报错

反正是公司内部用,也就不要什么权限验证什么的,就把这个去掉了,自己做了个安装包,放到服务器,然后要实施人员自己从服务器下载给用户安装插件,用着也蛮好的。但现在我这个控件做了些优化,需要重新发布安装,但在安装时,报错了.这下郁闷了。。按照提示进控制面板删除了原来的版本还是不行
 求指导,怎么实现自动安装,上面两个报错怎么解决,是什么原因造成的。大家一起讨论下
c#activenet在线拍照web摄像

解决方案 »

  1.   

    找一个你懂得的控件(特别是COM控件)来用,不要弄一堆不懂的控件。这个帮不了你。劝你从头开始考虑!
      

  2.   

    你用到了第三方COM组件,就不要不好意思公布出来。否则无法解决问题。
      

  3.   

    蛋疼,第三方组件就是系统自带的,
     //全局变量
            private int hHwnd;
            ///   <summary>   
            ///   必需的设计器变量。   
            ///   </summary>   
            [DllImport("avicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern int capCreateCaptureWindowA([MarshalAs(UnmanagedType.VBByRefStr)]   ref   string lpszWindowName, int dwStyle, int x, int y, int nWidth, short nHeight, int hWndParent, int nID);
            [DllImport("avicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern bool capGetDriverDescriptionA(short wDriver, [MarshalAs(UnmanagedType.VBByRefStr)]   ref   string lpszName, int cbName, [MarshalAs(UnmanagedType.VBByRefStr)]   ref   string lpszVer, int cbVer);
            [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern bool DestroyWindow(int hndw);
            [DllImport("user32", EntryPoint = "SendMessageA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern int SendMessage(int hwnd, int wMsg, int wParam, [MarshalAs(UnmanagedType.AsAny)]   object lParam);
            [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
            [DllImport("vfw32.dll")]
            public static extern string capVideoStreamCallback(int hwnd, videohdr_tag videohdr_tag);
            [DllImport("vicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            public static extern bool capSetCallbackOnFrame(int hwnd, string s);
    这有什么不好意思的。。这话说的要是能解决问题,源码公布都没问题,就是怕大神们懒的看。。
      

  4.   

    怎么没人讨论啊,刚看到一个,说active不能调用win32的api,请问这个说法对吗?如果是对的话,问题就不需要问下去了。。