打印本文 打印本文  关闭窗口 关闭窗口  
VFP9.0SP2中的MY组件帮助译文(三)
作者:佚名  文章来源:不详  点击数  更新时间:2008/5/9 19:02:53  文章录入:杜斌  责任编辑:杜斌

  My 命名空间

    My 有一些命名空间(直接映射到My.VCX)。最顶级的命名空间是 My,作爲其他 My 命名空间的父类。 My麾下有5个命名空间:

  My.App:提供程序方法和属性
  My.Computer:提供访问计算机组件可变的组件
  My.Data:提供数据手动化的性能
  My.Settings:提供程序设置
  My.User:提供当前用户的信息
  My

  My

  在My系统中,MY是其他命名空间的父类。其本身没有任何属性和方法。
  --------------------------------------------------------------------------------

  My.App

  提供应用程序的方法和属性。

  类成员
  成员
  描述

  Execute
  执行指定的文件。
  My.App.Execute(FileName as String [, Operation as String
  [, WorkingFolder as String [, OtherParameters as String]]]) as Integer

  前置要求:无

  My.App.Execute

  功能:执行指定的文件

  用法:My.App.Execute(FileName as String [, Operation as String
  [, WorkingFolder as String [, OtherParameters as String]]]) as Integer
  返回值:
  一个数值代号,指明状态:
  -1: 如果没有传递文件名
  2: 坏的关联
  29: 装入程序失败
  30: 程序忙
  31: 没有程序关联
  超过 32的值,表明成功,并且返回程序的的实例句柄
  参数
  FileName as String
  要用来执行的文件的名称和路径

  Operation as String

  The operation to perform. Optional; if it isn't specified, "Open" is used.

  WorkingFolder as String

  文件的工作目录。可选。

  OtherParameters as String

  其他的参数传递给程序,用来管理文件的

  范例
  local My as My
  My = newobject('My', 'My.vcx')
  lcFile = fullpath('roadmap.html')
  erase (lcFile)
  lnResult = My.Computer.Network.DownloadFile('http://msdn.microsoft.com/vfoxpro/roadmap', ;
  lcFile)
  if lnResult = 0
  My.App.Execute(lcFile)
  endif lnResult = 0
  参见:
  My.App 类

  My.App.Info

  包含程序特定的属性

  类成员
  成员
  描述

  GetApplicationInformation
  得到有关特定程序的信息
  My.App.Info.GetApplicationInformation(EXEPath as String)

  GetCurrentApplicationInformation
  得到当前程序的信息My.App.Info.GetCurrentApplicationInformation()

  Comments
  程序的内容。只读。

  CompanyName
  公司名称。只读。

  Copyright
  版权。只读。

  Description
  程序的描述。只读。

  DirectoryPath
  程序运行的目录。只读。

  InternalName
  程序的内部名称。只读。

  Language
  程序的语言。只读。

  OLESelfRegister
  .T.,如果 EXE 是自注册的。只读。

  OriginalFileName
  原来的文件名称。只读。

  PrivateBuild
  私有的版本。只读。

  ProductName
  产品名称。只读。

  ProductVersion
  产品的版本数。只读。

  SpecialBuild
  特别的版本。只读。

  Trademarks
  程序的商标。只读。

  TranslationCode
  翻译代码;参见Visual FoxPro 帮助主题 AGETFILEVERSION() 以知得更多。只读。

  Version
  程序的版本数。只读。

  前置要求:无

  My.App.Info.GetApplicationInformation

  功能:得到关于指定程序的信息。

  用法:My.App.Info.GetApplicationInformation(EXEPath as String)
  参数:EXEPath as String

  要查知信息的的 EXE 文件路径和名称。

  备注

  在参考例如公司名称或者版本之前,调用此方法。

  范例
  local My as My
  My = newobject('My', 'my.vcx')
  My.App.Info.GetApplicationInformation('C:\Program Files\MyApp\MyApp.EXE')
  messagebox(My.App.Info.Version)
  参见:
  My.App.Info | My.App.Info.GetCurrentApplicationInformation

打印本文 打印本文  关闭窗口 关闭窗口