Thanks Deepesh Jain,
Here i m giving my entire code.This code is written to take backup from database using export uitily of oracle. Please take a look at that and let me know the problem.
Option Explicit
Public Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Public Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
Public Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Public Const INFINITE = &HFFFF ' Infinite timeout
Public Const SW_SHOWDEFAULT = 10
Public Const NORMAL_PRIORITY_CLASS = &H20
Public Const HIGH_PRIORITY_CLASS = &H80
Public Const SW_HIDE = 0
Public Const SW_MAXIMIZE = 3
Public Const SW_MINIMIZE = 6
Public Const SW_NORMAL = 1
Public Const STARTF_USESHOWWINDOW = &H1
Public Function Spawn()
Dim Proc As PROCESS_INFORMATION
Dim Start As STARTUPINFO
Dim A As SECURITY_ATTRIBUTES
Dim B As SECURITY_ATTRIBUTES
Dim Rc As Long
Dim n As Long
Start.dwFlags = STARTF_USESHOWWINDOW
Start.wShowWindow = SW_MAXIMIZE
'initialize STATRTUPINFO type
Start.cb = Len(Start)
'Start the shelled application
Rc = CreateProcess(vbNullString, "d:\oracle\ora92\bin\exp.exe bnr/bnrsys@orcl file=test.dmp rows=y", _
A, B, 1, HIGH_PRIORITY_CLASS, 0, vbNullString, Start, Proc)
'Wait for shelled appication to finish
Rc = WaitForSingleObject(Proc.hProcess, INFINITE)
'close the handle
Rc = CloseHandle(Proc.hProcess)
End Function
This is written in module and i m calling it thru from.
Pls help me
Thanking you in advance.
B.V.Kumar
|