如题,试验成功,马上结贴
解决方案 »
- 请教,如何将其它的多个文件保存到本程序中!!
- 当窗体最小化到任务栏时,就没法取得上面控件的TEXT了;如果不最小化到任务栏就是好的,为什么?
- 如何向TMemoryStream中增加内容?
- 请教,这个过程不是向指定的URL传送了一个字符串吗?
- 急急急!100分求救!小弟我在用adodataset连VF的一个表时出现问题。
- netwolfds(晓竹)请来拿分
- 怎样把TreeView控件的同一层次的节点自定义排序?
- 怎么为我继承的一个系统空间添加一个属性阿,
- 急!急!急!有关两个子窗体内容互相复制的问题?(请各位大侠帮我看看代码错在哪?)
- *** 30 分**** 如何知道MEMO有几行字符
- 动态load的包的垃圾回收问题请教
- 一个对数组数的判断
procedure TIOCPSEVER1.callback(S:tsocket;Even:integer);stdcall;
begin
PostMessage(FwindowHandle,wm_user+Even,s,0);
end;
function TIOCPSEVER1.init(callback:pointer;port:integer):longbool;
begin
result:=_init(pointer(self),callback,port);
end;
明天再贴中间层的
這篇可能最好!!
procedure TxwCallBackRDM.AssignCallback(ACallback: OleVariant);
begin
FClientCallback := ACallback;
end;procedure TxwCallBackRDM.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False;
FClientCallback.CallbackMethod('This is the message.');
end;procedure TxwCallBackRDM.RemoteDataModuleCreate(Sender: TObject);
begin
Timer1.Enabled := True;
end;
Setting up the Client
On the client, I implemented the IClientCallback interface as the class TClientCallback within the main form's unit. The code for the main form is shown below. unit xwcMainFrm;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, CallBackSrv_TLB, DB, DBClient, MConnect, ComObj, ActiveX;type TClientCallback = class(TAutoIntfObject, IClientCallback)
protected
procedure CallbackMethod(const AMessage: WideString); safecall;
end; TMainForm = class(TForm)
DCOMConnection1: TDCOMConnection;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
FClientCallback: TClientCallback;
public
{ Public declarations }
end;var
MainForm: TMainForm;implementation{$R *.dfm}{ TClientCallback }procedure TClientCallback.CallbackMethod(const AMessage: WideString);
begin
ShowMessage(AMessage);
end;procedure TMainForm.FormCreate(Sender: TObject);
var
typelib: ITypeLib;
begin
DCOMConnection1.Connected:=true;
OleCheck(LoadRegTypeLib(LIBID_CallbackSrv, 1, 0, 0, typelib));
FClientCallback := TClientCallback.Create(typelib, IClientCallback); DCOMConnection1.AppServer.AssignCallback(FClientCallback as IDispatch);
end;end.自己到那個網頁看下更好!!