原创  使用Delphi,显示ActiveX控件的属性页方法 收藏

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.

发表于 @ 2007年05月31日 11:41:00 | 评论( loading... ) | 编辑| 举报| 收藏

旧一篇:在linux中,让程序进入后台运行的命令—>daemon程序 | 新一篇:问题:Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath.Perhaps JAVA_HOME does not point to the JDK

  • 发表评论
  • 评论内容:
  •  
Copyright © llh0223
Powered by CSDN Blog