新的想法,自動更新客戶端程式有關問題

lzrwj 2003-08-25 10:30:59
新的想法,自動更新客戶端程式有關問題

我公司現在自己開發的系統都有几十個甚至上百個用戶, 我們現在客戶端是自動更新的。就是說如果系統有了新版本,只要在服務器上更新了,用戶端就自動更新。
現在我的做法是把要更新的版本做成exe,每次就更新這個exe.

做成exe有不好的地方,我想把這exe做成dll,問題如下:
1.連編成dll時提示"缺少ole公用類別"?
2.如把exe連編成dll後如何調用?
...全文
132 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
流星尔 2003-08-27
  • 打赏
  • 举报
回复
建立一个项目,添加一个OLE PUBLIC类,然后在里面定义方法,属性等。连编成DLL。
然后在你自己的项目中,引用这个DLL即可方法是
local omsg as oserver.messenger
omsg=createobject("oserver.messenger")
omsg.checkcount() &&checkcount是类里面定义的方法
dfwxj 2003-08-27
  • 打赏
  • 举报
回复
谈一下网络操作的模式,目前我们正打算上马一套业务管理软件,该系统是网络版,操作模式是没有客户端程序和服务器端程序,只有一个应用程序,各个站点不需要安装任何软件,只需建立一个指向服务器的应用程序的快捷方式即可,这种方式下要更新系统只需重新安装服务器上的程序就行了,因为在各个分站点上没有程序
fj_jiangqi 2003-08-26
  • 打赏
  • 举报
回复
用dll,我……我没试过……
用SET LIBRARY TO可以让它运行吗?
dll中有个DLLMain不知vfp中是如何定义的?
DECLARE这个能用吗?
你得多试试看了,或用其它语言来调用它。
-------------------------
我流落在凄凉的世界里-孤苦伶仃
我过着动荡无助的生活-四处漂泊
lzrwj 2003-08-26
  • 打赏
  • 举报
回复
我系統沒用過ole呀,要編譯成dll一定要ole的嗎?
那我是不是隨便搞個ole上去。
lzrwj 2003-08-26
  • 打赏
  • 举报
回复
to fj_jiangqi(强盗) :
我現在已經是自動更新了,不過被更新的是exe,我想做成dll,這樣好像好看點,也專業點。因為用戶有時看到兩個exe不知道運行哪個。
magnetmoon 2003-08-25
  • 打赏
  • 举报
回复
1.連編成dll時提示"缺少ole公用類別"?
可能要把ActiveX控件打包進去


2.如把exe連編成dll後如何調用?
期待樓下的
fj_jiangqi 2003-08-25
  • 打赏
  • 举报
回复
vfp编译成exe就可以,按时间或版本号定文件号。
另外再做一个加载exe文件的exe,最好不要用vfp开发,用delphi或c来做,每一次运行搜索一下最新版,再进行加载。也可以将最新版文件名存在一个ini的文件中,用文本进行编辑。或者每一个新版都将exe直接定位exe文件,重新编译。
如果软件运行是在一个局域网中,可不必下载到窗户端,直接放在服务器上运行就可以了。
一个也许你不想要的答案,仅供参考
-------------------------
我流落在凄凉的世界里-孤苦伶仃
我过着动荡无助的生活-四处漂泊
xuzuning 2003-08-25
  • 打赏
  • 举报
回复
做成exe有不好的地方
其实也没什么不好,或许编译成app文件还要好些。在基本的exe中调用扩展的app

我想把這exe做成dll,問題如下:
1.連編成dll時提示"缺少ole公用類別"?
这种dll是com方式的,需派生于CUSTOM,并设ole属性为“公用”
2.如把exe連編成dll後如何調用?
注册于系统后
o = createobject("oleobj_name.sub_name");
o.method
westbulls 2003-08-25
  • 打赏
  • 举报
回复
Note A .vbr registry file is the same as a .reg registry file except that the .vbr file doesn't include hard-coded paths.
Registering an Automation Server
Your Automation servers are available to other applications once the servers have been added to the Windows Registry. When you build an Automation server, it's automatically registered on the build machine. You can also register your servers on other machines.

When you use the Visual FoxPro Setup to create setup disks, the setup program registers your servers on your customers' machines. You can also manually register servers.

To register an .exe component

Run the .exe file with the /regserver switch.
For example, to register Myserver.exe, run the following command:

myserver /regserver
To remove an .exe component registry entry

Run the .exe file with the /unregserver switch.
For example, to unregister Myserver.exe, run the following command:

myserver /unregserver
To register a .dll component

Run REGSVR32 with the name of the server.
For example, to register Myserver.dll run the following command:

REGSVR32 myserver.dll
To remove a .dll component registry entry

Run REGSVR32 with the name of the server and the /u switch.
For example, to register Myserver.dll run the following command:

REGSVR32 /u myserver.dll
Note The registry contains the full path name to the file, so if you move the file, you'll need to register it again.
Using the Automation Server
Any application that can create Automation objects can create objects based on your Automation server, set properties that are not HIDDEN or PROTECTED, and call methods. For example, assuming that your server is named foxole and contains a class named person with a GetName method, the following code could be run in Visual FoxPro:

oTest = CREATEOBJECT("foxole.person")
cName = oTest.GetName()
Similar code could be run in Microsoft Excel or Visual Basic:

