| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading.Tasks;
- namespace ivf_tl_Entity.CameraEntitys
- {
- public class MVCAPI
- {
- public delegate void LPMV_CALLBACK2(IntPtr lpParam, IntPtr lpUser);
- public const short ResSuccess = 0x0000;
- public const short ResNullHandleErr = 0x0001;
- public const short ResNullPointerErr = 0x0002;
- public const short ResFileOpenErr = 0x0003;
- public const short ResNoDeviceErr = 0x0004;
- public const short ResInvalidParameterErr = 0x0005;
- public const short ResOutOfMemoryErr = 0x0006;
- public const short ResNoPreviewRunningErr = 0x0007;
- public const short ResOSVersionErr = 0x0008;
- public const short ResUsbNotAvailableErr = 0x0009;
- public const short ResNotSupportedErr = 0x000a;
- public const short ResNoSerialString = 0x000b;
- public const short ResVerificationErr = 0x000c;
- public const short ResUnknowErr = 0x00ff;
- public const int WS_CHILD = 0x40000000;
- public const int WS_VISIBLE = 0x10000000;
- //public static uint WS_CHILD = 1073741824u;
- //public static uint WS_VISIBLE = 268435456u;
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2Init(String pFilterName, out int index, ref CapInfoStruct pCapInfo, out IntPtr hImager);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2GetSerial(IntPtr hImager, StringBuilder number);
- /// <summary>
- /// 卸载相机,成功返回0
- /// </summary>
- /// <param name="hImager"></param>
- /// <returns></returns>
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2Uninit(ref IntPtr hImager);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2Start(IntPtr hImager, String tilte, uint style, int x, int y, int width, int height, IntPtr parent, uint nId, int ViewDataThreadPriority, int ViewDrawThreadPriority);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2StartCapture(IntPtr hImager, bool bCapture);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2Stop(IntPtr hImager);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2PausePreview(IntPtr hImager, bool bPause);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2GetFrameRate(IntPtr hImager, out float nRate);
- /**************************************************/
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2SetOpMode(IntPtr hImager, byte nMode, bool bStrobe);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2SetPartOfCapInfo(IntPtr hImager, ref CapInfoStruct pCapInfo);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2GetRgbData(IntPtr hImager, ref CapInfoStruct pCapInfo, IntPtr pDest);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2GetRawData(IntPtr hImager, ref CapInfoStruct pCapInfo);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2ConvertRawToRgb(IntPtr hImager, IntPtr pSrc, int width, int height, IntPtr pDest);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2SaveFrameAsBmp(IntPtr hImager, ref CapInfoStruct pCapInfo, IntPtr pDest, string strname);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2SetMaskCallBack(IntPtr hImager, LPMV_CALLBACK2 MaskCallBackFunction, IntPtr lpUser);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2SetFrameCallBack(IntPtr hImager, LPMV_CALLBACK2 CALLBACKFUNCT, IntPtr lpUser);
- [DllImport(@"Resources\ccd\mvcapi.dll")]
- public static extern Int32 MV_Usb2SetMask(IntPtr hImager, bool bMask);
- [DllImport(@"Resources\ccd\MVCAPI.dll")]
- public static extern int MV_Usb2SavePausedFrameAsBmp(IntPtr hImager, string fileName);
- [DllImport(@"Resources\ccd\MVCAPI.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
- public static extern int MV_Usb2GetPausedRgbData(IntPtr intptr_device, IntPtr rgbdata);
- [DllImport(@"Resources\ccd\mvavi.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
- public static extern void MV_AVIFileInit(uint filetype, short framerate);
- [DllImport(@"Resources\ccd\mvavi.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
- public static extern void MV_AVIFileFini();
- /// <summary>
- /// 1是成功 0失败
- /// </summary>
- /// <param name="bitmapData"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <param name="path"></param>
- [DllImport(@"Resources\newccd\Project2.dll", EntryPoint = "#7", CallingConvention = CallingConvention.Cdecl)]
- public extern static int SavePic(byte[] bitmapData, int width, int height, string path);
- }
- }
|