首页
社区
课程
招聘
[求助]谁有编写包含窗体及其过程的DLL的例子或教程
2006-2-15 15:10 5191

[求助]谁有编写包含窗体及其过程的DLL的例子或教程

2006-2-15 15:10
5191
弟现在正学习如何编写DLL文件,不包含窗体的DLL有很多教程及资料,但包含窗体的好象就难了,也没有例子参考,哪位大侠给点指点或提供点材料?

弟先谢了!

[培训]《安卓高级研修班(网课)》月薪三万计划,掌 握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
点赞0
打赏
分享
最新回复 (10)
雪    币: 313
活跃值: (440)
能力值: ( LV12,RANK:530 )
在线值:
发帖
回帖
粉丝
4nil 13 2006-2-15 22:00
2
0
一个解决方法我想可以象EXE一样动态创建.呵呵,就是麻烦了点
我刚开始学的SDK编程,也不一定正确.
雪    币:
能力值: (RANK: )
在线值:
发帖
回帖
粉丝
游客 2006-2-16 08:19
3
0
谢谢楼上指点!
雪    币:
能力值: (RANK: )
在线值:
发帖
回帖
粉丝
游客 2006-2-16 08:19
4
0
有没有人有典型的教程什么的?兄弟太想学习一下了。
雪    币: 242
活跃值: (163)
能力值: ( LV9,RANK:250 )
在线值:
发帖
回帖
粉丝
林海雪原 6 2006-2-16 09:12
5
0
把exe做成dll不就行了?
雪    币:
能力值: (RANK: )
在线值:
发帖
回帖
粉丝
游客 2006-2-16 15:02
6
0
哪楼上的请告诉我如何将EXE文件转化为DLL呢?又如何在其他的EXE文件中使用其中的资源?
雪    币: 291
活跃值: (208)
能力值: ( LV12,RANK:210 )
在线值:
发帖
回帖
粉丝
thebutterfly 5 2006-2-16 16:25
7
0
Exe和Dll文件本来都是一样的PE文件, 只不过文件头中的属性位不同决定了它们的用途不同. 至于在Dll中创建窗口问题, 实际上和Exe文件没有太大的区别, 可以把exe文件的源代码原样拷贝并稍做修改后插入Dll的代码里. 或者是在Dll中创建一个线程建立一个窗口
雪    币:
能力值: (RANK: )
在线值:
发帖
回帖
粉丝
游客 2006-2-16 17:44
8
0
楼上的大侠能不能给个例子?
雪    币: 212
活跃值: (40)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
starluck 1 2006-2-16 19:02
9
0
有窗体与没窗体差不多的编写方法啊!
调用方式也差不多
雪    币: 238
活跃值: (326)
能力值: ( LV12,RANK:450 )
在线值:
发帖
回帖
粉丝
gzgzlxg 11 2006-2-17 01:11
10
0
下面给出实例:(部分)
library stock;

uses
  IstodbDM in 'IstodbDM.pas' {IstoDM: TDataModule},
  istoch in 'istoch.pas' {istoch_Form},
  ......
  ......
  IstochDM in 'IstochDM.pas' {DataModule1: TDataModule};

{$R *.RES}

exports
  showistochform,    //In istoch.pas    库存修改
  ......
  ......
  showistopdform;    //In istopd.pas    库存货品盘点
begin
end.

unit istoch;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  DBCtrls, StdCtrls, Buttons, ExtCtrls, Grids, DBGrids, UserDlg, Db,
  ComCtrls;

