我在编程时候遇到了点问题,想问一下,请各位高手帮我一下,谢谢!
我的问题是:我用VB调用外部程序EXE,然后这个外部程序EXE生成了一个dxf文件,我怎么直接调用这个dxf文件?就是使这个dxf文件生成之后马上就被打开,然后我就可以直接对这个dxf文件进行操作了,而不必再去找到这个文件之后再打开。请各位高手们指导我一下,谢谢!
mProcFunc模块
Public Function ftnStripNullChar(sInput As String) As String
  Dim x As Integer
  x = InStr(1, sInput$, Chr$(0))
  If x > 0 Then
    ftnStripNullChar = Left(sInput$, x - 1)
  End If
End Function
Public Function ftnReturnNodePath(sExplorerPath As String) As String
  Dim iSearch(1) As Integer
  Dim sRootPath As String
  iSearch%(0) = InStr(1, sExplorerPath$, "(", vbTextCompare)
  iSearch%(1) = InStr(1, sExplorerPath$, ")", vbTextCompare)
  If iSearch%(0) > 0 Then
    sRootPath$ = Mid(sExplorerPath$, iSearch%(0) + 1, 2)
  End If
  If iSearch%(1) > 0 Then
    ftnReturnNodePath$ = sRootPath$ & Mid(sExplorerPath$, iSearch%(1) + 1, Len(sExplorerPath$)) & "\"
  End If
End Function
Public Function ftnReturnAttributes(lAttribute As Long) As String
  If lAttribute& And FILE_ATTRIBUTE_READONLY Then
    ftnReturnAttributes = "r"
  End If
  If lAttribute& And FILE_ATTRIBUTE_ARCHIVE Then
    ftnReturnAttributes = ftnReturnAttributes & ".a"
  End If
  If lAttribute& And FILE_ATTRIBUTE_SYSTEM Then
    ftnReturnAttributes = ftnReturnAttributes & ".s"
  End If
  If lAttribute& And FILE_ATTRIBUTE_HIDDEN Then
    ftnReturnAttributes = ftnReturnAttributes & ".h"
  End If
End Function
Public Sub subShellApplication(sCorrectPath As String, sFileName As String, lHwnd As Long)
  Dim lShellFile As Long
  lShellFile& = ShellExecute(lHwnd&, "open", sFileName$, vbNullString, sCorrectPath$, SW_SHOWNORMAL)
  If lShellFile& > 32 Then
    Exit Sub
  Else
    Select Case lShellFile&
      Case 2
        If Right(sFileName$, 3) <> "htm" Then
          MsgBox "File not found.", vbCritical + vbOKOnly, "X-File:"
        End If
        Exit Sub
      Case 3
        MsgBox "Path not found.", vbCritical + vbOKOnly, "X-File:"
        Exit Sub
      Case 5
        MsgBox "Access denied.", vbCritical + vbOKOnly, "X-File:"
        Exit Sub
      Case 8
        MsgBox "Out of Memory.", vbCritical + vbOKOnly, "X-File:"
        Exit Sub
      Case 32
        MsgBox "Shell32.dll not found.", vbCritical + vbOKOnly, "X-File:"
        Exit Sub
    End Select
  End If
End Sub
Public Function Ptr2StrU(ByVal pAddr As Long) As String
  Dim lStrLen As Long
  lStrLen& = lstrlenW(pAddr)
  Ptr2StrU = Space$(lStrLen&)
  CopyMemory ByVal StrPtr(Ptr2StrU), ByVal pAddr, lStrLen& * 2
End Function
Public Function ftnSelectedPath(sInputPath As String) As String
  Dim iSearch(0) As Integer
  Dim sDrivePath As String
  Dim sFolderPath As String
  iSearch%(0) = InStr(1, sInputPath$, "(", vbTextCompare)
  sDrivePath$ = Mid(sInputPath$, iSearch%(0) + 1, 2)
  iSearch%(0) = InStrRev(sInputPath$, ")", -1, vbTextCompare)
  If iSearch%(0) > 0 Then
    sFolderPath$ = Mid(sInputPath$, iSearch%(0) + 2, Len(sInputPath$) - iSearch%(0))
  End If
  ftnSelectedPath$ = sDrivePath$ & "\" & sFolderPath$
End Function
