Difference between revisions of "Documentation/DevGuide/ProUNO/Bridge/The Service Manager Component"
((checkpoint save)) |
((checkpoint save)) |
||
Line 62: | Line 62: | ||
|-bgcolor=#EDEDED | |-bgcolor=#EDEDED | ||
!Key | !Key | ||
− | !Value | + | !Value* |
|- | |- | ||
|CLSID\{82154420-0FBF-11d4-8313-005004526AB4} | |CLSID\{82154420-0FBF-11d4-8313-005004526AB4} | ||
Line 89: | Line 89: | ||
|-bgcolor=#EDEDED | |-bgcolor=#EDEDED | ||
!Key | !Key | ||
− | !Value | + | !Value |
|- | |- | ||
|com.sun.star.ServiceManager | |com.sun.star.ServiceManager | ||
Line 107: | Line 107: | ||
|-bgcolor=#EDEDED | |-bgcolor=#EDEDED | ||
!Key | !Key | ||
− | !Value | + | !Value |
|- | |- | ||
|com.sun.star.ServiceManager.1 | |com.sun.star.ServiceManager.1 | ||
Line 118: | Line 118: | ||
|} | |} | ||
+ | "Value" means the default, unnamed value in that key of type String / REG_SZ. | ||
The value of the key <code>CLSID\{82154420-0FBF-11d4-8313-005004526AB4}\LocalServer32</code> reflects the path of the office executable. | The value of the key <code>CLSID\{82154420-0FBF-11d4-8313-005004526AB4}\LocalServer32</code> reflects the path of the office executable. | ||
Line 124: | Line 125: | ||
+ | {|border="1" cellpadding=4 style="border-collapse:collapse;" | ||
<code> | <code> | ||
REGEDIT4 | REGEDIT4 | ||
Line 158: | Line 160: | ||
@="{82154420-0FBF-11d4-8313-005004526AB4}" | @="{82154420-0FBF-11d4-8313-005004526AB4}" | ||
</code> | </code> | ||
− | + | } | |
Revision as of 21:44, 26 April 2012
Instantiation
The service manager is the starting point for all Automation clients. The service manager requires to be created before obtaining any UNO object. Since the service manager is a COM component, it has a CLSID
and a programmatic identifier which is com.sun.star.ServiceManager
. It is instantiated like any ActiveX component, depending on the language used:
//C++ IDispatch* pdispFactory= NULL; CLSID clsFactory= {0x82154420,0x0FBF,0x11d4,{0x83, 0x13,0x00,0x50,0x04,0x52,0x6A,0xB4}}; hr= CoCreateInstance( clsFactory, NULL, CLSCTX_ALL, __uuidof(IDispatch), (void**)&pdispFactory);
In Visual C++, use classes which facilitate the usage of COM pointers. If you use the Active Template Library (ATL), then the following example looks like this:
CComPtr<IDispatch> spDisp; if( SUCCEEDED( spDisp.CoCreateInstance("com.sun.star.ServiceManager"))) { // do something }
JScript:
var objServiceManager= new ActiveXObject("com.sun.star.ServiceManager");
Visual Basic:
Dim objManager As Object Set objManager= CreateObject("com.sun.star.ServiceManager")
VBScript with WSH:
Set objServiceManager= WScript.CreateObject("com.sun.star.ServiceManager")
JScript with WSH:
var objServiceManager= WScript.CreateObject("com.sun.star.ServiceManager");
The service manager can also be created remotely, that is. on a different machine, taking the security aspects into account. For example, set up launch and access rights for the service manager in the system registry (see DCOM).
The code for the service manager resides in the office executable soffice.exe. COM starts up the executable whenever a client tries to obtain the class factory for the service manager, so that the client can use it.
Registry Entries
For the instantiation to succeed, the service manager must be properly registered with the system registry. The keys and values shown in the tables below are all written during setup. It is not necessary to edit them to use the Automation capability of the office. Automation works immediately after installation. There are three different keys under HKEY_CLASSES_ROOT
that have the following values and subkeys:
Key | Value* |
---|---|
CLSID\{82154420-0FBF-11d4-8313-005004526AB4} | "StarOffice Service Manager (Ver 1.0)" |
Sub Keys | |
LocalServer32 | "<OfficePath>\program\soffice.exe" |
NotInsertable | |
ProgIDcom.sun.star.ServiceManager.1 | "com.sun.star.ServiceManager.1" |
Programmable | |
VersionIndependentProgID | "com.sun.star.ServiceManager" |
Key | Value |
---|---|
com.sun.star.ServiceManager | "StarOffice Service Manager" |
Sub Keys | |
CLSID | "{82154420-0FBF-11d4-8313-005004526AB4}" |
CurVer | "com.sun.star.ServiceManager.1" |
Key | Value |
---|---|
com.sun.star.ServiceManager.1 | "StarOffice Service Manager (Ver 1.0)" |
Sub Keys | |
CLSID | "{82154420-0FBF-11d4-8313-005004526AB4}" |
"Value" means the default, unnamed value in that key of type String / REG_SZ.
The value of the key CLSID\{82154420-0FBF-11d4-8313-005004526AB4}\LocalServer32
reflects the path of the office executable.
Or, copy the following lines to your editor, edit the path to soffice.exe in the following (double backslashes in that line to mask it), save it as a .reg file, close it, and double-click that file.
Content on this page is licensed under the Public Documentation License (PDL). |