您的位置:首页 > 编程语言 > Delphi

使用Delphi,显示ActiveX控件的属性页方法

2007-05-31 11:41 381 查看
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, MSCommLib_TLB, StdCtrls, ActiveX, OLECtl;

type
TForm1 = class(TForm)
MSComm1: TMSComm;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
Spec: ISpecifyPropertyPages;
XObj: IMSComm;
auuid: TCAGUID;
begin
XObj := MSComm1.DefaultInterface;
try
if XObj.QueryInterface(System.TGUID(IID_ISpecifyPropertyPages), Spec)=S_OK then
begin
Spec.GetPages(auuid);
try
OleCreatePropertyFrame(Handle, 30, 30, nil, 1, @XObj, auuid.cElems, auuid.pElems, 0, 0, nil);
CoTaskMemFree(auuid.pElems);
finally
Spec:= nil;
end;
end;
finally
XObj:= nil;
end;
end;

end.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