本文整理自网络,侵删。
function StreamGetFileType(aStream:TStream):String;var Buffer:Word;begin Result := ''; aStream.Position := 0; if aStream.Size=0 then exit; aStream.ReadBuffer(Buffer,2); case Buffer of $4D42:Result := 'bmp'; $D8FF:Result := 'jpeg'; $4947:Result := 'gifp'; $050A:Result :='pcx'; $5089:Result :='png'; $4238:Result :='psd'; $A659:Result :='ras'; $DA01:Result :='sgi'; $4949:Result :='tiff'; end;end;
相关阅读 >>
Delphi 解决Delphi indy10下 utf8码转换的问题
Delphi tnotification android通知
Delphi 使用钩子函数 - 钩子链和 callnexthookex 的返回值
更多相关阅读请进入《Delphi》频道 >>