Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Thaddy> SAPI

Posted on 1998-11-12
11
Medium Priority
?
340 Views
Last Modified: 2010-04-04
Hello !

Can you show me delphi source of Tvcommand from SAPI 4,
i always get error on "Vcommand1.AddCommand(" :( ,
or maybe anyone known solution also.

Jecksom.
0
Comment
Question by:jecksom
  • 6
  • 5
11 Comments
 
LVL 2

Expert Comment

by:Thaddy
ID: 1346668
If Olevariant(Vcommand).AddCommand(Acommand) works do I get the points?

0
 
LVL 1

Author Comment

by:jecksom
ID: 1346669
I'll better show my source :

var
  gmymenu:longint;

procedure TForm1.FormCreate(Sender: TObject);
begin
Vcommand1.Initialized := 1;
gMymenu := Vcommand1.MenuCreate['Project1', 'state1', 4];
Vcommand1.Enabled := 1;
Vcommand1.AddCommand(gMymenu, 1, 'red', 'when you say' + 'red', 'listen list',0, '');///ERROR
Vcommand1.AddCommand(gMymenu, 1, 'blue', 'when you say' + 'blue', 'listen list', 0, '');
Vcommand1.AddCommand(gMymenu, 1, 'green', 'when you say' + 'green', 'listen list', 0, '');
Vcommand1.Activate(gMymenu);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
Vcommand1.ReleaseMenu(gMymenu);
end;

I've just transfered it from VB source . "///ERROR" - Access Violation .... Xcommand.dll,
maybe you know why ? or maybe i'm doing wrong way ?

Jecksom

0
 
LVL 1

Author Comment

by:jecksom
ID: 1346670
PS:    Vcommand1: TVcommand; from Microsoft Voice Command OCX.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:Thaddy
ID: 1346671
I'll check it this weekend. will be back.
Until then, why not try the ms agent stuff? MS states this will be their (high level) standard for text to speech and speech to text. You don't have to show some not.so.funny characters, they are just part of the spec. the speech engine is, apart from the dragon products, the best I've seen jet.
0
 
LVL 1

Author Comment

by:jecksom
ID: 1346672
HI , Dragon dictant ? i didn't checked it myslef , does it based on MS API ? or  they have
self designed  engine ?
Okay , i'll try MS agent , hope you'll don't forget about my question after weekend .

Best Regards,
           Jecksom


0
 
LVL 2

Expert Comment

by:Thaddy
ID: 1346673
Olevariant(Vcommand1).AddCommand(gMymenu, 1, 'red', 'when you say' + 'red', 'listen list',0);///NO ERROR , you default to the default!
As explained in first comment, this works (and I tested it too)

0
 
LVL 1

Author Comment

by:jecksom
ID: 1346674
Olevariant(Vcommand1).AddCommand(gMymenu, 1, 'red', 'when you say' + 'red', 'listen list',0); ----> Invalid Typecast at : "Olevariant(Vcommand1).". How i can fix that ?


0
 
LVL 2

Expert Comment

by:Thaddy
ID: 1346675
Oops, forgot to say that I did use it directly, that is, not with an ocx wrapper but directly via the interface.
I create the control almost always via a coXX.Create
look in the *_TLB.PAS file and look for the coClasses section
There you'll find the interfaces that you can create an instance of directly. Then, use them as needed. If you need help, I'll send an example.
0
 
LVL 1

Author Comment

by:jecksom
ID: 1346676
Yes ! example would be great !
0
 
LVL 2

Accepted Solution

by:
Thaddy earned 400 total points
ID: 1346677
Check this out: All that was wrong in your code are a few little quirks:
'First: make shure not to pass a const empty widestring without 'an extra #00
'MAKE SHURE that you pass a parameter to a valid Twincontrol, 'like Mainmenu1.
procedure TForm1.FormCreate(Sender: TObject);
begin
Vcommand1.Initialized := 1;
Vcommand1.Enabled:= 1;
gMymenu := Vcommand1.MenuCreate['Mainmenu1', 'state1', 4];
Vcommand1.AddCommand(gMymenu, 1, 'red', 'when you say' + 'red', 'listen list', 0, ''#00);
Vcommand1.AddCommand(gMymenu, 1, 'blue', 'when you say' + 'blue', 'listen list', 0, ''#00);
Vcommand1.AddCommand(gMymenu, 1, 'green', 'when you say' + 'green', 'listen list', 0, ''#00);

UpdateList;
Vcommand1.Activate(gMymenu);
end;

0
 
LVL 1

Author Comment

by:jecksom
ID: 1346678
Yep ! It works ! thanx for your help !

Jecksom.

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question