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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delphi ActiveX control won't import custom VCL functions !

Status
Not open for further replies.

PANTLORD

Programmer
Aug 28, 2001
49
EU
Hi there,

Having a problem with this, I have generated a VCL based on a TMemo. Within the TMemo I have a custom function GetLabelFileData which retrieves info from a text file and displays it in the Memo box onscreen.
When I install this VCL into a package and then drag and drop it onto various Delphi Applications it works fine and I have access to the function GetLabelFileData.
My problem arises when I convert the VCL using the Delphi 5 wizard to an ocx file, again I register and drag and drop onto apps, but I now don't see or have access to this custom function !! I still have all my properties but no customer function. I did add it via the Type Library editor and then I could see it okay once I dragged my activeX onto a form but it didn't seem to do anything.

Any ideas on what I need to do to maintain access to this function in the ocx ?

Thanks in advance
Mully
 
Check out the ocx with the OLE viewer and see what it says about your interfaces etc. Or try to place it on a VB form and view it with the object browser, see what it says about your component's exports.
Greetings,
Rick
 
Hi Rick,

Thanks for the quick response. I looked at the ocx using the oleviewer and under the interfaces section I see;

[id(0x00000001)]
HRESULT GetLabelFileData();

not sure what this means. I have read somewhere that the Delphi wizard will skip properties, methods etc which cannot be mapped as standard OLE types, could that be what its doing here ?. The function really just assigns values to a memo which it has read from a string.

Thanks
Mully
 
I'm not familiar with Delphi at all, so I'll try to explain from VB/VC:

What you see there is a function returning an HRESULT (which is the standard COM returning code, in methods as well as in properties). It indicates success or failure of the function. In C you would just evaluate this code to check whether or not the function succeeded. In VB the runtime evaluates this HRESULT and will generate an error if the function did not succeed (with an error code that has the same value as the HRESULT). The HRESULT will NOT show up in the intellisence of VB, neither will it show up in VB's object browser. Again, I'm not familiar with Delphi so I do not know how Delphi handles this.

I do not know what the original prototype was (before you made it into an OCX), but now, the function does NOT return a value (a Sub in VB, a void in C) and it does not take any parameters.

But since it's present in the typelibrary of the control, it should be accesible by any COM compliant language.
Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top