function CreateThread( lpThreadAttributes: Pointer; dwStackSize: DWORD; {堆棧大小} lpStartAddress: TFNThreadStartRoutine; lpParameter: Pointer; dwCreationFlags: DWORD; var lpThreadId: DWORD): THandle; stdcall;CreateThread
本例:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, StdCtrls;type TForm1 = class(TForm) TreeView1: TTreeView; procedure FormCreate(Sender: TObject); procedure TreeView1
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; procedure Button1Click(Sender:
//rc 檔案:StringTablebegin0 "AAAA"1 "BBBB"2 "CCCC"3 "DDDD"end//也可以這樣寫:StringTablebegin0,"AAAA"1,"BBBB"2,"CCCC"3,"DDDD"end//還可以這樣寫:StringTable{0,"AAAA"1,"BBBB"2,"CCCC"3,"DDDD"}{嚴格的頭可能是這樣寫: STRINGTABLE DISCARDABLE}//程式碼:unit Unit1;interfaceuses Windows,
function CreateThread( lpThreadAttributes: Pointer; {安全設定} dwStackSize: DWORD; lpStartAddress: TFNThreadStartRoutine; lpParameter: Pointer; dwCreationFlags: DWORD; var lpThreadId: DWORD): THandle; stdcall;CreateThread 的第一個參數
function CreateThread( lpThreadAttributes: Pointer; dwStackSize: DWORD; lpStartAddress: TFNThreadStartRoutine; lpParameter: Pointer; {入口函數的參數} dwCreationFlags: DWORD; var lpThreadId: DWORD): THandle; stdcall;線程入口函數的參數是個無類型指標(Pointer),
本例:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, StdCtrls;type TForm1 = class(TForm) TreeView1: TTreeView; Button1: TButton; Button2: TButton; Button3: TButton;
//rc 檔案:sound1 WAVE "SoundFile1.wav"sound2 WAVE "SoundFile2.wav"//代碼:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2:
procedure TForm1.Button1Click(Sender: TObject);var str: string; wh: TSize; w,h: Integer;begin {前面用過 Canvas.TextWidth、Canvas.TextHeight} str := '萬'; w := Canvas.TextWidth(str); h := Canvas.TextHeight(str); ShowMessage(Format('寬度: %d; 高度: %d',
本例:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, StdCtrls;type TForm1 = class(TForm) TreeView1: TTreeView; CheckBox1: TCheckBox; CheckBox2: TCheckBox; CheckBox3:
function CreateThread( lpThreadAttributes: Pointer; dwStackSize: DWORD; lpStartAddress: TFNThreadStartRoutine; {入口函數的指標} lpParameter: Pointer; dwCreationFlags: DWORD; var lpThreadId: DWORD): THandle; stdcall;到了入口函數了, 學到這個地方, 我查了一個入口函數的標準定義,
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); end;var Form1:
//下面是 Windows 支援的資源格式:RT_CURSOR = MakeIntResource(1);RT_BITMAP = MakeIntResource(2);RT_ICON = MakeIntResource(3);RT_MENU = MakeIntResource(4);RT_DIALOG = MakeIntResource(5);RT_STRING =
先看一段程式, 代碼檔案:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) ListBox1: TListBox; Button1: TButton; procedure FormCreate(Sender: TObject);
//幾乎每一個提取資源的例子都用到了 HInstance, 做個對比測試:var h,a,f: Cardinal;begin h := HInstance; a := Application.Handle; f := Self.Handle; ShowMessage(IntToStr(h)); {4194304} ShowMessage(IntToStr(a)); {13107942} ShowMessage(IntToStr(f)); {4260652}end;通過測試看出:
本例:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ImgList, ComCtrls;type TForm1 = class(TForm) TreeView1: TTreeView; ImageList1: TImageList; procedure FormCreate(Sender:
本例:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure
一下子跳到等待函數 WaitForSingleObject, 是因為下面的 Mutex、Semaphore、Event、WaitableTimer 等同步手段都要使用這個函數; 不過等待函數可不止 WaitForSingleObject 它一個, 但它最簡單.function WaitForSingleObject( hHandle: THandle; {要等待的物件控點} dwMilliseconds: DWORD {等待的時間, 單位是毫秒}): DWORD;
問題來源: http://www.cnblogs.com/del/archive/2009/01/30/1381263.html#1439476這個例子是把一張圖片平均分成了 4 份, 順序是: 左、右、上、下; 沒使用迴圈操作, 顯得有點笨, 但容易理解.unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,
本例將把一張 bmp 圖片, 以資源檔的方式嵌入 dll, 然後再調用.第一步: 建一個 DLL 工程, :然後儲存, 我這裡使用的名稱都是預設的.第二步: 建一個資源原檔案, :編輯內容如下(路徑中的檔案一定要存在):img1 BITMAP "c:\temp\test.bmp"然後, 取個名(尾碼須是 rc, 我這裡取名為 Res.rc), 儲存在工程目錄下.第三步: 在 DLL 工程中添加這個資源原檔案, :此時, 工程源檔案中會添加一句: {$R 'Res.res' 'Res.rc'},