Solved

Thaddy> SAPI

Posted on 1998-11-12
11
326 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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 100 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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