Пример #1
0
//---------------------------------------------------------------------------
// support function for communicating other loop tuner instances
//---------------------------------------------------------------------------
static bool FindOtherLoopTunerInstanceAndNotify()
{
	HWND wnd = FindWindow("TTSSLoopTuner2MainForm", NULL);
	if(wnd)
	{
		char buf[256];
		GetWindowText(wnd, buf, 256-1);
		if(strstr(buf, "(//designing//)")==NULL)
		{
			PostMessage(wnd, WM_SHOWFRONT, 0, 0);
			int i;
			int paramcount = ParamCount();
			for(i=1; i<=paramcount; i++)
			{
				if(FileExists(ParamStr(i)))
				{
					AnsiString data = "open:" + AnsiString(ParamStr(i));
					COPYDATASTRUCT cds;
					cds.dwData = 0x746f8ab3;
					cds.cbData = data.Length() + 1;
					cds.lpData = data.c_str();
					SendMessage(wnd, WM_COPYDATA, NULL, (LPARAM)&cds);
					break;
				}
			}
			return false; // exit the application
		}
	}
	return true; // continue the application
}
Пример #2
0
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent *Owner)
	: TForm(Owner)
{
 try
 {
  AnsiString CursorFile = ExtractFilePath(Application->ExeName) + "Images\\move.cur";
  HCURSOR hCursor = LoadCursorFromFile(CursorFile.c_str());
  if(hCursor) Screen->Cursors[crDrag] = hCursor;
 }
 catch(...)
 {
 }

 AnsiString sCmd = ParamStr(0);  //current program
 AnsiString sExt = ".cpf";
 TExtInfo *inf;
 try
 {
  inf = Reg1->GetExtInfo(sExt);
  if (inf->ExecutePath != "\"" + ParamStr(0) + "\" \"%1\"")
  RegisterExt();
 }
 catch(...)
 {
  RegisterExt();
 }

 NewClientWP = (FARPROC)MakeObjectInstance(MDIClientWndProc); // Bg additions
 OldClientWP = (FARPROC)SetWindowLong(ClientHandle, GWL_WNDPROC, (LONG)NewClientWP);
}
BOOL CCommandLineParameters::CheckHelp(const BOOL bNoSwitches /*= FALSE */)
{
     if (bNoSwitches && (paramcount < 2)) return TRUE;
     if (paramcount < 2) return FALSE;
     if (strcmp(ParamStr(1),"-?") == 0) return TRUE;
     if (strcmp(ParamStr(1),"/?") == 0) return TRUE;
     if (strcmp(ParamStr(1),"?") == 0) return TRUE;
     return FALSE;
}
Пример #4
0
//---------------------------------------------------------------------------
void __fastcall TForm1::OgUsageCode2GetCode(TObject *Sender, TCode &Code)
{
	String S;
	TheDir = ExtractFilePath(ParamStr(0));
  int L = TheDir.Length();
  if (L > 3 && TheDir[L] != '\\')
    TheDir = TheDir + '\\';

  if (FileExists(TheDir + "Usage2.INI")) {
    // open Ini File
    IniFile = new TIniFile(TheDir + "Usage2.INI");
    try {
      // try to read release code
      S = IniFile->ReadString("Codes", "Uses", "");

      // convert retrieved string to a code
      HexToBuffer(S, &Code, sizeof(Code));
    }
    catch (...) {
      delete IniFile;
      IniFile = 0;
    }
    delete IniFile;
  }
}
Пример #5
0
// ---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent *Owner) : TForm(Owner) {
	DragAcceptFiles(Handle, true); // Enable D&D

	Gdv0->LicenseKEY = WideString(L"6223560888372426056441256");

	IniFile = TPath::Combine(ExtractFilePath(Application->ExeName), "v2iewx.ini");
	KeyFile = TPath::Combine(ExtractFilePath(Application->ExeName), "key.ini");
	LangFile = TPath::Combine(ExtractFilePath(Application->ExeName), "lang.ini");
	RecentFile = TPath::Combine(ExtractFilePath(Application->ExeName), "recent.ini");

	hSPI = new TObjectList();
	flst = new TObjectList();
	paramStr = new TStringList();
	RecentList = new TStringList();

	fn_LoadLang();
	fn_LoadIni();
	fn_LoadRecent();

	KeyConf = new TMemIniFile(KeyFile);
	Recent = new TMemIniFile(RecentFile);

	if (ParamCount() > 0) {
		for (int i = 1; i <= ParamCount(); ++i) {
			paramStr->Add(ParamStr(i));
		}
		fn_ParseFiles(paramStr);
	}
}
CString CCommandLineParameters::GetSwitchStr(const char *sz,
                                             const char *szDefault, /* = "" */
                                             const BOOL bCase /* = FALSE */
                                            )
{
    int idx = Switch(sz,bCase);
    if (idx > 0) {
        CString s = ParamStr(idx);
        int n = s.Find(':');
        if (n > -1) {
			CString ts = s.Mid(n + 1);
			ts.Replace("\"", "");
            return ts;
//            return s.Mid(n+1);
        } 
//		else {
//          if ((idx+1) < paramcount) {
//              if (!IsSwitch(parms[idx+1])) {
//                  return parms[idx+1];
//              }
//          }
//        }
        //return szDefault;
    }
    return szDefault;
}
Пример #7
0
void XLog::Flush()
{
  if (0 == m_savingqueue_size)
    return;
  m_file_date_tmp = new SYSTEMTIME();
  GetLocalTime(m_file_date_tmp);
  string sfile = m_logfilepath;
  sfile.append(m_computer_name);
  sfile.append("_");
  sfile.append(ExtractFileName(ParamStr(0)));
  sfile.append("_");
  sfile.append(FormatDate(*m_file_date_tmp));
  sfile.append(".log");

  if (!FileExists(sfile.c_str()))
  {
//      unsigned char head[2] = {0xFF,0xFE};
      SaveBufferToFile(sfile,m_savingqueue_logical,m_savingqueue_size);
  }
  else
  {
	  AppendBuf2File(sfile,m_savingqueue_logical,m_savingqueue_size);
  }
  m_savingqueue_size = 0;
}
Пример #8
0
void __fastcall TfmLauncher::ProcessCommandLine()
{
  if (ParamCount > 0){
    FileName = ParamStr(1);
    if (FileExists(FileName))
      RootDirectory = ExtractFileDrive(FileName);
  }
}
Пример #9
0
//---------------------------------------------------------------------------
UnicodeString TConfiguration::ModuleFileName() const
{
#if defined(__BORLANDC__)
  return ParamStr(0);
#endif
  Classes::Error(SNotImplemented, 204);
  return L"";
}
Пример #10
0
// новая игра
void __fastcall TForm1::NewGame()
{
    static int Tag = 0;
       // загрузить файл иллюстрации
    if (( ParamCount() == 0 ) && (Tag == 0 )) Tag = 1;

    switch ( Tag )
    {
        case 0 :  // имя файла - из командной строки
             fn = ParamStr(1);
             Tag = 1;
             break;

        case 1:  // выбрать первый по порядку bmp-файл
             { FindFirst("*.bmp",faAnyFile,SearchRec);
               fn = SearchRec.Name;
               Tag = 2;
             }
             break;

        case 2: // выбрать следующий bmp-файл
             {
                if ( FindNext(SearchRec) != 0)
                    FindFirst("*.bmp",faAnyFile,SearchRec);
                fn = SearchRec.Name;
             }
             break;
    }

    // загрузить иллюстрацию
    try {
        pic->LoadFromFile(fn);
    }
    catch (EFOpenError &e)
    {
        MessageDlg("Ошибка доступа к файлу иллюстрации",
          mtWarning, TMsgDlgButtons()<< mbOK<<mbHelp,0);
        return;
    }

    // определить размер клетки
    wc = pic->Width / W;
    hc = pic->Height / H;

    // установить размер формы
    ClientWidth = wc * W;
    ClientHeight = hc * H;

    // исходное (правильное) положение фишек
    int k = 1;
    for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++)
            pole[i][j] = k++;

    GameOver = false;
    Mixer();     // перемешать фишки
    ShowPole();  // отобразить игровое поле
}
Пример #11
0
// ---------------------------------------------------------------------------
void __fastcall TfrmMain::FormActivate(TObject *Sender) {
	if (Activated) {
		return;
	}
	else {
		Activated = true;
	}
	/* Cargamos los archivos pasados por parámetro */
	for (int i = 1; i <= ParamCount(); i++) {
		if (FileExists(ParamStr(i))) {
			new TfrmChild(this, ParamStr(i));
		}
		else {
			Application->MessageBox(L"El archivo no se encuentra", L"Error",
				MB_OK + MB_ICONERROR);
		}
	}
}
void __fastcall TfrmMain::FormActivate(TObject *Sender)
{
    if (firstTime)
    {
        this->WindowState = wsMaximized;

        RegIns(".ats", "atsfile");

        RegIns("atsfile", "Aardbei Texture Studio 1");
        RegIns("atsfile\\shell", "");
        RegIns("atsfile\\shell\\open", "");
        char tmp[128];
        wsprintf(tmp, "%s \"%%1\"", Application->ExeName);
        RegIns("atsfile\\shell\\open\\command", tmp);
        wsprintf(tmp, "%s,0", Application->ExeName);
        RegIns("atsfile\\DefaultIcon",  tmp);

        mnuMain->Items->Items[menuIndexGenerate]->Visible = false;
        mnuMain->Items->Items[menuIndexDistort]->Visible  = false;
        mnuMain->Items->Items[menuIndexLayer]->Visible    = false;
        mnuMain->Items->Items[menuIndexColor]->Visible    = false;
        mnuMain->Items->Items[menuIndexBlur]->Visible     = false;
        Undo1->Enabled = false;
        Export1->Enabled = false;
        mnuMain->Items->Items[menuIndexFile]->Items[menuIndexClose]->Visible  = false;
        mnuMain->Items->Items[menuIndexFile]->Items[menuIndexSave]->Visible   = false;
        mnuMain->Items->Items[menuIndexFile]->Items[menuIndexSaveAs]->Visible = false;

        Repaint();

        // if paramcount is 1, load the file
        if (ParamCount() == 1)
        {
            _sleep(1);
            openedByClicking = true;
            textureFilename = new char[ParamStr(1).Length() + 1];
            strcpy(textureFilename, ParamStr(1).c_str());
//            textureFilename = ParamStr(1).c_str();
            Open1Click(Sender);
        }

        firstTime = false;
   }
}
Пример #13
0
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  ReadIniSettings();
  SetCaption();
  UpdateMenu();
  if (ParamCount > 0)
    try {
      AbZipOutline1->FileName = ParamStr(1);
    }
    catch (...) {}
}
Пример #14
0
XLog::XLog(const char *p_logfilenamepath,
           int p_logqueue_size,
           int p_flush_interval)
{
  if (!p_logfilenamepath)
    m_logfilepath.assign(ExtractFilePath(ParamStr(0),true));
  else
  {
    m_logfilepath.assign(p_logfilenamepath);
    if (m_logfilepath.empty() || !DirectoryExists(m_logfilepath.c_str()))
      m_logfilepath.assign(ExtractFilePath(ParamStr(0),true));
    else
      m_logfilepath.assign(IncludeTrailingPathDelimiter(m_logfilepath));
  }
  m_logqueue_size = p_logqueue_size;
  if (m_logqueue_size <= 0)
    m_logqueue_size = 1 * 1024 * 1024; //1M;
  m_flush_interval = p_flush_interval;

  m_swaplock = new pthread_mutex_t();
  pthread_mutex_init(m_swaplock,NULL);
  m_prequeuelock = new pthread_mutex_t();
  pthread_mutex_init(m_prequeuelock,NULL);
  m_prequeue_real = malloc(m_logqueue_size);
  m_savingqueue_real = malloc(m_logqueue_size);
  m_prequeue_logical = m_prequeue_real;
  m_savingqueue_logical = m_savingqueue_real;
  m_prequeue_size = 0;
  m_savingqueue_size = 0;
  m_file_handle = NULL;
  m_file_date = NULL;
  m_file_date_tmp = NULL;
  DWORD dwComputerNameSize = 255;
  m_computer_name = (char*)malloc(dwComputerNameSize*sizeof(char));
  memset(m_computer_name,0,dwComputerNameSize*sizeof(char));
  char s[255];
  memset(s,0,255);
  gethostname(s,255);
  memcpy(m_computer_name,s,strlen(s));
}
Пример #15
0
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
	: TForm(Owner), _colNum (-1)
{
	if (ParamCount() >= 1)
    	Caption = ParamStr(1);
    else if (OpenDialog->Execute())
        Caption = OpenDialog->FileName;
    else
    	return;

    if (_strategy.DataOpen(Caption.c_str(), false))
        _storage = c4_Storage (_strategy, true);
}
Пример #16
0
void __fastcall TMainFrm::FormCreate(TObject *Sender)
{
IndyVersionLabel->Caption=POP->Version;
  ReadConfiguration();
   //setup path to put attachments into
   FAttachPath = IncludeTrailingBackslash(ExtractFileDir(ParamStr(0))); //starting directory
   FAttachPath = FAttachPath + "Attach\\";
   if (!DirectoryExists(FAttachPath))
     ForceDirectories(FAttachPath);

   FMsgCount = 0;
   FMailBoxSize = 0;
   ShowBusy(false);

}
Пример #17
0
//---------------------------------------------------------------------------
void __fastcall TAssemblerBox::cmdExecuteClick(TObject *Sender)
{
  AnsiString sim68K, S68;

  //grab the active child window
  TTextStuff *Active = (TTextStuff*)Main->ActiveMDIChild;

  // get name of current S-Record file
  S68 = "\"" + ChangeFileExt(Active->Project.CurrentFile,".S68") + "\"";

  //run simulator
  sim68K = ExtractFilePath(Application->ExeName) + "SIM68K.EXE";
  spawnl(P_NOWAITO, sim68K.c_str(), ParamStr(0).c_str(), S68.c_str(), NULL);

  AssemblerBox->Close();
}
Пример #18
0
__fastcall TRelFolderSelectorForm::TRelFolderSelectorForm(TComponent* Owner)
	: TForm(Owner)
{
	ShellTreeView->Path = ExtractFileDir(ParamStr(0));

	// adjust components
	Label1->Left = SPACER;
	Label1->Top = SPACER;
	ShellComboBox->Left = SPACER;
	ShellComboBox->Top = SPACER + Label1->Height + 2;
	ShellComboBox->Width = ClientWidth - SPACER * 2;
	ShellTreeView->Left = SPACER;
	ShellTreeView->Top = ShellComboBox->Height + ShellComboBox->Top;
	ShellTreeView->Width = ClientWidth - SPACER * 2;
	OKButton->Top = ClientHeight - OKButton->Height - SPACER;
	CancelButton->Top = ClientHeight - CancelButton->Height - SPACER;
	OKButton->Left = ClientWidth - (StatusBar->Width + SPACER + CancelButton->Width
		+ SPACER + OKButton->Width);
	CancelButton->Left = ClientWidth - ( StatusBar->Width + SPACER + CancelButton->Width);
	ShellTreeView->Height = CancelButton->Top - SPACER - ShellTreeView->Top;

	if(ShellTreeView->Selected)
	{
		ShellTreeView->Selected->Expanded = true;
		TTreeNode * topnode = ShellTreeView->Selected;
		if(topnode->Count >= 1)
		{
			TTreeNode * longestitem = NULL;
			int longesttextsize = -1;
			for(int i = 0; i < topnode->Count; i++)
			{
				TTreeNode *subnode = topnode->Item[i];
				TRect rect = subnode->DisplayRect(true);
				if(rect.right > longesttextsize)
				{
					longesttextsize = rect.right;
					longestitem = topnode->Item[i];
				}
			}
			if(longestitem)
				longestitem->MakeVisible();
		}
		ShellTreeView->TopItem = topnode;
		topnode->MakeVisible();
	}

}
Пример #19
0
AnsiString  __fastcall TMainForm::GetList()
{
   TSearchRec sr;
   AnsiString s;
   AnsiString result;
sFilePattern = ExtractFileDir(ParamStr(0)) + "\\images\\*.bmp";
s = "";
if (FindFirst(sFilePattern,faAnyFile,sr) == 0)
    {
    s = sr.Name;
    while (FindNext(sr) == 0 )
        {s = s + "," + sr.Name;
        }
    }
result = s;
return result;
}
Пример #20
0
//---------------------------------------------------------------------------
void __fastcall TForm_Main::FormCreate(TObject *Sender)
{
	if (!InitMiles())
	{
		ShowMessage("Error initializing Miles");
		Close();
		return;
	}

	FillFilterList();

	// Open a file off the command line
	if (ParamCount() > 0)
	{
		c_Edit_FileName->Text = ParamStr(1);
		OpenFile();
	}
}
Пример #21
0
//---------------------------------------------------------------------------
void __fastcall TfrmMain::Button1Click(TObject *Sender)
{
  TProcessInformation ProcessInfo;
  TStartupInfo StartupInfo;

  StartupInfo.cb = sizeof(StartupInfo);
  GetStartupInfo(&StartupInfo);

  if (CreateProcess(NULL, (AnsiString(ParamStr(0)) + AnsiString(" \"1st Argument\" /second /third")).c_str(),
    NULL, NULL, false, 0, NULL, NULL, &StartupInfo, &ProcessInfo))
  {
    // we do not need them
    CloseHandle(ProcessInfo.hThread);
    CloseHandle(ProcessInfo.hProcess);
  }
  else
    MessageDlg("Error starting new process instance.", mtError, TMsgDlgButtons() << mbOK, 0);

}
Пример #22
0
// =====================================================================
WINAPI WinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
    CreateMutex(NULL, FALSE, "ChildMom");
    if( GetLastError() == ERROR_ALREADY_EXISTS )
    {

        for (int i = 0; i <= ParamCount(); i++)
            if (LowerCase(ParamStr(i)) == "-show" )
            {
                FindAndSendMesageToParent();
                break;
            }

        return 0;
    }
    // ------------------
    try
    {
        Application->Initialize();
        Application->MainFormOnTaskBar = true;
        Application->CreateForm(__classid(Tform_Main), &form_Main);
        Application->Run();
    }
    catch (Exception &exception)
    {
        Application->ShowException(&exception);
    }
    catch (...)
    {
        try
        {
            throw Exception("");
        }
        catch (Exception &exception)
        {
            Application->ShowException(&exception);
        }
    }
    return 0;
}
Пример #23
0
//---------------------------------------------------------------------------
void __fastcall TForm1::OgDateCode1GetCode(TObject *Sender, TCode &Code)
{
  String S;
	TDateTime SD;
  TDateTime ED;

  // force the INI file to be in the same directory as the application}
  TheDir = ExtractFilePath(ParamStr(0));
  int L = TheDir.Length();
  if (L > 3 && TheDir[L] != '\\')
    TheDir = TheDir + '\\';

  // open Ini File}
  TIniFile* IniFile = new TIniFile(TheDir + "Datep21.INI");
  try {
    // try to read release code}
    S = IniFile->ReadString("Codes", "DateCode", "");

    // If default string returned, create code on the fly}
    if (S == "") {
      SD = TDateTime::CurrentDate();
			ED = TDateTime::CurrentDate();
      ED += 21;
      InitDateCode(CKey, SD, ED, Code);

      // save string representation of release code to Ini File}
      S = BufferToHex(&Code, sizeof(Code));
      IniFile->WriteString("Codes", "DateCode", S);
    }
    else
      // convert retrieved string to a code}
      HexToBuffer(S, &Code, sizeof(Code));
  }
  catch (...) {
  	delete IniFile;
  }
  delete IniFile;
}
Пример #24
0
//---------------------------------------------------------------------------
void __fastcall TMainFrm::ReadConfiguration()
{


    TIniFile * MailIni;
    MailIni = new TIniFile(ExtractFilePath(ParamStr(0)) + "Mail.ini");

    Pop3ServerName = MailIni->ReadString("Pop3", "ServerName", "pop3.server.com");
    Pop3ServerPort = StrToInt(MailIni->ReadString("Pop3", "ServerPort", "110"));
    Pop3ServerUser = MailIni->ReadString("Pop3", "ServerUser", "your_login");
    Pop3ServerPassword = MailIni->ReadString("Pop3", "ServerPassword", "your_password");

    SmtpServerName = MailIni->ReadString("Smtp", "ServerName", "smtp.server.com");
    SmtpServerPort = StrToInt(MailIni->ReadString("Smtp", "ServerPort", "25"));
    SmtpServerUser = MailIni->ReadString("Smtp", "ServerUser", "your_login");
    SmtpServerPassword = MailIni->ReadString("Smtp", "ServerPassword", "your_password");
    SmtpAuthType = MailIni->ReadInteger("Smtp", "SMTPAuthenticationType", 0);
    UserEmail = MailIni->ReadString("Email", "PersonalEmail", "*****@*****.**");

    delete  MailIni;


}
Пример #25
0
//---------------------------------------------------------------------------
UnicodeString __fastcall TConfiguration::ModuleFileName()
{
  return ParamStr(0);
}
int CCommandLineParameters::ParamInt(const int index)
{
    return atoi(ParamStr(index));
}
Пример #27
0
//---------------------------------------------------------------------------
AnsiString LanguageFileName()
{
    return ExtractFilePath(ParamStr(0)) + SettingView.m_Language + ".lng";
}
Пример #28
0
//---------------------------------------------------------------------------
UnicodeString __fastcall TConfiguration::GetIniFileStorageName(bool ReadingOnly)
{
  if (FIniFileStorageName.IsEmpty())
  {
    UnicodeString ProgramPath = ParamStr(0);

    UnicodeString ProgramIniPath = ChangeFileExt(ProgramPath, L".ini");

    UnicodeString IniPath;
    if (FileExists(ProgramIniPath))
    {
      IniPath = ProgramIniPath;
    }
    else
    {
      UnicodeString AppDataIniPath =
        IncludeTrailingBackslash(GetShellFolderPath(CSIDL_APPDATA)) +
        ExtractFileName(ProgramIniPath);
      if (FileExists(AppDataIniPath))
      {
        IniPath = AppDataIniPath;
      }
      else
      {
        // avoid expensive test if we are interested in existing files only
        if (!ReadingOnly && (FProgramIniPathWrittable < 0))
        {
          UnicodeString ProgramDir = ExtractFilePath(ProgramPath);
          FProgramIniPathWrittable = IsDirectoryWriteable(ProgramDir) ? 1 : 0;
        }

        // does not really matter what we return when < 0
        IniPath = (FProgramIniPathWrittable == 0) ? AppDataIniPath : ProgramIniPath;
      }
    }

    // BACKWARD COMPATIBILITY with 4.x
    if (FVirtualIniFileStorageName.IsEmpty() &&
        TPath::IsDriveRooted(IniPath))
    {
      UnicodeString LocalAppDataPath = GetShellFolderPath(CSIDL_LOCAL_APPDATA);
      // virtual store for non-system drives have a different virtual store,
      // do not bother about them
      if (TPath::IsDriveRooted(LocalAppDataPath) &&
          SameText(ExtractFileDrive(IniPath), ExtractFileDrive(LocalAppDataPath)))
      {
        FVirtualIniFileStorageName =
          IncludeTrailingBackslash(LocalAppDataPath) +
          L"VirtualStore\\" +
          IniPath.SubString(4, IniPath.Length() - 3);
      }
    }

    if (!FVirtualIniFileStorageName.IsEmpty() &&
        FileExists(FVirtualIniFileStorageName))
    {
      return FVirtualIniFileStorageName;
    }
    else
    {
      return IniPath;
    }
  }
  else
  {
    return FIniFileStorageName;
  }
}
Пример #29
0
WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{

	HWND h = FindWindowA(UnicodeString("TMainForm").t_str(), UnicodeString("Прибор динамического рассеяния").t_str());
	if (h)
	{
		if (ParamCount() > 0)
		{
			UnicodeString str = ParamStr(1);
			if (FileExists(str))
			{
				/*
				char *buff = new char[str.Length()+1];
				strcpy(buff, str.t_str());
                */
                TCopyDataStruct data;
                data.dwData = 0;
                data.cbData = str.Length()+1;
                data.lpData = str.t_str();

                SendMessageA(h, WM_COPYDATA, 0, LPARAM(&data));
			}
		}

		ShowWindow(h, SW_MAXIMIZE);
        BringWindowToTop(h);
		return 0;
	}

	try
	{
		Application->Initialize();
		Application->MainFormOnTaskBar = true;
		Application->Title = "ПДР";
		Application->CreateForm(__classid(TMainForm), &MainForm);
		Application->CreateForm(__classid(TOptionsForm), &OptionsForm);
		Application->CreateForm(__classid(TGradForm), &GradForm);
		Application->CreateForm(__classid(TAddGradForm), &AddGradForm);
		Application->CreateForm(__classid(TReportForm), &ReportForm);
		Application->CreateForm(__classid(TAdd2ReportForm), &Add2ReportForm);
		Application->CreateForm(__classid(TReportEditForm), &ReportEditForm);
		Application->CreateForm(__classid(TAutoProgressForm), &AutoProgressForm);
		Application->CreateForm(__classid(TGraphApproxForm), &GraphApproxForm);
		Application->CreateForm(__classid(TRecThreadStartForm), &RecThreadStartForm);
		Application->CreateForm(__classid(TStatusRecForm), &StatusRecForm);
		Application->CreateForm(__classid(TAdjustAngleAperForm), &AdjustAngleAperForm);
		Application->CreateForm(__classid(TTestRecForm), &TestRecForm);
		Application->Run();
	}
	catch (Exception &exception)
	{
		//Application->ShowException(&exception);
		MainForm->Memo1->Lines->Add(exception.Message);
	}
	catch (...)
	{
		try
		{
			throw Exception("");
		}
		catch (Exception &exception)
		{
			Application->ShowException(&exception);
		}
	}
	return 0;
}
Пример #30
0
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
	AnsiString w;
	HKEY key;
	DWORD trash;
	DWORD value;
	DWORD size;

	size = sizeof(DWORD);
	if(RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\marumo\\mpeg2vid_vfp", 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, &trash) != ERROR_SUCCESS){
		Close();
	}

	if(ignore_aspect_ratio->Checked){
		value = 0;
	}else{
		value = 1;
	}
	RegSetValueEx(key, "aspect_ratio", 0, REG_DWORD, (LPBYTE)&value, size);

	if(no_remap->Checked){
		value = 0;
	}else{
		value = 1;
	}
	RegSetValueEx(key, "re_map", 0, REG_DWORD, (LPBYTE)&value, size);

	if(idct_double->Checked){
		value = 0;
	}else if(idct_llm->Checked){
		value = 1;
	}else if(idct_ap922->Checked){
		value = 2;
	}else{
		value = 1;
	}
	RegSetValueEx(key, "idct_func", 0, REG_DWORD, (LPBYTE)&value, size);

	if(keep_frame->Checked){
		value = 0;
	}else if(top_first->Checked){
		value = 1;
	}else{
		value = 2;
	}
	RegSetValueEx(key, "field_order", 0, REG_DWORD, (LPBYTE)&value, size);

	value = 0;
	if(mmx->Checked){
		value |= 1;
	}
	if(sse->Checked){
		value |= 2;
	}
	if(sse2->Checked){
		value |= 4;
	}
	RegSetValueEx(key, "simd", 0, REG_DWORD, (LPBYTE)&value, size);

	switch(color_matrix->ItemIndex){
	case 0:
		value = 0;
		break;
	case 1:
		value = 1;
		break;
	case 2:
		value = 4;
		break;
	case 3:
		value = 5;
		break;
	case 4:
		value = 6;
		break;
	case 5:
		value = 7;
		break;
	default:
		value = 0;
	}
	RegSetValueEx(key, "color_matrix", 0, REG_DWORD, (LPBYTE)&value, size);

	value = yuy2_matrix->ItemIndex;
	RegSetValueEx(key, "yuy2_matrix", 0, REG_DWORD, (LPBYTE)&value, size);

	value = 0;
	if(this->never_save_gl_file->Checked){
		value |= 1;
	}
	if(this->never_use_timecode->Checked){
		value |= 2;
	}
	RegSetValueEx(key, "gl", 0, REG_DWORD, (LPBYTE)&value, size);

	value = 0;
	if(this->open_multi_file->Checked){
		value |= 1;
	}
	RegSetValueEx(key, "file", 0, REG_DWORD, (LPBYTE)&value, size);
    
	RegCloseKey(key);

	if(RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\VFPlugin", 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, &trash) != ERROR_SUCCESS){
		Close();
	}
	w = ExtractFileDir(ParamStr(0));
	w = w + "\\m2v.vfp";
	
	RegSetValueEx(key, "MPEG2VIDEO", 0, REG_SZ, (LPBYTE)w.c_str(), w.Length());
	RegCloseKey(key);
	
	Close();
}