this is a more-or-less complete implementation of the wmi class win32_pingstatus in vfp.

this class has some more platform restrictions as well as not being available in windows 2000 or 95 or 98:

starting with windows vista, win32_pingstatus can return data for computers that have both ipv4 addresses and ipv6 addresses.

windows server 2003 and windows xp win32_pingstatus only returns data for computers running ipv4.

it's useful to be able to ping as part of a multi-computer scripting operation as it lets you know if it's worth trying the much more expensive operation of actually trying to connect to the wmi… Continue reading

I'm fed up with getting spam from the contact page on this blog, so I've turned it off. I've turned comments back on again, but that probably won't last long.

If you'd like to get in touch, feel free to contact me on stuartdunkeld at gmail dot com

Updating a file in a Visual Studio project from VFP is pretty straightforward.

First up, get a reference to the project:

oVS = createobject("VisualStudio.Solution.8.0") && VS2005 
oVS.Open("C:\projects\example.sln")
oProject = oVS.Projects(1)

Each project has a ProjectItems collection: each can be a folder or a file. The items can be referenced by name, so this returns a reference to an XML file in the XML folder:

oDocument = oProject.ProjectItems("XML").ProjectItems("file.xml")

Each item has a URL property which indicates (for a file) the file name, but this is only available via the Properties collection:

cFilePath = substr(oDocument.Properties("URL").Value, 9) && strip off file:///
xmltocursor(alias(), "_cliptext")… Continue reading 

the february 2007 ctp of vfp9 sp2 can be slipstreamed into the original vfp installation: this means that it's integrated into the setup process so it will directly install vfp9 sp2 - or, alternatively, vfp9 sp2 can simply be run from the slipstream directory (or from a usb device or cd) without the need to install the upgrade.

this alleviates the need to run the community technology preview of sp2 on a virtual (or spare) machine in order to still be able to support applications which require vfp9 sp1.

to slipstream you need to copy your vfp9 cd to a… Continue reading

how applications 'talk' to users, especially in messageboxes and other dialogs, sets the tone for an application and colours the user experience.

the first question is usually - who is 'talking' here? the computer, the program, or the developer? sometimes it's hard to tell. for example this message from itunes/windows: "itunes has detected that it is not the default player for audio files." itunes is referring to itself in the third person, as is the norm. this is one source of the confusion that dialogs can cause - generally users will attempt to determine the source of a popup by… Continue reading

foxkb - foxpro kb article archive

in order to determine whether a user is a member of an active directory group (or a member of a group which is a member of the group) in a large directory, iteration through the members collection is too slow as each group can contain thousands of members: we need to be able to tell what groups are members of each group and recursively query those until we find a group the user is a member of.

there are various means of querying the active directory: the recommended way for clients like vfp is to use ado. the ado ad… Continue reading

Calling the TaskDialog API from FoxPro (in Vista build 5308) turned out to be a bit harder than Craig Boyd makes it sound but once it emerged that the string parameters have to be manually null-terminated and converted to Unicode it became much easier (if you don't convert the strings the output looks like this)

declare integer TaskDialog in "comctl32.dll" ;
	integer nHWND, ;
	integer hInstance, ;
	string cTitle, ;
	string cDescription, ;
	string cContent, ;
	integer nButtons, ;
	integer nIcon, ;
	integer @ nResult

* Icons

#define TD_ICON_BLANK			100
#define TD_ICON_WARNING			101
#define TD_ICON_QUESTION		102
#define TD_ICON_ERROR			103… Continue reading 

windows vista (currently rc1, build 5536) ships with winrm installed but the service is only started automatically on longhorn server: if you want to use winrm on vista the service has to be started manually. whether this is still the case in the final product, or which versions of it, remains to be seen. it's presence currently is no surprise given the shared code base of ws2003 and vista, but significant changes have been made to the winrm configuration schema in vista.

the winrm configuration now includes the settings for winrs - windows remote shell - and allows these to… Continue reading

It's surprisingly easy to create a command-line interface to your application: example usages could be application updates, maintenance routines, anything that doesn't require a user interface.

As an example create a file called vfp.cmd somewhere in the default path (e.g. the system32 directory for local admins or at install) and add the following:

@cscript //nologo "%~dpn0.vbs" %*

This executes a script which is on the same drive, the same path, has the same name as the cmd file, has the extension vbs, and passes all the command line arguments to the script host.

Then create a file in the same… Continue reading