private void savefile(IntPtr pData, ref ToupCam.BITMAPINFOHEADER header) { Bitmap bmp = new Bitmap(header.biWidth, header.biHeight, PixelFormat.Format24bppRgb); BitmapData bmpdata = bmp.LockBits(new Rectangle(0, 0, header.biWidth, header.biHeight), ImageLockMode.WriteOnly, bmp.PixelFormat); ToupCam.CopyMemory(bmpdata.Scan0, pData, header.biSizeImage); bmp.UnlockBits(bmpdata); bmp.Save("toupcamdemowinformcs2.jpg"); }