본문 바로가기

컴터/delphi

동적 dll 링크 implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var ////동적 dll 만들기.. iDllHandle : Integer; DllFunc : Function (a, b : Integer): Integer; //해당 함수 레퍼런스 가지고 있게. begin iDllHandle := LoadLibrary('dll1.dll'); //dll 파일 호출 if iDllHandle >= 32 then begin ////32미만은 에러다.메모리에 올리기. @DllFunc := GetProcAddress(iDllHandle, 'Sum');//@는포인터로 바꿈 if @DllFunc Nil then ShowMessage(IntToStr(Dl.. 더보기
dll 만들기 기초 dll1.dll 파일 ------------------------------------------------------------------------ library dll1; { Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings pa.. 더보기
TQuery의 묵시적 transaction 을 줄이기 위해.(cachedUpdate : false => true 로 전환) unit test5; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, DBTables, StdCtrls, Grids, DBGrids, ExtCtrls, DBCtrls; type TForm1 = class(TForm) Query1: TQuery; DataSource1: TDataSource; DBGrid1: TDBGrid; Edit1: TEdit; Button1: TButton; DBNavigator1: TDBNavigator; Button2: TButton; Button3: TButton; procedure Button1Click(Sender: TObject); proc.. 더보기
BDE > Query(DBTables) 사용시 Query1.Close; Query1.SQL.Text:= 'Select * from @TableName where Category like :category'; //category 변수로 함. Query1.SQL.Text:= StringReplace(Query1.SQL.Text, '@TableName', 'biolife', [rfReplaceAll, rfIgnoreCase]);///디비이름을 수시로 바꾸고 싶을때 :TableName의 변수는 쓰질 못한다. Query1.ParamByName('Category').AsString:=Edit1.Text + '%'; //파라미터 전송. Query1.Open; 더보기
북마크 type private pBookMark : Pointer; /////pointer 변수 선언 procedure TForm1.Button2Click(Sender: TObject); begin pBookMark:=Table1.GetBookmark; //pointer end; ////북마크하기 procedure TForm1.Button3Click(Sender: TObject); begin Table1.GoToBookMark(pBookMark); end; //북마크 한데로 찾아가기 더보기
DB 검색하기.. unit test2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, DB, DBTables, StdCtrls; type TForm1 = class(TForm) Query1: TQuery; DataSource1: TDataSource; DBGrid1: TDBGrid; DBNavigator1: TDBNavigator; Edit1: TEdit; Button1: TButton; Edit2: TEdit; procedure Button1Click(Sender: TObject); procedure Edit1KeyPress(Se.. 더보기
예제]엑셀로 DB 떨어뜨리기 unit mainForm2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Grids, DBGrids, DB, DBTables, ExtCtrls, DBCtrls; type TForm1 = class(TForm) Table1: TTable; DataSource1: TDataSource; DBGrid1: TDBGrid; Button1: TButton; Button2: TButton; DBNavigator1: TDBNavigator; Button3: TButton; Button4: TButton; procedure Button1Click(Sender: TObjec.. 더보기