Comments (6)
I spent a few hours on this and could not figure out. Problem is setting capture window as topmost dialog for multiple windows at the same time. You cannot have multiple modal dialogs at the same time. So it has to be one form, which is correctly stretched to accommodate full desktop, accounting for different DPI, I'm not sure how to accomplish this. Tagged ticket with "help wanted".
Greenshot somehow does it, so might need to spend more time looking into their source (it's also open source .NET code). Upvote if you think it's important. Personally I run all my monitors with the same DPI setting. They all (4) have the same size (24'') and orientation (landscape) - easier to work with.
from pinwin.
Sorry to bump an old thread but I do have some food for though here.
It seems from looking at your source that you did not declare your program to be per-monitor DPI aware and just used the SetProcessDPIAware
function.
So all monitors are falsely scaled to the primary monitor DPI and when you manipulate coordinates in pixels, all the values are scaled and you get troubles. The SetProcessDPIAware
is only good for Windows Vista/7 when no per-monitor DPI existed.
If you always reason in pixels, then your program should declare itself as per monitor DPI aware.
This can be done using the SetProcessDPIAware(PROCESS_PER_MONITOR_DPI_AWARE = 2)
on Win8.x or by using SetProcessDpiAwarenessContext()
on Win10 1607+ or something like this, when Microsoft introduced the version two of per-monitor dpi awareness.
I would recommend not to mess up with those functions but rather to add the following lines in your .manifest file.
<asmv3:application>
<asmv3:windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>
</asmv3:windowsSettings>
</asmv3:application>
This is what Microsoft recommends.
https://docs.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process
Also once your program is declared as fully DPI-aware, you will be able to use the GetDpiForWindow and GetDpiForMonitor and they will no more lye to you.
from pinwin.
@RamonUnch That's an interesting idea. Unfortunately, per-monitor DPI aware behavior requires at least .NET 4.6.2, according to this answer. This project is based on .NET 4.0 for wider compatibility between Windows version. It can even run on Windows XP!
Another point - I am not using WPF, which is what most examples are using, for instance:
from pinwin.
You can always change the .manifest file with a resource editor once your project is compiled. there is no reasons .NET version would matter. The manifest file is just a resource attached to your exe completely language neutral. It would remain XP compatible no problems.
You can also on newer Winodw force the DPI awareness for any program in the compatibility property sheet of the program/shortcut.
from pinwin.
Well sorry, I did not think properly but you are right because .NET has his own procedures to draw controls, So this one might not be DPI aware and the program might have problems if you force per monitor DPI awareness. This could still be tried though.
from pinwin.
I'll think about it, thanks.
from pinwin.
Related Issues (20)
- Customize keyboard shortcuts - store user settings
- Provide visual indication of currently hovered window in capture overlay HOT 1
- Create about screen
- Left Click Icon to open Interface or directly trigger Window selection HOT 4
- Crash when trying to pin OBS HOT 5
- Working strange on Edge HOT 5
- Like the program HOT 5
- Error creating window handle. HOT 3
- The pin is placed above the minimize button HOT 2
- Can't Pin Vivaldi - Program Crashes HOT 2
- Allow multiple Windows users to run PinWin at the same time HOT 2
- the pin continues to be placed on top of the minimize button for UWP apps. HOT 9
- PinWin installer for XP HOT 4
- Removing hotkey causes pinwin to instantly close without error message HOT 1
- Request: different TargetWindowIcons HOT 7
- Suggestion: Embed the target and red pin icons into the PinWin.exe file HOT 2
- Request: "Always on Top" windows HOT 13
- Create an app like "TXMOUSE" to autocopy text selection and paste with middle mouse
- Slight drawback when pinning "foxit reader". HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pinwin.