JavaScript Editor js editor     Web development 



Main Page

After creating a project in Visual Studio, you can build and debug it. The following procedures are for Visual Studio 6.0. For the most recent information, read the documentation for version you are using.

Building the Project

Before building your project, you need to establish the project settings. Some of the settings you make depend on whether you want to create a debug or release version of the control or library. As a rule, create debug versions of the program until you are satisfied that it works correctly, then create a release version.

To specify a debug or release version

  1. On the Build menu, choose Set Default Configuration.

  2. Choose whether you're creating a debug or release version of the control.

  3. Choose OK.

To establish project settings

  1. From the Build menu, choose Settings.

  2. Under Settings For, choose whether you're creating a debug or release version of the program.

  3. Click the C/C++ tab and then make these settings:

    • In the Category list, choose Code Generation.

    • In the Calling Convention list, choose _fastcall.

    • In the Use run-time library list, choose Multithreaded DLL.

  4. Choose the Link tab and then in the Object/Library Modules text box, add one of the following libraries:

    • If you're building an .ocx, add OCXAPI.LIB from the Visual FoxPro API directory.

    • If you're building an .fll, add WINAPIMS.LIB from the Visual FoxPro API directory.

  5. Unmark Ignore all default libraries.

  6. Choose OK.

To make sure the compiler can find the necessary files

  1. From the Tools menu, choose Options.

  2. Click the Directories tab.

  3. In the Show directories for list, choose Include files.

  4. In the Directories toolbar, click the Add button.

  5. Add the directory with Pro_ext.h.

  6. In the Show directories for list, choose Library files.

  7. In the Directories toolbar, click the Add button.

  8. Add the directory with Ocxapi.lib from the Visual FoxPro API directory (when creating a control) or add the Winapims.lib from the Visual FoxPro API directory (when creating an FLL)

  9. In the Options dialog box, choose OK.

After you've specified the settings, you can compile and link your program.

To compile and link an .ocx file

  • From the Build menu, choose BuildВ projname.ocx.

When you compile and link the .ocx file, Visual C++ automatically registers the control on the computer on which it was built. If for any reason you must register the control manually, you can do so using the following procedure.

To register the ActiveX control

  1. From the Tools menu in the Microsoft Development Environment, choose Register Control.

    -or-

  2. Declare and call DLLRegisterServer(В ) from your program.

Debugging an ActiveX control or FLL library in the context of a full Visual FoxPro application is more difficult than debugging it separately from the application. It's a good idea to create a simple test program to test the operation of your control or library.

Debugging with the Microsoft Development Environment

Microsoft Visual C++ version 4.0 and higher offers an integrated debugging environment that makes it easy to set break points and to step through your code. You can even run Visual FoxPro from Visual C++.

To start debugging with Microsoft Visual C++

  1. From the Build menu, choose Settings.

  2. In the Project Settings dialog box, click the Debug tab.

  3. In the Executable for debug session text box, type the path and name of the Visual FoxPro executable (.exe) file. For example, you can type the following line with the appropriate substitution for the Visual FoxPro version number:

    C:\Program Files\Microsoft Visual FoxPro <versionNumber>\Vfp<versionNumber>.exe

  4. Choose OK.

  5. Set a break point in your library.

  6. From the Build menu, choose Debug. Then, from the submenu choose Go.

  7. When Visual Studio displays a message that says, " VFP9.exe does not contain debugging information," choose Yes to continue.

For more information about debugging in Visual C++, see the Visual C++ documentation set.

Debugging with Other Debuggers

You should be able to debug a control or library with any debugger that correctly handles an INT 3 (_BreakPoint( )) embedded in your program. You can use any debugger for symbolic debugging as long as it can do all of the following:

  • Make a symbol table from a map file.

  • Load the symbol table independent of the program.

  • Relocate the symbols to a new address.

To debug a library

  1. Add a _BreakPoint(В ) call to the routine at the point where debugging will begin.

  2. Build the control or library.

  3. Invoke your debugger.

  4. If your debugger supports symbols, load the symbol table for your library.

  5. Start Visual FoxPro.

  6. Call your library routine from Visual FoxPro.

  7. When the breakpoint is reached, make adjustments to the symbol base to align your symbols with the actual location where the library was loaded.

  8. Increment the instruction pointer (IP) register by 1 to skip over the INT 3 instruction.

  9. Continue debugging as with a normal program.

    Note:
    Always remove any breakpoints specified in your debugger before you release your product.

See Also



JavaScript Editor js editor     Web development