แชร์ผ่าน


VPL Tutorial 1 - Hello World

Glossary Item Box

VPL Tutorials: VPL Tutorial 2 - Incrementing a Value

VPL User Guide: Getting Started

See Also Microsoft Robotics Developer Studio Send feedback on this topic

VPL Tutorial 1 - Hello World

This tutorial is the classic introduction for most programming languages that displays the words "Hello World". This is easily accomplished in Microsoft Visual Programming Language (VPL) using two activity blocks, a Data block and the Simple Dialog block.

This tutorial is provided in the Microsoft Visual Programming Language (VPL) language. You can find the project files for this tutorial at the following location under the Microsoft Robotics Developer Studio installation folder:

Samples\VPLTutorials\Tutorial1

This tutorial teaches you how to:

  • Create a Hello Word Diagram in VPL

Prerequisites

Hardware

This tutorial requires no special hardware.

Software

This tutorial is designed for use with VPL which is included as part of Microsoft Robotics Developer Studio.

Create a Hello Word Diagram in VPL

To run VPL, from the Start menu choose All Programs and then click on Visual Programming Language under the Microsoft Robotics Developer Studio installation folder.

From the File menu click New to create a new project. Insert a Data activity, by double-clicking on the icon or draggging and dropping it from the Basic Activities toolbox. Choose string from the drop-down list. Click in the text box of the Data activity block and type Hello World.

Figure 1

Figure 1 - Data Activity Block

Insert a Simple Dialog activity block by dragging one from the Services toolbox and place it to the right of the Data activity block. (To save time looking for a service, you can type the name of the service you are looking for into the top of the Services toolbox. The toolbox will then display any matching activities.)

Drag a link starting from the output connection pin of the Data activity block onto the Simple Dialog activity block. The Connections dialog box automatically opens. Choose DataValue in the first list and AlertDialog in the second list, then click OK.

Figure 2

Figure 2 - Connections Dialog Box

The Data Connections dialog box opens next. In the drop-down list, choose value.

Figure 3

Figure 3 - Data Connections Dialog Box

The Data Connections dialog box tells VPL that you want to apply the value of the Data activity to the message text for the Alert form of this dialog.

Your diagram should now look like the following.

Figure 4

Figure 4 - Completed Diagram

Now choose the Run command from the Run menu (or press F5). If you have not saved your project yet, VPL opens the Save dialog. Enter a name for your project and click Save.

VPL should now run your application. If you get a message asking whether to unblock the application, choose Unblock.

A simple Alert dialog box should appear with the text Hello World in it.

Figure 5

Figure 5 - Alert Dialog

To stop the application, click the Stop button in the Run dialog.

You have now completed your first application in VPL. Try VPL Tutorial 2 - Incrementing a Value to learn more about VPL and its dataflow control activities.

Summary

In this tutorial, you learned how to:

  • Create a Hello Word Diagram in VPL
See Also 

VPL Tutorials: VPL Tutorial 2 - Incrementing a Value

VPL User Guide: Getting Started

 

 

© 2012 Microsoft Corporation. All Rights Reserved.