Comments (5)
Generally there are a few conditions where CreateFromMonitor can give you an access denied error:
- MDM policy (if it works at all, it's not this)
- App container (UWP)
- LowIL
Aside from that, the API works best if used from the same user account as the interactive session. Using the SYSTEM account or calling from a non-interactive session is not supported at this time.
from windows.ui.composition-win32-samples.
Thanks for your answer
In my cases, "If I switch Standard User Logon Windows, app works fine when double click run, but access_denied in CreateForMonitor when run as Administrator"
Using the SYSTEM account or calling from a non-interactive session is not supported at this time.
This is the reason?so even Administrator couldn't capture stantard user's monitor?
case 3) The only clue I guess is the Electron's constraint, but I'm not familiar with it, so I don't kown why when run as admin, CreateFromMonitor return access denied error, LowIL? How to resolve this issue? or I can use DXGI?
from windows.ui.composition-win32-samples.
Running elevated as the same user shouldn't impact the capture API, but running as a different user will.
You can give DDA a try, it is allowed as the SYSTEM user (and that will allow you to capture the secure desktop).
What are the steps you take to run the application as administrator that causes it not to work? I can't repro this.
from windows.ui.composition-win32-samples.
Running elevated as the same user shouldn't impact the capture API, but running as a different user will.
Yes, I think this is the reason for my case 1) and 2),result like the table below:
Windows User | Run as Admin | C# | MFC Demo |
---|---|---|---|
Administrator | asInvoker(double click run) | work fine | work fine |
Administrator | Admin | work fine | work fine |
Standard User | asInvoker(double click run) | work fine | work fine |
Standard User | Admin | don‘t work | don‘t work |
The dependence is app->A.dll->OBS libs(use IGraphicsCaptureItemInterop::CreateForMonitor)
This is not my key question, I can understand the reason you point out
What are the steps you take to run the application as administrator that causes it not to work? I can't repro this.
Sorry, maybe my description is not clear?
In case 3), I write an Electron app through C++ addons(wrapped with A.dll), the dependence is
Electron app->addon.node->A.dll->OBS libs(use IGraphicsCaptureItemInterop::CreateForMonitor)
Windows User | Powershell | Electron app |
---|---|---|
Administrator | click run(non-admin) | work fine |
Administrator | Run as Admin | don‘t work |
Windows User | Debug with VS2022 | Electron app | C# | MFC Demo |
---|---|---|---|---|
Administrator | non-admin launch VS2022 | work fine | work fine | work fine |
Administrator | Admin launch VS2022 | don‘t work | work fine | work fine |
Debug Electron app with VS2022(non-admin launch)
The IntegrityLevel is SECURITY_MANDATORY_MEDIUM_RID(8192) and the CreateForMonitor is OK, so can capture the monitor
Debug Electron app with VS2022(admin launch)
The IntegrityLevel is SECURITY_MANDATORY_HIGH_RID(12288) and the CreateForMonitor is access_denied, so can't capture the monitor
So I don't know if the electron has some constraint or something else?
from windows.ui.composition-win32-samples.
Debug MFC app with VS2022(non-admin launch)
The IntegrityLevel is SECURITY_MANDATORY_MEDIUM_RID(8192) and the CreateForMonitor is OK, so can capture the monitor
Debug MFC app with VS2022(admin launch)
The IntegrityLevel is SECURITY_MANDATORY_HIGH_RID(12288) and the CreateForMonitor is OK, so can capture the monitor
GetProcessIL is from Cannot use IGraphicsCaptureItemInterop::CreateForWindow with electron apps #111
from windows.ui.composition-win32-samples.
Related Issues (20)
- Some samples use `WindowsRuntimeMarshal` class, that is no longer available in .NET 5+ HOT 4
- Cannot use IGraphicsCaptureItemInterop::CreateForWindow with electron apps HOT 6
- This repo is missing important files HOT 4
- How to capture Windows10/11 Virtual Desktop via Windows.Graphics.Capture ? HOT 2
- Accessing screen capture image bytes with MapFlags.DoNotWait for better CPU usage HOT 3
- Can I do successive captures on two different windows HOT 8
- ScreenCapture Sample - write capture stream to disk mp4? HOT 5
- Capture area of a monitor HOT 4
- Memory Leak? HOT 5
- BSODs on 4 separate Hard Drives HOT 3
- Multiple screen captures in a loop cause explorer.exe and native Windows app to lag? HOT 11
- Capture OnFrame Callback very slow on Win11 23H2 HOT 7
- Cannot catch errors in CreateCaptureItemForWindow HOT 3
- WGC CaptureFrame returns wrong SystemRelativeTime in window capture mode HOT 2
- Cursor may become invisible when recording some fullscreen games using WGC HOT 6
- Frame has issue after change window state (maximize from normal/ normal from maximize/ ...) HOT 1
- ScreenCaptureforHWND sample leaks handles leading to "Out of memory" crash HOT 1
- ScreenCaptureforHWND sample main thread hang HOT 2
- ScreenCaptureforHWND: How to get the byte data of the captured frame? HOT 4
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 windows.ui.composition-win32-samples.