Memochipan
Memochipan

Reputation: 3465

Detect when a window is being closed and pass the path of the window in C#

I'm trying to develop the software I described in this post:

Get the path of every explorer window with c#

After I better analyzed the problem I found that I need to build a list with the "closed windows" not with the "current open windows".

I want to know if there is a way to catch the close window action and pass the path of that window to a variable in C#.

I appreciate the response had a little explanation and not just the code, to really understand what the code does.

Upvotes: 1

Views: 207

Answers (1)

David Heffernan
David Heffernan

Reputation: 612934

Use a CBT hook to receive notification of windows being closed. Note that this would likely be easier from native code. From mananged code you will expend a lot of energy working out p/invoke signatures, marshalling etc.

Upvotes: 2

Related Questions