Solved

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

Posted on 2001-07-18
7
296 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Grade changed as requested

Computer101
E-E Moderator
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This video teaches viewers about errors in exception handling.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

771 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

11 Experts available now in Live!

Get 1:1 Help Now