mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
Change User32 Extended Styles on Windows #114
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fatalmuffin on GitHub (Jan 31, 2018).
Originally assigned to: @GregorBiswanger on GitHub.
Hello. I am writing an app which relies on an external C# dll to run some user32 interop functions.
It's working quite well except I'm not allowed to subclass in C# .net and therefore cannot change windows styles / extended styles for my Electron window.
If you're wondering what I'm talking about, check here:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx
My interop dll is parenting the electron window to another window, which works fine, except the window gets a black backdrop instead of it's normal transparency.
I figured out (through Winspectorspy utility) that it needs the WS_EX_TRANSPARENT style and must not have the WS_EX_COMPOSITED style applied to the window.
My question, before I jump into creating an umanaged C++ wrapper so I can subclass the window (huge pain in the ass), is there any way other way I could change the electron window's extended styles?
@GregorBiswanger commented on GitHub (Jan 31, 2018):
Hey @fatalmuffin,
you could change everything, the BrowserWindow-Object offers.
You find the BrowserWindow documentation here:
https://github.com/electron/electron/blob/master/docs/api/browser-window.md
In Electron.NET here:
Electron.WindowManager.BrowserWindows.First();Don´t forget your P/Invoke code is only for windows.
Use the .NET Core code for determine the Operating System:
I hope my answer helps you.
@fatalmuffin commented on GitHub (Feb 10, 2018):
Hey! Sorry for the lack of a response, I found out I was actually wrong about the reason why I was having issues. Turns out after adding the extended styles I needed, I had to refresh to parent window (in this case the desktop) done with a pinvoke SystemParametersInfo. Thanks for the reply though!