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

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

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

弟先谢了!

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
点赞
支持
分享
最新回复 (10)
雪    币: 313
活跃值: (440)
能力值: ( LV12,RANK:530 )
在线值:
发帖
回帖
粉丝
2
一个解决方法我想可以象EXE一样动态创建.呵呵,就是麻烦了点
我刚开始学的SDK编程,也不一定正确.
2006-2-15 22:00
0
雪    币:
能力值: (RANK: )
在线值:
发帖
回帖
粉丝
3
谢谢楼上指点!
2006-2-16 08:19
0
雪    币:
能力值: (RANK: )
在线值:
发帖
回帖
粉丝
4
有没有人有典型的教程什么的?兄弟太想学习一下了。
2006-2-16 08:19
0
雪    币: 242
活跃值: (163)
能力值: ( LV9,RANK:250 )
在线值:
发帖
回帖
粉丝
5
把exe做成dll不就行了?
2006-2-16 09:12
0
雪    币:
能力值: (RANK: )
在线值:
发帖
回帖
粉丝
6
哪楼上的请告诉我如何将EXE文件转化为DLL呢?又如何在其他的EXE文件中使用其中的资源?
2006-2-16 15:02
0
雪    币: 291
活跃值: (218)
能力值: ( LV12,RANK:210 )
在线值:
发帖
回帖
粉丝
7
Exe和Dll文件本来都是一样的PE文件, 只不过文件头中的属性位不同决定了它们的用途不同. 至于在Dll中创建窗口问题, 实际上和Exe文件没有太大的区别, 可以把exe文件的源代码原样拷贝并稍做修改后插入Dll的代码里. 或者是在Dll中创建一个线程建立一个窗口
2006-2-16 16:25
0
雪    币:
能力值: (RANK: )
在线值:
发帖
回帖
粉丝
8
楼上的大侠能不能给个例子?
2006-2-16 17:44
0
雪    币: 212
活跃值: (40)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
9
有窗体与没窗体差不多的编写方法啊!
调用方式也差不多
2006-2-16 19:02
0
雪    币: 238
活跃值: (326)
能力值: ( LV12,RANK:450 )
在线值:
发帖
回帖
粉丝
10
下面给出实例:(部分)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
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.

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

再次感谢!!

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

谁要是有个MASM32的例子就更好了!
2006-2-20 17:19
0
游客
登录 | 注册 方可回帖
返回

账号登录
验证码登录

忘记密码?
没有账号?立即免费注册