[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 157
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

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.

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