这是我以前的一段代码。
1 procedure TForm1.Button1Click(Sender: TObject);
2 var
3 OCXHand: THandle;
4 RegFunc: TDLLRegisterServer;{uses ActiveX or OleCtl}
5 begin
6 if OpenDialog1.Execute then
7 begin
8 try
9 OCXHand := LoadLibrary(PChar(OpenDialog1.FileName));
10 RegFunc := GetProcAddress(OCXHand, \'DllRegisterServer\');
11 if RegFunc <> 0 then
12 ShowMessage(\'Error!\');
13 finally
14 FreeLibrary(OCXHand);
15 end;
16 end;
17 end;