dapplo / dapplo.windows Goto Github PK
View Code? Open in Web Editor NEWA library with a different approach to calling Win32 APIs, e,g providing reactive access to the clipboard or global hotkeys.
License: MIT License
A library with a different approach to calling Win32 APIs, e,g providing reactive access to the clipboard or global hotkeys.
License: MIT License
Hi,
I'm trying to subscribe create window event and exclude one emitted by children.
However, it seems the child windows is still generating events.
Can you suggest please, what is wrong here:
var winEventObservable = WinEventHook.Create(
Dapplo.Windows.Enums.WinEvents.EVENT_OBJECT_CREATE
).Where(winEventInfo =>
winEventInfo.IsSelf &&
winEventInfo.ObjectIdentifier == Dapplo.Windows.User32.Enums.ObjectIdentifiers.Window
)
.Select(info => InteropWindowFactory.CreateFor(info.Handle).Fill())
.Subscribe(interopWindow =>
{
Console.WriteLine("Window created: {0}. Title = {1}", interopWindow.Handle, interopWindow.Caption);
replaySubject.OnNext(interopWindow);
}, exception => Console.WriteLine("An error occured: {0}", exception));
Thank you for the nice project.
When I use devcon.exe, WMI and so on to query for a particular graphics card in my system I get the following identifier(s):
PCI\VEN_10DE&DEV_1FB8&SUBSYS_09061028&REV_A1\4&32AF3F68&0&0008
However, using your library (๐) I do get a similar id.. but.. only similar & not the same, i.e. when listenting for removal events (read: enabling/disabling the device via Windows' device manager):
\?\PCI#VEN_10DE&DEV_1FB8&SUBSYS_09061028&REV_A1#4&32af3f68&0&0008#{1ca05180-a699-450a-9a0c-de4fbe3ddd89}
I am a bit confused why there are #s in the .Name and also the DeviceClassGuid.. is this an encoding issue.. or on purpose?
And a slightly related note: the graphics card(s) in my system all have the very same (Device) Class Guid (in the device manager's details) which is "{4d36e968-e325-11ce-bfc1-08002be10318}", however none of the DeviceNotification.OnDeviceArrival() / DeviceNotification.OnDeviceRemoved() events fired (and there are 6 or so per enabling/disabling in the device manager) has that DeviceClassGuid set.
So I am again a bit puzzled why I see info a) in Windows its tools etc but b) the info not matching with the info of the events. I think I must be missing something here, some missing link / mapping or something.. but if you had any ideas / suggestions what might be going on it would be highly appreciated!
Thanks and thanks especially for all your work on this library!!
When the handling of a key takes to long, the key-up is not detected and next key presses are suddenly causing weird detections.
I need a test-case for this, so we can see if changes in the KeyboardHook to the IObservable work as needed.
I expect a .ObserveOn(TaskPoolScheduler.Default) to solve this...
You can save your time if you join other libraries instead of writing a new one
https://github.com/dahall/Vanara
https://github.com/AArnott/pinvoke
It's hard to update the package from Nuget when there are no release notes. Is it possible to have release notes generated for packages beyond 0.1.30 (or at least for current release)?
Some code automatically registers for WindowsMessages, which might not be someone people want.
For instance the ScreenBounds are automatically updated, which might not be needed.
... more to follow
I couldn't get the MouseClick
event to work properly, digging into the code
it looks like an error whereby the MouseDown
event is fired twice, rather than a MouseDown
and a MouseUp
.
Currently it's still all in development but it would be good to see some better documentation on usages.
Provide a simple API to query for software
A class for the information, this is just quickly thrown together with the values from the registry at SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
public class Software {
Guid Id {get;set;}
string AuthorizedCDFPrefix {get;set;}
string Contact {get;set;}
string DisplayName {get;set;}
string DisplayVersion {get;set;}
int EstimatedSize {get;set;}
string HelpLink {get;set;}
string HelpTelephone {get;set;}
/// YYYYMMDD
string InstallDate {get;set;}
string InstallLocation {get;set;}
string InstallSource {get;set;}
int Language {get;set;}
string Publisher {get;set;}
string Readme {get;set;}
string Size {get;set;}
string UninstallString {get;set;}
string URLInfoAbout {get;set;}
string URLUpdateInfo {get;set;}
int Version{get;set;}
int VersionMajor {get;set;}
int VersionMinor {get;set;}
bool WindowsInstaller {get;set;}
bool NoModify {get;set;}
bool NoRepair {get;set;}
}
Code to retrieve the installed software:
public IEnumerable<Software> InstalledSoftware()
{
string uninstallKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(uninstallKey))
{
foreach (string skName in rk.GetSubKeyNames())
{
using (RegistryKey sk = rk.OpenSubKey(skName))
{
try
{
// Map values to Software Class, take the ID from the skName?
yield return new Software {
Id = new Guid(skName),
DisplayName = sk.GetValue("DisplayName");
};
}
catch (Exception ex)
{
Log.Warn
}
}
}
}
}
Especially something to create Icon file, ICONDIRENTRY etc.
Prevent throwing if something is not a stream. maybe by allowing to check this first?
It might make sense to simplify the usage, so other apps do not need to know the details of enabling and disabling the cloud copying.
See https://docs.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-loadiconmetric and there specifically the mentioning of SM_CXSMICON & SM_CYICONSPACING etc mentioned here: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsystemmetrics
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.