We help IT Professionals succeed at work.

Delphi Com Object communicate with VB

Explorer060599
on
hi experts, i would like to write delphi com object that communicate with external vb program. what this com
object does is just retrieve data from database and pass value of string or variant to vb program. how
do i pass the information to vb program ?
itsn't i need to create the event in delphi com object and fire it when i need to pass to vb program.
on other side, vb program need to catch the event. right ? any example code or info sites ? any help would appreciated. thanks.

eddie
Comment
Watch Question

Commented:
Listening... (do you HAVE to use events? Couldnt the VB program ask for the DB lookup (GetData function or something), and wait for it to finish?)

Author

Commented:
because i want to notify vb program when necessary only. is GetData a standard function implemented in com ?

Commented:
No, GetData was just an example. I've never made events in COM, so I cant help you there. Just following the thread :o)

Author

Commented:
other than event, anyother method use for notification to external vb program ?

Commented:
Lots I guess... The simplest could be a Windows event (wrapped in TEvent). You can use events systemwide. VB waits for the event, and when the Delphi COM object sets it, you can call a function to retrieve the data.

I hardly know anything about VB, but I assume you can use events.

Author

Commented:
yes, that's what i wants. can i have a example code of delphi com object to create event ?
Commented:
Events are very simple in Delphi. Look at TEvent in the help.

Event := TEvent.Create(nil, true, false, 'YourEventName');

Use 'Event.SetEvent' in Delphi when the data are ready, and VB should use something like the 'Event.WaitFor' in Delphi.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.