Tuesday, March 29, 2005

Project Documenting Machine

Document your Visual FoxPro projects with this tool.

Thursday, March 24, 2005

What runs when Windows starts?

Silent Runners - script documentation

VB script that interrogates the windows registry for programs that run at startup.

Great for identifying adware, malware, and those lame programs that HP and Epson install etc to tell you all about your printing process...

Foxite.COM Community Weblog

There is a new VFP blog in town, and I'm now a part of it.

This may cut down on my posts here at Musings, certainly related to VFP -- but head on over and checkout the FoxCite.com blog -- maybe consider starting one of your own!

Wednesday, March 23, 2005

FoxCast

FoxCast

"FoxCast.org supports user groups by providing top VFP speakers, presenting from locations around North America and abroad. User groups can connect to the live, interactive monthly meetings or replay recordings of past events at their monthly meetings."

Registration and most (if not all) seminars are free, great resource.

Monday, March 14, 2005

Developers Report on Power, Productivity and Extensibility of New Visual FoxPro 9.0

A Press Release about developers and tool vendors adopting VFP9.

"Visual FoxPro 9.0 is the biggest upgrade since the product was first released," - Doug Hennig

We couldn't agree more, this *is* the version to move to. Look for future postings "99 Reasons to Move to Visual FoxPro 9" on this blog.

Tuesday, March 08, 2005

VFP: Call Report Writer from COM

We needed to move a number of existing VFP reports to the web quickly. One technique is to issue REPORT FORM ASCII TO from a COM object.

After digging around and testing we found that it was possible. There are two things to keep in mind.

1) COM objects cannot raise UI events.
The commands to ensure this are:
SET NOTIFY OFF
SET TALK OFF
REPORT FORM myRepo NOCONSOLE ASCII TO myrepo.txt

2) COM objects must be compiled as OUT OF PROCESS (EXE) not IN-PROCESS (DLL).
(Special thanks to Malcolm Greene of ProFox for this tip)

Here is the code we used to test the premise:


* run as is, assumes you have a FOXUSER file in use
***************************************************
* clear prior runs, create report from FOXUSER
CLEAR
CLOSE ALL
CLEAR ALL
ERASE myrepo*.*
USE SET("RESOURCE",1) AGAIN IN 0
CREATE REPORT myrepo FROM ALIAS()

* create main program with COM class
TEXT TO cMain NOSHOW
DEFINE CLASS myRepo AS Custom OLEPUBLIC
PROCEDURE DoReport(tlTest)
SET NOTIFY OFF
SET TALK OFF
SET SAFETY OFF
IF m.tlTest
STRTOFILE("This is a test","myrepo.txt")
ELSE
REPORT FORM myRepo NOCONSOLE ASCII TO myrepo.txt
ENDIF
SET SAFETY ON
RETURN FILE("myrepo.txt")
ENDPROC
ENDDEFINE
ENDTEXT

* write out the main program
SET SAFETY OFF
STRTOFILE(m.cMain, "myrepo.prg")

* add to project, compile EXE (not DLL)
CREATE PROJECT myrepo NOWAIT NOSHOW
_VFP.ACTIVEPROJECT.FILES.ADD("myrepo.prg")
BUILD EXE myrepo FROM myrepo
RELEASE WINDOWS PROJECT
SET SAFETY ON

* call without com
SET PROCEDURE TO myrepo.prg
o=CREATEOBJECT("myrepo")
TryMyRepo(o)
RELEASE o
SET PROCEDURE TO

* call with com
o=CREATEOBJECT("myrepo.myrepo")
TryMyRepo(o)

PROCEDURE TryMyRepo(o)
TRY
? o.DoReport(.T.)
? o.DoReport()
CATCH TO oExc
? oExc.MESSAGE
ENDTRY
ENDPROC