Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

calling vcl.net form from com client

2 views
Skip to first unread message

Jesse Calato

unread,
Sep 28, 2006, 4:51:34 PM9/28/06
to

Hi I am trying to call a vcl .net form developed in delphi 2005
from a com client developed in delphi 5. I get an access
violation when doing this. I do the same thing with a WinForms
form developed in Delphi 2005 and it works perfectly. Any
ideas why I might be getting the Access violation only with the
VCL .net form? I am the only developer in my company who knows
WinForms and we would like to stick with VCL if possible, but
we also need to be able to call new forms developed in .net
from our existing win32 apps. Thanks in advance for any help.

Jesse Calato

unread,
Sep 28, 2006, 4:49:01 PM9/28/06
to

Unknown

unread,
Sep 28, 2006, 6:25:50 PM9/28/06
to

Can you post a sample of code which doesn't work?

--
Marc Rohloff [TeamB]
marc rohloff -at- myrealbox -dot- com

Jesse Calato

unread,
Sep 29, 2006, 8:45:48 AM9/29/06
to

>Can you post a sample of code which doesn't work?

Here is the Assembly code:

type
[ComVisible(True), ClassInterface(ClassInterfaceType.AutoDual)]
TDotNetObj = class
private
{ Private Declarations }
public
constructor Create;
function ShowWinForm: string;
procedure ShowVCLForm;
end;

implementation

uses WinForm, MyVCL;

constructor TDotNetObj.Create;
begin
inherited Create;
// TODO: Add any constructor code here
end;

procedure TDotNetObj.ShowVCLForm;
var
a: TmyVCLForm;
begin
a := TmyVCLForm.Create(nil);
a.ShowModal;
end;

Here is the code in the COM Client:

procedure TForm1.Button2Click(Sender: TObject);
var
fc: TDotNetObj;
begin
fc := CoTDotNetObj.Create;
fc.ShowVCLForm;
fc.Free;
fc := nil;
end;

CoTDotNetObj was defined by Delphi when I imported the type
library generated by regasm.

The only ideas that I had were that I would need certain borland specific dlls registered with the OS in some way that
the delphi install does not automatically do for me.

I appreciate any help.

0 new messages