Rick Strahl's Weblog
Rick Strahl's FoxPro and Web Connection Weblog
White Papers | Products | Message Board | News |

Last 50 comments

Re: UTC Time in FoxPro

1 month ago

Sorry, but this functions are NOT working correctly! Especially the GetUtcTime() is incorrect. Your function GetTimeZone() checks for daylight-savings-time, but GetUtcTime() does not! When passing a datetime as parameter to the GetUtcTime() function, you have to check, if the given datetime is in daylight-savings-time or standard-time. If you run that function in winter, it gives a different result compared to if you run it in summer!

Re: Drive Mapping in Web Applications

Emin Kazok
4 months ago

Mapping as part of startup in group policy did the trick. Thank you very much.

Re: Calling JSON REST Services with FoxPro and wwJsonServiceClient

7 months ago

@Phil - you can use wwDotnetBridge to call that .NET Component to encode your message.

Re: Calling JSON REST Services with FoxPro and wwJsonServiceClient

7 months ago


Great app and nice (though somewhat cryptic) descriptions of what can be done with it.

PLEASE, PLEASE address the OAUTH 2 signature question posed by Phil on Feb 26. I am trying to accomplish the exact same thing, and I'm an absolute noob when it comes to API/JSON services.

Many thanks, Will

re: Fixing wwDotnetBridge "Unable to load Clr Instance" Errors

Chris B
Oct 24, 2018


We are getting a similar "Clr Instance..." error but with a different hash identifier as follows:

Unable to load wwDotNetBridge: Unable to load Clr instance.0x8007000e:

We are using the WW library v.6.15 DtNetBridge DLL with a custom VFP v.09x enterprise platform on our LAN. VFP and the enterprise platform is running on Windows 2012 R12 Server and have .met v4.7 running as well.

The error is odd as it is occasional/intermittent and does not always occur. It just started occurring today.

Any ideas?


re: Web Connection and TLS 1.2 Support

Rick Strahl
Sep 14, 2018

@Darko - if you're going to use an EXE maybe you should just shell out and use curl instead. It has a lot of capabilities and it too can work just fine without the Windows TLS stack and it's a well known interface that works for all sorts of things beyond just HTTP.

re: Using CreateProcess API instead of the FoxPro ! RUN command

Aug 9, 2018


Sorry I forgot to mention that I'm running a VFP compiled exe with createprocess()


re: Using CreateProcess API instead of the FoxPro ! RUN command

Aug 9, 2018


I can get start a process using createprocess() but the lhProcess number is different to the PID listed in the TaskManager.

So when I use OpenProcess(PROCESS_QUERY_INFORMATION+PROCESS_VM_READ,0,lhProcess) it fails to open the handle.

Is there a way to get the correct pid back or is enumerating all the processes the only way to go?


re: Web Connection and TLS 1.2 Support

Darko Kezic
Jul 5, 2018

Hi, thanks for sharing this.

I used in my various VFP applications directly Windows AJAX with l_oHttp = CREATEOBJECT("MSXML2.ServerXMLHTTP") ... and was biten with TLS 1.2 issue on various client PCs.

At the end, I created small EXE with Golang which only connects to server and returns result. Then I called this EXE instead of MSXML2.ServerXMLHTTP with l_oShell = CREATEOBJECT("Wscript.Shell") ...

Yes, it looks silly to call another EXE for every HTTP request, but this was only secure way to do it on older Windows.

re: Visual FoxPro and Multi-Threading

David Phillips
May 29, 2018

Thank you Rick you a legend. FoxPro is so good with handling data it will be hard to find an alternative in the future unless someone reinvents it in a multithreaded form. Hopefully we can keep it going for another 20yrs or so. There is still Cobol Code out there that is 58yrs old and still running.

re: Web Connection and TLS 1.2 Support

May 17, 2018

Thanks, Rick--great information, as always!

re: Web Connection and TLS 1.2 Support

Michael Birnholz
Apr 11, 2018

Rick - discovered a few minutes ago that another issue when trying to resolve this is the default settings for IE Enhanced Security Settings Configuration. If these are both active you will not be able to open this url https://api.authorize.net/xml/v1/request.api if you are running Windows 2012 R2. If you deactivate for both administrators and users the page will open.

