Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 159
  • Last Modified:

Event handling in DLL

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
FBlair
Asked:
FBlair
  • 4
  • 2
1 Solution
 
ronit051397Commented:
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
 
FBlairAuthor Commented:
Sounds easy enough, but how would that work if the DLL is in Delphi and the calling program is in, say VB?
0
 
ronit051397Commented:
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ronit051397Commented:
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
 
FBlairAuthor Commented:
Cool.  I think I have the idea.  If you'll make it an official answer, I'll take it.

Thanks.
0
 
ronit051397Commented:
OK.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now