Implement a helper animation in Office in your own program.

xiaoxiao2021-03-05  22

hope its good for U.S..

---- 1, add agent control

---- Select Menu Component, Import ActiveX Control - Select Microsoft Agent Control 2.0 (Version 2.0) in the list box under Import ActiveX, click Button Install - Click the button OK in the Install dialog - in the Confirm dialog Click the button YES - in the dialog box OK. At this point, the Agent control is added to the BCB component board ActiveX page.

---- 2, call an Agent control

---- (1) New project1 (including Form1), place the Agent1 on Form1 (Name property is MyAgent), button1.

---- (2) define the variable.

IAgentctlcharacter Peedy; IAGENTLREQUEST Request1, Request2;

---- (3) The main attributes, methods, events.

---- 1Characters attribute and load, unload method: initialize the Agent, load animation data, uninstall the animated characters

---- Request1 = myagent-> character-> "" peedy "," c: /windows/system/peedy.acs "); ---- peedy = myagent-> characters-> character (" peedy ") ; ---- myagent-> characters-> unload ("peedy");

---- 2SHOW and HIDE Method: Show, hide the Agent animation. The parameter FAST represents the movie character display, hidden speed. FAST is 0 indicates that Agent is flying, flying out, FAST is 1 means Agent directly, disappears, no animation process.

---- peedy-> show (0); ---- peedy-> hide (1);

---- 3Stopall, STOP method: Stop all actions. ---- Peedy-> Stopall ("); ---- peedy-> stop (request);

---- 4Connected Property: Is Agent to connect to a Microsoft Agent server. ---- MyAgent-> Connected = True;

---- 5GetHeight, Getwwidth, setHeight, SetWidth Method: Get the height, width of the Agent animation character.

---- 6Moveto method: Parameters x, y indicates the coordinate of the Agent animation person, and the parameter speed represents the speed of the movement.

---- Peedy-> Moveto ((Screen-> width-peedy-> getWidth) / 2, (Screen-> Height-Peedy-> GetHeight) / 2, 2);

---- 7INTERRUPT method: Interrupt the animation of the specified role. In dozens of animation actions, there is a kind of action that is a kind of suffix "ING", such as "Processing", "Searching", "Reading", "Writing", once executed, you must by call another animated person's Interrupt Method can be interrupted. The role cannot be interrupted, otherwise it will result in an exception.

Request1 = Robby-> Play ("Reading"); peedy-> interrupt (request1);

---- 8WAIT method: coordinate animation actions between multiple different animation characters, such as waiting for SRobby's current action execution, peedy does another action. Request1 = robby-> play ("read"); peedy-> wait (request1); peedy-> play ("search");

---- ⑨Play method: Perform the specified animation action, parameter Animation is a constant, indicating the animation type. Agent provides dozens of predefined actions, just call these constants directly when developing software. The following is a brief introduction to some of the commonly used constants are for programming purposes only.

---- Action Type Chinese Invention Action Type Chinese Invention Action Type Chinese Invention

acknowledge acknowledge lookdown looking down sad sad alert warning lookdownblink looking down blink search looking statement announce lookup to look up startlistening start listening blink blink blink of an eye looking down lookupblink stoplistening stop listening confused confused lookleft look to the left suggest recommendations congratulate congratulations lookleftblink look to the left blink surprised surprised decline refused lookright looking to the right think to think dontrecognize not recognize lookrightblink see blink wave waving explain explain movedown move down write writing gesturedown posture down moveup move up processing computing ...... gestureup right up to the right posture moveright reading reading ...... GESTUREFT moves to the left movement move to left to move Searching Search ... Gestureright PLESED Happy Writing Writing ... Getattion Get Note Read Read Greet Greeting RESTPOSE Recovery Initial Status Request = Peedy-> Play ("Search);"

It should be noted that some characters are relatively simple, and there is not so much action you can next AVTOOL. EXE, is Microsoft's Agent Role Action View Program, with him to see all the actions

---- ⑩SPEAK method: Agent By calling the voice synthesis engine, supporting English speech synthesis output function, just enter the English string, Agent can pass the sound card, the speaker "speak". The current version of Agent does not have to support Chinese speech synthetic function, so "can only play Chinese in the form of .WAV file. The Chinese sentence you want to say is pre-recorded in advance, stored in .wav form, call it in the program. The parameter text represents the text displayed in the text balloon, the parameter URL represents the path to the .wav file.

---- Peedy-> Speak ("Hey, friends, you are good, now I will help you! ',' c: / new folder / Help.wav");

---- Peedy-> Speak ("Do you like my help? if so, please send me an email! Thank you!", ""

---- ⑾ Commands-> add method: Add a custom voice recognition command for the agent in the Button1Click event, parameter const name indicates the identity of the voice command, the parameter caption indicates that the command is displayed in the input command window, the parameter Voice representation This command corresponds to the statement. When the user issues a voice command through the microphone, triggered the Command event of the Agent, so we can additionally write a process to complete the speech recognition. Void __fastcall tform1 :: Button1click (TOBJECT * Sender); {peedy-> Commands-> Add ("BCB", "Run BCB", "BCB", TRUE, TRUE); peedy-> show (0); PEEDY-> Speak ("What CAN I do for you, sir?", "");

Request1 = robby-> play ("read"); peedy-> wait (request1); peedy-> play ("search");

acknowledge acknowledge lookdown looking down sad sad alert warning lookdownblink looking down blink search looking statement announce lookup to look up startlistening start listening blink blink blink of an eye looking down lookupblink stoplistening stop listening confused confused lookleft look to the left suggest recommendations congratulate congratulations lookleftblink look to the left blink surprised surprised decline refused lookright looking to the right think to think dontrecognize not recognize lookrightblink see blink wave waving explain explain movedown move down write writing gesturedown posture down moveup move up processing computing ...... gestureup right up to the right posture moveright reading reading ...... GESTURELEFT moves to left postching Moveleft to left Searching Search ... GestureRight PLEASED Happy Writing Writing ... GetAttTent gets Note Read Read Greet Greeting RESTPOSE Recovery Initial Status Request = Peedy-> Play ("great"); // Perform greet action

转载请注明原文地址:https://www.9cbs.com/read-37477.html

New Post(0)