DLL 使用上的問題 |
缺席
|
yuhboy
一般會員 發表:12 回覆:27 積分:12 註冊:2004-11-01 發送簡訊給我 |
|
syntax
尊榮會員 發表:26 回覆:1139 積分:1258 註冊:2002-04-23 發送簡訊給我 |
你到底想做什麼?
1. 傳字串回呼叫端? 2. 「在 dll 中的動作,程式a還能使用」,使用什麼? 多打一點字說清楚一點吧! 最好先爬文 ===================引 用 yuhboy 文 章=================== 大略說明一下 我的程式去呼叫 dll 中的一個函數 applogin() 而這個Dll 中是含有 Form 我希望 dll 中 form 上的 button onClick 後 可以將一個字串回傳到呼叫 dll 的那個程式上 明白一點的說法是,我希望 當程式a 去呼叫 dll 後 在 dll 中的動作,程式a還能使用 共用的意思 |
christie
資深會員 發表:30 回覆:299 積分:475 註冊:2005-03-25 發送簡訊給我 |
參考參考
http://www.swissdelphicenter.ch/torry/showcode.php?id=685 ===================引 用 yuhboy 文 章=================== 我的程式去呼叫 dll 中的一個函數 applogin() 而這個Dll 中是含有 Form 當程式a 去呼叫 dll 後 可以將一個字串回傳到呼叫 dll 的那個程式上
------
What do we live for if not to make life less difficult for each other? |
yuhboy
一般會員 發表:12 回覆:27 積分:12 註冊:2004-11-01 發送簡訊給我 |
|
christie
資深會員 發表:30 回覆:299 積分:475 註冊:2005-03-25 發送簡訊給我 |
Example Code:
// Call DLL Program (Normal Application Project) // This example calls a Form within a DLL. unit uMain; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons; type CString = string[100]; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation function DisplaySampleReport: CString; stdcall; external 'DLL_FRM.DLL'; {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); begin caption:=DisplaySampleReport // <- 回傳值 end; end. //////////////////////////////////////////////// // DLL Project library DLL_FRM; uses SysUtils, Classes, uReport in 'uReport.pas' {Form1}; // <-- 一 般 的 Form type CString = string[100]; function DisplaySampleReport: cstring; var rc:string; begin Form1 := TForm1.Create(nil); rc:=''; try form1.p_v:='gogogo'; form1.showmodal; rc:=form1.p_v; // 回傳值 finally Form1.Free; end; result:=rc end; exports DisplaySampleReport; end. ////////////////////////////////////////////////一 般 的 Form unit uReport; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, Grids, DBGrids, DBTables, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Database1: TDatabase; Query1: TQuery; DBGrid1: TDBGrid; DataSource1: TDataSource; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } p_v:string; end; var Form1: TForm1; .....
------
What do we live for if not to make life less difficult for each other?
編輯記錄
christie 重新編輯於 2007-12-14 16:11:21, 註解 無‧
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |