[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Event handling in DLL

Posted on 1998-06-29
6
Medium Priority
?
158 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 
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 400 total points
ID: 1356354
OK.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

608 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