Solved

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

Posted on 2001-07-18
7
302 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will learn how to implement Singleton Design Pattern in Java.

822 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