⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unitmain.pas

📁 在delphi中实现windows核心编程.原书光盘代码核心编程.原书光盘代码
💻 PAS
字号:
unit UnitMain;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  function WJSReadDisk32(drv:byte;SecCount,SecStart:byte;Cylinder:word;Head:byte;buffer:pchar):boolean;stdcall;external 'Read32.dll';
  function WJSWriteDisk32(drv:byte;SecCount,SecStart:byte;Cylinder:word;Head:byte;buffer:pchar):boolean;stdcall;external 'Read32.dll';
  
var
  Form1: TForm1;
  
implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
   s:string;
   i:integer;
   buf:array[0..512-1]of char;
begin
   if not WJSReadDisk32($80,1,1,0,0,buf) then
      raise exception.create('Read错误');
   s:='';
   for i:=0 to 512-1 do
   begin
      s:=s+format('%.2x ',[integer(buf[i])]);
      if i mod 16=15 then s:=s+#13;
   end;
   showmessage(s);
   if not WJSWriteDisk32($80,1,1,0,0,buf) then
      raise exception.create('Write错误');   
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -