Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can i get CLSID
Message
From
14/11/2001 08:38:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
14/11/2001 07:14:11
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00581399
Message ID:
00581424
Views:
23
>Hi:
>
>I´m trying to get the CLSID from a COM object.
>I´ve registered the dll file. I can make the object but when I put "object.CLSID", it appears an OLE error message (Unkown name). What´s the problem?
>Could you help me?

Xabi,
CLSID applies to server object. When your project is active :

oServer = _VFP.ActiveProject.Servers("classnamehere")
? oServer.CLSID

If you mean to read from registry :
? _GetClassCLSID('word.application')
? _GetClassCLSID('myCOMDLL.myClass')
*function _GetClassCLSID
Lparameters tcClassName
#Define HKEY_CLASSES_ROOT   -2147483648
#Define ERROR_SUCCESS		0	&& OK

Declare Integer RegOpenKey IN Win32API ;
  Integer nHKey, String @cSubKey, Integer @nResult

Declare Integer RegCloseKey IN Win32API ;
  Integer nHKey

Declare Integer RegQueryValueEx IN Win32API ;
  Integer nHKey, String lpszValueName, Integer dwReserved,;
  Integer @lpdwType, String @lpbData, Integer @lpcbData

Local lnKey,lpdwReserved,lpdwType,lpbData,lpcbData,nErrCode,CLSID
Store 0 TO lpdwReserved,lpdwType
Store SPACE(256) TO lpbData
Store LEN(m.lpbData) TO m.lpcbData

lnKey = 0
llRetVal = ( RegOpenKey(HKEY_CLASSES_ROOT, tcClassName+'\CLSID', @lnKey) = ERROR_SUCCESS )
If llRetVal
  If RegQueryValueEx(lnKey,'',;
      m.lpdwReserved,@lpdwType,@lpbData,@lpcbData) = ERROR_SUCCESS
    m.CLSID = LEFT(m.lpbData,m.lpcbData-1)
  Else
    m.CLSID = ''
  Endif
  RegCloseKey(lnKey)
Endif
Return m.CLSID
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform