📄 yourpaseditcw.dpr
字号:
program YourPasEditcw;
uses Dialogs,
Forms,
Windows,
SysUtils,
About in 'About.pas' {frmAbout},
YrPasEdit in 'YrPasEdit.pas' {frmYourPasEdit};
{$R *.RES}
var
Previous: HWND;
{This code, to allow file association and open doubleclicked file in the running instance of app
was written by Andrius Adamonis}
function EnumWindowsCallback(Handle: HWND; Param: LPARAM): Boolean; stdcall;
function IsMyClass: Boolean;
var
ClassName : array[0..30] of Char;
FormClassName: string;
begin
GetClassName(Handle, ClassName, 30);
Result := (StrIComp(ClassName, 'TfrmYourPasEdit') = 0) and { this finds my window, TfrmYourPasEdit }
(SendMessage(Handle, WM_FINDINSTANCE, 0, 0) = MyUniqueConst); { this checks if this is really my application }
end;
begin
Result := not IsMyClass; { needs True to continue }
if not Result { = MyClass } then Previous := Handle;
end;
var
ATOM: TAtom;
begin
Previous := 0;
ATOM := 0;
EnumWindows(@EnumWindowsCallback, 0);
if Previous <> 0 then
begin
PostMessage(Previous, WM_RESTOREAPP, 0, 0);
if (ParamCount > 0) then
begin
ATOM := GlobalAddAtom(PChar(ParamStr(1)));
SendMessage(Previous, WM_OPENEDITOR, ATOM, 0);
GlobalDeleteAtom(ATOM);
end;
Exit;
end;
Application.Initialize;
Application.Title := 'YourPasEdit';
Application.CreateForm(TfrmYourPasEdit, frmYourPasEdit);
if ParamCount > 0 then frmYourPasEdit.OpenFile(ParamStr(1));
Application.Run;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -