Why this Method save the same bitmap every times called?
-
I have the following method to capture image from a window it works ok but today it save the same image to disk every times called. Please help me! I cannot understand what is the problem. _______________________________________________ public void GetWindowPicture(IntPtr hWnd) { IntPtr hdcDest = default(IntPtr); IntPtr hdcSrc = default(IntPtr); RECT r = new RECT(); int w = 0; int h = 0; GetWindowRect(hWnd, ref r); w = r.Right - r.Left; h = r.Bottom - r.Top; Bitmap bm = new Bitmap(w, h); Graphics g = Graphics.FromImage(bm); hdcSrc = GetWindowDC(hWnd); hdcDest = g.GetHdc(); BitBlt(hdcDest, 0, 0, w, h, hdcSrc, 0, 0, SRCCOPY); g.ReleaseHdc(hdcDest); ReleaseDC(hWnd, hdcSrc); bm.Save(GetOutputInfo(),System.Drawing.Imaging.ImageFormat.Jpeg); } _____________________________________ Thanks for your attention,
-
I have the following method to capture image from a window it works ok but today it save the same image to disk every times called. Please help me! I cannot understand what is the problem. _______________________________________________ public void GetWindowPicture(IntPtr hWnd) { IntPtr hdcDest = default(IntPtr); IntPtr hdcSrc = default(IntPtr); RECT r = new RECT(); int w = 0; int h = 0; GetWindowRect(hWnd, ref r); w = r.Right - r.Left; h = r.Bottom - r.Top; Bitmap bm = new Bitmap(w, h); Graphics g = Graphics.FromImage(bm); hdcSrc = GetWindowDC(hWnd); hdcDest = g.GetHdc(); BitBlt(hdcDest, 0, 0, w, h, hdcSrc, 0, 0, SRCCOPY); g.ReleaseHdc(hdcDest); ReleaseDC(hWnd, hdcSrc); bm.Save(GetOutputInfo(),System.Drawing.Imaging.ImageFormat.Jpeg); } _____________________________________ Thanks for your attention,