Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Configure COM+ programmatically
Message
De
10/05/2006 11:16:50
 
 
À
07/05/2006 09:36:01
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01119931
Message ID:
01120707
Vues:
11
This may help as a starting point:


oAdminCatalog = createobject("COMAdmin.COMAdminCatalog")
oAdminCatalog.connect("myserver")

oApplications = oAdminCatalog.GetCollection("Applications")
oApplications.Populate()


procedure CreateApplication(cAppName as string) as Boolean

local oNewApp as COMAdmin.COMAdminCatalogObject

oNewApp = oApplications.add()
oNewApp.value("Name") = cAppName
oApplications.SaveChanges()
Populate()

endproc

procedure AddComponentToApplication ;
(cAppName as string, cDLLPath as string, ;
cTypeLibraryPath as string, cDLLProxy as string) as long

* We aren't using proxy stub DLLs (the 4th parameter)
nReturnValue = oAdminCatalog.InstallComponent(cAppName, cDLLPath, cTypeLibraryPath, "")

if isnull(nReturnValue) or nReturnValue = 0
lFailed = .f.
else
lFailed = .t.
endif

return not lFailed

endproc


procedure SetIdentity (cDomainUserName as string, cPassword as string) as Boolean

local lFailed as Boolean
for each oApp in colApplications
if lFailed
exit
endif
* Configure applications to use a specific account
* An error will be raised if username or password is invalid.
try
oApp.value("Identity") = cDomainUserName
oApp.value("Password") = cPassword
* Note this uses the SaveChanges method of the collection, not the app itself
oApplications.SaveChanges()
? "Set identity for " + oApp.name

catch to oException
if oException.errorno = 1426 and left(oException.details, 8) = "80110414"
messagebox("Either the supplied username or password is not correct.")
else
messagebox("Unexpected error " + transform(oException.errorno) + " setting identity for " + oApp.name)
endif
lFailed = .t.
endtry
next

return not lFailed

endproc

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform