Thanks for reporting back what constant did the trick. Regarding the activation letter for a control, I think this depends on the object model rather than the language used. With C# and the WinForms classes, an ampersand character (&) is used. I do not know about WPF. The ampersand has a special meaning in XML (so it has to be escaped for a literal one), so perhaps it is an underscore character (_) instead, which I think would be true regardless of language (the .NET Framework tries to be language acgnostic). Jamal On Wed, 4 Mar 2009, Jacob Kruger wrote: > Date: Wed, 4 Mar 2009 15:39:10 +0200 > From: Jacob Kruger <jacobk@xxxxxxxxxxxx> > Reply-To: program-l@xxxxxxxxxxxxx > To: program-l@xxxxxxxxxxxxx > Subject: [program-l] Re: Telling a C# implementation of SayTools to in > fact UseSAPI > > Ok. > > I was just being hasty/silly. > > Here's the working code: > public void SaySomething(string stIn ) > { > Type t = Type.GetTypeFromProgID("Say.Tools"); > object oST = Activator.CreateInstance(t); > object[] aParams1 = { 1}; > t.InvokeMember("UseSAPIAsBackup", BindingFlags.PutDispProperty, null, oST, > aParams1); > > object[] aParams = { stIn}; > t.InvokeMember("Say", BindingFlags.InvokeMethod, null, oST, aParams); > } > > The change that made it work is: > BindingFlags.PutDispProperty > > One other question is that when doing normal windows development in C#, it > seems to like something like _One to, for example set that buttons hotkey to > be the letter O, but here in WPF, it doesn't always seem to want to work. > > I know that in VB.Net it would be something like &One, and was just > wondering if the _ character is in fact the right one to use in C# etc.? > > Stay well > > Jacob Kruger > Blind Biker > Skype: BlindZA > '...fate had broken his body, but not his spirit...' > > ----- Original Message ----- > From: "Jamal Mazrui" <empower@xxxxxxxxx> > To: "Program-l" <program-l@xxxxxxxxxxxxx> > Sent: 03 March, 2009 11:17 PM > Subject: [program-l] Re: Telling a C# implementation of SayTools to in fact > UseSAPI > > > > Late-bound COM automation can be tedious to code in C#! In case it's > > helpful, the EdSharp source code (within EdSharp.cs) includes a Com class > > that makes things a bit easier. In your example, try using the > > BindingFlags.SetProperty constant instead. > > > > By the way, you seem to have done more WPF programming with a screen > > reader than anyone I know. Would you consider writing a "fruit > > basket" program that illustrates this framework? > > > > As you may know, folks on the list ProgrammingBlind@xxxxxxxxxxxxx > > developed a set of criteria for a sample GUI program, and have > > encouraged its implementation in various languages. This allows > > someone considering a language to get a sense of what coding in it is > > like and what the resulting accessibility might be of a program. The > > web site with criteria and implementations is > > > > http://FruitBasketDemo.AlacornComputer.com > > > > Cheers, > > Jamal > > > > On Tue, 3 Mar 2009, > > Jacob Kruger wrote: > > > >> Date: Tue, 3 Mar 2009 15:36:11 +0200 > >> From: Jacob Kruger <jacobk@xxxxxxxxxxxx> > >> Reply-To: program-l@xxxxxxxxxxxxx > >> To: Program-l <program-l@xxxxxxxxxxxxx> > >> Subject: [program-l] Telling a C# implementation of SayTools to in fact > >> UseSAPI > >> > >> Hi there > >> > >> While now again looking into WPF etc., I have put together a small class > >> to > >> render a better description caption for various objects etc. from within > >> the > >> WPF applications, and it makes use of what they call event bubbling so > >> that > >> I just added an event handler for GotFocus to the window class, and in > >> that > >> event code I send e.OriginalSource to the other class that I then > >> included > >> in the application, and this gets specifically sent to a method called > >> SayObject, wherein I'm in fact doing a switch based on the > >> Object.GetType.ToString() function to see what type of object it is, and > >> then getting Jaws etc. to say extra info relating to it's content etc. > >> etc. > >> > >> The primary idea is that while I wouldn't want to get it to necessarily > >> speak extra unless the user was actually running a screenreader, I was > >> just > >> wondering about in fact telling it to use SAPI as a backup in any case. > >> > >> Basically, the small bit of code from within Jamal's example code for > >> making > >> it say something looks like the following: > >> Type t = Type.GetTypeFromProgID("Say.Tools"); > >> object oST = Activator.CreateInstance(t); > >> string sText = "Hello world"; > >> object[] aParams = {sText}; > >> t.InvokeMember("Say", BindingFlags.InvokeMethod, null, oST, aParams); > >> > >> I tried adding in the following 2 lines of code above the actual > >> invokeMember above to tell it to in fact use SAPI as a backup, but it > >> just > >> generates errors relating to invalid execution or something (not at that > >> machine right now): > >> object[] aParams1 = {1}; > >> t.InvokeMember("UseSAPIAsBackup", BindingFlags.InvokeMethod, null, oST, > >> aParams1); > >> > >> Maybe I'm just not used enough to C# syntax, or something, but I have > >> checked the cases of the methods/functions/variable names as much as I > >> can, > >> so not sure why it doesn't want to do this. > >> > >> Since I'm also sort of busy migrating to C# from VB.Net, it would also be > >> best for me to figure this one out now already though. > >> > >> TIA > >> > >> Jacob Kruger > >> Blind Biker > >> Skype: BlindZA > >> '...fate had broken his body, but not his spirit...' > >> > >> ** To leave the list, click on the immediately-following link:- > >> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe] > >> ** If this link doesn't work then send a message to: > >> ** program-l-request@xxxxxxxxxxxxx > >> ** and in the Subject line type > >> ** unsubscribe > >> ** For other list commands such as vacation mode, click on the > >> ** immediately-following link:- > >> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq] > >> ** or send a message, to > >> ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq > >> > > ** To leave the list, click on the immediately-following link:- > > ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe] > > ** If this link doesn't work then send a message to: > > ** program-l-request@xxxxxxxxxxxxx > > ** and in the Subject line type > > ** unsubscribe > > ** For other list commands such as vacation mode, click on the > > ** immediately-following link:- > > ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq] > > ** or send a message, to > > ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq > > ** To leave the list, click on the immediately-following link:- > ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe] > ** If this link doesn't work then send a message to: > ** program-l-request@xxxxxxxxxxxxx > ** and in the Subject line type > ** unsubscribe > ** For other list commands such as vacation mode, click on the > ** immediately-following link:- > ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq] > ** or send a message, to > ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq > ** To leave the list, click on the immediately-following link:- ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe] ** If this link doesn't work then send a message to: ** program-l-request@xxxxxxxxxxxxx ** and in the Subject line type ** unsubscribe ** For other list commands such as vacation mode, click on the ** immediately-following link:- ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq] ** or send a message, to ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq