| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1470 人关注过本帖
标题:【求助】十万火急: 用VB怎么样直接调用外部程序EXE所生成的文件
只看楼主 加入收藏
笨笨编程
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2006-2-26
收藏
 问题点数:0 回复次数:7 
【求助】十万火急: 用VB怎么样直接调用外部程序EXE所生成的文件



  各位高手们,小弟有礼了!
  我在编程时候遇到了点问题,想问一下,请各位高手帮我一下,谢谢!

  我的问题是:我用VB调用外部程序EXE,然后这个外部程序EXE生成了一个dxf文件,我怎么直接调用这个dxf文件?就是使这个dxf文件生成之后马上就被打开,然后我就可以直接对这个dxf文件进行操作了,而不必再去找到这个文件之后再打开。请各位高手们指导我一下,谢谢!
搜索更多相关主题的帖子: EXE 文件 
2006-02-26 18:58
笨笨编程
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2006-2-26
收藏
得分:0 


  我被这个问题困绕了很久,实在想不出来,我想用shell函数完成,但是不知道怎么办,而且我没有这个外部程序EXE源程序,所以我实在不知道怎么办,请高手稍微指点一下在下,谢谢你们了!


2006-02-26 19:43
ryu
Rank: 1
等 级:新手上路
帖 子:124
专家分:0
注 册:2006-2-12
收藏
得分:0 
Private Sub FileList_DblClick()
If FileList.ListItems.Count > 0 Then
Call mProcFunc.subShellApplication(mProcFunc.ftnReturnNodePath(Explorer.SelectedItem.FullPath), FileList.SelectedItem.Text, Me.hwnd)
End If
End Sub

本帖版权归ryu所有.如果引用本帖,请注明帖子的出处和作者;本帖如系引用,其版权归原作者所有.
2006-02-26 20:57
ryu
Rank: 1
等 级:新手上路
帖 子:124
专家分:0
注 册:2006-2-12
收藏
得分:0 

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


本帖版权归ryu所有.如果引用本帖,请注明帖子的出处和作者;本帖如系引用,其版权归原作者所有.
2006-02-26 21:06
xinfresh
Rank: 4
等 级:贵宾
威 望:13
帖 子:594
专家分:0
注 册:2006-1-13
收藏
得分:0 
牛人,上次版主怎么跟你说的来着:要写注释,你这么牛的人,不写注释,谁看的懂啊

E-mail:xinfresh@QQ:383094053校内:http:///getuser.do?id=234719042
2006-02-26 22:13
ryu
Rank: 1
等 级:新手上路
帖 子:124
专家分:0
注 册:2006-2-12
收藏
得分:0 
^_^
Return Correct Drive Path when Clicking on Node in Explorer Tree eg.

Determine what Attributes the File or Folder has. We pass the Value of the Attribute.

Open associated application from sCorrectPath$ & sFileName$.

Returns the string which is located at a memory address.

Returns the correct path from sInputPath, eg.

本帖版权归ryu所有.如果引用本帖,请注明帖子的出处和作者;本帖如系引用,其版权归原作者所有.
2006-02-26 22:27
笨笨编程
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2006-2-26
收藏
得分:0 

谢谢!谢谢!
我是第一次发贴,就得到你们的帮助,真的非常感动!
虽然我不是很懂上面的回复,,我会好好看的,谢谢你们!真的非常感谢!


2006-02-27 00:04
shiyide
Rank: 2
等 级:新手上路
威 望:4
帖 子:297
专家分:0
注 册:2006-2-22
收藏
得分:0 
就是 希望能有注释 那样看的人也轻松很多` ` ```
支持楼上的xinfresh的说法

学好编程,为中国的软件事业出一份力。
2006-03-03 18:05
快速回复:【求助】十万火急: 用VB怎么样直接调用外部程序EXE所生成的文件
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019220 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved