Solved

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

Posted on 2001-07-18
7
319 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

705 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