re: Writing to the Windows Console from Visual FoxPro

Randy H
Apr 4, 2018

I know we all hate flashing command windows, but:

STRTOFILE("systeminfo >systeminfo.txt","runsysteminfo.bat") RUN /n runsysteminfo.bat sysitext= FILETOSTR("systeminfo.txt")

I do like simple solutions.

re: Calling JSON REST Services with FoxPro and wwJsonServiceClient

Feb 26, 2018

Hi Rick,

I'm trying to figure out how to use wwJsonServiceClient to generate an OAUTH 2.0 signature.

Their API docs have an example: The signature is sent in a header named BDXAPI_NAME.

MessageDigestPasswordEncoder encoder = new MessageDigestPasswordEncoder("SHA-1"); StringBuilder sb = new StringBuilder(); sb.append("bdxapikey").append("=").append(bdxApiKey).append("&"); sb.append("bdxapiClientId").append("=").append(clientId).append("&"); sb.append("bdxapisecret").append("=").append(bdxApiSecret); model.setSignature(encoder.encodePassword(sb.toString(), null)); return model;

re: FoxPro EXE DCOM Configuration on 64 Bit Systems

Feb 16, 2018


Did you ever find a resolve for this? We are migrating our website over to a new Windows 2012 Server and are not able to get the foxpro dlls to work even when we have registered them successfully?


re: Calling JSON REST Services with FoxPro and wwJsonServiceClient

Rick Strahl
Feb 9, 2018

Yes you can call CreatewwHttp() which returns a wwHttp instance once which you can set any wwHttp settings. That instance is then used in the request:

oProxy = CREATEOBJECT("wwJsonServiceClient")

*** Create custom Http Object for Authentication
loHttp = CREATEOBJECT("wwHttp")
loHttp.cUsername = "ricks"
loHttp.cPassword = "seekrit22"

*** Pass it to the proxy to use

loArtist = loProxy.CallService("http://albumviewerswf.west-wind.com/api/artist",loArtist,"PUT")

IF  loProxy.lError
   ? loProxy.cErrorMsg

? loArtist.Albums.Count

re: Calling JSON REST Services with FoxPro and wwJsonServiceClient

Feb 9, 2018

I like the idea using the wwJsonServiceClient, however is this also possible with headers? Using HTTP call I would normally so something like that: loHTTP = CREATEOBJECT("wwHTTP") loHTTP.AppendHeader("user_session", lcUserSession) lcHTML = loHTTP.HTTPGet("")

re: Doing HTTP Headers right in Web Connection 5.0

Rick Strahl
Aug 13, 2017



The .T. parameter makes a permanent redirect.

re: Doing HTTP Headers right in Web Connection 5.0

Michael Hogan
Aug 13, 2017

Very helpful - but how would I return a 301 redirect? In my 5.x app, I do this: Response.Clear() Response.Status = "404 File not found" Response.Write("Page was not found")


re: UTC Time in FoxPro

Michael B
Jul 23, 2017

