Results 1 to 8 of 8

Thread: [2008] com/dial up modem help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2007
    Location
    indiana
    Posts
    341

    [2008] com/dial up modem help

    i have a dail up modem connected to COM4. i need to be able to tell how long it has been connected to the Internet using vb.net 2005. i also would like to know how to forcibly close the modem or the COM4 port. i would also like to know how to send the program the the system tray when the close button is pressed. but if there is no quick answer then i am sure i can find it in the forums someplace.

    thanks in advance.

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2008] com/dial up modem help

    I cant help with the COM stuff but to minimise a program to the system tray you just need to use the NotfyIcon control from the toolbox in VS. Something like this

    vb Code:
    1. Me.Visible = False
    2. Me.ShowInTaskbar = False
    3. MyNotifyIcon.Visible = True
    Obviously that assumes that you have a notify icon on your form named MyNotifyIcon
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: [2008] com/dial up modem help

    You could try to open the port. If it is already open, your open will fail.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2007
    Location
    indiana
    Posts
    341

    Re: [2008] com/dial up modem help

    Quote Originally Posted by dbasnett
    You could try to open the port. If it is already open, your open will fail.
    if the program is running then i know that the port will be open. i really need to know how long it has been open. there has to be a way to do it becasue if you double click on the network icon in the sys tray then you can see how long you have been connected.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2007
    Location
    indiana
    Posts
    341

    Re: [2008] com/dial up modem help

    Quote Originally Posted by chris128
    I cant help with the COM stuff but to minimise a program to the system tray you just need to use the NotfyIcon control from the toolbox in VS. Something like this

    vb Code:
    1. Me.Visible = False
    2. Me.ShowInTaskbar = False
    3. MyNotifyIcon.Visible = True
    Obviously that assumes that you have a notify icon on your form named MyNotifyIcon
    what sub does this belong in i cant seem to find a form minimize or some other related sub.

  6. #6
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: [2008] com/dial up modem help

    Quote Originally Posted by bagstoper
    if the program is running then i know that the port will be open. i really need to know how long it has been open. there has to be a way to do it becasue if you double click on the network icon in the sys tray then you can see how long you have been connected.
    sorry.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  7. #7
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2008] com/dial up modem help

    Quote Originally Posted by bagstoper
    what sub does this belong in i cant seem to find a form minimize or some other related sub.
    Well you said you wanted it to happen when the user clicks a close button... so it belongs in the click event handler for a Close button.
    If you were referring to the X in the top right hand corner of the window, then you would put something like this in the FormClosing event of your form:

    vb Code:
    1. If not CanClose = True then
    2. e.Cancel
    3. Me.Visible = False
    4. Me.ShowInTaskbar = False
    5. MyNotifyIcon.Visible = True
    6. End If
    So what we are doing here is saying if the variable named CanClose is NOT set to True then we cancel the closing event (to stop your app exiting) and then just make the form invisible etc. I would advise you to declare the CanClose variable at class level in your form like so:
    vb Code:
    1. Dim CanClose As Boolean = False

    Then when you DO actually want to close the program you can just set CanClose to True and then the e.Cancel line will not get called so the program will actually exit.
    Hope that makes sense.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2007
    Location
    indiana
    Posts
    341

    Re: [2008] com/dial up modem help

    thanks. that is a big help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width