Skip to content

Commit

Permalink
2.3.4.4 - Fix to Screen Capture method.
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinkendall committed Mar 8, 2021
1 parent b0b1cd2 commit 70fd25f
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.4.3")]
[assembly: AssemblyFileVersion("2.3.4.3")]
[assembly: AssemblyVersion("2.3.4.4")]
[assembly: AssemblyFileVersion("2.3.4.4")]
[assembly: NeutralResourcesLanguageAttribute("en-CA")]
62 changes: 30 additions & 32 deletions ScreenCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,55 +449,55 @@ public Image GetImageByPath(string path)
/// <returns>A bitmap image representing what we captured.</returns>
public Bitmap GetScreenBitmap(int source, int component, int x, int y, int width, int height, bool mouse)
{
try
if (width > 0 && height > 0)
{
if (width > 0 && height > 0)
if (source > 0 && component > -1)
{
if (source > 0 && component > -1)
try
{
// Test if we can acquire the actual screen from Windows and if we can't just let this
// method catch the out of bounds exception error.
System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.AllScreens[component];
}
catch
{
return null;
}
}

Size blockRegionSize = new Size(width, height);
Size blockRegionSize = new Size(width, height);

Bitmap bmp = new Bitmap(width, height);
Bitmap bmp = new Bitmap(width, height);

using (Graphics g = Graphics.FromImage(bmp))
using (Graphics g = Graphics.FromImage(bmp))
{
g.CopyFromScreen(x, y, 0, 0, blockRegionSize, CopyPixelOperation.SourceCopy);

if (mouse)
{
g.CopyFromScreen(x, y, 0, 0, blockRegionSize, CopyPixelOperation.SourceCopy);
CURSORINFO pci;
pci.cbSize = Marshal.SizeOf(typeof(CURSORINFO));

if (mouse)
if (GetCursorInfo(out pci))
{
CURSORINFO pci;
pci.cbSize = Marshal.SizeOf(typeof(CURSORINFO));

if (GetCursorInfo(out pci))
if (pci.flags == CURSOR_SHOWING)
{
if (pci.flags == CURSOR_SHOWING)
{
var hdc = g.GetHdc();
DrawIconEx(hdc, pci.ptScreenPos.x - x, pci.ptScreenPos.y - y, pci.hCursor, 0, 0, 0, IntPtr.Zero, DI_NORMAL);
g.ReleaseHdc();
}
var hdc = g.GetHdc();
DrawIconEx(hdc, pci.ptScreenPos.x - x, pci.ptScreenPos.y - y, pci.hCursor, 0, 0, 0, IntPtr.Zero, DI_NORMAL);
g.ReleaseHdc();
}
}
}

CaptureError = false;

return bmp;
}

CaptureError = true;
CaptureError = false;

return null;
}
catch
{
return null;
return bmp;
}

CaptureError = true;

return null;
}

/// <summary>
Expand Down Expand Up @@ -619,19 +619,17 @@ public bool GetScreenImages(int source, int component, int x, int y, int width,
{
try
{
CaptureError = false;

bitmap = source == 0 && component == 0
? GetActiveWindowBitmap()
: GetScreenBitmap(source, component, x, y, width, height, mouse);

if (bitmap != null)
{
CaptureError = false;

return true;
}

CaptureError = true;

return false;
}
catch (Exception ex)
Expand Down
2 changes: 1 addition & 1 deletion app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<assemblyIdentity
type="win32"
name="GavinKendall.AutoScreenCapture"
version="2.3.4.3"/>
version="2.3.4.4"/>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware>
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Auto Screen Capture by Gavin Kendall


Codename "Boombayah"
2.3.4.4 Fix to Screen Capture method.
2.3.4.3 Fix to Screen Capture method.
2.3.4.2 Fix to Screen form for preview image.
2.3.4.1 Does not capture image of screen if screen does not exist.
Expand Down
3 changes: 2 additions & 1 deletion interface/FormAbout.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="richTextBoxApplication.Text" xml:space="preserve">
<value>Auto Screen Capture 2.3.4.3 ("Boombayah")
<value>Auto Screen Capture 2.3.4.34 ("Boombayah")
Developed by Gavin Kendall (2008 - 2021)

SourceForge Project Site
Expand All @@ -140,6 +140,7 @@ Triggers have been rewritten. I haven't spent much time on the new wizard-style
</data>
<data name="richTextBoxChangelog.Text" xml:space="preserve">
<value>Codename "Boombayah"
2.3.4.4 Fix to Screen Capture method.
2.3.4.3 Fix to Screen Capture method.
2.3.4.2 Fix to Screen form for preview image.
2.3.4.1 Does not capture image of screen if screen does not exist.
Expand Down
1 change: 1 addition & 0 deletions settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public void Load(FileSystem fileSystem)
_versionCollection.Add(new Version(CODENAME_BOOMBAYAH, "2.3.4.0")); // Screenshots can be sent to a file server either from the main interface window or with a Trigger. The SMTP and SFTP settings are in their own XML files and can be configured. Help system is available but still early in development.
_versionCollection.Add(new Version(CODENAME_BOOMBAYAH, "2.3.4.1")); // Does not capture image of screen if screen does not exist.
_versionCollection.Add(new Version(CODENAME_BOOMBAYAH, "2.3.4.2")); // Fix to Screen form for preview image.
_versionCollection.Add(new Version(CODENAME_BOOMBAYAH, "2.3.4.3")); // Fix to Screen form for preview image.

Application = new SettingCollection()
{
Expand Down

0 comments on commit 70fd25f

Please sign in to comment.