Solved

Exposing Winsock_DataArrival Event (or any other event from a .dll) ) in a custom ActveX .dll

Posted on 2001-07-18
7
298 Views
Last Modified: 2013-11-25
I am writing an ActiveX dll, which encapsulates the Winsock Component to perform SMTP commands via port 25 I have written this using the winsock control inside a standard .exe with no problems at all. However in a .dll I can only use the CreateObject(ProgID) in my code
(as there is no form for the control to sit on).  Again no problem, I can access the methods and set properties etc...  My code relies on the Winsock_DataArrival event to execute certain rules.  How can I expose the events of an object instance which has been created programmatically?  I have a feeling that the key lies somewhere in either WithEvents or RaiseEvents (or both).
Ideally to keep things as simple as possible, I do not want to use the Winsock API!

Any help with the above would be of great help.

Many thanks in advance,

Dave
0
Comment
Question by:davee_jay
7 Comments
 
LVL 4

Accepted Solution

by:
VincentLawlor earned 50 total points
ID: 6294333
Use WithEvents and Raise event from your DLL

In your main code write handlers for these events.

There's loads of help available in MSDN.

http://mdsn.microsoft.com

Vin.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7156171
Hi davee_jay,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept VincentLawlor@devx's comment(s) as an answer.
    ** I'm not sure this is complete enough to be PAQworthy.

davee_jay, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Author Comment

by:davee_jay
ID: 7156545
My apologies for not getting back to you sooner.  I did indeed use WithEvents as was my hunch, and after a bit of input from MSDN and some experimenting I got it working.

I totally forgot to update the 'experts' question.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 49

Expert Comment

by:DanRollins
ID: 7156597
davee_jay,
Here's a tip for the future, in case you continue to use this site:  Most experts would rather not receive a C on their grading record.  I'm sure you meant well, but please review the EE grading guidelines:  http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp#3  Thanks!
-- Dan
0
 
LVL 1

Author Comment

by:davee_jay
ID: 7156643
Ah, any chance that grading can be ammended once it has been submitted, because after looking at the guidelines, it looks more relevant to give an A)?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7157578
You can post a message to Community Support by clicking here: http://www.experts-exchange.com/jsp/qAskQuestion.jsp?ta=commspt 
Indicate that you made a mistake in grading and specify your desire.  Be sure to include the question ID.  It is: Q_20152835

-- Dan
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7159217
Grade changed as requested

Computer101
E-E Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now