0

Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork ' ========================================================== ' This function will call the initial bat file ("runminer") ' to run the miner bat ("runbat") ' path == \configs\cpuminer-x64 ' ==========================================================

    Dim proc As Process = Nothing
    Try
        Dim batdir As String = String.Format(startpath & "\configs\cpuminer-x64")
        proc = New Process()
        proc.StartInfo.WorkingDirectory = batdir
        proc.StartInfo.FileName = "runminer.bat"
        proc.StartInfo.CreateNoWindow = False

        proc.Start()
        Dim oStreamReader As StreamReader = proc.StandardOutput
        Dim notif As New System.Windows.Forms.NotifyIcon()

        While True
            oStreamReader.ReadLine()
            If oStreamReader.ReadLine.Contains("scrypt") Then

                notif.Visible = True
                notif.Icon = System.Drawing.SystemIcons.Information
                notif.BalloonTipTitle = "Information"
                notif.BalloonTipText = "Yaaay a block share was accepted!" + Environment.NewLine + "Happy farming!"

            End If
        End While

        notif.ShowBalloonTip(5000)
        Thread.Sleep(10000)
        notif.Dispose()

    Catch ex As Exception
        Console.WriteLine(ex.StackTrace.ToString())
    End Try


End Sub
Teytey
  • 1
  • Is this a Console app? If so, see the example here: [Adding MenuItems to Contextmenu for a TrayIcon in a Console app](https://stackoverflow.com/a/65048753/7444103) -- For sure, you don't want use a loop like that. – Jimi Aug 21 '21 at 16:31
  • It almost certainly shouldn't be a Console app. If you want an application that displays in the tray without displaying a form, I suggest that you read [this](https://www.vbforums.com/showthread.php?636812). – jmcilhinney Aug 22 '21 at 03:13

0 Answers0