VB6でCMDウィンドウを開かずにシェルコマンドを実行する方法

次のコードは、私のVB6プログラムの一部です。

VBでシェルコマンドを使い、フラグと引数を指定してpscp.exeを実行しました。

私の問題は、VBが行を実行するときです。

      Shell strCommand, 1  

また、2-4秒間CMDウィンドウ(CMDポップアップウィンドウ)が表示されます。

私の質問 - CMDウィンドウを開かない方法で "Shell strCommand, 1" を実行することは可能でしょうか?

つまり、私はVBアプリケーションを実行するときに、CMDポップアップウィンドウを見たくないのです。

  Const cstrSftp As String = "D:\pscp.exe"
  Dim strCommand As String
  Dim pUser As String
  Dim pPass As String
  Dim pHost As String
  Dim pFile As String
  Dim pRemotePath As String
  pUser = "root"
  pPass = "pass123"
  pHost = "110.218.201.15"
  pFile = """D:\scan_ip.ksh""" 
  pRemotePath = "/var/tmp"

  strCommand = cstrSftp & " -sftp -l " & pUser & " -pw " & pPass & " " & pHost & ":" & pRemotePath & " " & pFile

  Shell strCommand, 1  
ソリューション

隠しフォーカスを使うことができます。

Shell strCommand, vbHide

または

Shell strCommand, 0

その他のフォーカスタイプについては、こちらを参照してください。 または http://msdn.microsoft.com/en-us/library/aa242087%28v=VS.60%29.aspx (リンクをくれた MarkJ に感謝します)

解説 (1)