- 积分
- 0
- 注册时间
- 2005-1-5
- 仿真币
-
- 最后登录
- 1970-1-1
|
发表于 2006-3-25 12:28:34
|
显示全部楼层
来自 四川成都
Re:vb和ansys
API声明部分
Declare Function WinExec Lib "KERNEL32" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As Long
Declare Function GetModuleHandle Lib "KERNEL32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Sub Command3_Click()
Dim xc As Integer
Dim cmdline As String
Dim hwnd As Integer
Dim hwnd5 As Long
cmdline = "D:/ANSYS80/v80/ANSYS/bin/intel/ansys80cust.exe -b -p ANE3FL -i c:/wo.dat -o e:/岩土设计/ansys.dat"
hwnd5 = FindWindow("Shell_c:/WINDOWS/system32/cmd.exe", vbNullString)
hwnd = WinExec(cmdline, 0) '参数为0则隐藏窗体
' Call ShowWindow(hwnd5, SW_HIDE) '隐藏任务栏SW_HIDE
If hwnd < 32 Then 'hWin<32则启动应用程序失败
MsgBox "error!"
Exit Sub
End If
While GetModuleHandle(hwnd%) '获取一个应用程序或动态链接库的模块句柄
MousePointer = 11 '‘鼠标呈沙漏状
WAIT% = DoEvents()
Wend
xc = MsgBox("计算成功", 48, "岩土设计计算")
If xc = 1 Then
Form8.Show
End If
MousePointer = 1 '鼠标复原为箭头
End Sub |
|