BSOne.SFC/Tocsg.Module/TrayIconStream/DTisMain.pas

65 lines
1.3 KiB
Plaintext

unit DTisMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TDlgTisMain = class(TForm)
btnGetData: TButton;
mmData: TMemo;
procedure btnGetDataClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DlgTisMain: TDlgTisMain;
implementation
uses
System.Win.Registry, Tocsg.Safe, Tocsg.Hex;
{$R *.dfm}
procedure TDlgTisMain.btnGetDataClick(Sender: TObject);
var
Reg: TRegistry;
nLen: Integer;
pBuf: TBytes;
i: Integer;
c: PChar;
sData: AnsiString;
begin
mmData.Clear;
Guard(Reg, TRegistry.Create);
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKeyReadOnly('SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify') then
begin
if not Reg.ValueExists('IconStreams') then
exit;
nLen := Reg.GetDataSize('IconStreams');
if nLen = 0 then
exit;
SetLength(pBuf, nLen);
if Reg.ReadBinaryData('IconStreams', pBuf[0], nLen) <> nLen then
exit;
sData := ConvBinToStr(PAnsiChar(@pBuf[0]), nLen);
for i := 0 to nLen - 1 do
begin
BinToHex(pBuf[i], c, 1);
end;
end;
end;
end.