现想把以前写的一个东西,打成DLL,初学,所以向高手讨些经验,这段程序,是MDI形式的,请高手指教不胜感激~~~~~~~~

解决方案 »

  1.   

    可以把一个子窗口做一个COM,编译时用运行期包方式,这样做出来的程序小点
      

  2.   

    去盒子下载Delphi5开发人员指南,里面有一章对于DLL很详细的解说的
    www.delphibox.com
      

  3.   

    去盒子下载Delphi5开发人员指南,里面有一章对于DLL很详细的解说的
    www.delphibox.com
      

  4.   

    新建个DLL,然后把原来的项目添加过去,做个函数接口把窗口句柄传递给MDI窗口
      

  5.   

    << g961681
    主要基于代码的重用程度
    所以,考虑,,想试试dll
      

  6.   

    新建个DLL,然后把原来的项目添加过去,做个函数接口把窗口句柄传递给MDI窗口
    同意我以前过过一个例子
    unit Adjgczj;interfaceuses
      ComObj, ActiveX, Adjustgczj_TLB, StdVcl,Gczjtz;type
      TAdjGczj = class(TAutoObject, IAdjGczj)
      protected
        function ExchageParam(const Param1, Param2, Param3, Param4, Param5, Param6,
          Param7, Param8, Param9, Param10: WideString): WideString; safecall;
        { Protected declarations }
      end;implementationuses ComServ;function TAdjGczj.ExchageParam(const Param1, Param2, Param3, Param4,
      Param5, Param6, Param7, Param8, Param9, Param10: WideString): WideString;
    begin
      Result := ReadOldBj(Param1, Param2, Param3, Param4,  Param5, Param6, Param7,
                Param8, Param9, Param10);
    end;initialization
      TAutoObjectFactory.Create(ComServer, TAdjGczj, Class_AdjGczj,
        ciMultiInstance, tmApartment);
    end.//要转换的
    unit GczjTz;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      ComCtrls, StdCtrls, ExtCtrls, Buttons, Mask, DBCtrlsEh;type
      TGctzFrm = class(TForm)
        PageControl1: TPageControl;
        BitBtn1: TBitBtn;
        BitBtn2: TBitBtn;
        BitBtn3: TBitBtn;
        GroupBox1: TGroupBox;
        Label1: TLabel;
        Label2: TLabel;
        Label3: TLabel;
        Label4: TLabel;
        Label6: TLabel;
        Label7: TLabel;
        Label8: TLabel;
        Label9: TLabel;
        Label10: TLabel;
        Label11: TLabel;
        Label12: TLabel;
        Label13: TLabel;
        Label14: TLabel;
        Shape1: TShape;
        Label17: TLabel;
        Label18: TLabel;
        Label19: TLabel;
        Label20: TLabel;
        Label21: TLabel;
        rgtz: TDBNumberEditEh;
        cltz: TDBNumberEditEh;
        jxtz: TDBNumberEditEh;
        zctz: TDBNumberEditEh;
        sbtz: TDBNumberEditEh;
        rgysbj: TDBNumberEditEh;
        clysbj: TDBNumberEditEh;
        jxysbj: TDBNumberEditEh;
        zcysbj: TDBNumberEditEh;
        sbysbj: TDBNumberEditEh;
        fbysbj: TDBNumberEditEh;
        csysbj: TDBNumberEditEh;
        otherysbj: TDBNumberEditEh;
        lxysbj: TDBNumberEditEh;
        rgqw: TDBNumberEditEh;
        clqw: TDBNumberEditEh;
        jxqw: TDBNumberEditEh;
        zcqw: TDBNumberEditEh;
        sbqw: TDBNumberEditEh;
        SelBjAdj: TRadioGroup;
        ZcNoJoin: TCheckBox;
        procedure BitBtn2Click(Sender: TObject);
        procedure RgtzChange(Sender: TObject);
        procedure cltzChange(Sender: TObject);
        procedure jxtzChange(Sender: TObject);
        procedure BitBtn1Click(Sender: TObject);
        procedure BitBtn3Click(Sender: TObject);
        procedure zctzChange(Sender: TObject);
        procedure sbtzChange(Sender: TObject);
        procedure ZcNoJoinClick(Sender: TObject);
        procedure FormKeyPress(Sender: TObject; var Key: Char);
        //procedure FormClose(Sender: TObject; var Action: TCloseAction);
      private
        { Private declarations }
      public
        ResultItem: string;
        Flag: Boolean;
        { Public declarations }
      end;
    function ReadOldBj(const Param1, Param2, Param3, Param4,
      Param5, Param6, Param7, Param8, Param9, Param10: WideString): WideString;
    var
      GctzFrm: TGctzFrm;implementation{$R *.DFM}function ReadOldBj(const Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10: WideString): WideString;
    var
      GJF: TGctzFrm;
    begin  try
        GJF := TgctzFrm.Create(Application);    GJF.Flag := False;
        GJF.zctz.Visible := false;
        GJF.sbtz.Visible := false;
        GJF.zcqw.Visible := false;
        GJF.sbqw.Visible := false;
        GJF.label19.Visible := false;
        GJF.label21.Visible := false;
      //GJF.HsYsbj.text :=param1;
        GJF.Fbysbj.text := param2;
        GJF.Rgysbj.text := param3;
        GJF.Clysbj.text := param4;
        GJF.Jxysbj.text := param5;
        GJF.Zcysbj.text := param6;
        GJF.Sbysbj.text := param7;
        GJF.Csysbj.text := param8;
        GJF.OtherYsbj.text := param9;
        GJF.Lxysbj.text := param10;    GJF.Showmodal;  finally
        if GJF.Flag then
          Result := GJF.ResultItem
        else
          Result := '*'; //
        GJF.Free;  end;end;procedure TGctzFrm.BitBtn2Click(Sender: TObject);
    begin
      ResultItem := '*';
      Flag := False;
      close;
    end;procedure TGctzFrm.RgtzChange(Sender: TObject);
    var
      a: real;begin
       //strtofloatf
      if rgtz.Text <> '' then begin      a := strtofloat(trim(rgysbj.Text)) * strtofloat(trim(rgtz.text)) * 0.01;
          rgqw.text := format('%15.2f', [a]);
        end
      else begin      rgqw.text := '';
        end;
    end;procedure TGctzFrm.cltzChange(Sender: TObject);
    var
      a: real;begin
      if cltz.text <> '' then begin
          a := strtofloat(trim(clysbj.Text)) * strtofloat(trim(cltz.text)) * 0.01;
          clqw.text := format('%15.2f', [a]);
        end
      else begin
          clqw.text := '';
        end;
    end;procedure TGctzFrm.jxtzChange(Sender: TObject);
    var
      a: real;begin
      if jxtz.text <> '' then begin
          a := strtofloat(trim(jxysbj.Text)) * strtofloat(trim(jxtz.text)) * 0.01;
          jxqw.text := format('%15.2f', [a]);
        end
      else begin
          jxqw.text := '';
        end;
    end;procedure TGctzFrm.BitBtn1Click(Sender: TObject);
    begin
      ResultItem := Trim(rgtz.text) + '#' + Trim(cltz.Text) + '#' + Trim(jxtz.Text) + '#' + Trim(zctz.Text) + '#' + Trim(sbtz.Text);
      Flag := True;
      close;
    end;procedure TGctzFrm.BitBtn3Click(Sender: TObject);
    begin
      if MessageBox(handle, pchar('确定撤销所有调整吗?撤销后将恢复为定额价!'), '确认', MB_ICONQUESTION + MB_OKCANCEL + MB_DEFBUTTON2) = mrok then
        begin
          ResultItem := '?';      Flag := True;
        end
      else begin
          abort;    end;
    end;procedure TGctzFrm.zctzChange(Sender: TObject);
    var
      a: real;begin
      if zctz.text <> '' then begin
          a := strtofloat(trim(zcysbj.Text)) * strtofloat(trim(zctz.text)) * 0.01;
          zcqw.text := format('%15.2f', [a]);
        end
      else begin
          zcqw.Text := '';
        end;
    end;procedure TGctzFrm.sbtzChange(Sender: TObject);
    var
      a: real;begin
      if sbtz.Text <> '' then begin
          a := strtofloat(trim(sbysbj.Text)) * strtofloat(trim(sbtz.text)) * 0.01;
          sbqw.text := format('%15.2f', [a]);
        end
      else begin
          sbqw.text := '';
        end;
    end;procedure TGctzFrm.ZcNoJoinClick(Sender: TObject);
    begin
      if zcnojoin.checked then begin
          zctz.Visible := false;
          sbtz.Visible := false;
          zcqw.Visible := false;
          sbqw.Visible := false;
          label19.Visible := false;
          label21.Visible := false;
        end
      else begin
          zctz.Visible := True;
          sbtz.Visible := True;
          zcqw.Visible := True;
          sbqw.Visible := True;
          label19.Visible := True;
          label21.Visible := True;
        end;end;procedure TGctzFrm.FormKeyPress(Sender: TObject; var Key: Char);
    begin
      if key = #13 then
        postMessage(Self.ActiveControl.Handle, WM_KeyDown, vk_Tab, 0);
    end;end.
    ------------------------------------
    我的blog有点记载 blog.codelphi.com/ken
      

  7.   

    你找找DLL的开发
    然后把你的程序稍微改动复制过去就可以了啊
    ---------------------------------------------
      

  8.   

    dll制作
     http://blog.csdn.net/whbo
      

  9.   

    新建一个DLL,然后再往里添加UNIT,并且开放几个接口就可以实现啦。
      

  10.   

    widesting和string有什么区别啊。
      

  11.   

    "可以把一个子窗口做一个COM,编译时用运行期包方式,这样做出来的程序小点"
    这个听起来有意思,能说说怎么实现么?