delphi 调试时总出现cpu窗口,ntdll.dll点的解决方法
在主界面的implementation {$R *.dfm} 下放入以下代码:
procedure PatchInt3;
var
NOP: Byte;
NTDLL: THandle;
BytesWritten: DWORD;
Address: Pointer;
begin
if Win32Platform <> VER_PLATFORM_WIN32_NT then
Exit;
NTDLL := GetModuleHandle('NTDLL.DLL');
if NTDLL = 0 then
Exit;
Address := GetProcAddress(NTDLL, 'DbgBreakPoint');
if Address = nil then
Exit;
try
if Char(Address^) <> #$CC then
Exit;
NOP := $90;
if WriteProcessMemory(GetCurrentProcess, Address, @NOP, 1, BytesWritten) and (BytesWritten = 1) then FlushInstructionCache(GetCurrentProcess, Address, 1);
except // Do not panic if you see an EAccessViolation here, it is perfectly harmless!
on EAccessViolation do ;
else
raise;
end;
end;
然后在窗体的Create中调用 PatchInt3 ;或者在窗体代码的最后一个end.前加入一下代码即可以解决
//-------------------------------------------------------------- i
nitialization
begin
PatchInt3; //防止关闭窗口时出现CPU: ntdll.DbgBreakPoint
end;
相关文档:
一、一个叫声接口和几只鸭子
1、从一个叫声接口开始
{《HeadFirst设计模式》Delphi代码之模式小结 }
{ 一个叫声接口 }
{ 编译工具:Delphi2010 for win32 }
{ E-Mail :xshlife@163.com }
unit uQuackable;
interface
type
IQuackable = in ......
1. 产品类
{《HeadFirst设计模式》工厂模式之简单工厂 }
{ 产品类 }
{ 编译工具 :Delphi7.0 }
{ 联系方式 :xshlife@163.com }
unit uProducts;
interface
type
TPizza = class(TObject)
public
procedure Prepare; virt ......
什么是多态,字面意思就是“多种形态”,用对象来讲就是子类继承基类,而不同的子类又分别对基类进行功能的扩展。
多态在Object Pascal中是通过虚方法实现的(Virtual Method),在Object Pascal中基类的虚方法是可以被派生类覆盖(Override)的 ......
1. 命令的接收者
{《HeadFirst设计模式》之命令模式 }
{ 本单元中的类为命令的接收者 }
{ 编译工具 :Delphi7.0 }
{ 联系方式 :xshlife@163.com }
unit uReceiveObject;
interface
type
TLight = class(TObject)
private
FLocation: String;
public
constru ......
没有应用状态模式的代码
1. 工程文件
program Project1;
{$APPTYPE CONSOLE}
uses
uGumballMachine in 'uGumballMachine.pas';
var
aGumballMachine: TGumballMachine;
begin
aGumballMachine := TGumballMachine.Create(5);
aGumballMachine.InsertQuarter;
aGumballMachine.TurnCrank;
Writeln; ......