using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace HelloWorldCom
{
[Guid("B80E18FA-A733-4eaf-90ED-C9B052F46F64")]
public interface IHelloWorldCom
{
[DispId(0x8001)]
int SayHelloWorld(string name);
}
[Guid("8715F0A3-48B4-4aed-AE98-3D9B35367FEB"),
ClassInterface(ClassInterfaceType.None)]
public class HelloWorldCom : IHelloWorldCom
{
public int SayHelloWorld(string name)
{
MessageBox.Show(string.Format("Hello world {0}", name));
return 42;
}
}
}
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe" HelloWorldCom.dll /tlb:HelloWorldCom.tlb
"C:\Programme\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /i HelloWorldCom.dll
"C:\Programme\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /u HelloWorldCom.dll
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe" HelloWorldCom.dll /unregister /tlb:HelloWorldCom.tlb
del HelloWorldCom.tlb
CREATE(HelloWorldCom);
i := HelloWorldCom.SayHelloWorld('MyCom');
MESSAGE('COM returned ' + FORMAT(i));
CLEAR(HelloWorldCom);
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace HelloWorldCom
{
[ComVisible(false)]
public delegate void HelloWorldComEventHandler(string eventText);
[Guid("B80E18FA-A733-4eaf-90ED-C9B052F46F64")]
public interface IHelloWorldCom
{
[DispId(0x8001)]
int SayHelloWorld(string name);
[DispId(0x8002)]
void StartSomething();
}
[Guid("48939794-243B-44c5-A992-42D5E0DAF76A"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHelloWorldComEventHandler
{
[DispIdAttribute(0x9001)]
void SomeEvent(string eventText);
}
[Guid("8715F0A3-48B4-4aed-AE98-3D9B35367FEB"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(IHelloWorldComEventHandler))]
public class HelloWorldCom : IHelloWorldCom
{
event HelloWorldComEventHandler SomeEvent;
public HelloWorldCom()
{
}
public int SayHelloWorld(string name)
{
MessageBox.Show(string.Format("Hello world {0}", name));
return 42;
}
public void StartSomething()
{
this.SomeEvent(
string.Format("Time 1: {0}.", System.DateTime.Now));
for (int i = 0; i < 100000; i++)
;
this.SomeEvent(
string.Format("Time 2: {0}.", System.DateTime.Now));
for (int i = 0; i < 100000; i++)
;
}
}
}
-- OnRun()
CREATE(HelloWorldCom);
i := HelloWorldCom.SayHelloWorld('MyCom');
MESSAGE('COM returned ' + FORMAT(i));
HelloWorldCom.StartSomething();
MESSAGE ('Last message!');
CLEAR(HelloWorldCom);
-- HelloWorldCom::SomeEvent(eventText : Text[1024])
MESSAGE('Event Text: ' + eventText);
string
SayHelloWorld(string name, string name)
TEXTOCX.SayHelloWorld(VarText01,VarText02);
IF ISCLEAR(Catalog) THEN
CREATE(Catalog);
Pos := STRPOS(Customer.Name,' ');
Vorname := COPYSTR(Customer.Name,1,Pos-1);
Name := COPYSTR(Customer.Name,Pos+1);
GUI := Customer."Kundennr. Shop";
CLEAR(GUI);
REPEAT
GUI := Catalog.CreateUserProfile('C:\Dokumente und Einstellungen\alle\Desktop\Pending\',GUI,'',
'',Customer."E-Mail",'','',Customer."Fax No.",Customer."Phone No.",Vorname,Name,
'',Customer.Address,Customer."Country Code",Customer."Post Code",Customer.City,Customer.Geburtsdatum,'');
UNTIL Customer.NEXT = 0;
MESSAGE('%1',GUI);
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace GCard
{
[Guid("5BD50CFD-2CB9-434E-B058-65765BFBC1D8")]
public interface IsetCardId
{
[DispId(1)]
void setCardId(string ID);
}
[Guid("23E08A8F-47F3-4295-90B6-387BB102A53F"),
ClassInterface(ClassInterfaceType.None)]
public class GC : IsetCardId
{
public void setCardId(string ID)
{
unsafe
{
CallFunction.setCardId(ID);
}
}
public static class CallFunction
{
[DllImport("GCARD.dll")]
public unsafe static extern void setCardId(string ID);
}
}
}
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace GiftCard2005
{
public static class CallMember
{
[DllImport("GC_CLIENT.dll", EntryPoint = "?setCardId@Request@giftcard@lsag@@QAEXPAD@Z",CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern void setCardId(ref IntPtr s);
[DllImport("GC_CLIENT.dll", EntryPoint = "?setDomainIp@Response@giftcard@lsag@@QAEXPAD@Z",CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern void setDomainIp(ref IntPtr s);
[DllImport("GC_CLIENT.dll", EntryPoint = "?setDomainPort@Response@giftcard@lsag@@QAEXPAD@Z",CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern void setDomainPort(ref IntPtr s);
[DllImport("GC_CLIENT.dll", EntryPoint = "?setTransType@Request@giftcard@lsag@@QAEXH@Z", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern void setTransType(ref IntPtr s);
[DllImport("GC_CLIENT.dll", EntryPoint = "?getBalanceMax@Response@giftcard@lsag@@QAEPADXZ",CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern IntPtr getBalance();
}
[Guid("6AB89431-8D2D-4e1e-9207-741F0DC8290B")]
public interface IsetCardId
{
[DispId(1)]
void setCardId(string s);
[DispId(2)]
void setDomainIp(string s);
[DispId(3)]
void setDomainPort(string s);
[DispId(4)]
string getBalance();
}
[Guid("D40857A8-11C2-4865-95E9-03680E534B50"),
ClassInterface(ClassInterfaceType.None)]
public class GiftCard : IsetCardId
{
public unsafe void setCardId(string s)
{
IntPtr ID = Marshal.StringToHGlobalAnsi(s);
CallMember.setCardId(ref ID);
}
public unsafe void setDomainIp(string s)
{
IntPtr IP = Marshal.StringToHGlobalAnsi(s);
CallMember.setDomainIp(ref IP);
}
public unsafe void setDomainPort(string s)
{
IntPtr Port = Marshal.StringToHGlobalAnsi(s);
CallMember.setDomainPort(ref Port);
}
public unsafe void setTransType(string s)
{
IntPtr Type = Marshal.StringToHGlobalAnsi(s);
CallMember.setDomainPort(ref Type);
}
public unsafe string getBalance()
{
IntPtr Balance = IntPtr.Zero;
string Erg;
Balance = CallMember.getBalance();
Erg = Marshal.PtrToStringAnsi(Balance);
return Erg;
}
}
}
int Gateway::doTrans(const char* domainIp, const char* domainPort,
const ParameterMap& requestMap, ParameterMap& responseMap) {
#include <string>
#include <map>
using namespace std;
namespace lsag {
namespace giftcard {
typedef map<string, string> ParameterMap;
typedef ParameterMap::value_type ParameterPair;
}
}
#endif
ZurĂĽck zu Software-Integration
Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast