form1.frm

来自「功能:这里是用VB生成.OCX控件」· FRM 代码 · 共 82 行

FRM
82
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "Command2"
      Height          =   615
      Left            =   2280
      TabIndex        =   1
      Top             =   720
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   240
      TabIndex        =   0
      Top             =   720
      Width           =   1455
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function RegComCtl32 Lib "C:\MMB\Exe\MMBDebuger.OCX" _
        Alias "DllRegisterServer" () As Long
        
Private Declare Function UnRegComCtl32 Lib "C:\MMB\Exe\MMBDebuger.OCX" _
        Alias "DllUnregisterServer" () As Long
        
Private Declare Function FormatMessage Lib "kernel32" _
        Alias "FormatMessageA" (ByVal dwFlags As Long, _
        lpSource As Any, ByVal dwMessageId As Long, _
        ByVal dwLanguageId As Long, ByVal lpBuffer _
        As String, ByVal nSize As Long, Arguments As _
        Long) As Long
        
Private Declare Function GetLastError Lib "kernel32" () As Long

Const ERROR_SUCCESS = &H0

Private Sub Command1_Click()
    Dim astr As String
    
    '注册ComCtl32.Ocx
    If RegComCtl32 = ERROR_SUCCESS Then
        MsgBox "注册成功"
        
    Else
        astr = String$(256, 20)
        FormatMessage FORMAT_MESSAGE_FROM_SYSTEM Or _
            FORMAT_MESSAGE_IGNORE_INSERTS, 0&, GetLastError, _
            0&, astr, Len(astr), ByVal 0
        MsgBox astr
    End If
End Sub

Private Sub Command2_Click()
    Dim astr As String

    '反注册ComCtl32.Ocx
    If UnRegComCtl32 = ERROR_SUCCESS Then
        MsgBox "反注册成功"
    Else
        astr = String$(256, 20)
        FormatMessage FORMAT_MESSAGE_FROM_SYSTEM Or _
            FORMAT_MESSAGE_IGNORE_INSERTS, 0&, GetLastError, _
            0&, astr, Len(astr), ByVal 0
        MsgBox astr
    End If
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?