I have this code to get the image file from the scanner and save it to a local drive:
IntPtr img = (IntPtr)pics[i]; SetStyle(ControlStyles.DoubleBuffer, false); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.Opaque, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); bmprect = new Rectangle(0, 0, 0, 0); bmpptr = GlobalLock(img); pixptr = GetPixelInfo(bmpptr); Gdip.SaveDIBAs(@"C:\", bmpptr, pixptr);
The problem here is Gdip.SaveDIBAs(@"C:\", bmpptr, pixptr); . save dialog. 
I want to cancel this dialog box and save the file directly to my disk.
**Updated:** public static bool SaveDIBAs(string picname, IntPtr bminfo, IntPtr pixdat) { SaveFileDialog sd = new SaveFileDialog(); sd.FileName = picname; sd.Title = "Save bitmap as..."; sd.Filter = "Bitmap file (*.bmp)|*.bmp|TIFF file (*.tif)|*.tif|JPEG file (*.jpg)|*.jpg|PNG file (*.png)|*.png|GIF file (*.gif)|*.gif|All files (*.*)|*.*"; sd.FilterIndex = 1; return true; } for (int i = 0; i < pics.Count; i++) { IntPtr img = (IntPtr)pics[i]; SetStyle(ControlStyles.DoubleBuffer, false); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.Opaque, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); bmprect = new Rectangle(0, 0, 0, 0); bmpptr = GlobalLock(img); pixptr = GetPixelInfo(bmpptr); SaveDIBAs(@"C:\a.jpg", bmpptr, pixptr); }
c # image intptr scanning
Ehsan akbar
source share