formIExplorer プロセスが実行されているかどうかを確認し、RichTextBox(ユーザーに IE を閉じるようにアドバイスする) がプロセス = 1 であり、プロセス = 0 の場合はButton次に進むように表示する VB.Net を使用して作成しようとしています。form
それは簡単な部分です。難しい部分は、フォームがロードされたときにプロセスが = 0 だった場合、ユーザーが IE を開き、ボタンを削除してRichTextBox(ユーザーに IE を閉じるようにアドバイスする) を表示したいということです。閉じる IE ボタンが再び表示されます。
buttonIE が開いているかどうかに応じて表示RichTextBoxさform_loadれるIfステートメントが含まれていますが、IE が閉じているか開いているかを切り替えることができません。どんな助けも大歓迎です。
RTB とボタンの Form_load にあるコードは次のとおりです。
aProc = Process.GetProcessesByName("iexplore")
If aProc.Length = 0 Then
    Dim b1 As New Button
    b1.Location = New System.Drawing.Point(274, 244)
    b1.Name = "btnOK"
    b1.Size = New System.Drawing.Size(75, 29)
    b1.TabIndex = 5
    b1.Text = "OK"
    b1.UseVisualStyleBackColor = False
    Me.Controls.Add(b1)
    AddHandler b1.Click, AddressOf btn_OK
Else
    Dim t1 As New RichTextBox
    t1.Location = New System.Drawing.Point(170, 233)
    t1.Name = "rtbMessage2"
    t1.ReadOnly = True
    t1.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    t1.Size = New System.Drawing.Size(293, 40)
    t1.TabIndex = 5
    t1.Text = ("Internet Explorer is Running - Please Close Internet Explorer to Continue")
    Me.Controls.Add(t1)
    AddHandler t1.Click, AddressOf btn_OK
End If