L
ldg
Unregistered / Unconfirmed
GUEST, unregistred user!
本人由于Delphi刚入门,现想将下面这段程序转换成VC5程序,
敬请帮忙,或告之Delphi变量与VC5变量的对应关系?
function bbb(xyz:string):integer;stdcall
var
InFile: TMemoryStream;
BMPFile: TMemoryStream;
AWord: word;
AByte: Byte;
i: Longint;
Max: word;
Min: word;
ALong: Longint;
begin
InFile:= TMemoryStream.Create;
BMPFile:= TMemoryStream.Create;
InFile.LoadFromFile('C:/Temp1.BMP');
InFIle.Seek(0, 0);
for Max:= 1 to 539do
begin
InFIle.Read(AWord, 2);
BMPFile.Write(Aword, 2);
end;
BMPFile.Seek(54, 0);
for i:= 0 to 255do
begin
AByte:= i;
BMPFile.Write(AByte, 1);
BMPFile.Write(AByte, 1);
BMPFile.Write(AByte, 1);
Abyte:=0;
BMPFile.Write(AByte, 1);
end;
InFIle.Clear;
InFile.LoadFromFile(xyz);
InFile.Seek(1080, 0);
Max:= 0;
Min:= $FFFF;
for i:= 1 to 320*240do
begin
InFile.Read(AWord, 2);
AWord:= Swap(Aword);
if AWord>Max then
Max:= AWord;
if AWord<Min then
Min:= AWord;
end;
InFile.Seek(1080, 0);
for i:= 1 to 320*240do
begin
InFile.Read(AWord, 2);
AWord:= Swap(Aword);
AByte:= round((AWord-Min)/(Max-Min)*255);
BMPFile.Write(AByte, 1);
end;
ALong:= 320*240+1078;
BMPFile.Seek(2, 0);
BMPFile.Write(ALong, 4);
ALong:= 320;
BMPFile.Seek(18, 0);
BMPFile.Write(ALong, 4);
ALong:= 240;
BMPFile.Write(ALong, 4
BMPFile.SaveToFile('C:/Temp.BMP');
end;
敬请帮忙,或告之Delphi变量与VC5变量的对应关系?
function bbb(xyz:string):integer;stdcall
var
InFile: TMemoryStream;
BMPFile: TMemoryStream;
AWord: word;
AByte: Byte;
i: Longint;
Max: word;
Min: word;
ALong: Longint;
begin
InFile:= TMemoryStream.Create;
BMPFile:= TMemoryStream.Create;
InFile.LoadFromFile('C:/Temp1.BMP');
InFIle.Seek(0, 0);
for Max:= 1 to 539do
begin
InFIle.Read(AWord, 2);
BMPFile.Write(Aword, 2);
end;
BMPFile.Seek(54, 0);
for i:= 0 to 255do
begin
AByte:= i;
BMPFile.Write(AByte, 1);
BMPFile.Write(AByte, 1);
BMPFile.Write(AByte, 1);
Abyte:=0;
BMPFile.Write(AByte, 1);
end;
InFIle.Clear;
InFile.LoadFromFile(xyz);
InFile.Seek(1080, 0);
Max:= 0;
Min:= $FFFF;
for i:= 1 to 320*240do
begin
InFile.Read(AWord, 2);
AWord:= Swap(Aword);
if AWord>Max then
Max:= AWord;
if AWord<Min then
Min:= AWord;
end;
InFile.Seek(1080, 0);
for i:= 1 to 320*240do
begin
InFile.Read(AWord, 2);
AWord:= Swap(Aword);
AByte:= round((AWord-Min)/(Max-Min)*255);
BMPFile.Write(AByte, 1);
end;
ALong:= 320*240+1078;
BMPFile.Seek(2, 0);
BMPFile.Write(ALong, 4);
ALong:= 320;
BMPFile.Seek(18, 0);
BMPFile.Write(ALong, 4);
ALong:= 240;
BMPFile.Write(ALong, 4
BMPFile.SaveToFile('C:/Temp.BMP');
end;