dbTalk Databases Forums  

Shelled Command Line Not Visible

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Shelled Command Line Not Visible in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John Baker
 
Posts: n/a

Default Shelled Command Line Not Visible - 03-19-2005 , 09:25 AM






I have an Access frontend that controls the running of several MS SQL Server DTS packages (among other things).

I dynamically build a command line for dtsrun, and then use the ShellWait command from here:
http://www.mvps.org/access/api/api0004.htm

The problem is that some of the packages take quite some time to execute, and no window appears to give the feedback
that dtsrun usually gives.

I tried writing the dtsrun command line out to a .cmd file and then running that with ShellWait, but the behavior is
exactly the same.

Advice appreciated.
--
To Email Me, ROT13 My Shown Email Address


Reply With Quote
  #2  
Old   
ByteMyzer
 
Posts: n/a

Default Re: Shelled Command Line Not Visible - 03-19-2005 , 03:13 PM






"John Baker" <wbua.onxre (AT) wzwfreivprf (DOT) pbz> wrote

Quote:
I have an Access frontend that controls the running of several MS SQL
Server DTS packages (among other things).

I dynamically build a command line for dtsrun, and then use the ShellWait
command from here:
http://www.mvps.org/access/api/api0004.htm

The problem is that some of the packages take quite some time to execute,
and no window appears to give the feedback
that dtsrun usually gives.

I tried writing the dtsrun command line out to a .cmd file and then
running that with ShellWait, but the behavior is
exactly the same.

Advice appreciated.
--
To Email Me, ROT13 My Shown Email Address

One disadvantage to using the method implemented in the above link is that
it does not return control back to your code until the Shelled process has
finished execution. The following ShellWait function runs asynchronously,
giving the option to enumerate the process status within the code:

'---<< begin code>>---
Option Explicit

Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess
As Long, lpExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess
As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long

Private Const STILL_ACTIVE = &H103
Private Const PROCESS_QUERY_INFORMATION = &H400

Public Sub ShellWait(PathName As String, Optional WindowStyle As Long =
vbMinimizedFocus)

Dim bInheritHandle As Long
Dim dwProcessId As Long
Dim lpExitCode As Long
Dim lpRetVal As Long

bInheritHandle = Shell(PathName, WindowStyle)
dwProcessId = OpenProcess(PROCESS_QUERY_INFORMATION, False,
bInheritHandle)

Do
lpRetVal = GetExitCodeProcess(dwProcessId, lpExitCode)
DoEvents
Loop While lpExitCode = STILL_ACTIVE And lpRetVal > 0

If lpRetVal = 0 Then Debug.Print Err.LastDllError

End Sub

'----<< end code>>----




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.