I am working on a delivery routing module for my application and I decided to use javascript to pass the users browser time to vfp. I then convert the hex value to a fox datetime() easily. Javascript returns the time in hex starting from 1/1/1970 (aka "epoch time).

lnUnixEpochTime = 1500847437204 ? lnUnixEpochTime/(6060606060*60) + DATETIME()

This returns: 07/23/2017 05:16:29 PM

re: Persisting Static Objects in Web Connection Applications

Thierry Nivelet
Jun 8, 2017

Using addproperty() in .Init() works around the COM signature issue.

Also, using state persistence the way you describe applied more to single server applications (logical servers such as COM objects)

re: IIS 7 Default Request Filtering and Web Connection

May 31, 2017

Hello, i am facing the issue while using request filtering option. My website didn't work until I add '.' in allowed list. I am unable to find which particular extension I am missing. Thanks in advance.

re: Handling Multiple Screens in Visual FoxPro Desktop Applications

Apr 27, 2017

Yes, the _screen.top and _screen.left can obtain value -32000 which is hard to find on any monitor...

This can happen when the main FoxPro window is minimized.

Foxpro application

Techmatic systems
Mar 6, 2017

Thank you for your given information. Foxpro application.

Visual FoxPro is great for building desktop applications.It is a object-oriented programming to reuse components across applications.Visual FoxPro originated as a member of the class of languages commonly referred to as "xBase" languages,Visual FoxPro is a great tool for building database solutions of all sizes.

re: Clicks not working in Internet Explorer Automation from FoxPro

Feb 3, 2017

Hi Thank you, thank you are a genius, i was about to setup a machine with older OS and IE. oButton.Click(.F.) is a life saver.

re: Calling JSON REST Services with FoxPro and wwJsonServiceClient

Dec 13, 2016

Thank you Rick--great stuff as always. And a cool plug for a great band in your example (Accept)!

re: Fixing wwDotnetBridge "Unable to load Clr Instance" Errors

Ian C.
Dec 1, 2016

Hi All.

There now exists a command-line tool to unblock these downloaded files. PowerShell has the Unblock-File commandlet.

See http://ss64.com/ps/unblock-file.html

re: Visual Studio Gets Support for FoxPro Files

Richard Kaye
Nov 29, 2016

The link for the syntax highlighting extension has some extraneous text at the beginning of the URL, Rick.

re: Visual Studio Gets Support for FoxPro Files

Rick Strahl
Nov 24, 2016

Cetin - this is actually not an official Microsoft language add-in. Mads just built this on his own and FoxPro merely uses the TextMate add in to provide FoxPro support. The individual languages are not supported by this add-in but rather they are re-using existing Textmate add-ins from other tools (in this case Matt Slay's Sublime implementation). That implementation only provides highlighting not auto-complete features.

TextMate syntax supports better autocomplete, but the language file has to be built up to support this. The source code for the plug-in is available so you can contribute to make it better yourself instead of crying about it. Guaranteed nobody at Microsoft is going to do it for us...

re: Visual Studio Gets Support for FoxPro Files

Cetin Basoz
Nov 24, 2016

I downloaded and installed the extension in an excitement (besides VFP, I have been using C# and Go and seeing Go there made me more happy initially). However it is a total disappointment. It doesn't even work as well as VFP's own editor.

Come on Microsoft you could do it better for your own product! Notepad++ is doing that highlighting for years (not surprising after the failure they made announcement "VS on Mac" has turned to be another big disappointment with their ridicilous license aggrement).

re: Detecting hung Objects in Visual FoxPro

Matt Slay
Sep 25, 2016

Good grief... Every time I run into a VFP problem, I dig into it enough to think I understand the issues, and when I Google during my research, Rick has already tackled it and explained it well enough to help me finish solving my problem. Again!

I have now added Dispose() method into my base business object class, and my objects can now be cleanly and fully released from memory.

Thanks, Rick!!

re: Detecting hung Objects in Visual FoxPro

Eddie Caldwell
Sep 9, 2016

Thanks Rick for yet another informative post. On a similar note, I was looking for a hung object but the memory leak turned out to be a foxpro feature. When foxpro loads an image like with the image control, it keeps the image in memory in case it is needed again. You have to issue [release resources] or [release resource <>] to free up the memory.


Matt Slay
Jun 28, 2016

Wow... almost 10 years later and today I was researching slow client app form load times on forms that use 30-40 Business Objects to present data field and grids to the user.

40 BOs were taking 7-8 seconds to new up when the form launched while running in an EXE, but only 1-2 seconds when running the same code from within the VFP IDE.

I blogged about my discovery, research, and remedy. Link below. In the post I also give props to Rick for blogging about this a decade ago.


re: Calling JSON REST Services with FoxPro and wwJsonServiceClient

Rick Strahl
May 28, 2016
  1. Yes you can return cursor data by using "cursor:TQuery" as a string to specify the cursor in a property. The cursor is turned into an array and sent as JSON. Can be the top level result or set on a property assuming the cursor is open. Cursor serialization is one way - you can't directly deserialize an array into a cursor. You can however use CollectionToCursor() to dump the result object back into a cursor/table as long as the table exists.

  2. Memo fields are just text and it just works. Nothing special about memo fields. Binary data is converted base64 and sent.

re: Calling JSON REST Services with FoxPro and wwJsonServiceClient

May 27, 2016

Hi Rick,

Nice addition in west wind client tools. I have following questions.

  1. In VFp, table structure can be passed with cursortoXml. Is it possible with Json services?

  2. How memo field data is passed with Json services ?

TIA Naeem

re: Transparent Bitmaps on Buttons and other Controls

Paul Weisberg
Apr 3, 2016

Great article! I found this while searching for a similar problem. One thing I just discovered for myself, is that when you assign a PNG file to the picture property of a control, FoxPro locks the resource file such that it cannot be used in another control and other file methods like fopen() on that picture file will fail. This is not true for BMP files, nor is it true for PNG files that have no transparency. This is obviously some quirk in the way that FoxPro handles transparent PNG files. I expect that the above solutions will work nicely!

re: How to work around Visual FoxPro's 16 Megabyte String Limit

Mar 14, 2016

Hi Rick,

Attempted to modify wc6/classes/wwAPI > EncodeDBF() to support files larger than 16Meg, couldn't work it out, any idea why?

FUNCTION EncodeDBF LPARAMETERS lcDBF, llHasMemo, lcEncodedName

LOCAL lcResult, lcFPT

lcDBF = Iif(Vartype(m.lcDBF)="C", Upper(ForceExt(m.lcDBF, 'dbf')), "") if !File(m.lcDBF) return '' endif

lcFPT = ForceExt(m.lcDBF, 'fpt') llHasMemo = m.llHasMemo and File(m.lcFPT) lcEncodedName = Evl(m.lcEncodedName, JustFname(m.lcDBF))

lcResult = ''; + "wwDBF"; && 5 + Padr(m.lcEncodedName, 40); + Str(Len(FileToStr(m.lcDBF)), 10); + Iif(m.llHasMemo; , Padr(ForceExt(m.lcEncodedName, "fpt"), 40); + Str(FileToStr(m.lcFPT), 10); , Space(50); ); + ''

lcResult = m.lcResult + FileToStr(m.lcDBF) && 2016-03-14 thn -- {en} attempt to work around the 16 MB VFP limitation - https://www.west-wind.com/wconnect/weblog/ShowEntry.blog?id=882 && 2016-03-15 thn -- {en} _cliptext = m.lcResult && 2016-03-15 thn -- {en} wwDBFAWADAPTERDETAIL.DBF 19106822 && 18,22 MB && 2016-03-15 thn -- {en} String is too long to fit (Error 1903)

lcResult = m.lcResult + Iif(m.llHasMemo; , FileToStr(m.lcFPT); , ''; )

return m.lcResult ENDFUNC

re: How to work around Visual FoxPro's 16 Megabyte String Limit

Mar 14, 2016

Hi Rick,

Can't find 'oPostStream' and 'cPostStreamClass' in WC6's wwHTTP. Did you implement these properties somewhere else?


re: Custom Manifest Files in Visual FoxPro EXEs

Rick Strahl
Mar 6, 2016

@Tomas - Exe execution doesn't work with registrationless COM due to the extra DCOM related entries. It only works for DLL servers including OCX files (which are just renamed DLLs).

re: Custom Manifest Files in Visual FoxPro EXEs

Feb 27, 2016

Registrationless COM Activation requires that during using vfp exe, dll must be near vfp exe, does not it?

re: UTC Time in FoxPro

Jan 13, 2016

Almost any time I have a VFP question or problem, I need look no further than your blog--very helpful, as always. Thanks for continuing to be such a great resource for VFP developers.

re: String Tokenizing based on StrExtract()

Rick Strahl
Nov 29, 2015

It's been real handy to have this function. In Help Builder I dozens of places where this stuff comes in handy. My MarkdownParser class in Web Connection too uses this in a couple of places. It's reduced a few very common use cases to two lines of code.

re: UTC Time in FoxPro

Vince Stevens
Nov 25, 2015

Hi Rick, The code examples are great.. many thanks... but do you know a way of determining the UTC of a particular country on a particular date... I am attempting to write code to calculate the the flight time from one location to another, on a given date, and passing back the correct local time of arrival... Any help would be much appreciated. Vince

re: String Tokenizing based on StrExtract()

Doug Hennig
Nov 20, 2015

I have to do this stuff frequently as well, and interestingly, like in your case, it usually involves parsing a comma-delimited list (usually column names, such as in a SQL SELECT statement) where one of the items in the list could contain commas, such as SELECT [This is a dumb column name, right], SomeOtherField ... I pretty much use the same technique (placeholders) but hadn't thought of creating a helper class.

re: Handling Multiple Screens in Visual FoxPro Desktop Applications

Nov 10, 2015

My Foxpro disappeared as you had explained but I don't even have a second monitor. Somehow, when I double clicked, it ran with just the icon at the bottom. No matter how I clicked on it, the screen didn't appear then I saw this post. I used Notepad to create a prg file with the following codes and then dragged this prg file to the VFP icon to run. My screen popped back. Wonderful.

_Screen.left=5 _Screen.top=5

re: UTC Time in FoxPro

Paul Gibson
Oct 28, 2015

Very good post Rick, totally agree. Even if you don't use datetimes from different geographical timezones it is still relevant if you deal with DST and the pertinence of this goes up every 6 months when systems transition from DST to non-DST. And so it is that I've landed on this page just a few days after the UK has reverted back to GMT from DST and I've hit a couple of little niggles with VFP's inability to natively resolve datetimes correctly.

You are spot on that this is par for the course and almost second nature when coding in .NET so it's frustrating that it is a little awkward in VFP.

I have an exe that was built just over a week ago (20/10/2015) while we were still in DST, it was built at 11:24 AM Local time which would have been 10:24 UTC. I'm ignoring the date-part for brevity because that's not changing due to the UK being so close to UTC and the file being built near midday. Up until Sunday morning VFP reported the time of the file correctly as 11:24 and you could confirm this by looking at the file in Windows Explorer. Since the clocks went back VFP now reports the file's (local) time as 10:24 so any comparisons might assume that the file was changed. Windows Explorer is still showing the time correctly as 11:24 but FDATE() and ADIR() in VFP cannot give me the correct local time now that it's running in the different TimeZone.

This is particular annoying for a routine I wrote which monitors changes in JPEGs. Once of the metrics which it stores to detect if the files have changed is the date modified - obtained via ADIR(). When the routine ran before Sunday it recorded all the Date modifies of all the pertinent files and that was fine but since the clocks changed the routine has scanned the (unchanged) files and the datetimes appear to have all changed when they haven't in reality, it's just VFPs (in)ability to read the correct datetime for files created in a different timezone which is causing a problem. My routine therefore assumed that all the JPEGs had changed since the previous time it scanned them and performed a task it thought was necessary when in fact it wasn't. It'll only hit this problem once every six months because it then records the new datetimes but it's not good for this routine to have this problem at all, let alone a reoccurring one.

The solution, as you say, is to store those datetimes using the UTC standard and potentially have a general rule that any datetime used for comparison purposes be stored in UTC. I'm working in a 16+ year-old application, so it's difficult to retrofit storing ALL datetimes in UTC across the whole system but for new facilities it should be possible.

One thing I thought was interesting in your implementation is that you cache the TimeZone offset for speed so you only need to query it once, does that make the implementation require a restart or a specific clearing of the cache when the computer system transitions between DST and non-DST? On my computer that function would return 0 or -60 depending on the DST-ness of the system but if it caches that value and uses the cache then the function risks returning the wrong value if it was cached before the transition and then called after the transition. I've seen this before on applications that run 24/7 and use the SECONDS() function due to the "caching" VFP does to facilitate SECONDS().


re: An Updated Web Connection Add-in for Visual Studio 2015

Sean Gowens
Oct 26, 2015

I installed VS 2015 several weeks ago and just got around to needing to use the 'show foxpro code' option. I couldn't figure out how to make it work, but as always I figured you were on top of things. Thanks so much.

re: UTC Time in FoxPro

Rick Strahl
Sep 3, 2015

Luis - not sure what you mean. All the code you need is here...

re: UTC Time in FoxPro

Luis Guerra
Sep 2, 2015

Hi Rick, interesting your article on UTC time. I've seen you're using functions from your tools, but, what about those people that do not use your tools but they want to begin using UTC time?

I'd would like you to point me in the right direction to begin using UTC time.

Best Regards,

Luis GUerra

© Rick Strahl, West Wind Technologies, 2003 - 2019