I have an Outlook-Addin, which contains a Ribbon with a Textbox. I'd like to access and set this Text in the Code behind, but according to this Thread Access Ribbon Elements Programatically in XML Ribbon this is not possible. So I tried to bypass the Outlook-Logic and work with PInvokes.
I've written a small wrapper, which returns me the Class-Name, the Text and the Handle of each Control of a given Process, for example Outlook.
But I still didn't find a possibility, to kindahow indentify Textbox X as Handle y.
I also tried to get more Informations via
[DllImport("user32.dll", SetLastError = true)]
internal static extern Boolean GetClassInfoEx(IntPtr hInstance, String lpClassName, ref Model.WndClassEx lpWndClass);
But I also can't see a possibility to identify my Control with this Data.
The last possibility I see here is to create a 'GetText'-Delegate on the Ribbon, set some specific Text and search the Control via this Text, but this seems super-hackish to me.
Are there better ways to make this work?