By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,012 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

A97: Q re ShellWait?

P: n/a
MLH
How to avoid the 'User-defined Type not defined' problem in the
following code snippet. How do I set up the User-defined Type
to make this compile?
Public Sub ShellWait(Pathname As String, Optional WindowStyle As Long)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret As Long
' Initialize the STARTUPINFO structure:
With start
.cb = Len(start)
If Not IsMissing(WindowStyle) Then
.dwFlags = STARTF_USESHOWWINDOW
.wShowWindow = WindowStyle
End If
End With
' Start the shelled application:
ret& = CreateProcessA(0&, Pathname, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
' Wait for the shelled application to finish:
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
ret& = CloseHandle(proc.hProcess)
End Sub

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Sun, 24 Jul 2005 07:56:53 -0400, MLH <CR**@NorthState.net> wrote:
How to avoid the 'User-defined Type not defined' problem in the
following code snippet. How do I set up the User-defined Type
to make this compile?
Public Sub ShellWait(Pathname As String, Optional WindowStyle As Long)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret As Long
' Initialize the STARTUPINFO structure:
With start
.cb = Len(start)
If Not IsMissing(WindowStyle) Then
.dwFlags = STARTF_USESHOWWINDOW
.wShowWindow = WindowStyle
End If
End With
' Start the shelled application:
ret& = CreateProcessA(0&, Pathname, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
' Wait for the shelled application to finish:
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
ret& = CloseHandle(proc.hProcess)
End Sub

see the whole caboodle at http://www.mvps.org/access/api/api0004.htm

Nov 13 '05 #2

P: n/a
MLH
OK, that did the trick. Thx.
<snip>

see the whole caboodle at http://www.mvps.org/access/api/api0004.htm


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.