You can write it as an IE Helper Object, those are not executed but are loaded with any instance of IE. IEHOs are DLLs, you can google it and find more information on them, I don't have any handy. You may have to access COM+ stuff though I am not sure.
With a helper object you have access to all data passed to and from an IE instance.