Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

Commit

Permalink
found source code for screeninfo.dll, format project
Browse files Browse the repository at this point in the history
  • Loading branch information
Minnowo committed Mar 1, 2022
1 parent 4e87ff7 commit 77abc63
Show file tree
Hide file tree
Showing 21 changed files with 218 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
screen_clipping_tool/ahk/
screen_clipping_tool/build/
screen_clipping_tool/dist/
screen_clipping_tool/env/
screen_clipping_tool/tess_folder/

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions screen_clipping_tool/ScreenClippingToolMaster.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- mode: python ; coding: utf-8 -*-

block_cipher = None


a = Analysis(['ScreenClippingToolMaster.py'],
pathex=['X:\\Languages\\Python\\Apps\\ScreenClippingToolMaster'],
binaries=[],
datas=[('pyclip_bringforward.ico', '.'), ('pyclip_default.ico', '.'), ('pyclip_delay.ico', '.'), ('pyclip_destroy.ico', '.'), ('pyclip_multi.ico', '.'), ('pyclip_reload.ico', '.'), ('pyclip_screenshot.ico', '.'), ('pyclip_settings.ico', '.'), ('pyclip_snapshot.ico', '.'), ('pyclip_gif.ico', '.'), ('tess_folder', '.')],
hiddenimports=['pkg_resources.py2_warn'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='ScreenClippingToolMaster',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False )
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed screeninfo.dll
Binary file not shown.
25 changes: 25 additions & 0 deletions screeninfo/screeninfo.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30621.155
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "screeninfo", "src\screeninfo.csproj", "{EF633911-6B09-472D-A88E-B11F65CA59AB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EF633911-6B09-472D-A88E-B11F65CA59AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF633911-6B09-472D-A88E-B11F65CA59AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF633911-6B09-472D-A88E-B11F65CA59AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF633911-6B09-472D-A88E-B11F65CA59AB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {865E5AAE-5DEB-4F12-BA4E-2CABDAAE9B49}
EndGlobalSection
EndGlobal
36 changes: 36 additions & 0 deletions screeninfo/src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("screeninfo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("screeninfo")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ef633911-6b09-472d-a88e-b11f65ca59ab")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
68 changes: 68 additions & 0 deletions screeninfo/src/ScreenInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;

namespace screeninfo_c
{
public static class ScreenInfo
{
[ComVisible(true)]
[DllImport("user32.dll", SetLastError = true)]
static extern int SetProcessDpiAwarenessContext(int value);


public struct Monitor
{
public string name;
public Rectangle bounds;
public Rectangle workArea;
public int hashCode;

}

public static IEnumerable<Monitor> GetMonitors()
{
SetProcessDpiAwarenessContext(-3);
Monitor[] monitrs = new Monitor[Screen.AllScreens.Length];

foreach (Screen screen in Screen.AllScreens)
{
yield return new Monitor
{
name = screen.DeviceName,
bounds = screen.Bounds,
workArea = screen.WorkingArea,
hashCode = screen.GetHashCode()
};
}

}

public static Monitor MonitorFromPoint(int x, int y)
{
Screen scr = Screen.FromPoint(new Point(x, y));
return new Monitor
{
name = scr.DeviceName,
bounds = scr.Bounds,
workArea = scr.WorkingArea,
hashCode = scr.GetHashCode()
};
}

public static string GetRectAsImage(int x, int y, int x1, int y1, string filename)
{
Rectangle rect = new Rectangle(x, y, x1-x, y1-y);
Bitmap bmp = new Bitmap(rect.Width, rect.Height, PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(rect.Left, rect.Top, 0, 0, rect.Size);
bmp.Save(filename, ImageFormat.Png);
bmp.Dispose();
g.Dispose();

return filename;
}
}
}
50 changes: 50 additions & 0 deletions screeninfo/src/screeninfo.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EF633911-6B09-472D-A88E-B11F65CA59AB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>screeninfo</RootNamespace>
<AssemblyName>screeninfo</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ScreenInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

0 comments on commit 77abc63

Please sign in to comment.