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
Solved

Event handling in DLL

Posted on 1998-06-29
6
152 Views
Last Modified: 2010-04-04
Maybe I'm just being obtuse:

If I call a function in a DLL that should return an integer and that function uses a process that requires event handling how do I return the result?

For example: my actual function takes some information, massages it, opens a socket connection to a service, writes the data, and receives a response.  That response needs to be returned to the calling application.  However, when I get the response, I'm in the onDataArrival event handler -- far removed from my original function.

How can I return that value?

Any thoughts?

Thanks
- Frank
0
Comment
Question by:FBlair
  • 4
  • 2
6 Comments
 
LVL 5

Expert Comment

by:ronit051397
ID: 1356349
You can send messages between Main Application and DLL and then use the event OnGetMyMessage... or something similar. Is this approach good for you?
If yes, Let me know and I'll post some example.
0
 

Author Comment

by:FBlair
ID: 1356350
Sounds easy enough, but how would that work if the DLL is in Delphi and the calling program is in, say VB?
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1356351
It doesn't matter, you send messages "to the Handle" of a program, so if you are writing the other program in VB you should see it's documentation on handeling messages.
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 5

Expert Comment

by:ronit051397
ID: 1356352
in the DLL you write somethong like:
sendmessage(Handle which is the Handle of the VB program, WM_MYMESSAGE, here you write the Integer value, 0);

On the VB program you write an event which handles the messages coming to your program.

Or use DDE...
0
 

Author Comment

by:FBlair
ID: 1356353
Cool.  I think I have the idea.  If you'll make it an official answer, I'll take it.

Thanks.
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 100 total points
ID: 1356354
OK.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

829 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