Board index » cppbuilder » COM call from BCB6

COM call from BCB6


2004-04-13 04:35:50 PM
cppbuilder10
Few months ago I've tryied to get some help here translating JScript COM
code to BCB (command line) COM code, but without success. Now, I again need
it. Please help.
*** This is JScript code: ***
var myapp = new ActiveXObject("MyCOM.MyApp.1");
var prop = myapp.CreatePropObject();
myapp.Param1 = "Some text here";
myapp.Param2 = "";
myapp.Param3 = true;
myapp.Param4 = true;
var res = myapp.MyFunc(prop);
WScript.StdOut.WriteLine("Error code: " + res.error);
*** This is Delphi code: ***
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils, ComObj, Windows, Classes, ActiveX, Variants;
var
MyApp, prop, res: Variant;
begin
CoInitialize(nil);
MyApp := CreateOleObject('MyCOM.MyApp.1');
prop := MyApp.CreatePropObject;
prop.Param1 := 'Some text here';
prop.Param2 := '';
prop.Param3 := True;
prop.Param4 := True;
res := MyApp.MyFunction(prop);
WriteLn( 'Error: ' + VarToStr(res.error));
CoUninitialize();
end.
 
 

Re:COM call from BCB6

Hi, the delphi stuff seems easy enough to translate...
but....
1. Is there someway I can test this - what is the COM server application
you are using.
2. What version BCB compiler are you using. I have 3 and 6 and both work
slightly differently when it comes to COM/DCOM stuff. The code may
actually look different when it is translated (????) What compiler
should I do this for.....
Oliver Young wrote:
Quote
Few months ago I've tryied to get some help here translating JScript COM
code to BCB (command line) COM code, but without success. Now, I again need
it. Please help.

*** This is JScript code: ***

var myapp = new ActiveXObject("MyCOM.MyApp.1");
var prop = myapp.CreatePropObject();

myapp.Param1 = "Some text here";
myapp.Param2 = "";
myapp.Param3 = true;
myapp.Param4 = true;

var res = myapp.MyFunc(prop);

WScript.StdOut.WriteLine("Error code: " + res.error);

*** This is Delphi code: ***

program Project1;
{$APPTYPE CONSOLE}

uses
SysUtils, ComObj, Windows, Classes, ActiveX, Variants;

var
MyApp, prop, res: Variant;

begin
CoInitialize(nil);

MyApp := CreateOleObject('MyCOM.MyApp.1');

prop := MyApp.CreatePropObject;
prop.Param1 := 'Some text here';
prop.Param2 := '';
prop.Param3 := True;
prop.Param4 := True;

res := MyApp.MyFunction(prop);

WriteLn( 'Error: ' + VarToStr(res.error));

CoUninitialize();
end.


 

Re:COM call from BCB6

Thank you, but I've succeeded to translate it by my own.
Thank you.
 

{smallsort}