Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Internet Connection 4

Status
Not open for further replies.

Ablecken

Programmer
Jun 5, 2001
130
US
How would i be able to tell whether a person is online? and another thing, how would i put an internet link in a form? and another, how would u be able to send and email? is there anywat to do that with strait vb or would i have to download a third party ocx or dll?

thanx a lot guys

Ablecken
 
When you ask how to tell if a person is online... do you mean, the local user of a program?... or a specified remote user across the internet?....

For the internet connection of the local user... im not sure exactly how you would do that off the top of my head... but there are plenty of canned functions you can use at though, some dont work right if the user connects through a LAN... if dialup you could do a quick way...

Add a winsock control say, winsock1... and use

if winsock1.localIP <> &quot;0.0.0.0&quot; then
connected = true
else
connected = false
end if

(though this will only work with a modem dialup, and SOME dialup DSL services that dont have a static IP)...

----------------

as for putting in a link, there are user controls out there to do this... but what you can do, is make a label or button or whatever.... and insert the following code on click (or whatever is desired)...


Set ie = New InternetExplorer
ie.Visible = True
ie.Navigate &quot;
Then, say its a label, you can make it react like a link by changing the mouseicon to the little hand icon, make it blue and underlined

----------------

as for the email... Thats something I havent done....
I assume you could probably do it with some work using winsock... but im not sure, so I'd say check out most likely youll find something there
 
oh, on the internet connection thing.. where I said you could possibly use that code..... that wont work with anybody on a network that has a set IP... so, might wanna look for something else....

and another thing, if you want to see if a remote user is online, an easy way would be just to send a ping, and if it was timed out theyre offline, if a ping is returned, theyre on... though they'll need a static IP or it wont know where to look
 
As for internet conn..

Private Declare Function InternetGetConnectedState Lib &quot;wininet.dll&quot; (ByRef _
lpSFlags As Long, ByVal dwReserved As Long) As Long
Const INTERNET_CONNECTION_MODEM = 1
Const INTERNET_CONNECTION_LAN = 2
Const INTERNET_CONNECTION_PROXY = 4
Const INTERNET_CONNECTION_MODEM_BUSY = 8

' return True if there is an active Internect connection
'
' optionally returns the connection mode through
' its argument (see INTERNET_CONNECTION_* constants)
' 1=modem, 2=Lan, 4=proxy
' 8=modem busy with a non-internet connection

Function IsConnectedToInternet(Optional connectMode As Integer) As Boolean
Dim flags As Long
' this ASPI function does it all
IsConnectedToInternet = InternetGetConnectedState(flags, 0)
' return the flag through the optional argument
connectMode = flags
End Function

That will cost you all of nothing.
Brad,
Free mp3 player,games and more.
 
Hey Brad,

im getting a Sub or Function not defined. I have the Private Declare Function in a module and the function being called by a button. Do i need to send one of the numbers, 1 2 4 or 8, to the function?
 
As for the mail, Do you know what mail client the users will be using? ie(outlook, lotus, etc?)
 
Im still getting the Sub or Function not defined. It has to do with

Function IsConnectedToInternet(Optional connectMode As Integer) As Boolean
Dim flags As Long
' this ASPI function does it all
IsConnectedToInternet = InternetGetConnectedState(flags, 0)
' return the flag through the optional argument
connectMode = flags
End Function

that part. I put...


As for internet conn..

Private Declare Function InternetGetConnectedState Lib &quot;wininet.dll&quot; (ByRef _
lpSFlags As Long, ByVal dwReserved As Long) As Long
Const INTERNET_CONNECTION_MODEM = 1
Const INTERNET_CONNECTION_LAN = 2
Const INTERNET_CONNECTION_PROXY = 4
Const INTERNET_CONNECTION_MODEM_BUSY = 8

into a module.

And i dont know what email. what i really want to do is to have them be able to send me comments about a prog. :)

Thanx a lot
 
Did you paste

Private Declare Function InternetGetConnectedState Lib &quot;wininet.dll&quot; (ByRef _
lpSFlags As Long, ByVal dwReserved As Long) As Long
Const INTERNET_CONNECTION_MODEM = 1
Const INTERNET_CONNECTION_LAN = 2
Const INTERNET_CONNECTION_PROXY = 4
Const INTERNET_CONNECTION_MODEM_BUSY = 8

at the top where the option explicit goes ???


Also, MrMooCow, I got it to work also. However, it always says I'm connected. Is this because I get to the Internet over the Lan here at work ??? Tyrone Lumley
augerinn@gte.net
 
If you put API calls in a module and want other objects (forms) to be able to use it, it needs to be public.

I couldn't find InternetGetConnectionState using my API viewer so I couldn't verify the syntax of the call, I guess I should look for an update for WinApi32.txt ;-)

-Mike
Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.
 
WOW THANX A LOT GUYS ESPECIALLY MR. MOO. THIS FORUM ROCKS.

P.S. I fixed by changing Private to Public(should have known)...thanx MikeCox.
 
What about somehow sending me a mail or something about what they want to put into the program. you know like a suggestion box or something. any suggestions?
 
Once you figure out how to send mail here is what I would (and actually i am doing the same thing) do,

First Register a name at yahoo, doesn't matter whats the name cuz no one is going to see it.

Second set up the mailer in vb to use this as the mail address (hard code it)

Third hardcode the to address.

Voila! Thats the steps I am takin, I hope they r of help to you. Brad,
Free mp3 player,games and more.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top