<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>varaxor's Feed - Programmer's Heaven</title>
    <link>http://www.programmersheaven.com/feed/User/546957/RSS.aspx</link>
    <description>Events at Programmer's Heaven related to the user varaxor.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Tue, 18 Jun 2013 19:01:41 -0700</pubDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <item>
      <title>Re: Shell  asynchronously/ synchronously</title>
      <link>http://www.programmersheaven.com/mb/VBasic/275827/423161/ReadMessage.aspx#423161</link>
      <description>&lt;p&gt;Posted a '&lt;a href="http://www.programmersheaven.com/mb/VBasic/275827/423161/ReadMessage.aspx#423161"&gt;reply&lt;/a&gt; on the &lt;a href="http://www.programmersheaven.com/mb/VBasic/Board.aspx"&gt;Visual Basic&lt;/a&gt; forum.&lt;/p&gt;All the samples of code, I've seen so far use Windows API.&lt;br /&gt;
&lt;br /&gt;
However, if you want to use code that don't call API as me you can do it with simple VB code :&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
Sub ShellAndWait(PathName As String, _
                 Optional WindowsStyle As VbAppWinStyle = vbMinimizedFocus)
    Dim ShellCmdPath As String
    Dim FileNumber As Long
    Dim template As String
    Dim i As Integer

    ' Generate a temporary filename
    i = 0
    Do
        ShellCmdPath = Hex(i) &amp;amp; ".bat"
        i = i + 1
    Loop While Len(Dir(ShellCmdPath)) &amp;gt; 0

    ' Prepare batch file content
    template = "@echo off" &amp;amp; vbCrLf
    
    ' Action to execute
    template = template &amp;amp; PathName &amp;amp; vbCrLf
    
    ' Remove created batch file when action has been executed
    template = template &amp;amp; "del " &amp;amp; ShellCmdPath

    ' Create batch file
    FileNumber = FreeFile
    Open ShellCmdPath For Output As #FileNumber
    Print #FileNumber, template
    Close #FileNumber

    ' Execute batch file containing action
    Shell ShellCmdPath, WindowsStyle

    ' Wait for asynchronous command to finish
    While Len(Dir(ShellCmdPath)) &amp;gt; 0
        DoEvents
    Wend
End Sub
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBasic/275827/423161/ReadMessage.aspx#423161</guid>
      <pubDate>Mon, 11 Apr 2011 08:46:06 -0700</pubDate>
    </item>
  </channel>
</rss>