I'm trying to create a custom pattern for UIAutomation, and it's been quite the hassle.
It seems that it's impossible to call IUIAutomationRegistrar.RegisterPattern() from c# (see this question), I got around that by calling RegisterPattern() from a c++ DLL that I linked in. I'm now doing that from both my automated UI test harness and my main application, and in both cases RegisterPattern() is succeeding (returning S_OK) and telling me that the patternID is 50000. So far so good!
But in my test harness, if I call IUIAutomationElement.GetCurrentPattern(50000), it returns a null pointer. I put extra logging into my main application, and it sure looks like the test harness isn't even trying to contact the application about this. I'm logging when the main app gets WM_GETOBJECT, and I don't see anything there that would indicate that's happening.
Is support for UIAutomation under c# extremely limited? No way to do custom patterns?