|
-
Aug 24th, 2000, 02:17 PM
#1
Thread Starter
Fanatic Member
I have been able to get my mail program to work finally using Mswinsck.ocx as a reference file. This works great on the machine I am developing on because this has already been registered. When I go to a WinNT computer the Mswinsck.ocx is not registered so I can not create the winsock object.
How do I register this object using the package deployment wizard or can't I?
Is there a way to include a form in a class so that I can add the Winsock control to the form and reference that in the class?
Is there a way to send a very simple mail message using straight APIs from Wsock32.dll?
Again I am trying to package this all in a class to be used in other projects as well.
I can provide the class code if you need it.
Thanks
-
Aug 24th, 2000, 02:29 PM
#2
Monday Morning Lunatic
P&DW will register any controls for you.
Instead of adding it to the form as a control, try this:
Code:
Public WithEvents Winsock1 As (New?) Winsock
Put it in the Declarations section of your form. It can then be accessed from a class:
Any events will be passed back to Form1, though. You can add it to the class, and then the class will recieve the events.
As for not using the Winsock control, I think there is an example on Planetsourcecode of sending an email using the API.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 25th, 2000, 07:35 AM
#3
Thread Starter
Fanatic Member
Parksie,
I'm a little confused then (like that's new), what I did was add Mswinsck.ocx into my project as a reference and then declared it in the class as
Code:
Private Sub Class_Initialize()
Set mobjWinsock = New MSWinsockLib.Winsock
End Sub
I ran the program on the Win 98 machine I'm developing on and everything works great. I use P&DW and setup the program on a Win NT 4.0 6a machine and I get a Run-time error 429, Active X component can't create object This may be wrong but I assumed that it is because the OCX did not get registered.
Is there a way to verify that the OCX was registered?
I also placed
Code:
Private WithEvents mobjWinsock As MSWinsockLib.Winsock
in the class declarations. So I would not have to refer back to the form (I won't know the form name for future projects) again I would like to make the class stand on its own so I can use the class over and over again. Is there a way to have the winsock control on the project form and then be able to use that control in the stand alone class, maybe passing the form name that the control is on to the class and then create the control in the class at runtime?
Thanks for any advice you can offer.
-
Aug 25th, 2000, 07:43 AM
#4
Fanatic Member
Tut, tut, tut, parksie.
One cannot use New when one is declaring something WithEvents.
-
Aug 25th, 2000, 08:21 AM
#5
Thread Starter
Fanatic Member
Originally posted by V(ery) Basic
Tut, tut, tut, parksie.
One cannot use New when one is declaring something WithEvents.
I think that's why he stated (New?)
-
Aug 25th, 2000, 09:24 AM
#6
Thread Starter
Fanatic Member
Parksie,
I did try it your way as mentioned above but when I try
Code:
frmMain.Winsock1.LocalPort = 0
inside the class, I get the error: Run-time error '91': Object variable or With block variable not set
I did not think you needed a Set New statement for form controls.
-
Aug 25th, 2000, 09:40 AM
#7
Thread Starter
Fanatic Member
Pass Winsock object to the class
This may show my ignorance for classes but...
Could you create the winsock object in the project before you call the class and then pass the winsock object to the class so that it can be used?
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
|