2021-07-01 18:02:16 +02:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include <vcl.h>
|
|
|
|
#pragma hdrstop
|
2023-09-02 23:11:51 +02:00
|
|
|
#include <IniFiles.hpp>
|
|
|
|
#include <System.Hash.hpp>
|
2021-07-01 18:02:16 +02:00
|
|
|
#include <tchar.h>
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
#include <Vcl.Styles.hpp>
|
|
|
|
#include <Vcl.Themes.hpp>
|
|
|
|
USEFORM("ConfigFormUnit.cpp", ConfigForm);
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Application->Initialize();
|
|
|
|
Application->MainFormOnTaskBar = true;
|
2023-09-02 23:11:51 +02:00
|
|
|
|
|
|
|
HWND hwnd =
|
|
|
|
FindWindow(
|
|
|
|
THashSHA1::GetHashString(Application->ExeName).w_str(), NULL);
|
|
|
|
|
|
|
|
if (hwnd && ParamStr(1) != L"-restart") {
|
|
|
|
|
|
|
|
if (IsIconic(hwnd)) {
|
|
|
|
ShowWindow(hwnd, SW_RESTORE);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetForegroundWindow(hwnd);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-02-03 21:06:24 +01:00
|
|
|
auto *ini = new TIniFile(".\\ddraw.ini");
|
2023-09-02 23:11:51 +02:00
|
|
|
auto theme = ini->ReadString("ddraw", "configtheme", "Windows10");
|
|
|
|
|
|
|
|
TStyleManager::TrySetStyle(
|
|
|
|
theme == "Cobalt XEMedia" ? "Cobalt XEMedia" : "Windows10");
|
|
|
|
|
|
|
|
delete ini;
|
|
|
|
|
2021-07-01 18:02:16 +02:00
|
|
|
Application->CreateForm(__classid(TConfigForm), &ConfigForm);
|
|
|
|
Application->Run();
|
|
|
|
}
|
|
|
|
catch (Exception &exception)
|
|
|
|
{
|
|
|
|
Application->ShowException(&exception);
|
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
throw Exception("");
|
|
|
|
}
|
|
|
|
catch (Exception &exception)
|
|
|
|
{
|
|
|
|
Application->ShowException(&exception);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
//---------------------------------------------------------------------------
|