VB.NET, needs help with project,$5 paypal!

Discussion in 'OT Technology' started by Hydrogen, May 9, 2005.

  1. Hydrogen

    Hydrogen building block

    Joined:
    Apr 14, 2005
    Messages:
    2,615
    Likes Received:
    0
    Location:
    Joliet, IL
    OK, here it is, I am making a program for a project in VB using Visual Studio .NET 2003. This program will basically control entertainment appliances with the click of the mouse. I am using Girder with the TIRA 2.0 USB IR emitter/receiver.

    Here comes the tricky part. There are two ways to communicate with Girder, using a COM object or through event.exe. The rumor is event.exe is faster and easier. Girder comes with a command prompt program called event.exe that supposedly calls girder functions. So essentially I just need to use VB to call the functions of the event.exe.

    http://www.meedio.com/pub/Tools/TVHolic/Readme-TVHolic.htm

    At the very bottom of the page the guy says something about...

    event.exe <eventstring. [device] [pld1][pld2][pld3][-silent]
    event.exe hello -silent

    So pretty much there has to be a way to use VB to call this function, I think it is going to only be a couple of lines of code per button. So each event can easily copy and pasted for each button.

    So what I need is the exact code to call the event.exe functions. My VB experience is limited with basic stuff and I got a couple books for reference.
    Any help at all would be appreciated. This is a small part of the project that has to get working soon, I am a poor college student just like everyone else but whoever gets it working 100% there will be a couple bucks in it for ya.
     
  2. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
  3. AVengeance

    AVengeance Active Member

    Joined:
    Aug 17, 2004
    Messages:
    22,615
    Likes Received:
    0
    Location:
    In my bunker Position:Hunkering
    With .NET things have gotten much simpler. The System.Diagnostics namespace exposes a Process class that you can use to launch external programs. At the simplest level, you can launch a new process with the shared Process.Start method, passing it either the name of an executable file or a filename with an extension associated with an executable application. For example, the following code launches the "c:\somepath\somefile.txt"

    System.Diagnostics.Process.Start _ ("c:\somepath\somefile.txt")



    I just learned something today!
     
  4. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    How to cut and paste?
     
  5. Hydrogen

    Hydrogen building block

    Joined:
    Apr 14, 2005
    Messages:
    2,615
    Likes Received:
    0
    Location:
    Joliet, IL
    Thanks for your inputs. I can now open the girder program and event.exe in VB. Now I just need to find out exactly what arguements to pass to event.exe and how to pass them.
     
  6. Hydrogen

    Hydrogen building block

    Joined:
    Apr 14, 2005
    Messages:
    2,615
    Likes Received:
    0
    Location:
    Joliet, IL
    Dim myProcess2 As Process = System.Diagnostics.Process.Start("C:\Program Files\girder\Event.exe <Eventstring> [-silent]")

    that is the code I am trying to use. I am not sure 100 percent what eventstring is, it is either the hex code for the IR that girder uses or it is a label for the eventstring.

    I tryed both ways and got this error,

    "An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in system.dll

    Additional information: The system cannot find the file specified"

    Which doesn't make any sense because event.exe is in the right directory.
     
  7. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    First substitute your program with notepad.exe and see if it starts that.
     
  8. Hydrogen

    Hydrogen building block

    Joined:
    Apr 14, 2005
    Messages:
    2,615
    Likes Received:
    0
    Location:
    Joliet, IL
    At the formload I open the two executables girder and event.exe

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

    Dim myProcess1 As Process = System.Diagnostics.Process.Start("C:\Program Files\girder\Girder.exe")

    Dim myProcess2 As Process = System.Diagnostics.Process.Start("C:\Program Files\girder\Event.exe")

    myProcess1.WaitForInputIdle(1000)

    myProcess2.WaitForInputIdle(1000)

    and that works like butter, but now for a button press i use this

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

    Dim myProcess2 As Process = System.Diagnostics.Process.Start("C:\Program Files\girder\Event.exe <eventstring>")

    I just have to find out what to substitute eventstring for.
     

Share This Page