Running and Debugging

Team-Fly    

 
eMbedded Visual Basic: Windows CE and Pocket PC Mobile Applications
By Chris Tacke, Timothy Bassett
Table of Contents
Chapter 1.  An Introduction to Windows CE


Now that you have your first application, let's look at the debugging tools available, or, as you'll soon see, unavailable.

First notice that in the toolbar you'll have a ComboBox with two items: Pocket PC Emulation and Pocket PC (Default Device). You choose the former if you want to debug with the emulator and the latter if you want to debug with a connected device. For a connected device, you must be currently connected with ActiveSync.

Let's look at the emulator, so be sure that the ComboBox says Pocket PC Emulation. Put a break point on the MsgBox code line in your Command1_Click event handler and click the Run button.

The first thing that should happen is that eVB attempts to connect to your device, which is the emulator in this case. If the emulator isn't running, eVB will launch it.

After a short while, the emulator should appear with your form at the front. If it doesn't appear, try minimizing eVB to see if it came up behind it. Figure 1.13 shows eVB running with the emulator.

Figure 1.13. The full debugging environment for eVB. I've squished it all onto one screen to make it easier to see.

graphics/01fig13.gif

Click Command1 to get it to break on your breakpoint. Notice the debug toolbar. It's missing the familiar Pause button. The only way to stop execution of an eVB application while running is through a breakpoint.

Go ahead and click Run and revel in the splendor of your first application (see Figure 1.14).

Figure 1.14. The first application, running bug-free.

graphics/01fig14.gif

Another thing to be aware of that we can't really explore in this sample is that breakpoints don't always work, or they don't work reliably, regardless of whether you're using the emulator or a physical device for debugging.

If you find that execution is running past your breakpoint without stopping, there are two things to try:

  • Try setting the breakpoint at the Form level. This means placing the breakpoint in Form event handling code before it goes into another sub or function. These breakpoints work more reliably.

  • Try placing three or four breakpoints on consecutive lines. This often causes an uncooperative debug session to behave better, although it still may break on a completely different line of code than the breakpoint.

Another major missing piece in eVB that VB6 has is the Locals window. You can't view all your current variables , nor can you traverse the call stack in eVB. You simple get the immediate window.

Debugging is probably one of the largest frustrations I have with eVB. We'll cover more of the limitations later in the book and you'll undoubtedly discover how well the IDE behaves on your machine and how to get around some of the quirks . Above all, remember that the MsgBox is a valuable debugging tool that reliably stops execution.


Team-Fly    
Top
 


eMbedded Visual BasicR. WindowsR CE and Pocket PC Mobile Applications
eMbedded Visual BasicR. WindowsR CE and Pocket PC Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2001
Pages: 108

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net