I
iamyourneed
Unregistered / Unconfirmed
GUEST, unregistred user!
function fGetBmp(var bmp: TBitmap; Side: char): boolean; stdcall;
begin
try
if Side = 'F' then
begin
bmp := TBitmap.Create;
bmp.Assign(BmpF);
result := true;
end else
begin
bmp := TBitmap.Create;
bmp.Assign(BmpR);
result := true;
end;
except
result := false;
end;
end;
这是我的dll部分
btSM := nil;
btDM := TBitmap.Create;
fGetBmp(btSM, 'F');
L := btSM.Width * 5 div 100;
T := btSM.Height * 2 div 100;
R := btSM.Width * 50 div 100;
B := btSM.Height * 30 div 100;
rcS.Left := L;
rcS.Top := T;
rcS.Right := R;
rcS.Bottom := B;
rcD.Left := 1;
rcD.Top := 1;
rcD.Right := R - L;
rcD.Bottom := B - T;
btDM.Height := rcD.Bottom + 1;
btDM.Width := rcD.Right + 1;
btDM.Canvas.CopyRect(rcD, btSM.Canvas, rcS);
btSM.Free;
rv1 := frmConfirmRepeat.ScrollBox1.Height;
rv2 := ((rv1 * btDM.Width * 100) div btDM.Height) div 100;
if rv2 <= frmConfirmRepeat.ScrollBox1.Width then
begin
frmConfirmRepeat.Image1.Width := rv2;
frmConfirmRepeat.Image1.Height := rv1;
end else
begin
rv2 := frmConfirmRepeat.ScrollBox1.Width;
rv1 := ((rv2 * btDM.Height * 100) div btDM.Width) div 100;
if rv1 <= frmConfirmRepeat.ScrollBox1.Height then
begin
frmConfirmRepeat.Image1.Width := rv2;
frmConfirmRepeat.Image1.Height := rv1;
end;
end;
frmConfirmRepeat.lbH.Caption := Inttostr(rv1);
frmConfirmRepeat.lbw.Caption := Inttostr(rv2);
frmConfirmRepeat.Image1.Picture.Bitmap.Assign(btDM);
btDM.Free;
frmConfirmRepeat.ShowModal;
result := false;
这是调用部分,但是每运行到frmConfirmRepeat.ShowModal;
就报错了,报错如下:
Access violation at adress 7C938FEA in module 'ntdll.dll'.
怀疑是溢出了。不知道是那的问题。
begin
try
if Side = 'F' then
begin
bmp := TBitmap.Create;
bmp.Assign(BmpF);
result := true;
end else
begin
bmp := TBitmap.Create;
bmp.Assign(BmpR);
result := true;
end;
except
result := false;
end;
end;
这是我的dll部分
btSM := nil;
btDM := TBitmap.Create;
fGetBmp(btSM, 'F');
L := btSM.Width * 5 div 100;
T := btSM.Height * 2 div 100;
R := btSM.Width * 50 div 100;
B := btSM.Height * 30 div 100;
rcS.Left := L;
rcS.Top := T;
rcS.Right := R;
rcS.Bottom := B;
rcD.Left := 1;
rcD.Top := 1;
rcD.Right := R - L;
rcD.Bottom := B - T;
btDM.Height := rcD.Bottom + 1;
btDM.Width := rcD.Right + 1;
btDM.Canvas.CopyRect(rcD, btSM.Canvas, rcS);
btSM.Free;
rv1 := frmConfirmRepeat.ScrollBox1.Height;
rv2 := ((rv1 * btDM.Width * 100) div btDM.Height) div 100;
if rv2 <= frmConfirmRepeat.ScrollBox1.Width then
begin
frmConfirmRepeat.Image1.Width := rv2;
frmConfirmRepeat.Image1.Height := rv1;
end else
begin
rv2 := frmConfirmRepeat.ScrollBox1.Width;
rv1 := ((rv2 * btDM.Height * 100) div btDM.Width) div 100;
if rv1 <= frmConfirmRepeat.ScrollBox1.Height then
begin
frmConfirmRepeat.Image1.Width := rv2;
frmConfirmRepeat.Image1.Height := rv1;
end;
end;
frmConfirmRepeat.lbH.Caption := Inttostr(rv1);
frmConfirmRepeat.lbw.Caption := Inttostr(rv2);
frmConfirmRepeat.Image1.Picture.Bitmap.Assign(btDM);
btDM.Free;
frmConfirmRepeat.ShowModal;
result := false;
这是调用部分,但是每运行到frmConfirmRepeat.ShowModal;
就报错了,报错如下:
Access violation at adress 7C938FEA in module 'ntdll.dll'.
怀疑是溢出了。不知道是那的问题。