mirror of
https://github.com/greenshot/greenshot
synced 2025-07-30 11:40:40 -07:00
Fixes: Catching an outlook exception that can be ignored. Making sure that the window to be captured is active, so the colors are right. Also a little cleanup, and added FindWindow to the User32.cs so we can use this to find Metro (Modern UI) applications, this still needs to be added to the WindowsHelper.cs
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2244 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
599bb594ad
commit
15d5bb58e4
3 changed files with 23 additions and 18 deletions
|
@ -544,11 +544,7 @@ namespace GreenshotPlugin.Core {
|
|||
return User32.IsIconic(this.hWnd) || Location.X <= -32000;
|
||||
}
|
||||
set {
|
||||
User32.SendMessage(
|
||||
this.hWnd,
|
||||
User32.WM_SYSCOMMAND,
|
||||
(IntPtr)User32.SC_MINIMIZE,
|
||||
IntPtr.Zero);
|
||||
User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -560,11 +556,7 @@ namespace GreenshotPlugin.Core {
|
|||
return User32.IsZoomed(this.hWnd);
|
||||
}
|
||||
set {
|
||||
User32.SendMessage(
|
||||
this.hWnd,
|
||||
User32.WM_SYSCOMMAND,
|
||||
(IntPtr)User32.SC_MAXIMIZE,
|
||||
IntPtr.Zero);
|
||||
User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MAXIMIZE, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -700,7 +692,7 @@ namespace GreenshotPlugin.Core {
|
|||
/// </summary>
|
||||
public void Restore() {
|
||||
if (Iconic) {
|
||||
User32.SendMessage(this.hWnd, User32.WM_SYSCOMMAND, (IntPtr)User32.SC_RESTORE, IntPtr.Zero);
|
||||
User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_RESTORE, IntPtr.Zero);
|
||||
}
|
||||
User32.BringWindowToTop(this.hWnd);
|
||||
User32.SetForegroundWindow(this.hWnd);
|
||||
|
@ -871,6 +863,9 @@ namespace GreenshotPlugin.Core {
|
|||
tempForm.BackColor = Color.Black;
|
||||
// Make sure everything is visible
|
||||
tempForm.Refresh();
|
||||
// Make sure the application window is active, so the colors & buttons are right
|
||||
ToForeground();
|
||||
// Make sure all changes are processed and visisble
|
||||
Application.DoEvents();
|
||||
using (Bitmap blackBitmap = WindowCapture.CaptureRectangle(captureRectangle)) {
|
||||
capturedBitmap = ApplyTransparency(blackBitmap, whiteBitmap);
|
||||
|
@ -898,6 +893,9 @@ namespace GreenshotPlugin.Core {
|
|||
}
|
||||
// Make sure everything is visible
|
||||
tempForm.Refresh();
|
||||
// Make sure the application window is active, so the colors & buttons are right
|
||||
ToForeground();
|
||||
// Make sure all changes are processed and visisble
|
||||
Application.DoEvents();
|
||||
// Capture from the screen
|
||||
capturedBitmap = WindowCapture.CaptureRectangle(captureRectangle);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue