Skip to content

Commit

Permalink
ShellExt: Option for separate instance (VCL)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjee21 committed Jan 15, 2025
1 parent 70b196a commit 937b722
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
31 changes: 31 additions & 0 deletions Source/GUI/VCL/GUI_Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,18 @@ void __fastcall TPreferencesF::Language_EditClick(TObject *Sender)
void __fastcall TPreferencesF::OKClick(TObject *Sender)
{
Prefs->Config.Save();
if (CB_InscrireShell_SeparateInstance->Visible) {
TRegistry* Reg = new TRegistry(KEY_WRITE);
try {
if (Reg->OpenKey(__T("Software\\MediaArea\\MediaInfo"), true)) {
if (CB_InscrireShell_SeparateInstance->Checked)
Reg->WriteInteger("ShellExtension_SeparateInstance", 1);
else
Reg->DeleteValue("ShellExtension_SeparateInstance");
}
} catch (...) {}
delete Reg;
}
}

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -691,6 +703,25 @@ void __fastcall TPreferencesF::GUI_Configure()
Tree->FullExpand();
Page->ActivePage=Setup;

//Enable separate instance option if modern shell extension is installed
TRegistry* Reg = new TRegistry;
try {
Reg->RootKey = HKEY_CLASSES_ROOT;
if (Reg->OpenKeyReadOnly(__T("PackagedCom\\ClassIndex\\{20669675-B281-4C4F-94FB-CB6FD3995545}"))) {
CB_InscrireShell_SeparateInstance->Visible=true;
Reg->RootKey = HKEY_CURRENT_USER;
if (Reg->OpenKeyReadOnly(__T("Software\\MediaArea\\MediaInfo"))) {
if (Reg->ValueExists("ShellExtension_SeparateInstance"))
CB_InscrireShell_SeparateInstance->Checked=Reg->ReadInteger("ShellExtension_SeparateInstance");
}
}
} catch (...) {}
delete Reg;

//Move InfoTip option up to prevent blank space if there is a space
if (!CB_InscrireShell_SeparateInstance->Visible)
CB_InfoTip->Top=CB_InscrireShell_Folder->Top+CB_InscrireShell_Folder->Height*0.9;

//Translation
//Title
Caption=Prefs->Translate(__T("Preferences")).c_str();
Expand Down
12 changes: 11 additions & 1 deletion Source/GUI/VCL/GUI_Preferences.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ object PreferencesF: TPreferencesF
end
object CB_InfoTip: TCheckBox
Left = 2
Top = 104
Top = 120
Width = 655
Height = 18
Caption =
Expand Down Expand Up @@ -176,6 +176,16 @@ object PreferencesF: TPreferencesF
TabOrder = 4
OnClick = CB_InscrireShell_FolderClick
end
object CB_InscrireShell_SeparateInstance: TCheckBox
Left = 18
Top = 104
Width = 639
Height = 17
Caption = 'Open each item in a separate instance'
TabOrder = 8
Visible = False
OnClick = CB_InscrireShell_FolderClick
end
end
object Setup_Advanced: TTabSheet
Caption = 'Advanced'
Expand Down
1 change: 1 addition & 0 deletions Source/GUI/VCL/GUI_Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class TPreferencesF : public TForm
TCheckBox *CB_InscrireShell;
TCheckBox *CB_InscrireShell_Folder;
TCheckBox *Advanced_LegacyStreamDisplay;
TCheckBox *CB_InscrireShell_SeparateInstance;
void __fastcall General_Language_SelChange(TObject *Sender);
void __fastcall General_Output_SelChange(TObject *Sender);
void __fastcall Custom_EditClick(TObject *Sender);
Expand Down

0 comments on commit 937b722

Please sign in to comment.