|
-
Dec 6th, 1999, 03:20 PM
#1
Thread Starter
Addicted Member
Hello,
I have a small mail app which uses the winsock control to attach to the SMTP port of my local exchange server, however I need to use the actual winsock cotrol. Is there any way of using the winsock.dll directly, so perhaps I could create a customised mail class with code only?
Like
dim newWin as winsock
set newWin = New winsock
newWin.connect .....
Thanks in advance.
-
Dec 6th, 1999, 10:07 PM
#2
Add a REFERENCE(not as component) to Mswinsck.ocx
This is when you would just use a module.
You could also use a class and call that from the module then you could use the default events you also get with the control
Private WithEvents sckTest As MSWinsockLib.Winsock
But here a simple example
Code:
Option Explicit
'Add a REFERENCE(not as component) to Mswinsck.ocx (%winsysdir%\Mswinsck.ocx)
Private sckTest As MSWinsockLib.Winsock
Sub Main()
Dim sData As String
Dim sBuffer As String
Set sckTest = New Winsock
sckTest.Connect "[My SMTP Server]", 25
Do Until sckTest.State = sckConnected And Not sckTest.State = sckError
DoEvents
Loop
If sckTest.State = sckError Then 'Error
End
End If
Do
sckTest.PeekData sBuffer, vbString
If sBuffer <> "" Then
sckTest.GetData sBuffer, vbString
End If
sData = sData & sBuffer
Debug.Print sData
'Proccess data here
'Finishd data proccssing
DoEvents
Loop
End Sub
Hope it helps.
(Use edit message to copy the code.)
------------------
Vincent van den Braken
EMail: [email protected]
ICQ: 15440110
Homepage: http://www.azzmodan.demon.nl
[This message has been edited by Azzmodan (edited 12-07-1999).]
[This message has been edited by Azzmodan (edited 12-07-1999).]
-
Dec 6th, 1999, 10:17 PM
#3
Thread Starter
Addicted Member
This looks like exactly what I want, many thanks.
Tony.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|