Set oTest = CreateObject("foxole.person")
cName$ = oTest.GetName()
Handling Exceptions
When a Visual FoxPro Automation server generates an exception, the Automation server sets the COM ErrorInfo object (via IErrorInfo) and cancels out of the current method. The Automation client can either release the Visual FoxPro Automation server or, if the client has access to the COM ErrorInfo object, handle the exception based on that information.

For an example using ErrorInfo, see _ErrorInfo( ) API Library Routine.

The new Visual FoxPro function, COMRETURNERROR( ), handles errors that occur on an Automation server. You can use COMRETURNERROR( ) in the Error method, to populate the COM exception structure with information that Automation clients can use to determine the source of Automation server errors. For more information, see COMRETURNERROR( ) Function.

Raising or Returning Errors from Automation Servers
The only interaction with the objects provided by an Automation server (COM component) is through the methods and properties of the exposed classes. When a client application calls a method of an object, and an error occurs in the Automation server, the method either returns an error value or raises an error in the client application.

The client application decides whether to alert the user or proceed with another execution path. The Automation server itself never interacts with the user. This allows the location of the Automation server to be transparent to the client application. The Automation server can be local, running on the user's computer, or you can use the Remote Automation feature of Visual FoxPro to run it on a network server.
westbulls 2003-08-25
  • 打赏
  • 举报
回复
Compiling the Automation Server
In Visual FoxPro, you can create either an out-of-process or an in-process Automation server. An out-of-process component is an executable (.exe file) that runs in its own process. Communication between a client application and an out-of-process server is therefore called cross-process communication. An in-process component is a dynamic-link library (DLL) that runs in the same process address space as the client that calls it.

There are benefits to each. An in-process server is faster because there is no inter-process communication overhead. On the other hand, an out-of-process server can be deployed remotely and an in-process server cannot. Additionally, because the in-process server and the client share a process address space, any serious error in the .dll will terminate the client whereas an error in an out-of-process .exe would only terminate the server.

Note Because in-process .dll and out-of-process .exe Automation servers are invoked through class instantiation, your project need not specify a main file. In Visual FoxPro you can now build an in-process .dll or an out-of-process .exe Automation server without first specifying a main file in the Project Manager.
When you create an executable with OLE Public classes, you don't lose any of your normal .exe capabilities. You can still run the executable, provide a user interface, and all the normal functionality you would include in an application. You increase the extensibility of your application, though, by allowing other applications to tap into the specific functionality you want to expose.

To compile an Automation server

From the Project Manager, choose Build.
In the Build Options dialog box, choose Build Win32 executable / COM server (exe), Build Single-threaded COM server (dll), or Build Multi-threaded COM server (dll).
Choose OK.
-or-

When you type BUILD<space> in the command window and there is an active project, an Intellisense script will help to complete the BUILD command by showing the full paths to the target and the project

Once you build the project, you can see the server classes displayed in the Project Information dialog box. Here you can also specify a help file and a Help context ID for each class. This help file can be opened from most generic object browsers.

You can choose class-specific instancing values in the Project Information dialog box. The instancing options are:

Not Creatable Even though the class is marked OLE public, it will not be available to other applications. For example, you could have a standard library of OLE public classes used in multiple applications and disable automation of one or more classes for a single application.
Single Use Each client application that uses your server creates a separate instance of the server class. Each instance has a single thread of execution. Although separate instances require more memory, choosing Single Use allows the operating system to apply preemptive multitasking.
Multi Use Once the server has been created, other applications can use the same instance.
Note If you make changes in the Servers tab of the Project Information dialog box, you need to rebuild the .dll or .exe for the new settings to take effect.
When you build a project with OLE public classes, three files are created:

The .dll or .exe file
A type library (.tlb) file
A registry (.vbr) file
The type library file is a binary file that lists all the published classes in your Automation server, along with their properties, methods, and events. OLE object browsers read this information and present it in a readable interface. For more information, see Binding Type Libraries.

The registry file lists the global unique IDs (GUID) for the classes in your server.

westbulls 2003-08-25
  • 打赏
  • 举报
回复
下面是有关olepublic的一段说明(Creating Automation Servers):
An Automation server is a COM component application that exposes functionality that can be used and reused by other applications through Automation. For example, using Visual FoxPro you can create an Automation server that displays reusable forms (in an out-of-process .exe file), or packages a complex routine into a simple component that other programmers can use. In addition, you can create one or more classes to handle enterprise-wide business rules. A client application that uses the business rule object would pass input parameters in a method call, and the Automation server might then do a great deal of work, retrieving or storing data from various sources and performing complex calculations, before returning the answer.

Examples of Automation servers are installed in the Visual FoxPro...\Samples\Servers directory.

Creating the Automation Server
All you need to create an Automation server in Visual FoxPro is a project that contains classes defined as OLEPUBLIC. You can have as many OLEPUBLIC classes as you want in the project and they can be defined in program files (.prg) or class libraries (.vcx).

For example, the following class definition in a program file creates a custom OLE public class:

DEFINE CLASS person AS CUSTOM OLEPUBLIC
FirstName = SPACE(30)
LastName = SPACE(45)

PROCEDURE GetName
RETURN THIS.FirstName + " " + THIS.LastName
ENDPROC
ENDDEFINE
When you're designing a class in the Class Designer, select OLE Public in the Class Info dialog box to designate the class as OLEPUBLIC.

2,749

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