Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Distributing MSGRAPH with an application
Message
From
12/10/2002 20:03:37
 
 
To
11/10/2002 09:55:40
General information
Forum:
Visual FoxPro
Category:
InstallShield
Miscellaneous
Thread ID:
00710007
Message ID:
00710693
Views:
24
Alan,

Here are some additional links to sites that give info about MS Graph:

- Microsoft Graph and Visual Foxpro - Tips and Tricks
http://ourworld.compuserve.com/homepages/RHendricks/msgptips.htm

- Limitations of Run-Time MS-Graph
http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q112483&

- Using MS Graph with Visual Foxpro
http://www.mhsoftware.com/FoxPro_Misc/using_graph.htm

- MS Graph ships with MS Office. It does not ship with MS Works.

In one of my applications I support MS Graph, but I don't distribute it because it's a hassle IMHO. So, if the user doesn't have MS Graph installed, I have to disable the option. This is done with a call to the next function CheckServer().
*	23/jun/2002 pdv
*	My version of ...
*		CheckServer.PRG
*		Published in _Microsoft Office Automation with Visual FoxPro_,
*		Hentzenwerke Publishing, June, 2000.
*		www.hentzenwerke.com
*		Copyright 2000 by Tamar E. Granor and Della Martin All Rights Reserved

*	Returns whether or not a specified OLE-server application exists.

* Parameter:
*  1   cServerName   Server Name. E.g. 'word.application', 'excel.application', 'msgraph.application'

* Example:
*	llFound = CheckServer( 'msgraph.application' )

FUNCTION CheckServer
LPARAMETER cServerName
LOCAL oRegistry, cClassID, cEXEName, lEXEExists, ;
      aClassIDValues, aClassIDValues, aServerNameValues

*!*	IF VERSION() >= "Visual FoxPro 06"
*!*   oRegistry = NewObject("Registry", HOME() + "FFC\Registry")
   oRegistry = NewObject("Registry")
*!*	ELSE
*!*	  SET PROCEDURE TO HOME() + "samples\classes\registry.prg" ADDITIVE
*!*	  oRegistry = CreateObject("Registry")
*!*	ENDIF

lEXEExists = .F.

DECLARE aClassIDValues[1], aServerNameValues[1]

WITH oRegistry
  * Find the CLSID of the server. First, look for the Class's Key.
  IF .OpenKey(cServerName + "\CLSID") = 0
    * The Class's Key is open, now enumerate its values
    .EnumKeyValues(@aClassIDValues)

    * The data portion of the first (only) value returned
    * is the CLSID. Find the LocalServer32 key for the CLSID 
    IF .OpenKey("CLSID\" + aClassIDValues[1,2] + "\LocalServer32") = 0
      * Enumerate the LocalServer32 values
      .EnumKeyValues(@aServerNameValues)

      * The EXE file is stored in the first (only) data value returned. 
      cEXEName = aServerNameValues[2]

      * The value that's returned may have " -Automation" or " /Automation" or
      * " /AUTOMATION" & other trailing stuff at the end. Strip it off.
      IF "AUTO" $ UPPER(cEXEName)
        cEXEName = LEFT(cEXEName, ATC("AUTO", UPPER(cEXEName)) - 2)
      ENDIF

      * Verify that the file exists 
      lEXEExists = FILE(cEXEName) 
    ENDIF 
  ENDIF
ENDWITH

RETURN lEXEExists
>Thanks for the reply!!
>You are probably right, and that is what I originally thought also.
>However, I saw a statement in the VFP 7 online documentation which
>led me to think otherwise. The statement is in the heading
>"Automate a Microsoft Excel Spreadsheet" which is NOT what I am doing
>but it states "However, you can distribute MS Graph with your applications".
>
>The entire section reads:
>
>Automate a Microsoft Excel Spreadsheet
>See Also
>Automate a Microsoft Word Document in a Form | Automate Microsoft Word and Excel | Solutions Samples
>File: ...\Samples\Solution\OLE\Olexl.scx
>
>This form shows two samples of Visual FoxPro calling an Excel worksheet through automation.
>
>The Trend button performs a query followed by a cross-tab to create a dataset to pass to Excel
>through automation using the Excel.Sheet object. Once in Excel, Visual FoxPro can call a Trend function to perform a simple regression analysis.
>
>The Chart button automates the Excel.Chart object to create a chart. Excel supports passing
>data through automation, but MS Graph does not. However, you can distribute MS Graph with your applications.
>
>See Also
>Automate a Microsoft Word Document in a Form | Automate Microsoft Word and Excel |
>Solutions Samples
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Previous
Reply
Map
View

Click here to load this message in the networking platform