Link to home
Start Free TrialLog in
Avatar of ScottParker
ScottParkerFlag for United States of America

asked on

Trigger windows sound from AS/400 program

Greetings,
I am trying to figure out if there is a way for an RPG or ILE program to trigger the playing of a sound file.
The "Beep" that we could do, is not sufficent in this case.  
I want to have a .wav file, that is stored on the PC played.

Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of stevebowdoin
stevebowdoin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ScottParker

ASKER

I thought about that as well..  so I made me a little VB.net console application.   It works just fine when I call it from the windows command line..
It "Opens" when I call it using the RUNRMTCMD from the AS/400   but the sound does not play.
here is the code...  Any Ideas?   I have also tried changing the WAITTIME(*NOMAX) and it didnt help.

JGPCPGM:    PGM                                                                                          
             DCL        VAR(&STRING     ) TYPE(*CHAR) LEN(200)                                            
             CHGVAR     VAR(&STRING) VALUE('"C:\PlaySound\PlaySound.exe"')                                
             RUNRMTCMD  CMD(&STRING) RMTLOCNAME('172.16.104.80' *IP) RMTUSER(*NONE) WAITTIME(*NOWAIT)    
EOJ:                                                                                                      
             ENDPGM                                                                                      
I have the RUNRMTCMD working for another program I made.  So I know that the "Incoming Remote Command" option is correct.
I added a 1/2 a second delay in the windows program.  Once I did that, everything worked fine.
Incoming remote command is going to spawn your program in another session, which may cause a problem for applications that need to interact with the user's session (including sound, I'm guessing).  You may be able to cure this by making sure the service is configured to interact with the desktop:

http://www.mcpressonline.com/programming/rpg/calling-a-pc-application-from-rpg-part-iii.html

Otherwise, you can try this instead.  STRPCCMD uses a different approach to start a PC command, and may not work through all emulators, though it should work fine with Client Access.

STRPCO
STRPCCMD

Another alternative, since you clearly know VB, is to write a little VB program that runs in the users session that uses the CA data queue APIs to watch an AS/400 data queue.  Entries placed on the data queue on the AS/400 can be used to trigger various programs in the user's session (or could even contain a command string itself).

- Gary Patterson