利用 ILMerge 打包後,process.hide 沒作用

MStone Lin

請問

我有一支winform
使用
Imports System.Windows.Forms
Imports SHDocVw

若編譯完的exe 與 Interop.SHDocVw.dll
放在同一目錄下執行

作process.start("http://tw.yahoo.com")
不會出現黑框(cmd 畫面)

但透過 ILMerge
將exe 與 dll 打包成1個exe

執行會出現黑框(cmd 畫面)

請問該如何作
才可以不出現黑框畫面

謝謝


Imports System
Imports System.Windows.Forms
Imports SHDocVw

Public Class Form1

    Inherits Form

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed

        Environment.Exit(Environment.ExitCode)

    End Sub

    Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
        Me.Hide()

    End Sub

    Private Sub Timer1_Tick(ByVal Sender As Object, ByVal e As EventArgs) Handles Timer1.Tick

        Label3.Text = CInt(Label3.Text) + 1

        If Label3.Text = "4" Then
            Application.Exit()
        End If
     
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Timer1.Start()

        Dim s() As String
        s = Environment.GetCommandLineArgs

        Dim nhi As String = "N"
       
        Dim closeurl() As String = {"UpToDate","rtPA", "ASIA", "RTS", "NIHSS"}

         If s.Length = 2 Then  '1個參數

            '關閉特定ie 標題
            Dim IEListc As New SHDocVw.ShellWindows
            Dim IEc

            Dim curl As String

            ....... 


            System.Threading.Thread.Sleep(1000)   '停1秒

            '  開啟url()
            Dim url As String = s(1).Replace("+", "&&")  '接收將+變 &
            ' Process.Start("iexplore.exe", url)
            ' Process.Start(url)

            Dim startInfo As New ProcessStartInfo(url)
            startInfo.WindowStyle = ProcessWindowStyle.Hidden
            'startInfo.CreateNoWindow = False
            'startInfo.UseShellExecute = True

            Process.Start(startInfo)

             Application.Exit()

        Else

            Dim startInfo As New ProcessStartInfo("http://tw.yahoo.com")
            startInfo.WindowStyle = ProcessWindowStyle.Hidden

            Process.Start(startInfo)

            Application.Exit()

        End If


    End Sub



回到頂部