Download WI-FI Final Report - Electrical and Computer Engineering

Transcript
E.1.3
Host Development: Microsoft Visual C++ .NET
Visual Studio .NET is Microsoft’s unified development environment for Windows software, supporting a myriad of
compilers and tools under a single Integrated Development Environment (IDE). Visual C++ .NET is designed to
work with object-oriented program design, and emphasizes looking at code not by files but by classes with its class
selection menus and wizards. It is the only reasonable way to develop using Windows APIs.
1.3.1
Projects, Solutions, and Dependencies
In Visual Studio .NET terminology, a project is a .vcproj file containing a group of headers and source
code files that creates a single static library, DLL, or executable. A solution is a .sln file that contains
multiple projects. A solution and its component projects can be copied together between computers. To do
so, you must copy all files referenced by the solution and keep all the relative pathnames between the
solution, the project, and the source files intact.
Solutions are used because often times a project requires a library to be built by another project before it
can compile. In this case you have a list of dependencies between your projects. Not only can developers
specify which projects depend on one another, but they can also change the build order. Both these options
are available when you right-click the solution name on the class or file view in the IDE.
1.3.2
Project Wizards and Windows GUI Projects
Like with Microsoft Office, in Visual Studio a wizard is a way to create an empty Windows interface that
your program can be built off of. There are as many types of application wizards as there are Windows
user interface libraries, but the three primary types are document, dialog, and console.
Document applications have a menu bar at the top and usually a user either creates or modifies files within
the interface. They often call smaller dialog windows to set options – these dialogs can be full-featured
applications in themselves. The RRS remote application is simply a dialog with buttons for playback,
recording, and so on.
Console applications run within the Windows command prompt and resemble the Unix terminal
applications of old. They can use printf() and scanf() calls. For those experienced with Unix
programming as we were, a console app was the simplest way to test the Windows APIs we were learning.
1.3.3
Finding Variable/Function/Class/Method Declarations
Part of the power of Visual Studio is that developers are freed from their documentation and can rapidly
find class and variable definitions. The class-list drop-down and context menus help to navigate through
objects and their methods rapidly. Additionally, by placing your cursor on any function or method name
and pressing F12, you will be taken to where that variable or function is defined, even if that definition is
contained in a different file from the one you’re viewing.
When you type in a class name, followed by two colons, both Visual Studio and eMbedded C++ will show
a scrollable list of methods and variables for that class. This auto-completion list is very useful to help find
variables that your program might need, such as a window handle for sending the window’s memory
address to other functions.
Another handy tip is to switch between the IDE’s child editor windows by pressing CTRL+TAB or
CTRL+SHIFT+TAB. This can be used in most document-style applications that handle more than one
open document.
1.3.4
Static and Dynamic Libraries with Windows XP
Windows programs often work with both .lib format static libraries and .dll format runtime, or dynamically
linked libraries (DLLs). When building a DLL project, it will build a DLL and an “exports” .lib file. The
idea, without going into extreme detail, is that without the .lib file, the application won’t know what the
DLL file contains. Some programs solely use static libraries and build the final application with those, but
12