📄 getprocessheapu.pas
字号:
unit GetProcessHeapu;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, HeapConst, Grids;
type
TForm1 = class(TForm)
Button1: TButton;
StringGrid1: TStringGrid;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
type
BufferType = array[0..63] of byte; // defines the buffer type
var
Buffer: ^BufferType; // the buffer variable
iLoop: Integer; // general loop control variable
begin
{allocate memory from the heap of the calling process}
Buffer := HeapAlloc(GetProcessHeap, HEAP_ZERO_MEMORY, sizeof(BufferType));
{display the default values from the new buffer (should be all zeros)}
for iLoop := 0 to 63 do
StringGrid1.Cells[iLoop, 0] := IntToStr(Buffer^[iLoop]);
{return the memory}
HeapFree(GetProcessHeap, 0, Buffer);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -