⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fmmain.pas

📁 多数代码可以直接在Delphi6和Delphi7环境下运行。部分涉及.NET技术内容的代码
💻 PAS
字号:
unit fmMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ActiveX, ComObj;

type
  TForm1 = class(TForm)
    Button1: TButton;
    ListBox1: TListBox;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure AppMsg(const sMsg : String);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

const
  Class_MyCOM: TGUID = '{2D80D5A3-01FC-4E30-B7DB-74F7301CE7C9}';

procedure TForm1.AppMsg(const sMsg: String);
begin
  ListBox1.Items.Add(sMsg);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  aIntf : IUnknown;
  iCount : Integer;
begin
  CoInitialize(nil);
  try
    OleCheck(CoCreateInstance(Class_MyCOM, nil, CLSCTX_INPROC_SERVER or
    CLSCTX_LOCAL_SERVER, IUnknown, aIntf));
    iCount := aIntf._AddRef;
    AppMsg(IntToStr(iCount));
    aIntf._Release;
  finally
    aIntf._Release;
    CoUninitialize;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -