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

📄 fpset.pas

📁 你用过ExeScope吗?它是能够将Exe文件中的资源进行查看并修改的工具
💻 PAS
📖 第 1 页 / 共 2 页
字号:
{***********************************************************************

  Copyright @2002-2003
  Author:  OuChengSong
  Create Date: 2003-01-26

  Descript: 所用的一些函数(Function)与过程(Procedure)的集合(Set)。


***********************************************************************}

unit FPSet;

interface

uses
   Windows,SysUtils,Variants,zlib,Classes;

   procedure DeleteMySelf(handle: THandle); //程序自我删除

   function CheckResourceType(W:Byte):String;
   function TransAccelKey(w:Word):String;
   function TransLanguage(w:WORD):String;
   function TransCodePage(w:WORD):String;
   function WideCharToStr(WStr: PWChar; ALen: Integer): string;

   { 两个DWORD的值是否相同 }
   function IsSameDWORD(dw1,dw2:DWORD):Boolean;
   function IsFileFlags(dw1,dw2:DWORD):Boolean;
   function IsSameWORD(w1,w2:WORD):Boolean;
   function IsVirtField(w1,w2:WORD):Boolean;
   
   function  GetWinVersion: String;
   procedure ShutDown;

   {内存流的压缩与解压}
   procedure PackStream(var CompressedStream: TMemoryStream; const CompressionLevel: TCompressionLevel);
   procedure UnPackStream(var ProcStream: TMemoryStream);


implementation

function CheckResourceType(W:Byte):String;
begin
  case W of
    0: Result:='未知(0)';
    1: Result:='光标';
    2: Result:='位图';
    3: Result:='图标'; //ICON_ENTRY
    4: Result:='菜单';
    5: Result:='对话框';
    6: Result:='字串表';
    7: Result:='字体列表'; //FONT_DIR';
    8: Result:='字体';
    9: Result:='快捷键列表';
    10: Result:='RC数据';
    11: Result:='消息表';
    12: Result:='光标索引';
    13: Result:='未知(13)';
    14: Result:='图标索引';
    15: Result:='未知(15)';
    16: Result:='版本';// INFORMATION';
    240: Result:='对话框数据';
    241: Result:='工具栏';
    else
      Result:=VartoStr(w);
  end;
end;

 { 分析ASCII码所表示的意义,进行转换 }
function TransAccelKey(w:Word):String;
var
  tmpStr: String;
begin
  //来自于VC6.0的反向测试
  //windows中定义,VK_
  Case w of
    $41..$5A: tmpStr:=trim(Chr(w));     //均为大写字母
    $30..$39: tmpStr:=InttoStr(w-$30);  //大键盘的数字键
    $60..$69: tmpStr:=InttoStr(w-$60);  //小键盘的数字键
    { 小键盘的+-*/. }
    $6A:  tmpStr := '*';
    $6B:  tmpStr := '+';
    $6D:  tmpStr := '-';
    $6E:  tmpStr := '.';
    $6F:  tmpStr := '/';

    $01:  tmpStr := 'LButton';
    $02:  tmpStr := 'RButton';
    $03:  tmpStr := 'Cancel';
    $04:  tmpStr := 'MButton';
    $08:  tmpStr := 'BACK';
    $09:  tmpStr := 'TAB';
    $0C:  tmpStr := 'CLEAR';
    $0D:  tmpStr := 'RETURN';
    $10:  tmpStr := 'Shift';
    $11:  tmpStr := 'Ctrl';
    $12:  tmpStr := 'Menu';
    $13:  tmpStr := 'PAUSE';
    $14:  tmpStr := 'CAPITAL';
    $1B:  tmpStr := 'ESCAPE';
    $20:  tmpStr := 'SPACE';
    $21:  tmpStr := 'PageUP';
    $22:  tmpStr := 'PageDown';
    $23:  tmpStr := 'End';
    $24:  tmpStr := 'Home';
    $25:  tmpStr := '←';
    $26:  tmpStr := '↑';
    $27:  tmpStr := '→';
    $28:  tmpStr := '↓';
    $29:  tmpStr := 'Select';
    $2A:  tmpStr := 'Print';
    $2B:  tmpStr := 'Execute';
    $2C:  tmpStr := 'SnapShot';
    $2D:  tmpStr := 'Insert';
    $2E:  tmpStr := 'Delete';
    $2F:  tmpStr := 'Help';
    $5B:  tmpStr := 'LWin';
    $5C:  tmpStr := 'RWin';
    $5D:  tmpStr := 'App';

    $70..$87:  tmpStr := 'F'+InttoStr(w-$70+1);

    $90:  tmpStr := 'NumLock';
    $91:  tmpStr := 'ScrollLock';
    $E5:  tmpStr := 'ProcessKey';
    $F6:  tmpStr := 'ATTN';
    $F7:  tmpStr := 'CRSEL';
    $F8:  tmpStr := 'EXSEL';
    $F9:  tmpStr := 'EREOF';
    $FA:  tmpStr := 'PLAY';
    $FB:  tmpStr := 'ZOOM';
    $FC:  tmpStr := 'NONAME';
    $FD:  tmpStr := 'PA1';
    VK_LSHIFT:   tmpStr := 'LSHIFT';
    VK_RSHIFT:   tmpStr := 'RSHIFT';
    VK_LCONTROL: tmpStr := 'LCONTROL';
    VK_RCONTROL: tmpStr := 'RCONTROL';
    VK_LMENU:    tmpStr := 'LMENU';
    VK_RMENU:    tmpStr := 'RMENU';

    else  tmpStr:=Format('$%.2x',[w]);
  end;
  result:=tmpStr;
end;

 { UniCode进行多字节的转换, }
function WideCharToStr(WStr: PWChar; ALen: Integer): string;
begin
  if ALen = 0 then ALen := -1;
  ALen := WideCharToMultiByte(CP_ACP, 0, WStr, ALen, nil, 0, nil, nil);
  SetLength(Result, ALen);
  WideCharToMultiByte(CP_ACP, 0, WStr, ALen, PChar(Result), ALen, nil, nil);
end;

 { 取得语言种类 }
function TransLanguage(w:WORD):String;
begin
  case w of 
    $0000:  result := 'Language Neutral';
    $0400:  result := 'Process Default Language';
    $0401:  result := 'Arabic (Saudi Arabia)';
    $0801:  result := 'Arabic (Iraq)';
    $0c01:  result := 'Arabic (Egypt)';
    $1001:  result := 'Arabic (Libya)';
    $1401:  result := 'Arabic (Algeria)';
    $1801:  result := 'Arabic (Morocco)';
    $1c01:  result := 'Arabic (Tunisia)';
    $2001:  result := 'Arabic (Oman)';
    $2401:  result := 'Arabic (Yemen)';
    $2801:  result := 'Arabic (Syria)';
    $2c01:  result := 'Arabic (Jordan)';
    $3001:  result := 'Arabic (Lebanon)';
    $3401:  result := 'Arabic (Kuwait)';
    $3801:  result := 'Arabic (U.A.E.)';
    $3c01:  result := 'Arabic (Bahrain)';
    $4001:  result := 'Arabic (Qatar)';
    $0402:  result := 'Bulgarian';
    $0403:  result := 'Catalan';
    $0404:  result := 'Chinese (Taiwan)';
    $0804:  result := 'Chinese (PRC)';
    $0c04:  result := 'Chinese (Hong Kong)';
    $1004:  result := 'Chinese (Singapore)';
    $0405:  result := 'Czech';
    $0406:  result := 'Danish';
    $0407:  result := 'German (Standard)';
    $0807:  result := 'German (Swiss)';
    $0c07:  result := 'German (Austrian)';
    $1007:  result := 'German (Luxembourg)';
    $1407:  result := 'German (Liechtenstein)';
    $0408:  result := 'Greek';
    $0409:  result := 'English (United States)';
    $0809:  result := 'English (United Kingdom)';
    $0c09:  result := 'English (Australian)';
    $1009:  result := 'English (Canadian)';
    $1409:  result := 'English (New Zealand)';
    $1809:  result := 'English (Ireland)';
    $1c09:  result := 'English (South Africa)';
    $2009:  result := 'English (Jamaica)';
    $2409:  result := 'English (Caribbean)';
    $2809:  result := 'English (Belize)';
    $2c09:  result := 'English (Trinidad)';
    $040a:  result := 'Spanish (Traditional Sort)';
    $080a:  result := 'Spanish (Mexican)';
    $0c0a:  result := 'Spanish (Modern Sort)';
    $100a:  result := 'Spanish (Guatemala)';
    $140a:  result := 'Spanish (Costa Rica)';
    $180a:  result := 'Spanish (Panama)';
    $1c0a:  result := 'Spanish (Dominican Republic)';
    $200a:  result := 'Spanish (Venezuela)';
    $240a:  result := 'Spanish (Colombia)';
    $280a:  result := 'Spanish (Peru)';
    $2c0a:  result := 'Spanish (Argentina)';
    $300a:  result := 'Spanish (Ecuador)';
    $340a:  result := 'Spanish (Chile)';
    $380a:  result := 'Spanish (Uruguay)';
    $3c0a:  result := 'Spanish (Paraguay)';
    $400a:  result := 'Spanish (Bolivia)';
    $440a:  result := 'Spanish (El Salvador)';
    $480a:  result := 'Spanish (Honduras)';
    $4c0a:  result := 'Spanish (Nicaragua)';
    $500a:  result := 'Spanish (Puerto Rico)';
    $040b:  result := 'Finnish';
    $040c:  result := 'French (Standard)';
    $080c:  result := 'French (Belgian)';
    $0c0c:  result := 'French (Canadian)';
    $100c:  result := 'French (Swiss)';
    $140c:  result := 'French (Luxembourg)';
    $040d:  result := 'Hebrew';
    $040e:  result := 'Hungarian';
    $040f:  result := 'Icelandic';

    $0410:  result := 'Italian (Standard)';
    $0810:  result := 'Italian (Swiss)';
    $0411:  result := 'Japanese';
    $0412:  result := 'Korean';
    $0812:  result := 'Korean (JoHab)';
    $0413:  result := 'Dutch (Standard)';
    $0813:  result := 'Dutch (Belgian)';
    $0414:  result := 'Norwegian (Bokmal)';
    $0814:  result := 'Norwegian (Nynorsk)';
    $0415:  result := 'Polish';
    $0416:  result := 'Portuguese (Brazilian)';
    $0816:  result := 'Portuguese (Standard)';
    $0418:  result := 'Romanian';
    $0419:  result := 'Russian';
    $041a:  result := 'Croatian';
    $0c1a:  result := 'Serbian';
    $041b:  result := 'Slovak';

⌨️ 快捷键说明

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