if instr(1,fname," ")>0 then  fname=mid(fname,2,len(fname)-1)

解决方案 »

  1.   

    仔细看看lpFile、lpParameters参数!
    ShellExecute VB声明 
    Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long 
    说明 
      查找与指定文件关联在一起的程序的文件名 
    返回值 
    Long,非零表示成功,零表示失败。会设置GetLastError 
    参数表 
    参数 类型及说明 
    hwnd Long,指定一个窗口的句柄,有时候,windows程序有必要在创建自己的主窗口前显示一个消息框 
    lpOperation String,指定字串“open”来打开lpFlie文档,或指定“Print”来打印它 
    lpFile String,想用关联程序打印或打开一个程序名或文件名 
    lpParameters String,如lpszFlie是可执行文件,则这个字串包含传递给执行程序的参数 
    lpDirectory String,想使用的完整路径 
    nShowCmd Long,定义了如何显示启动程序的常数值。参考ShowWindow函数的nCmdShow参数 
    或者把文件名转化成8.3格式:
    GetShortPathName
    The GetShortPathName function obtains the short path form of a specified input path. DWORD GetShortPathName(
      LPCTSTR lpszLongPath,  // pointer to a null-terminated path string
      LPTSTR lpszShortPath,  // pointer to a buffer to receive the 
                             // null-terminated short form of the path
      DWORD cchBuffer        // specifies the size of the buffer pointed 
                             // to by lpszShortPath
    );
     
    Parameters
    lpszLongPath 
    Pointer to a null-terminated path string. The function obtains the short form of this path. 
    lpszShortPath 
    Pointer to a buffer to receive the null-terminated short form of the path specified by lpszLongPath. 
    cchBuffer 
    Specifies the size, in characters, of the buffer pointed to by lpszShortPath. 
    Return Values
    If the function succeeds, the return value is the length, in characters, of the string copied to lpszShortPath, not including the terminating null character.If the function fails due to the lpszShortPath buffer being too small to contain the short path string, the return value is the size, in characters, of the short path string. You need to call the function with a short path buffer that is at least as large as the short path string. If the function fails for any other reason, the return value is zero. To get extended error information, call GetLastError.Res
    When an application calls this function and specifies a path on a volume that does not support 8.3 aliases, the function fails with ERROR_INVALID_PARAMETER if the path is longer than 67 bytes.The path specified by lpszLongPath does not have to be a fully qualified path or a long path. The short form may be longer than the specifed path. If the specified path is already in its short form, there is no need for any conversion, and the function simply copies the specified path to the buffer for the short path. You can set lpszShortPath to the same value as lpszLongPath; in other words, you can set the buffer for the short path to the address of the input path string. You can obtain the long name of a file from the short name by calling the FindFirstFile function.