Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
Saturday at 11:44 PM
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
C# Programing FAQ - Post here
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="asachan" data-source="post: 4451283" data-attributes="member: 189916"><p><strong><span style="color: DarkRed">Things required, where to get and how to install</span></strong></p><p></p><ol> <li data-xf-list-type="ol">You have to add reference <em>AgentObjects.dll</em> and <em>AgentServerObjects.dll</em>. You can get this two DLLs from <em>F:\Program Files\Microsoft Visual Studio .NET\ FrameworkSDK\Samples\Technologies\Interop\Applications\MSAgent\AgentExplorer</em>. Bear in mind, you have installed .NET in F:. Or Just go to <em>F:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Technologies\Interop\Applications\MSAgent\Hello1</em> and take a look at read <em>me.htm</em> file how to get those DLLs. You just give, nmake all. This command will create <em>AgentObjects.dll</em> and <em>AgentServerObjects.dll</em> in <em>hello1</em> folder.<br /> Or just use those DLLs from this setup. I have bind these DLLs with this setup.<br /> Assure those 2 DLLs in bin debug/release folder and add reference to solution explorer in you project.</li> <li data-xf-list-type="ol">We have to put <em>.acs</em> in debug or release folder. Announcer will show error if <em>.acs</em> file is not there. You can get four <em>.acs</em> files from <a href="http://www.microsoft.com/msagent/downloads/user.asp" target="_blank">http://www.microsoft.com/msagent/downloads/user.asp</a>. There you get genie, Merlin, Peedy and Robby, Microsoft agent character files (<em>.acs</em>)<br /> and put into <em>release</em> or <em>debug</em> folder.</li> <li data-xf-list-type="ol">Just download and open the <em>MicrosoftAgentApplication.sln</em> file to use it. Before run this, you have to install Text to speech engine. Download Text-to-Speech Engineer <em>tv_enua.exe</em> American English - 1 MB from here <a href="http://www.microsoft.com/msagent/downloads/user.asp" target="_blank">http://www.microsoft.com/msagent/downloads/user.asp</a>. I could not add this with my demo setup due to size restriction.<br /> Just click <em>tv_enua.exe</em> to install. Then announcer is ready to announce anything, sing a song and tell a joke.</li> </ol><p>Sample Code</p><p><span style="color: RoyalBlue"></span></p><p><span style="color: RoyalBlue"></span><span style="color: RoyalBlue">using System.Data;</span></p><p><span style="color: RoyalBlue">using System.Drawing;</span></p><p><span style="color: RoyalBlue">using System.Reflection; </span></p><p><span style="color: RoyalBlue">using System.Collections;</span></p><p><span style="color: RoyalBlue">using System.Windows.Forms;</span></p><p><span style="color: RoyalBlue">using System.ComponentModel;</span></p><p><span style="color: RoyalBlue">using System.Runtime.InteropServices; </span></p><p><span style="color: RoyalBlue">using AgentObjects;</span></p><p><span style="color: RoyalBlue">using AgentServerObjects;</span></p><p></p><p>If you install right Agent DLLs you and u add References to </p><p>that this will come Nice and easy</p><p><span style="color: Blue">Before we make a function to create an error files, we have to declare some variables that will be used in our function. This is an example of variables declaration and the main function is <span style="color: DarkRed">ErrorRoutine.</span></span></p><p><span style="color: Blue"><span style="color: DarkRed"></span></span></p><p><span style="color: Blue"><span style="color: DarkRed"></span></span><strong><span style="color: RoyalBlue"> AgentServer Srv = new AgentServer(); //Create a agent server</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> //If unable to create show the error</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> if (Srv == null) </span></strong></p><p><strong><span style="color: RoyalBlue"> {</span></strong></p><p><strong><span style="color: RoyalBlue"> MessageBox.Show("ERROR: Agent Server couldn't be started!");</span></strong></p><p><strong><span style="color: RoyalBlue"> }</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> IAgentEx SrvEx;</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> // The following cast does the QueryInterface to </span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> //fetch IAgentEx interface from the IAgent interface,</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> //directly supported by the object</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> SrvEx = (IAgentEx) Srv;</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> // First try to load the default character</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> int dwCharID=0, dwReqID=0;</span></strong></p><p><strong><span style="color: RoyalBlue"> try </span></strong></p><p><strong><span style="color: RoyalBlue"> {</span></strong></p><p><strong><span style="color: RoyalBlue"> // null is used where VT_EMPTY variant is expected by the COM object</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> String strAgentCharacterFile = null;</span></strong></p><p><strong><span style="color: RoyalBlue"> //Check microsoft agent character filename(.acs) is empty </span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> if (!strFileName.Equals(string.Empty)) </span></strong></p><p><strong><span style="color: RoyalBlue"> {</span></strong></p><p><strong><span style="color: RoyalBlue"> //Get the acs path</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> strAgentCharacterFile = strPath + strFileName;</span></strong></p><p><strong><span style="color: RoyalBlue"> }</span></strong></p><p><strong><span style="color: RoyalBlue"> else</span></strong></p><p><strong><span style="color: RoyalBlue"> {</span></strong></p><p><strong><span style="color: RoyalBlue"> MessageBox.Show("Select Style");</span></strong></p><p><strong><span style="color: RoyalBlue"> return;</span></strong></p><p><strong><span style="color: RoyalBlue"> }</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> if (!TxtSpeakInput.Text.Equals(string.Empty)) </span></strong></p><p><strong><span style="color: RoyalBlue"> {</span></strong></p><p><strong><span style="color: RoyalBlue"> //load the acs file</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> SrvEx.Load(strAgentCharacterFile, out dwCharID, out dwReqID);</span></strong></p><p><strong><span style="color: RoyalBlue"> }</span></strong></p><p><strong><span style="color: RoyalBlue"> else</span></strong></p><p><strong><span style="color: RoyalBlue"> {</span></strong></p><p><strong><span style="color: RoyalBlue"> MessageBox.Show("Enter Text");</span></strong></p><p><strong><span style="color: RoyalBlue"> return;</span></strong></p><p><strong><span style="color: RoyalBlue"> }</span></strong></p><p><strong><span style="color: RoyalBlue">} </span></strong></p><p><strong><span style="color: RoyalBlue">catch (Exception) </span></strong></p><p><strong><span style="color: RoyalBlue">{</span></strong></p><p><strong><span style="color: RoyalBlue"> MessageBox.Show("Failed to load Agent character! Exception details:");</span></strong></p><p><strong><span style="color: RoyalBlue">}</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> IAgentCharacterEx CharacterEx=null;</span></strong></p><p><strong><span style="color: RoyalBlue"> SrvEx.GetCharacterEx(dwCharID, out CharacterEx);</span></strong></p><p><strong><span style="color: RoyalBlue"> //CharacterEx.SetLanguageID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> // Show the character. The first parameter tells Microsoft</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> // Agent to show the character by playing an animation.</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> CharacterEx.Show(0, out dwReqID);</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> // Make the character speak</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> // Second parameter will be transferred to the COM object as NULL</span></strong></p><p><strong><span style="color: RoyalBlue"></span></strong></p><p><strong><span style="color: RoyalBlue"> CharacterEx.Speak(TxtSpeakInput.Text, null, out dwReqID);</span></strong></p><p><strong><span style="color: RoyalBlue">}</span></strong></p></blockquote><p></p>
[QUOTE="asachan, post: 4451283, member: 189916"] [B][COLOR=DarkRed]Things required, where to get and how to install[/COLOR][/B] [LIST=1] [*]You have to add reference [I]AgentObjects.dll[/I] and [I]AgentServerObjects.dll[/I]. You can get this two DLLs from [I]F:\Program Files\Microsoft Visual Studio .NET\ FrameworkSDK\Samples\Technologies\Interop\Applications\MSAgent\AgentExplorer[/I]. Bear in mind, you have installed .NET in F:. Or Just go to [I]F:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Technologies\Interop\Applications\MSAgent\Hello1[/I] and take a look at read [I]me.htm[/I] file how to get those DLLs. You just give, nmake all. This command will create [I]AgentObjects.dll[/I] and [I]AgentServerObjects.dll[/I] in [I]hello1[/I] folder. Or just use those DLLs from this setup. I have bind these DLLs with this setup. Assure those 2 DLLs in bin debug/release folder and add reference to solution explorer in you project. [*]We have to put [I].acs[/I] in debug or release folder. Announcer will show error if [I].acs[/I] file is not there. You can get four [I].acs[/I] files from [URL="http://www.microsoft.com/msagent/downloads/user.asp"]http://www.microsoft.com/msagent/downloads/user.asp[/URL]. There you get genie, Merlin, Peedy and Robby, Microsoft agent character files ([I].acs[/I]) and put into [I]release[/I] or [I]debug[/I] folder. [*]Just download and open the [I]MicrosoftAgentApplication.sln[/I] file to use it. Before run this, you have to install Text to speech engine. Download Text-to-Speech Engineer [I]tv_enua.exe[/I] American English - 1 MB from here [URL="http://www.microsoft.com/msagent/downloads/user.asp"]http://www.microsoft.com/msagent/downloads/user.asp[/URL]. I could not add this with my demo setup due to size restriction. Just click [I]tv_enua.exe[/I] to install. Then announcer is ready to announce anything, sing a song and tell a joke. [/LIST] Sample Code [COLOR=RoyalBlue] [/COLOR][COLOR=RoyalBlue]using System.Data; using System.Drawing; using System.Reflection; using System.Collections; using System.Windows.Forms; using System.ComponentModel; using System.Runtime.InteropServices; using AgentObjects; using AgentServerObjects;[/COLOR] If you install right Agent DLLs you and u add References to that this will come Nice and easy [COLOR=Blue]Before we make a function to create an error files, we have to declare some variables that will be used in our function. This is an example of variables declaration and the main function is [COLOR=DarkRed]ErrorRoutine. [/COLOR][/COLOR][B][COLOR=RoyalBlue] AgentServer Srv = new AgentServer(); //Create a agent server //If unable to create show the error if (Srv == null) { MessageBox.Show("ERROR: Agent Server couldn't be started!"); } IAgentEx SrvEx; // The following cast does the QueryInterface to //fetch IAgentEx interface from the IAgent interface, //directly supported by the object SrvEx = (IAgentEx) Srv; // First try to load the default character int dwCharID=0, dwReqID=0; try { // null is used where VT_EMPTY variant is expected by the COM object String strAgentCharacterFile = null; //Check microsoft agent character filename(.acs) is empty if (!strFileName.Equals(string.Empty)) { //Get the acs path strAgentCharacterFile = strPath + strFileName; } else { MessageBox.Show("Select Style"); return; } if (!TxtSpeakInput.Text.Equals(string.Empty)) { //load the acs file SrvEx.Load(strAgentCharacterFile, out dwCharID, out dwReqID); } else { MessageBox.Show("Enter Text"); return; } } catch (Exception) { MessageBox.Show("Failed to load Agent character! Exception details:"); } IAgentCharacterEx CharacterEx=null; SrvEx.GetCharacterEx(dwCharID, out CharacterEx); //CharacterEx.SetLanguageID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); // Show the character. The first parameter tells Microsoft // Agent to show the character by playing an animation. CharacterEx.Show(0, out dwReqID); // Make the character speak // Second parameter will be transferred to the COM object as NULL CharacterEx.Speak(TxtSpeakInput.Text, null, out dwReqID); }[/COLOR][/B] [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom