一、新建“应用程序”:
Function CreateApplication(AppName: String): Boolean
二、删除“应用程序”:
Function RemoveApplication(AppName: String): Boolean
三、新建“组件”:
Function InstallComponent(AppName: String; DllName: String): Boolean
四、删除“组件”:
Function RemoveComponent(AppName: String; DllName: String): Boolean
五、判断“应用程序”是否存在:
Function IsAppplicationExists(AppName: String): Boolean即把手工注册COM+组件用程序来实现。
操作系统:WIN2K SERVER 或者 WIN2K ADNVANCED SERVER
谢谢。
Function CreateApplication(AppName: String): Boolean
二、删除“应用程序”:
Function RemoveApplication(AppName: String): Boolean
三、新建“组件”:
Function InstallComponent(AppName: String; DllName: String): Boolean
四、删除“组件”:
Function RemoveComponent(AppName: String; DllName: String): Boolean
五、判断“应用程序”是否存在:
Function IsAppplicationExists(AppName: String): Boolean即把手工注册COM+组件用程序来实现。
操作系统:WIN2K SERVER 或者 WIN2K ADNVANCED SERVER
谢谢。
解决方案 »
- ~~~~~~~~~~~~~~~delphi实现文件上传与下载~~~~~~~~~~~~~~~
- DBchart的放大查看,在线等待您
- 求一控件,分不够另外开贴送!
- TIdUDPServer active之后,为何重新设定defaultport无效
- 如何向一个窗口里的输入框自动填入信息?
- TRefType=class of Control;是什么意思?
- 闲人免进!为什么我的登录窗体总是不能通过?
- (沈阳)沈阳的程序员和未来的程序员.大家都想知道程的序员待遇问题:薪水、工作性质。我们都在同一战壕上,面对老板我们心里应该有个数,想吹牛的朋友请您忍一忍。
- 新手有简单问题.....
- 数据库控件TTable的问题!
- 如何使用EnumChildWindows和EnumChildWindowProc函数啊?
- 怎么知道计算机有没有安装声卡啊
run|install com+ objects那也是用程序实现的呀。
CmAdmCtl, Forms; //一、新建“应用程序”:
function CreateApplication(AppName: string): Boolean;
//二、删除“应用程序”:
function RemoveApplication(AppName: string): Boolean;
//三、新建“组件”:
function InstallComponent(AppName: string; DllName: string): Boolean;
//四、删除“组件”:
function RemoveComponent(AppName: string; DllName: string): Boolean;
//五、判断“应用程序”是否存在:
function IsAppplicationExists(AppName: string): Boolean;
//六、启动“应用程序”
function StartApplication(AppName: string): Boolean;
//七、关闭“应用程序”
function ShutdownApplication(AppName: string): Boolean;implementation//一、新建“应用程序”:
function CreateApplication(AppName: string): Boolean;
var
objCatalog: TCOMAdminCatalog;
objCatalogApplicationCollection: TCOMAdminCatalogCollection;
objCatalogObject: TCOMAdminCatalogObject;
begin
Result := True;
//checks if the Application exists or not, if not exists then creates the Application
if not IsAppplicationExists(AppName) then
begin
try
try
objCatalog := TCOMAdminCatalog.Create(Application);
objCatalogApplicationCollection := objCatalog.GetCollection('Applications');
objCatalogApplicationCollection.Populate;
objCatalogObject := objCatalogApplicationCollection.Add;
objCatalogObject.Value['Name'] := AppName;
objCatalogApplicationCollection.SaveChanges;
except
Result := False;
end;
finally
objCatalog.Destroy;
end;
end;
end;//二、删除“应用程序”:
function RemoveApplication(AppName: string): Boolean;
var
objCatalog: TCOMAdminCatalog;
objCatalogApplicationCollection: TCOMAdminCatalogCollection;
iCounter: Integer;
begin
try
try
objCatalog := TCOMAdminCatalog.Create(Application);
//getting all the Applications in the server
objCatalogApplicationCollection := objCatalog.GetCollection('Applications');
objCatalogApplicationCollection.Populate;
//looping through all the Applications to test whether the Application exists
Result := False;
for iCounter := 0 to objCatalogApplicationCollection.Count-1 do
begin
//Debug.Print objCatalogApplicationCollection.Item(iCounter).Name
if objCatalogApplicationCollection.Get_Item(iCounter).Name = AppName then
begin
//Shutdown the application first
objCatalog.ShutDownApplication(AppName);
objCatalogApplicationCollection.Remove(iCounter);
objCatalogApplicationCollection.SaveChanges;
Result := True;
Break;
end;
end;
except
Result := False;
end;
finally
objCatalog.Destroy;
end;
end;//三、新建“组件”:
function InstallComponent(AppName: string; DllName: string): Boolean;
var
objCatalog: TCOMAdminCatalog;
begin
try
try
objCatalog := TCOMAdminCatalog.Create(Application);
objCatalog.InstallComponent(AppName, DllName, '','');
Result := True;
except
Result := False;
end;
finally
objCatalog.Destroy;
end;
end;//四、删除“组件”:
function RemoveComponent(AppName: string; DllName: string): Boolean;
var
objCatalog: TCOMAdminCatalog;
objCatalogApplicationCollection: TCOMAdminCatalogCollection;
objCatalogComponentCollection: TCOMAdminCatalogCollection;
iCounter: Integer;
iComponentCounter: Integer;
bRemoved: Boolean;
begin
Result := True;
try
try
objCatalog := TCOMAdminCatalog.Create(Application);
//getting all the Applications in the server
objCatalogApplicationCollection := objCatalog.GetCollection('Applications');
objCatalogApplicationCollection.Populate; //looping through all the Applications to get the current Application
for iCounter := 0 to objCatalogApplicationCollection.Count-1 do
begin
if objCatalogApplicationCollection.Get_Item(iCounter).Name = AppName then
begin
//if application is found Shutdown the application first
objCatalog.ShutDownApplication(AppName);
//getting the current collection
objCatalogComponentCollection := objCatalogApplicationCollection.GetCollection
('Components', objCatalogApplicationCollection.Get_Item(iCounter).Key);
objCatalogComponentCollection.Populate;
//check if the remove option is enabled
if objCatalogComponentCollection.RemoveEnabled then
begin
for iComponentCounter := 0 to objCatalogComponentCollection.Count-1 do
begin
//remove the component, which is always the top one
objCatalogComponentCollection.Remove(0);
end;
end
else
begin
Result := False;
//raise an error
end;
//saves changes
objCatalogComponentCollection.SaveChanges;
end;
end;
except
Result := False;
end;
finally
objCatalog.Destroy;
end;
end;//五、判断“应用程序”是否存在:
function IsAppplicationExists(AppName: string): Boolean;
var
objCatalog: TCOMAdminCatalog;
objCatalogApplicationCollection: TCOMAdminCatalogCollection;
iCounter: Integer;
begin
try
try
Result := False;
//getting all the Applications in the server
objCatalog := TCOMAdminCatalog.Create(Application);
objCatalogApplicationCollection := objCatalog.GetCollection('Applications');
objCatalogApplicationCollection.Populate;
//looping through all the Applications to test whether the Application exists
for iCounter := 0 to objCatalogApplicationCollection.Count - 1 do
begin
if objCatalogApplicationCollection.Get_Item(iCounter).Name = AppName then
begin
Result := True;
Break;
end;
end;
except
Result := False;
end;
finally
objCatalog.Destroy;
end;
end;//六、启动“应用程序”
function StartApplication(AppName: string): Boolean;
var
objCatalog: TCOMAdminCatalog;
begin
try
try
//starts the Application in COM+
objCatalog := TCOMAdminCatalog.Create(Application);
//starting the application
objCatalog.StartApplication(AppName);
Result := True;
except
Result := False;
//raise the error
end;
finally
objCatalog.Destroy;
end;
end;//七、关闭“应用程序”
function ShutdownApplication(AppName: string): Boolean;
var
objCatalog: TCOMAdminCatalog;
begin
try
try
//shut down the Application in COM+
objCatalog := TCOMAdminCatalog.Create(Application);
//shut down the application
objCatalog.ShutDownApplication(AppName);
Result := True;
except
Result := False;
//raise the error
end;
finally
objCatalog.Destroy;
end;
end;end.
我可等着code呢