Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a custom object to an ActiveX control?

Status
Not open for further replies.

djjd47130

Programmer
Nov 1, 2010
480
US
I don't have much of a problem generating an ActiveX control based on a TWinControl, that's a great built-in feature in Delphi (although has a few glitches). I also don't have a problem creating an Active Form (TActiveForm) and implementing my own stuff on it. The issue I'm facing is how to add more of my own new properties to be pulished? (I asked this in another thread and it was never answered, but the subject has changed a little)... I figure out how to add the properties, but finally when I import that control on the other end, those new properties don't exist.

Now another hurdle I'm trying to jump is how to also publish a simple TObject of my own to be accessible also? If this has anything to do with IDispatch and Interfaces Etc. (which I'm pretty sure it does), I know nothing about them. I found a great article explaining ActiveX, but was based on some Delphi 2.0 or some old version and I'm on 7 (which is where the glitches happen). I have for example TJDChatClientX control which wraps all necessary functionality for a chat client (and my own server too). I have some objects, for example "TJDChatBuddy" which represents a buddy of the user. This object has its own internal objects, methods, properties, etc., it's not just a record with a few values. I need to be able to access these objects through the ActiveX library in the remote language, whatever it may be (even javascript should be able to handle it).

JD Solutions
 
It looks like either no one knows anything about ActiveX/Delphi, or it's too huge of a subject to simply answer. I'm rather desperate on learning more about how to build an ActiveX library with Delphi, preferably one which is ideal for D7 (not the older versions) because I've seen some lost functionality since this good article I found.

As for handling the objects, I got to thinking it would be more ideal to just publish a function for example to get the buddy's info. For example...
Code:
function GetBuddyInfo(const Username: PChar; var FName, LName, DName, 
  Status, StatusString: PChar; var zFName, zLName, zDName, zStatus, 
  zStatusString: Integer): Bool; stdcall;
begin
  ......
end;

......

exports
  DllGetClassObject,
  DllCanUnloadNow,
  DllRegisterServer,
  DllUnregisterServer,
  GetBuddyInfo;


JD Solutions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top