Finding the result of a dialog from an out-of-process dialog

I have developed a tool in .net using C # that will help in validating and deleting specific file types using Team Foundation Server. There is a point in time though my tool really needs to know what the result of the dialog is when the user replies to the message dialog that appears as soon as a TFS or "Team Foundation Server" merge is done. Basically I need my tool to sit either in a loop or a timer and wait for a response, but I'm not sure how. I searched for it but nobody seemed to need it.

+2


source to share


2 answers


You can use AutoIt , you can write a script that will wait for windows (using WinWait ) and then do something about it.



0


source


You can use SetWindowsHookEx to set up a hook function to listen for events in another process. Note that this will install the hook function in every process running on your system and must be written in a drone (C / C ++) DLL.

But with that, you can use WH_CBT and WH_MSGFILTER to listen for a button click in the dialog.



This is somewhat dangerous, as you will inject the DLL into every process under the control of the current user, which means that the code you write in your DLL will be loaded and executed in each process. You will also need to worry about inter-process communication as your hook code will run in the TFS process, although you can traverse with mutexes as you just need a simple notification.

0


source







All Articles