CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
英特尔®游戏设计大赛100美元现金周周送 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VB >  控件

急,急,关于Vsflex7.ocx的自动注册问题

楼主seekafei(阿飞)2003-10-03 09:10:30 在 VB / 控件 提问

我用abc10   大虾   的下列代码对其他ocx控件进行注册,都能注册成功,但  
  注册Vsflex7.ocx总是出错。望各位大虾指教。谢谢  
   
  ****'注册、反注册OCX、DLL文件  
  Private   Declare   Function   LoadLibraryRegister   Lib   "kernel32"   Alias   "LoadLibraryA"   (ByVal   lpLibFileName   As   String)   As   Long  
  Private   Declare   Function   CreateThreadForRegister   Lib   "kernel32"   Alias   "CreateThread"   (lpThreadAttributes   As   Any,   ByVal   dwStackSize   As   Long,   ByVal   lpStartAddress   As   Long,   ByVal   lParameter   As   Long,   ByVal   dwCreationFlags   As   Long,   lpThreadID   As   Long)   As   Long  
  Private   Declare   Function   WaitForSingleObject   Lib   "kernel32"   (ByVal   hHandle   As   Long,   ByVal   dwMilliseconds   As   Long)   As   Long  
  Private   Declare   Function   GetProcAddressRegister   Lib   "kernel32"   Alias   "GetProcAddress"   (ByVal   hModule   As   Long,   ByVal   lpProcName   As   String)   As   Long  
  Private   Declare   Function   FreeLibraryRegister   Lib   "kernel32"   Alias   "FreeLibrary"   (ByVal   hLibModule   As   Long)   As   Long  
  Private   Declare   Function   CloseHandle   Lib   "kernel32"   (ByVal   hObject   As   Long)   As   Long  
  Private   Declare   Function   GetExitCodeThread   Lib   "kernel32"   (ByVal   hThread   As   Long,   lpExitCode   As   Long)   As   Long  
  Private   Declare   Sub   ExitThread   Lib   "kernel32"   (ByVal   dwExitCode   As   Long)  
  Public   Function   fun_RegServer(ByVal   filename   As   String)   As   Boolean  
  '注册  
                fun_RegServer   =   RegSvr32(filename,   False)  
  End   Function  
     
  Public   Function   fun_UnRegServer(ByVal   filename   As   String)   As   Boolean  
  '反注册  
                fun_UnRegServer   =   RegSvr32(filename,   True)  
  End   Function  
                     
  Private   Function   RegSvr32(ByVal   filename   As   String,   bUnReg   As   Boolean)   As   Boolean  
                Dim   lLib       As   Long  
                Dim   lProcAddress       As   Long  
                Dim   lThreadID       As   Long  
                Dim   lSuccess       As   Long  
                Dim   lExitCode       As   Long  
                Dim   lThread       As   Long  
                Dim   bAns       As   Boolean  
                Dim   sPurpose       As   String  
                sPurpose   =   IIf(bUnReg,   "DllUnregisterServer",   "DllRegisterServer")  
                If   Dir(filename)   =   ""   Then   Exit   Function  
                lLib   =   LoadLibraryRegister(filename)  
                '载入文件  
                If   lLib   =   0   Then   Exit   Function  
                lProcAddress   =   GetProcAddressRegister(lLib,   sPurpose)  
                If   lProcAddress   =   0   Then  
                        '不是ActiveX控件  
                            FreeLibraryRegister   lLib  
                            Exit   Function  
                Else  
                            lThread   =   CreateThreadForRegister(ByVal   0&,   0&,   ByVal   lProcAddress,   ByVal   0&,   0&,   lThread)  
                            If   lThread   Then  
                                                lSuccess   =   (WaitForSingleObject(lThread,   10000)   =   0)  
                                                If   Not   lSuccess   Then  
                                                            Call   GetExitCodeThread(lThread,   lExitCode)  
                                                            Call   ExitThread(lExitCode)  
                                                            bAns   =   False  
                                                            FreeLibraryRegister   lLib  
                                                            Exit   Function  
                                                Else  
                                                            bAns   =   True  
                                                End   If  
                                                CloseHandle   lThread  
                                                FreeLibraryRegister   lLib  
                            Else  
                                            FreeLibraryRegister   lLib  
                            End   If  
                End   If  
                RegSvr32   =   bAns  
  End   Function 问题点数:0、回复次数:2Top

1 楼yunfeng007(一水寒)回复于 2003-10-03 11:23:05 得分 0

提示什么错误?Top

2 楼seekafei(阿飞)回复于 2003-10-03 12:11:08 得分 0

不提示出错,但在vb引用该控件后,控件列表中出现的图标不正确  
  并且在窗口中引用该控件,则出错(不出现该控件)Top

相关问题

  • web ocx 自动下载注册
  • OCX如何实现自动下载并自动注册?
  • Help!!!怎样让IE自动注册OCX中的OCX
  • 做安装程序,自动注册dll和ocx怎么做呢?
  • 如何让网页自动下载ocx并注册
  • 关于ocx控件自动注册的问题;
  • 请问如何用程序自动注册OCX控件?
  • 怎么使ie浏览用户自动注册ocx控件
  • ocx如何注册?
  • 怎么注册*。ocx

关键词

  • 注册
  • longprivate
  • ocx
  • byval
  • kernel32
  • alias
  • long
  • lib
  • declare function

得分解答快速导航

  • 帖主:seekafei

相关链接

  • Visual Basic类图书
  • Visual Basic类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo