Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluding child window events #17

Open
Dr-Hex opened this issue May 11, 2022 · 2 comments
Open

Excluding child window events #17

Dr-Hex opened this issue May 11, 2022 · 2 comments
Labels

Comments

@Dr-Hex
Copy link

Dr-Hex commented May 11, 2022

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.

@Lakritzator
Copy link
Member

I read you question a few days ago, but I'm not 100% sure what you like to do.
Maybe the interpretation of "IsSelf" is not completely clear, and doesn't match your need.

I'm not sure what the "child" is in your case.

I love to hear a few more details!

@Dr-Hex
Copy link
Author

Dr-Hex commented Jul 26, 2022

Sorry for late reply.
Imagine that some process is started and displayed the "main" visible window (and perhaps, some hidden windows).
I'd like to receive "create" notifications from that "main" window (having no parent window).
For me, the mentioned code generate notification even by child controls as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants