Archive for March, 2006


Craig Berntson – Blogger has comment moderation, so open up the comments on your blog. Ya can’t ask a question on the post and not have comments so we can set you straight. FYI – Doug had the RSS feed early today.

Comments are just as big a deal as having an RSS feed exposed on a blog. Comments are probably more important. Both FireFox and FeedDemon recognized Doug’s feed even without the link. All good tools do.


Doug Hennig is absolutely one of my favorite authors and speakers in our community, and I for one am very happy he has decided to start a blog. This was an instant subscription when I found out yesterday. Welcome to the blogosphere Doug!


Wow, Jim Booth is speaking at Southwest Fox! Talk about an instant bonus to help you make your decision to attend this fantastic fall conference a no-brainer.

This is part of the super list of speakers Bob has on tap for – FoxPro Yesterday, Today, and Tomorrow. Other speakers include Marcia Akins, Bill Anderson, Jim Booth, Craig Boyd, Mike Feltman, Toni Feltman, Tamar Granor, Doug Hennig, Claudio Lassala, Ken Levy, Andy Kramek, Cathy Pountney, an undisclosed guest speaker, and yours truly.

I will be presenting a new session I am developing called the Professional Developer’s Toolkit, and by popular request on last year’s evaluations – a revamped Fishing with a ProjectHook. Doug Hennig, Craig Boyd, and I are cooking up the conference keynote address, which should be both fun and revealing.

This was by far the best and highest rated North American conference last year and I believe this year is going to top last year. I hope you can join us in Tempe October 19th to 22nd, 2006. Registration is already open with Southwest Fox Alumni and user group discounts available.

I know I am geeked!


If you author any kind of whitepaper or article with Visual FoxPro example code you quickly understand the need to suppress the rich text formatting included in VFP 9 when you copy code to the clipboard. At first I really liked this feature for my own technical documentation, but when I work with conference session templates, magazine templates, and Hentzenwerke Publishing templates I am frustrated because it breaks the style guides from the various publishers. During the VFP 9 beta the feature was part of the product and not configurable, but the voices of the beta testers were heard loud and clear. We want a way to shut this off.

I have helped many developers turn off this feature, and today while working on my error handling session for GLGDW 2006 I realized I turned this on (nice when sharing code in email or posting on a forum) and need it off while writing the whitepaper. I have a program to toggle the setting. Here is the code:

* Toggle rich text formatting to clipboard
IF ‘X’ $ _vfp.EditorOptions
* Turn it off
_vfp.EditorOptions = STRTRAN(_vfp.EditorOptions,”X”, SPACE(0))
* Turn it on
_vfp.EditorOptions = _vfp.EditorOptions + ‘X’

You can hook this up to a developer menu item, or toolbar, or just run it from the Command Window.

Bonus Tip
While reviewing the code I remembered another tip to share. IntelliSense has a feature called C++ Operator Expansion. I use this all the time. If you have a variable like lcErrorString and you want to concatenate some text to the existing string you can enter the following in the program editor:


Then hit the space bar and you will see:

lcErrorString = lcErrorString +

You are ready to type in the rest of the logic to perform the concatenation. There are several C++ operators to work with in VFP’s IntelliSense.


The reason I was inspired to write the bonus tip is the situation where you have a object.Property and want to concatenate or increment, like _vfp.EditorOptions. If you have code like this in the program editor:


And hit the space bar, nothing happens. I reported this as a bug during one of the betas. The workaround is simple, but you have to remember it when writing code. Include a space between the property name and the operator, then hit the space bar after the operator.

_vfp.EditorOptions +=

Enjoy the weekend!


I am looking for a blog entry, or more likely a white paper or book on Microsoft’s VirtualPC, and the setup of a Virtual Machine for a client (read – I am not interested in writing something already written on the subject).

I am not looking for a How To Install VirtualPC on Your Computer – although this could be part of the white paper. I want to point to a resource stepping the user through the process of building their first Virtual Machine, installing the OS, and helping them with the choices and some optimizations.

Any pointers?


