//-----------------------------------------------------------------------------
const char *dcb_p32_imgd_state(GUI_MENU_ENTRY *ptr)
{
	const char *ret = NULL;

	switch (ptr->action & 0x3FFF) {
		case 1:
			ptr->state = Settings->PMD32->driveA.writeProtect;
			ret = ExtractFileName(Settings->PMD32->driveA.image);
			break;
		case 2:
			ptr->state = Settings->PMD32->driveB.writeProtect;
			ret = ExtractFileName(Settings->PMD32->driveB.image);
			break;
		case 3:
			ptr->state = Settings->PMD32->driveC.writeProtect;
			ret = ExtractFileName(Settings->PMD32->driveC.image);
			break;
		case 4:
			ptr->state = Settings->PMD32->driveD.writeProtect;
			ret = ExtractFileName(Settings->PMD32->driveD.image);
			break;
		default:
			break;
	}

	return ret;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::openOutput1Click(TObject *Sender)
{// open output
  if (OpenDialog1->Execute())
  {
    Table2->Active=false;
    fileout=OpenDialog1->FileName;
    if (FileExists(fileout))
    {
      AnsiString filename2=ExtractFileName(fileout);
//      if(Session->IsAlias(filename2))
//      {
//        Table2->DatabaseName=filename2;
//        Table2->TableName=filename2;
//      }
//      else
//      {
//        Session->AddStandardAlias(filename2,ExtractFilePath(fileout),"");
//      }
//      Table2->Active=true;
//      Table2->TableType=ttDBase;
      Table2->DatabaseName=ExtractFilePath(fileout);//filename2;
      Table2->TableName=ExtractFileName(fileout);
      Table2->Active=true;
    }
  }
}
Beispiel #3
0
//---------------------------------------------------------------------------
void __fastcall TFormMain::ExportCFileClick(TObject *Sender)
{
  if (ExportDialog->Execute())
  {
    TStringList* SL = new TStringList;
    __try
    {
      ChangeFileExt(ExtractFileName(ExportDialog->FileName), "");

      SL->Add(Format("YETI_ROM rom_map_t %s = {", ARRAYOFCONST((
        ChangeFileExt(ExtractFileName(ExportDialog->FileName), "")))));

      SL->Add(Format("\"%s\",\"%s\",\"%s\",{", ARRAYOFCONST((
        "Test Map",
        "Derek J. Evans",
        "Welcome to Yeti3D"))));

      for (int y = 0; y < YETI_MAP_HEIGHT; y++)
      {
        SL->Add("{");
        for (int x = 0; x < YETI_MAP_WIDTH; x++)
        {
          cell_t* cell = &yeti->cells[y][x];

          SL->Add(Format("{%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d},", ARRAYOFCONST((
            cell->swi,
            cell->ent,
            cell->top,
            cell->mid,
            cell->bot,
            cell->lit,
            cell->wtx,
            cell->ttx,
            cell->mtx,
            cell->btx,
            0,  // Reserved 1            
            0   // Reserved 2
            ))));
        }
        String S =  SL->Strings[SL->Count - 1];
        SL->Strings[SL->Count - 1] = S.SubString(1, S.Length() - 1);
        SL->Add("},");
      }
      String S =  SL->Strings[SL->Count - 1];
      SL->Strings[SL->Count - 1] = S.SubString(1, S.Length() - 1);
      SL->Add("}};");
      
      SL->SaveToFile(ExportDialog->FileName);
    }
    __finally
    {
      SL->Free();
    }
  }  
Beispiel #4
0
void __fastcall TMainForm::ButtonAddDocClick(TObject *Sender)
{
  if (OraQueryAllJournal->RecordCount == 0)
  {
    ShowMessage ("Не выбрана запись !");
    return;
  }

  Screen->Cursor = crHourGlass;

  OpenDialogDocs->Filter = "All files (*.*)|*.*||";
  if (OpenDialogDocs->Execute())
  {
    for (int i = 0; i < OpenDialogDocs->Files->Count; i++)
    {
      OraQueryDocsInsert->SQL->Text = "SELECT DOC_NAME FROM " + m_shema + "." + m_blob_table + " WHERE DOC_NAME = '" +
                                      ExtractFileName(OpenDialogDocs->Files->Strings[i].c_str()) +
                                      "' AND " + m_blob_foreign_key + " = " + OraQueryAllJournal->Fields->FieldByName(m_primary_key)->AsString;

      OraQueryDocsInsert->Open();
      if (OraQueryDocsInsert->RecordCount)
      {
        ShowMessage ("Файл " + ExtractFileName(OpenDialogDocs->Files->Strings[i].c_str()) + " уже существует !");
        OraQueryDocsInsert->Close();
        continue;
      }

      OraQueryDocsInsert->Close();
      OraQueryDocsInsert->SQL->Clear();

      OraQueryDocsInsert->Open();
      OraQueryDocsInsert->Insert();

      TFields *fields = OraQueryDocsInsert->Fields;
      TBlobField *t = (TBlobField*)(fields->FieldByName("DOC_TEXT"));
      t->LoadFromFile(OpenDialogDocs->Files->Strings[i].c_str());

      OraQueryDocsInsert->FieldValues [m_blob_foreign_key] = OraQueryAllJournal->Fields->FieldByName (m_primary_key)->AsString;
      OraQueryDocsInsert->FieldValues ["DOC_NAME"] = ExtractFileName(OpenDialogDocs->Files->Strings[i].c_str());

      OraQueryDocsInsert->Post();
      OraQueryDocsInsert->Close();
    }
  }

  OraQueryDocs->Close();
  OraQueryDocs->Open();

  Screen->Cursor = crDefault;
}
void doc2txt::convertPro(AnsiString WordFile,AnsiString PathPutTxt)
{
	TStringList* word=new TStringList;
	String filename = WordFile;
	Variant  vVarApp,vVarDoc,vVarParagraphs,vVarParagraph;
	AnsiString resolution = ExtractFileExt(filename);
	AnsiString str = StringReplace( ExtractFileName(filename),resolution,"",TReplaceFlags()<< rfReplaceAll << rfIgnoreCase);

	try
	{
		vVarApp=CreateOleObject("Word.Application");
	}
	catch(...)
	{
		MessageBox(0, "Не удачно получилось открыть Word", "Внимание", MB_OK);
		return;
	}

	vVarApp.OlePropertySet("Visible",false);
	vVarDoc = vVarApp.OlePropertyGet("Documents");
	vVarDoc.OleProcedure("Open", StringToOleStr(filename));
	vVarDoc = vVarDoc.OleFunction("Item",1);
	vVarDoc.OleProcedure("Activate");
	String s = vVarDoc.OlePropertyGet("Content").OlePropertyGet("Text");
	word->Add(s);
	word->SaveToFile( PathPutTxt + str +".txt" );
	vVarApp.OleProcedure("Quit");
	delete word;
}
Beispiel #6
0
wxString FindDiskFileCaseInsensitive(wxString const & Filename)
{
	wxString result = "";
	wxString ShortFilename;
	wxString CurDir;
	wxDir dir;
	CurDir = ExtractFilePath(Filename);
	wxArrayString FileList;
	dir.GetAllFiles(CurDir, &FileList, GetAllFilesMask(), wxDIR_DEFAULT);

	for (size_t i = 0; i < FileList.GetCount(); i++)
	{
		ShortFilename = ExtractFileName(Filename);
		if (CompareText(FileList[i], ShortFilename) == 0)
		{
			if (CompareStr(FileList[i], ShortFilename) == 0)
			{
				// fits exactly
				result = Filename;
				break;
			}
			// fits case insensitive
			result = CurDir + FileList[i];
			// search further
		}
	}
	return result;
}
Beispiel #7
0
//
// Note: This does not aggregate the samples
//
bool GetProcessInfoMap(CpuProfileReader&    profileReader,
                       bool                 sepByCore,
                       gtUInt64             coreMask,
                       PidProcessInfoMap&   procInfoMap)
{
    GT_UNREFERENCED_PARAMETER(coreMask);
    bool retVal = false;
    gtUInt32 numCores = profileReader.getProfileInfo()->m_numCpus;
    gtUInt32 dataSize = (sepByCore) ? (numCores * profileReader.getProfileInfo()->m_numEvents)
                        : profileReader.getProfileInfo()->m_numEvents;

    PidProcessMap* procMap = profileReader.getProcessMap();

    if (nullptr != procMap)
    {
        for (PidProcessMap::const_iterator it = procMap->begin(); it != procMap->end(); it++)
        {
            ProcessInfo procInfo;
            ExtractFileName((*it).second.getPath(), procInfo.m_processName);
            procInfo.m_pid = (*it).first;
            procInfo.m_hasCSS = (*it).second.m_hasCss;
            procInfo.m_is32Bit = (*it).second.m_is32Bit;

            procInfo.m_dataVector.resize(dataSize);

            procInfoMap.insert(PidProcessInfoMap::value_type(procInfo.m_pid, procInfo));
        }

        retVal = true;
    }

    return retVal;
}
void __fastcall TForm1::OpenPicture1Click(TObject *Sender)
{
    OpenPictureDialog1->Filter =
       "Bmp files (*.bmp)|*.BMP| JPEG images (*.jpg) | *.jpg; " ;
    if (OpenPictureDialog1->Execute())
    {
        if (!FileExists(OpenPictureDialog1->FileName))
            return;
        AnsiString temp2 = ExtractFileName(OpenPictureDialog1->FileName);
        AnsiString temp = ExtractFileExt(OpenPictureDialog1->FileName);
        AnsiString Ext = temp.LowerCase();

        if (Ext.AnsiPos("jpg") > 0)
        {
            TJPEGImage *myjpeg = new TJPEGImage();
            myjpeg->LoadFromFile(OpenPictureDialog1->FileName);
            myjpeg->DIBNeeded();
            Image1->Picture->Bitmap->Assign(myjpeg);
            delete myjpeg;
        }
        else if (Ext.AnsiPos("bmp") > 0)
        {
            Image1->Picture->Bitmap->LoadFromFile(OpenPictureDialog1->FileName);
        }
    }
        {
        Undo1->Enabled=false; //apenergopoioume ta undo/redo
        Redo1->Enabled=false;
        ToolUndo->Enabled=false;
        ToolRedo->Enabled=false;
        }
}
Beispiel #9
0
/*
** static void MakeDestFileName(char ARG_PTR *argv[], char ARG_PTR *pszDest);
**
** Create the appropriate destination file name.
**
** Arguments:  argv    - like argument to main()
**             pszDest - pointer to destination file name buffer to be filled
**                       in
**
** Returns:    void
**
** Globals:    none
*/
static VOID MakeDestFileName(CHAR ARG_PTR *argv[], CHAR ARG_PTR *pszDest)
{
   CHAR ARG_PTR *pszDestFile;

   if (nNumFileSpecs == 2 && bTargetIsDir == FALSE && bDoRename == FALSE)
      // Compress a single input file to a single output file.  N.b., we must
      // be careful to eat up the output file name command-line argument so
      // it doesn't get processed like another input file!
      STRCPY(pszDest, argv[GetNextFileArg(argv)]);
   else if (bTargetIsDir == TRUE)
   {
      // Prepend output file name with destination directory path name.
      STRCPY(pszDest, pszTargetName);

      // Isolate source file name from source file specification.
      pszDestFile = ExtractFileName(pszInFileName);

      // Add destination file name to destination directory path
      // specification.
      MakePathName(pszDest, pszDestFile);
   }
   else
      // Destination file name same as source file name.  N.b., this is an
      // error condition if (bDoRename == FALSE).
      STRCPY(pszDest, pszInFileName);
}
Beispiel #10
0
bool __fastcall TForm1::kcFileCheck(AnsiString FileName)
{
        //TODO: Add your source code here
                if (!FileExists(FileName))
                return false;

 AnsiString str1,str2;

        FILE *fp;

        if(fp=fopen(FileName.c_str(),"r"))  //rt:r=只读 t=文本模式
                      str2=fgets(str1.c_str(),4,fp);

              fclose(fp);

        if(AnsiString(str2)!="01L" && AnsiString(str2)!="01B")
        {
          ErrorReport(ExtractFileName(FileName),0,"非接驳文件");
          //ADOQuery1->SQL->Text="select * from ErrorReport";
          //ADOQuery1->Open();
          return false;
        }

        return true;
}
//---------------------------------------------------------------------------
void __fastcall TCPRecib1::PHDS1BeforePost( TObject*  Sender )
{
  if( !FileExists( String( PHDS1->GV( RECIB_ARQUIVO ) ) ) )
   {
    FileClose( FileCreate( String( PHDS1->GV( RECIB_ARQUIVO ) ) ) );
   }

  if( PHDS1->State == phEdit )
   {
    if(W1->Documents->Count)
     {
      for(int f = 1; f <= W1->Documents->Count; f++)
       {
        if((String)W1->Documents->Item((OleVariant)f)->Name == ExtractFileName(PHDS1->GV(RECIB_ARQUIVO)))
         {
          /*quando o usuário deixou o word aberto e não salvou
            as alterações nele, salva automaticamente e fecha o word*/
          if(WordDocument1->Saved == false)
           WordDocument1->Save();
           
          W1->Disconnect();
          break;
         }
       }
     }
   }
}
Beispiel #12
0
void __fastcall TForm1::expLicExecute(TObject *Sender)
{
    //
    TListItem *it;
    //
    // remove entry
    it=lst->Selected;
    if(!removeLicense(localFile.c_str(),(int)it->Data,/*ignored*/1)){
        return;
    }
    pmc_license_t lic;
    memset(&lic, 0, sizeof lic);
    lic.count=1;
    lic.runLevel=StrToInt(it->SubItems->Strings[0]);
    lic.devLevel=StrToInt(it->SubItems->Strings[1]);
    strncpy(lic.comment,it->SubItems->Strings[2].c_str(),sizeof lic.comment);
    if(!insertLicense(remoteFile.c_str(),&lic)){
        insertLicense(localFile.c_str(),&lic);
    }
    scanLocalLicenses();
    scanRemoteLicenses();
#if 0
    /* create autorun.inf */
    AnsiString autoRun=Form3->lst->Text+"autorun.inf";
    if(!file_exists(autoRun.c_str())){
        AnsiString s;
        s=ExtractFileName(Application->ExeName);
        WritePrivateProfileString("autoRun","open",(s+" -autorun").c_str(),autoRun.c_str());
        CopyFile(Application->ExeName.c_str(),(Form3->lst->Text+s).c_str(),TRUE);
    }
#endif
}
void TSettings::SaveToFile() {
    TSettings *Settings = TSettings::Instance();
    TIniFile *ini = new TIniFile(".\\settings.cfg");

    ini->WriteBool("Global", "FullScreen", Settings->Fullscreen);
    ini->WriteInteger("Global", "Width", Settings->FormsWidth);
    ini->WriteInteger("Global", "Height", Settings->FormsHeight);
    ini->WriteInteger("Global", "Left", Settings->FormsLeft);
    ini->WriteInteger("Global", "Top", Settings->FormsTop);
    ini->WriteBool("Global", "Sound", Settings->SoundEnabled);
    ini->WriteInteger("Global", "SoundVolume", Settings->SoundVolume);
    ini->WriteBool("Global", "Music", Settings->MusicEnabled);
    ini->WriteInteger("Global", "MusicVolume", Settings->MusicVolume);
    ini->WriteBool("Global", "HostMode", Settings->HostMode);
    ini->WriteString("Global", "LastBase", Settings->LastBase);

    for (int i = 1; i <= 5; i++) {
        ini->WriteString("Players", "Player" + IntToStr(i), Settings->PlayerNames[i - 1]);
        ini->WriteInteger("Players", "PlayerType" + IntToStr(i), (int) Settings->PlayerType[i - 1]);
    }

    int i = 0;
    for (std::map <String, String> ::iterator it = BaseFiles.begin(); it != BaseFiles.end(); ++it) {
        ini->WriteString("Bases", "basename" + IntToStr(i), it->first);
        ini->WriteString("Bases", "base" + IntToStr(i), ExtractFileName(it->second));
        ++i;
    }
    ini->Free();

}
Beispiel #14
0
//---------------------------------------------------------------------------
__fastcall THttpTestForm::THttpTestForm(TComponent* Owner)
    : TForm(Owner)
{
    FIniFileName = LowerCase(ExtractFileName(Application->ExeName));
    FIniFileName.SetLength(FIniFileName.Length() - 3);
    FIniFileName = FIniFileName + "ini";
}
Beispiel #15
0
//---------------------------------------------------------------------------
void __fastcall TForm1::AbZipOutline1DblClick(TObject *Sender)
{
  bool Restoring;
  String TempDir, SaveDir;
  char TempPath[256];
  String TempName;

  GetTempPath(sizeof(TempPath), TempPath);
  SaveDir = TempPath;
  if (SaveDir[SaveDir.Length()] == '\\')
    SaveDir.Delete(SaveDir.Length(), 1);

  if (AbZipOutline1->SelectedZipItem) {
    TempDir = AbZipOutline1->BaseDirectory;
    Restoring = AbZipOutline1->ExtractOptions.Contains(eoRestorePath);
    AbZipOutline1->ExtractOptions =
      AbZipOutline1->ExtractOptions >> eoRestorePath;
    AbZipOutline1->BaseDirectory = SaveDir;
    try {
      AbZipOutline1->ExtractFiles(AbZipOutline1->SelectedZipItem->FileName);
      TempName = AbZipOutline1->SelectedZipItem->FileName;
      AbUnfixName(TempName);
      ShellExecute(Application->MainForm->Handle, NULL,
                    ExtractFileName(TempName).c_str(),
                    "", SaveDir.c_str(), SW_SHOWNORMAL);
    }
    catch (...) {
      AbZipOutline1->BaseDirectory = TempDir;
    }
    AbZipOutline1->BaseDirectory = TempDir;
    if (Restoring)
      AbZipOutline1->ExtractOptions = AbZipOutline1->ExtractOptions << eoRestorePath;
  }
Beispiel #16
0
void __fastcall TfrmMain::LoadFromFile(const AnsiString Filename)
{
  Screen->Cursor = crHourGlass;
  Enabled = false;
  try
  {
    JvTreeView1->Items->BeginUpdate();
    try
    {
      JvSimpleXml1->LoadFromFile(Filename);
      JvTreeView1->Items->Clear();
      ParseIntoTreeView(JvSimpleXml1->Root, JvTreeView1->Items->Add(NULL, ExtractFileName(Filename)));
    }
    __finally
    {
      JvTreeView1->Items->EndUpdate();
    }
    JvTreeView1->FullExpand();
  }
  __finally
  {
    Screen->Cursor = crDefault;
    Enabled = true;
  }

}
Beispiel #17
0
//---------------------------------------------------------------------------
void __fastcall TFormGrepStringsDialog::PutFileNameInCaption(AnsiString FileName)
{
        //TODO: Add your source code here
  if (DataOfFUU==NULL)   return;
  if (DataOfFUU->Target_Filename != "")
      Caption = InternalCaption + " - [ "+ ExtractFileName(FileName) +" ]";
}
Beispiel #18
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;
}
Beispiel #19
0
void __fastcall TfrmSpeedTest::AddInfo(const AnsiString FileName, bool Decode,
  __int64 FileSize, Cardinal MSecs, bool AddRow)
{
  const char* cDecoded[2] = {"Encoded", "Decoded"};

  Extended Speed, KBSpeed;

  if (MSecs == 0)
  {
    Speed = FileSize;
    KBSpeed = FileSize / 1024.0;
  }
  else
  {
    Speed = FileSize / static_cast<Extended>(MSecs);
    KBSpeed = (FileSize / 1024.0) / (MSecs / 1000.0);
  }
  if (AddRow)
    sgResults->RowCount = sgResults->RowCount + 1;
  int i = sgResults->RowCount - 1;
  sgResults->Cells[0][i] = ExtractFileName(FileName);
  sgResults->Cells[1][i] = IntToStr(FileSize);
  sgResults->Cells[2][i] = cDecoded[Decode];
  sgResults->Cells[3][i] = IntToStr(MSecs);
  sgResults->Cells[4][i] = IntToStr(static_cast<__int64>(floor(Speed)));
  sgResults->Cells[5][i] = Format("%.*f", ARRAYOFCONST((1 + (KBSpeed < 1)?1:0, KBSpeed)));
}
Beispiel #20
0
void __fastcall TFrmMain::PopupMenu1Popup(TObject* Sender)
{
    if (OpenOk == true)
    {
        AnsiString  iniSetFile = ExtractFilePath(Application->ExeName) + "BcdEditer.ini";
        AnsiString SectionName = ExtractFileName(CurrentOpenFile);
        int ColType;
        TIniFile* ini;
        ini = new TIniFile(iniSetFile);
        ColType = ini->ReadInteger(SectionName, "ColType" + IntToStr(sgEdit->Col), 0);
        delete ini;
        switch (ColType)
        {
            case 0:
                btIntType->Checked = true;
                btFloatType->Checked = false;
                btTxtType->Checked = false;
                break;
            case 1:
                btIntType->Checked = false;
                btFloatType->Checked = true;
                btTxtType->Checked = false;
                break;
            case 2:
                btIntType->Checked = false;
                btFloatType->Checked = false;
                btTxtType->Checked = true;
                break;
            default:
                btIntType->Checked = true;
                btFloatType->Checked = false;
        }
    }
}
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
    : TForm(Owner)
{
    // Build Ini file name
    FIniFileName = LowerCase(ExtractFileName(Application->ExeName));
    FIniFileName = FIniFileName.SubString(1, FIniFileName.Length() - 3) + "ini";
}
Beispiel #22
0
//---------------------------------------------------------------------------
wString& wString::ExtractFileName(char* str, const char* delim)
{
    wString* tmp;
    tmp = NextSac();
    *tmp = str;
    return ExtractFileName(*tmp, delim);
}
const Utf8String ExtractFileNameNoExt(const Utf8String& fileName)
{
	Utf8String result = ExtractFileName(fileName);
	int Qpos = result.find_last_of('.');
	if(Qpos>=0) result = result.substr(0, Qpos);
	return result;
}
Beispiel #24
0
void TOrdEntryForm::UpdateFileName(TFileName FName)
{
  CurFile = FName;
  char buff[MAX_PATH];
  sprintf(buff, "Order Entry Demo - %s", ExtractFileName(FName).c_str());
  OrdEntryForm->Caption = buff;
}
//simvan gia tin apothikeusi tis eikonas otan patiete to save
//dinatotita gia apothikeusi se bmp & jpg morfi
void __fastcall TForm1::SavePic1Click(TObject *Sender)
{
  SavePictureDialog1->Title = "Save Image";
  SavePictureDialog1->DefaultExt = "jpg";
  SavePictureDialog1->Filter =
       "JPEG images (*.jpg) | *.jpg; | Bmp files (*.bmp)|*.BMP" ;
  SavePictureDialog1->FilterIndex = 1;
    if (SavePictureDialog1->Execute())
    {
        AnsiString temp2 = ExtractFileName(SavePictureDialog1->FileName);
        AnsiString temp = ExtractFileExt(SavePictureDialog1->FileName);
        AnsiString Ext = temp.LowerCase();

        if (Ext.AnsiPos("jpg") > 0)
        {
            TJPEGImage *jp = new TJPEGImage();
            try
            {
              jp->Assign(Image1->Picture->Bitmap);
              jp->SaveToFile(SavePictureDialog1->FileName);
            }
            __finally
            {
              delete jp;
            }
        }
//---------------------------------------------------------------------------
void __fastcall TForm1::Open1Click(TObject *Sender)
{// open input
  if (OpenDialog1->Execute())
  {
    filein=OpenDialog1->FileName;
  Table1->Active=false;
    AnsiString filename2=ExtractFileName(filein);
//    if(!FileExists(filename2))
//    {
      if(Session->IsAlias(filename2))
      {
        Table1->DatabaseName=filename2;
        Table1->TableName=filename2;
      }
      else
      {
        Session->AddStandardAlias(filename2,ExtractFilePath(filein),"");
      }
      Table1->Active=true;
//      Table1->TableType=ttDBase;
      Table1->TableName=filename2;
      Table1->DatabaseName=filename2;
//    }
  }
}
Beispiel #27
0
//---------------------------------------------------------------------------
void __fastcall TForm1::FormKeyPress(TObject *Sender, char &Key)
{
if (Key == 32 && Timer1->Enabled )
        {
                Timer1->Enabled = false;
                Image2->Picture->LoadFromFile("pic\\"+MainPath  );
                AnsiString FileName=ExtractFileName(MainPath);
                AnsiString FileExt=ExtractFileExt(MainPath);
                TReplaceFlags   rf; 
                rf   <<   rfReplaceAll;
                FileName=StringReplace( FileName, FileExt, "",   rf   );
                ShowMessage("恭喜您抽中 "+FileName);
                ADOQuery1->SQL->Text = "delete from MainTable where path = '" + MainPath +"' AND id="+IntToStr(uid);
                ADOQuery1->ExecSQL() ;
                ADOQuery1->SQL->Text = "insert into SecondTable (path,id) values ('" + MainPath +"','"+ uid +"')";
                ADOQuery1->ExecSQL() ;

        }
else if (Key == 32 && Timer1->Enabled == false)
        {

        Timer1->Enabled = true;
        }

}
Beispiel #28
0
//===========================================================================
void Tform_Main::ReadDataFromRegistry()
{
    AnsiString Name;
    TRegistry *Reg = NULL;
    try {
        try {
           Reg = new TRegistry;
           AnsiString appName = ExtractFileName(Application->ExeName);
           appName.SetLength(appName.Length() - 4);

           Reg->RootKey = HKEY_LOCAL_MACHINE;
           Reg->OpenKey("Software\\InnalabsUA\\ccg_QFactor", true);

            DFT_DeltaFreq = Reg->ReadFloat("DFT_DeltaFreq");

            DTF_InterpolationPointsCount = Reg->ReadInteger("DTF_InterpolationPointsCount");
            FFT_MaxPointsCount = Reg->ReadInteger("FFT_MaxPointsCount");
            SoundCardIndex = Reg->ReadInteger("SoundCardIndex");
            FreqSoundCardIndex = Reg->ReadInteger("FreqSoundCardIndex");

       } catch ( ... ){
            Reg->CloseKey();
            SaveDataToRegistry();
        }
    } __finally {
        Reg->CloseKey();
        if (Reg != NULL)
            delete Reg;
    }
}
const mr_string mr_exception::fileName() const
{
	// We never use this value to open a file so we are safe to always convert its width.
	mr_stringstream ss;
	ToStream( ss, ExtractFileName( m_fileName ) );
	return ss.str();
}
Beispiel #30
0
void OnDropFile (DWORD wParam)
   {
   TCHAR FileName [FilePathLen + 1] ;
   LPTSTR         pFileNameStart ;
   HANDLE         hFindFile ;
   WIN32_FIND_DATA FindFileInfo ;
   int            NameOffset ;
   int            NumOfFiles = 0 ;

   NumOfFiles = DragQueryFile ((HDROP) wParam, 0xffffffff, NULL, 0) ;
   if (NumOfFiles > 0)
      {
      // we only open the first file for now
      DragQueryFile((HDROP) wParam, 0, FileName, FilePathLen) ;

      pFileNameStart = ExtractFileName (FileName) ;
      NameOffset = pFileNameStart - FileName ;

      // convert short filename to long NTFS filename if necessary
      hFindFile = FindFirstFile (FileName, &FindFileInfo) ;
      if (hFindFile && hFindFile != INVALID_HANDLE_VALUE)
         {
         // append the file name back to the path name
         lstrcpy (&FileName[NameOffset], FindFileInfo.cFileName) ;
         FindClose (hFindFile) ;
         }

      FileOpen (hWndMain, (int)0, (LPTSTR)FileName) ;
      PrepareMenu (GetMenu (hWndMain));
      }

   DragFinish ((HDROP) wParam) ;
   }