[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: Using CLSIDFromProgID method
|
Warning, in addition to this being a windows only
function, anything in an internal package may change at any time without
warning. The class COM may not exist in future releases and the API may
change.
The method COM.CLSIDFromProgID is just a JNI call
to the dll method CLSIDFromProgID defined in the MSDN.
Here is an example of using it:
String progID =
"Word.Document";
// create a GUID struct to hold the
result
GUID guid = new GUID();
// create a null terminated array of
char
char[] buffer = null;
if (progID != null) {
int count = progID
.length();
buffer = new char[count
+ 1];
progID.getChars(0,
count, buffer, 0);
}
if (COM.CLSIDFromProgID(buffer, guid) !=
COM.S_OK){
throw new
InvalidArgumentException();
}
return guid;