30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 16 Graphics and Multimedia 731<br />

The Windows Media Player control provides several but<strong>to</strong>ns that allow the user <strong>to</strong> play<br />

the current file, pause, s<strong>to</strong>p, play the previous file, rewind, forward and play the next file.<br />

The control also includes a volume control and trackbars <strong>to</strong> select a specific position in the<br />

media file.<br />

The application provides a MainMenu, which includes File and About menus. The<br />

File menu contains the Open and Exit menu items; the About menu contains the About<br />

Windows Media Player menu item.<br />

When a user chooses Open from the File menu, the openMenuItem_Click event<br />

handler (lines 22–36) executes. An OpenFileDialog box displays (line 25), allowing<br />

the user <strong>to</strong> select a file. The program then sets the FileName property of the player (the<br />

Windows Media Player control object of type AxMediaPlayer) <strong>to</strong> the name of the file<br />

chosen by the user. The FileName property specifies the file that Windows Media Player<br />

currently is using. Lines 31–35 adjust the size of player and the application <strong>to</strong> reflect the<br />

size of the media contained in the file.<br />

The event handler that executes when the user selects Exit from the File menu (lines<br />

39–43) simply calls Application.Exit <strong>to</strong> terminate the application. The event handler<br />

that executes when the user chooses About Windows Media Player from the<br />

About menu (lines 46–51) calls the AboutBox method of the player. AboutBox simply<br />

displays a preset message box containing information about Windows Media Player.<br />

16.13 Microsoft Agent<br />

Microsoft Agent is a technology used <strong>to</strong> add interactive animated characters <strong>to</strong> Windows<br />

applications or Web pages. Interactivity is the key function of Microsoft Agent technology:<br />

Microsoft Agent characters can speak and respond <strong>to</strong> user input via speech recognition and<br />

synthesis. Microsoft employs its Agent technology in applications such as Word, Excel and<br />

PowerPoint. Agents in these programs aid users in finding answers <strong>to</strong> questions and in understanding<br />

how the applications function.<br />

The Microsoft Agent control provides programmers with access <strong>to</strong> four predefined<br />

characters—Genie (a genie), Merlin (a wizard), Peedy (a parrot) and Robby (a robot). Each<br />

character has a unique set of animations that programmers can use in their applications <strong>to</strong><br />

illustrate different points and functions. For instance, the Peedy character-animation set<br />

includes different flying animations, which the programmer might use <strong>to</strong> move Peedy on<br />

the screen. Microsoft provides basic information on Agent technology at its Web site:<br />

www.microsoft.com/msagent<br />

Microsoft Agent technology enables users <strong>to</strong> interact with applications and Web pages<br />

through speech, the most natural form of human communication. When the user speaks in<strong>to</strong><br />

a microphone, the control uses a speech recognition engine, an application that translates<br />

vocal sound input from a microphone in<strong>to</strong> language that the computer understands. The<br />

Microsoft Agent control also uses a text-<strong>to</strong>-speech engine, which generates characters’<br />

spoken responses. A text-<strong>to</strong>-speech engine is an application that translates typed words in<strong>to</strong><br />

audio sound that users hear through headphones or speakers connected <strong>to</strong> a computer.<br />

Microsoft provides speech recognition and text-<strong>to</strong>-speech engines for several languages at<br />

its Web site:<br />

www.microsoft.com/products/msagent/downloads.htm

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!