mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
allow only 1 instance per game folder
This commit is contained in:
parent
d329495b1c
commit
614febabf6
@ -8,6 +8,7 @@
|
|||||||
#include <IOUtils.hpp>
|
#include <IOUtils.hpp>
|
||||||
#include <SysUtils.hpp>
|
#include <SysUtils.hpp>
|
||||||
#include <Registry.hpp>
|
#include <Registry.hpp>
|
||||||
|
#include <System.Hash.hpp>
|
||||||
#include "ConfigFormUnit.h"
|
#include "ConfigFormUnit.h"
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
#pragma package(smart_init)
|
#pragma package(smart_init)
|
||||||
@ -28,6 +29,15 @@ __fastcall TConfigForm::TConfigForm(TComponent* Owner)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __fastcall TConfigForm::CreateParams(TCreateParams & Params)
|
||||||
|
{
|
||||||
|
TForm::CreateParams(Params);
|
||||||
|
|
||||||
|
StrCopy(
|
||||||
|
Params.WinClassName,
|
||||||
|
THashSHA1::GetHashString(Application->ExeName).w_str());
|
||||||
|
}
|
||||||
|
|
||||||
void __fastcall TConfigForm::LanguageImgClick(TObject *Sender)
|
void __fastcall TConfigForm::LanguageImgClick(TObject *Sender)
|
||||||
{
|
{
|
||||||
auto *ini = new TIniFile(".\\ddraw.ini");
|
auto *ini = new TIniFile(".\\ddraw.ini");
|
||||||
|
@ -115,6 +115,7 @@ __published: // Von der IDE verwaltete Komponenten
|
|||||||
|
|
||||||
|
|
||||||
private: // Benutzer-Deklarationen
|
private: // Benutzer-Deklarationen
|
||||||
|
virtual void __fastcall CreateParams(TCreateParams & Params);
|
||||||
void SaveSettings();
|
void SaveSettings();
|
||||||
bool GetBool(TIniFile *ini, System::UnicodeString key, bool defValue);
|
bool GetBool(TIniFile *ini, System::UnicodeString key, bool defValue);
|
||||||
void ApplyTranslation(TIniFile *ini);
|
void ApplyTranslation(TIniFile *ini);
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <vcl.h>
|
#include <vcl.h>
|
||||||
#include <IniFiles.hpp>
|
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
|
#include <IniFiles.hpp>
|
||||||
|
#include <System.Hash.hpp>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
#include <Vcl.Styles.hpp>
|
#include <Vcl.Styles.hpp>
|
||||||
@ -16,6 +17,20 @@ int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
|
|||||||
Application->Initialize();
|
Application->Initialize();
|
||||||
Application->MainFormOnTaskBar = true;
|
Application->MainFormOnTaskBar = true;
|
||||||
|
|
||||||
|
HWND hwnd =
|
||||||
|
FindWindow(
|
||||||
|
THashSHA1::GetHashString(Application->ExeName).w_str(), NULL);
|
||||||
|
|
||||||
|
if (hwnd) {
|
||||||
|
|
||||||
|
if (IsIconic(hwnd)) {
|
||||||
|
ShowWindow(hwnd, SW_RESTORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetForegroundWindow(hwnd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
auto *ini = new TIniFile(".\\ddraw.ini");
|
auto *ini = new TIniFile(".\\ddraw.ini");
|
||||||
auto theme = ini->ReadString("ddraw", "configtheme", "Windows10");
|
auto theme = ini->ReadString("ddraw", "configtheme", "Windows10");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user