Help about using win32::API 
Author Message
 Help about using win32::API

Hi all,
I tried to ues Win32::API for calling a DLL by perl codes, but I just
so hope somebody here could help me.

The functions needed are defined in the header file as:
__declspec(dllimport) int initTTS(char *dataPath, short gender);
__declspec(dllimport) void termTTS(void);
__declspec(dllimport) int spk(char *string, double sentenceRate, short

And I attach my c++ codes, it could work and speak"Talking agent works"
#include <stdio.h>
#include <stdlib.h>
#include "..\\talk.h"

void main(){
 //printf("%d\n", 1|2);
 if( initTTS("d:\\tts_dll\\datafile", 3)==0 ){
  printf("CTTS initialisation fail\n");
 spk("Talking agent works", 1.5, F_VOICE);


However when I tried to call it by Perl codes with Win32::API module,
strangly, the functions were called with ok returned messages , but
it doesn't speak"talking aganet works", but some squeezed ones or
something strange. So I guess I did wrong something, but I could not
find any clues for several hours.
use Win32::API;

$the_string = "Talking agent works";

$initTTS = new Win32::API("talk", "initTTS", [P, I], I);
$spk = new Win32::API("talk", "spk", [P, N, I], I);
$termTTS = new Win32::API("talk", "termTTS", [], V);

if ($initTTS->Call('d:\\tts_dll\\datafile',1)  == 1 ){
 print "init ok\n";


if ( ($spk->Call($the_string, 2, 1)) == 1) {
 print "Spk ok\n";}
else {
 print "Spk failed\n";



Thanks very very much for looking into my problem.

Fri, 07 Mar 2003 00:28:13 GMT  
 [ 1 post ] 

 Relevant Pages 

1. HELP! Invoking a DLL function using Win32::API

2. HELP! Invoking a DLL function using Win32::API

3. Using Win32::API to access IO ports (Win95)

4. using Win32::API->MessageBox

5. Problem using dlink to load Win32::API

6. Using Win32::API to access IO ports (Win95)

7. Passing File Handles when using Win32::API

8. using Win32::API

9. Problem Passing Handles using Win32::API module (A.Calpini)

10. Using Win32 API from Perl

11. Please help, my WIN32::API script cant run after upgrading ActivePerl5.22 to 6.23

12. Win32::API needs help


Powered by phpBB® Forum Software