以下是引用asdf_123000在2016-1-1 20:50:16的发言:
看到过这些函数,就是不太会用,大师有不有实例?
* 检测MS日期控件 MSComCt2.OCX 未注册时完成注册,版本2-("MSComCtl2.DTPicker.2")
IF !myRegServer("MSComCtl2.DTPicker.2", 0)
IF !myRegServer("MSComCt2.OCX", 1)
RETURN .F.
ENDIF
ENDIF
* 取消MS日期控件 MSComCt2.OCX 的注册
myRegServer("MSComCt2.OCX", 2)
FUNCTION myRegServer(sName, nFlags)
IF INLIST(nFlags, 1, 2) AND !FILE(sName)
MESSAGEBOX(sName + " 文件不存在")
RETURN .F.
ENDIF
LOCAL sCLSID, nRet
DO CASE
CASE nFlags == 0
DECLARE LONG CLSIDFromProgID IN Ole32 STRING, STRING@
sCLSID = REPLICATE(0h00, 16)
nRet = CLSIDFromProgID(STRCONV(sName + 0h00, 5), @sCLSID)
CLEAR DLLS "CLSIDFromProgID"
RETURN (nRet == 0)
CASE nFlags == 1
DECLARE LONG DllRegisterServer IN (sName)
nRet = DllRegisterServer()
CLEAR DLLS "DllRegisterServer"
CASE nFlags == 2
DECLARE LONG DllUnregisterServer IN (sName)
nRet = DllUnregisterServer()
CLEAR DLLS "DllUnregisterServer"
OTHERWISE
MESSAGEBOX("调用 myRegServer() 的参数无效")
RETURN .F.
ENDCASE
IF (nRet != 0)
MESSAGEBOX("调用 myRegServer() 失败,试用管理员身份运行。")
ENDIF
RETURN (nRet == 0)
ENDFUNC
[此贴子已经被作者于2016-1-1 20:59编辑过]