The Toolbox is a very powerful tool added to VFP 8 and improved in VFP 9 by the simple fact it can be docked. Several developers refer to the Toolbox as the Forms Control toolbar on steroids (which might not be as politically correct as it once was {g}). I like the Toolbox for several reasons, but the one I really like is working with ActiveX controls.

You can drag and drop ActiveX controls from the Toolbox to the Form or Class Designer. Handy in itself, but not where I think the real power is. I like dropping the ActiveX control in a program or method window. Dragging the ActiveX controls to an editor provides the needed NEWOBJECT() code. The following code was created when I dropped the DynaZip Zip ActiveX control in the editor:

Olecontrol = NEWOBJECT(“dzactxctrl.dzactxctrl.1″, “dzactx.dll”)

Now you do not have to look up the registration information for the control in the Windows Registry or the documentation distributed with the control. You can change the line of code to:

LOCAL loZip AS “dzactxctrl.dzactxctrl.1″

Now as soon as you type loZip. in the editor you get IntelliSense for the ActiveX control. This works well and really increases productivity when you do some Automation code with a control of this type.


The Object Browser was new in Visual FoxPro 7. It exposes the public and protected interfaces of COM object libraries and ActiveX controls. Inside these libraries is a wealth of information concerning the properties, events, methods, constant values, and classes available for developers. This tool is very important to developers who write Automation code and need to understand the documented ways of using a particular Automation object.

Determining the values of constants defined in a COM object

One of the truly grueling tasks developing automation code is determining the constants used in the examples. These constants can be translated into #DEFINE code. Before you had the Visual FoxPro Object Browser you needed to trudge through Help files, hope examples documented the values, or use a tool like the object browser found in the VBA editors of Microsoft Office to find these values. This is a time consuming process for sure. Tools like the West Wind GetConstants.EXE read the type libraries and generate the #DEFINE code, which is easily compiled by Visual FoxPro.

The Object Browser can generate the #DEFINE code efficiently and is a real time saver. To accomplish this, open up the COM or ActiveX component, drill down the TreeView to expose the Constants node. Open up a program editor (program, or class method). Drag the Constant branch and drop it in the editor. Not only is the #DEFINE code typed in with the constant name and value, but the documentation for the constant is also included as a comment for the #DEFINE if the constant has a description. If you drag the constants branch you will get all the constants in the editor. You can also drag individual constants if you only need specific ones.

GOTCHA: I have experienced constants that are decimal values getting rounded to zero (with MapPoint). If this is the case, I recommend the GetConstants.exe from West Wind, which does not suffer from the same bug.

Use the Object Browser to create class templates to implement interfaces

A very powerful feature in Visual FoxPro is the capability to write code in our custom applications responding to events in other applications. For instance, you can write code to respond to a user closing a spreadsheet, or sending an email in Outlook, or doing a mail merge in Word. This is done with the IMPLEMENTS clause of DEFINE CLASS as well as the EventHandler() function.

The Object Browser assists you in writing tedious code in this respect. First open up the COM or ActiveX control in the Object Browser. Then drill down through the TreeView and locate the Interfaces node. Open up a program editor (program, or class method). Drag the interface node and drop it in the editor. The class definition is written, including the IMPLEMENTS and template code for each of the methods exposed. All you have to do at this point is rename the class from MyClass to something more descriptive, and add code to the appropriate method.

Find out the name of the OCX file to ship with my deployment setup

The Object Browser helps Visual FoxPro developers with numerous features for ActiveX controls. One of the simpler, yet more helpful items is displaying the actual file name for the OCX and other details about the control.

Open up the Object Browser and select an ActiveX control from the list. If you select the root node for the control there are details about the OCX displayed in the bottom pane of the Object Browser. Information like the file name, the Help file, and the GUID is presented for the developer. This can be handy when you need to find out what OCX file is to be included in a deployment package, and determine where the Help file is installed on the hard drive.


Have a slice of pie today to celebrate Pi Day (3.14) and Albert Einstein’s birthday. A true geek holiday if there is one.

I was having some fun with my kids who are all excellent in math. We were challenging each other to see who knew the most digits of Pi:

(no this is not how many digits I know {g})

More here: Pi to One Million Places
And here: The Ridiculously Enhanced Pi Page

For the record, dad wins this contest even though my kids are much smarter than I am.