5

The LA Fox Developer Newsletter
April 1998
Thought for the Month...
Playing Together Nicely
by David Rose, VFUG Editor
This is a testimonial to the many FoxPro developers out there on the bleeding edge. Sometimes that edge is using new technology, but increasingly that bleeding edge happens where old technology meets new technology. As software grows more componentized, there will be more problems getting the components to play together nicely. Within a development environment, this can be solved with careful configuration management. The real world isn’t always so accommodating.

When the problems occur from combinations of components, experience is the best source of knowledge. By exchanging problems and solutions, that experience is being leveraged by you, the network of developers looking for real world solutions to real world problems. Work with the network: ask questions, apply the answers, give yours to other developer’s questions and thereby enhance the richness of the community. Those best able to capitalize on this network will be the value-added experts that “can do” to make these systems work.


Wand’rin Aroun’
Brad Drury
Reprinted from OCFDG’s c-Newsletter
NOW PLAYING ONLINE: MICROSOFT WINDOWS NT

SERVER 4.0: FILE AND PRINT SERVICES
http://www.microsoft.com/seminar/98/NT4FileNPrint/portal.htm

This web seminar focuses on how file and print services are easy to administer and manage with Windows NT Server. Optimized for 28.8 Kbps, with low-overhead HTML and audio- only NetShow(tm).

WINDOWS NT MAGAZINE UPDATE

UPDATE is the free email newsletter from Windows NT Magazine that delivers relevant andtimely NT information once a week-right to your desktop. Register for your free subscription today: http://www.winntmag.com/update.

For information on local MSFT events and promotions in your area: http:llmicrosoft.com/usa/

You can subscribe to a variety of informative Microsoft newsletters by going to the Personal Information Center: http:// register.microsoft.com/regwiz/peronalinfor.asp
Prevent Multiple Instances
of a Fox Application
by James E. Blatta
This is a routine to prevent multiple instances of a Fox application. The program was written for FoxPro 2.6 for Windows but should work in VFP with a bit of work.

The call is as follows:

MODIFY WINDOW screen TITLE ‘Starting Program’ COLOR
RGB(O,O,O,1 92,1 92,192) NOCLOSE CLEAR
IF CK4RUN(PROGRAM’,.t.)
QUIT
ENDIF
MODIFY WINDOW screen TITLE ‘Program’ COLOR; RGB(O,O,O,1 92,192,192)
NOCLOSE
CLEAR

A bit of this is spurious but the general idea is that the 2nd attempt to start the application must have a different name than the running application (so that it is unique). I add ‘starting’ so that it will always tell the user the program is starting. Once the check is made the main window is renamed to the actual program name (designated by ‘PROGRAM’).

Place
this call as close to the top of the main program as you
I have it as the first lines. You need to use the two
modify window statements to get the thing to work. Also you can’t use other modify window screen statements in your application or the routine will fail and allow extra iterations of your applicaton. You could get around this by adding extra cases to CK4RUN but IMHO it is best to leave the main window title alone. See below for the complete CK4RUN program.

PROCEDURE CK4RUN
PARAMETERS _agver,_switch
PRIVATE
ALL LIKE IlRunning,foxtfnd,_switch,;
InFindWln,InShowWin,InHnd
IF PARAMETER()=1
_switch.f.
ENDIF
IlRunning.F.
_foxtfnd=.f.
IF I’FOXTOOLS’$SET(’LIBRARY’)
_foxtfnd.t.
SET LIBRARY TO SYS(2004)+’FOXTOOLS.FLL’ ADDITIVE
ENDIF
InFindWin=RegFn(”FindWindow”,”CC”,”I”)
InShowWin=RegFn(”ShowWindow”,”II”.”I”)
InHnd __ CaIIFn(InFindWln,O,_agver)
DO CASE
CASE InHnd#O AND _switch.t.
CaIlFn(InShowWin,InHnd,O)
CaIIFn(InShowWin,InHnd,9)
llRunning = .T. CASE InHnd#O AND _switch.f.
llRunning = .T.
ENDCASE


(Con’t, page 8)
Page 5

5