调用regsvr32能注册一个绝对路径带有中文或带空格的控件吗?如果能请举例说明,谢谢!

解决方案 »

  1.   

    有空格的话,可以先得到他的短文件名再注册可以这样,先做个小工具,窗体上先放1个按钮和1个textbox
    Option ExplicitPrivate Declare Function GetShortPathName Lib "kernel32" _
          Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
          ByVal lpszShortPath As String, ByVal cchBuffer As Long) As LongPrivate Function GetShortName(ByVal sLongFileName As String) As String
           Dim lRetVal As Long, sShortPathName As String, iLen As Integer
           'Set up buffer area for API function call return
           sShortPathName = Space(255)
           iLen = Len(sShortPathName)       'Call the function
           lRetVal = GetShortPathName(sLongFileName, sShortPathName, iLen)
           'Strip away unwanted characters.
           GetShortName = Left(sShortPathName, lRetVal)
       End Function
                        Private Sub Command1_Click()Text1.Text = GetShortName(Text1.Text)End Sub运行,在textbox中输入控件的完整路径,点按钮,会在textbox中得到短文件名,然后复制它,注册控件即可
      

  2.   

    regsvr32 "e;\aaa bbb\xx.ocx"
    路径两边加上双引号试试
      

  3.   

    rainstormmaster的答案是正确的,因为我在工程中就是这么用的,只要得到目标文件的短文件名即可。