type
  Tistoch_Form = class(TForm)
    InstoreIdGrid: TDBGrid;
    Panel1: TPanel;
    Panel2: TPanel;
    findBtn: TBitBtn;
    amendAllBtn: TBitBtn;
    delBtn: TBitBtn;
    exitBtn: TBitBtn;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    ModalText: TDBText;
    ClassifycodeText: TDBText;
    stocknameText: TDBText;
    EngineText: TDBText;
    TradePriceText: TDBText;
    CannibalizeText: TDBText;
    ManufacturerText: TDBText;
    ProducingAreaText: TDBText;
    PriceLimitText: TDBText;
    DiscountLimitText: TDBText;
    InstorehouseDlg: TUserDlg;
    amendAttrNumBtn: TBitBtn;
    amendPrice: TBitBtn;
    amendLocation: TBitBtn;
    amendbatchBtn: TBitBtn;
    Label11: TLabel;
    PositionCodeText: TDBText;
    StatusBar1: TStatusBar;
    procedure exitBtnClick(Sender: TObject);
    procedure amendAllBtnClick(Sender: TObject);
    procedure delBtnClick(Sender: TObject);
    procedure findBtnClick(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure amendAttrNumBtnClick(Sender: TObject);
    procedure amendPriceClick(Sender: TObject);
    procedure amendLocationClick(Sender: TObject);
    procedure amendbatchBtnClick(Sender: TObject);
    procedure InstoreIdGridDblClick(Sender: TObject);
    procedure ShowHint(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  istoch_Form: Tistoch_Form;

procedure showistochform(apphand: Thandle; dbpath, dbpassword: string); stdcall;

implementation

uses Istoquerypart, IstodbDM, istochalledit, Istochsumall,
  Istochpriceall, Istochpositionall, istochbat, IstochbF6E;
{$R *.DFM}

procedure showistochform(apphand: Thandle; dbpath, dbpassword: string); stdcall; export;
var
  oldhandle: Thandle;
begin
  dbpathname := dbpath;
  dbpasswd := dbpassword;
  oldhandle := application.Handle;
  {保存动态链接库应用句柄}
  application.Handle := apphand;
  {动态链接库句柄置成主应用程序句柄}
  istoch_Form := Tistoch_Form.Create(application);
  with istoch_Form do
  begin
    try
      showmodal;
    finally
      application.Handle := oldhandle;
        {恢复动态链接库句柄}
      free;
    end;
  end;
end;

procedure Tistoch_Form.FormCreate(Sender: TObject);
begin
  Application.OnHint := ShowHint;
  IstoDM := TIstoDM.Create(Self);
  with IstoDM do
  begin
    TempinstorehouseQuery.Active := True;
    PartPropInstorehouseQueryTable.Active := True;
  end;
end;

procedure Tistoch_Form.exitBtnClick(Sender: TObject);
begin
  CLOSE;
end;

procedure Tistoch_Form.amendAllBtnClick(Sender: TObject);
begin
  screen.cursor := crHourGlass;
  istochalledit_form := Tistochalledit_form.Create(application);
  with istochalledit_form do
  begin
    showmodal;
    free;
  end;
  screen.Cursor := crDefault;
  InstoreIdGrid.SetFocus;
end;

procedure Tistoch_Form.amendAttrNumBtnClick(Sender: TObject);
begin
  screen.cursor := crHourGlass;
  istochsumall_Form := Tistochsumall_Form.Create(Application);
  with istochsumall_Form do
  begin
    showmodal;
    free;
  end;
  screen.Cursor := crDefault;
  InstoreIdGrid.SetFocus;
end;

procedure Tistoch_Form.amendPriceClick(Sender: TObject);
begin
  screen.cursor := crHourGlass;
  Istochpriceall_Form := TIstochpriceall_Form.Create(Application);
  with Istochpriceall_Form do
  begin
    showmodal;
    free;
  end;
  screen.Cursor := crDefault;
  InstoreIdGrid.SetFocus;
end;

procedure Tistoch_Form.amendLocationClick(Sender: TObject);
begin
  screen.cursor := crHourGlass;
  Istochpositionall_Form := TIstochpositionall_Form.Create(Application);
  with Istochpositionall_Form do
  begin
    showmodal;
    free;
  end;
  screen.Cursor := crDefault;
  InstoreIdGrid.SetFocus;
end;

procedure Tistoch_Form.amendbatchBtnClick(Sender: TObject);
begin
  hide;
  screen.cursor := crHourGlass;
  Istochbat_Form := TIstochbat_Form.Create(Application);
  with Istochbat_Form do
  begin
    showmodal;
    free;
  end;
  Application.OnHint := ShowHint;
  screen.Cursor := crDefault;
  show;
end;

procedure Tistoch_Form.delBtnClick(Sender: TObject);
begin
  with InstorehouseDlg do
  begin
    title := '警告';
    message.Clear;
    message.Add('您要删除当前记录,是否继续?');
    buttons.Clear;
    buttons.Add('确定');
    buttons.Add('放弃');
    icon := icWarning;
    if show = 0 then
    begin
      istoDM.InstorehouseQuery.edit;
      istoDM.InstorehouseQuery.delete;
    end;
  end;
end;

procedure Tistoch_Form.findBtnClick(Sender: TObject);
var
  i: integer;
  elementstr: string;
  elementname: string;
  attribstr: string;
  descript: string;
  elements: Tstrings;
begin
  screen.Cursor := crHourGlass;
  elements := Tstringlist.Create;
  with IstoDM do
  begin
    for i := 0 to TempinstorehouseQuery.FieldCount - 26 do
    begin
      elementname := TempinstorehouseQuery.Fields[i].FieldName;
      attribstr := getattrib(TempinstorehouseQuery.Fields[i].DataType);
      descript := TempinstorehouseQuery.Fields[i].DisplayLabel;
      elementstr := elementname + ':' + attribstr + ':' + descript;
      elements.Add(elementstr);
    end;
    with TIstoqueryDlg.Create(self, elements) do
    begin
      if showmodal = mrOk then
      begin
        InstoreIdGrid.SetFocus;
      end;
      free;
    end;
  end;
  show;
  elements.Free;
  screen.Cursor := crDefault;
end;

procedure Tistoch_Form.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  case key of
    VK_RETURN: amendAllBtnClick(amendAllBtn);
    VK_DELETE: DelBtnclick(DelBtn);
    VK_ESCAPE: ExitBtnClick(ExitBtn);
  end;
end;

procedure Tistoch_Form.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  IstoDM.free;
  IstoDM := nil;
  Application.OnHint := nil;
  Action := caFree;
  istoch_Form := nil;
end;

procedure Tistoch_Form.InstoreIdGridDblClick(Sender: TObject);
begin
  amendAllBtnClick(amendAllBtn);
end;

procedure Tistoch_Form.ShowHint(Sender: TObject);
begin
  StatusBar1.Panels[0].Text := Application.Hint;
end;

end.

其他的类似
雪    币:
能力值: (RANK: )
在线值:
发帖
回帖
粉丝
游客 2006-2-20 17:19
11
0
感激楼上给出的DELPHI的例子,太棒了,回去一定仔细研究!

再次感谢!!

坛子里的朋友真不错,这么热心!

谁要是有个MASM32的例子就更好了!
游客
登录 | 注册 方可回帖
返回