//--------------------------------------------------------------------------- void __fastcall TfrmMain::JvAppInstancesInstanceDestroyed(TObject *Sender, DWORD ProcessId) { MemoLog->Lines->Add("Instance destroyed (Pid: " + IntToStr(ProcessId) + ")"); MaxInstances->Caption = Format("%d", ARRAYOFCONST(((int)(JvAppInstances->MaxInstances)))); RunningInstances->Caption = Format("%d", ARRAYOFCONST(((int)(JvAppInstances->AppInstances->InstanceCount)))); }
//--------------------------------------------------------------------------- void __fastcall TfrmMain::FormCreate(TObject *Sender) { Caption = "Pid: " + IntToStr(GetCurrentProcessId()); CheckBoxActive->Checked = JvAppInstances->Active; MaxInstances->Caption = Format("%d", ARRAYOFCONST(((int)(JvAppInstances->MaxInstances)))); RunningInstances->Caption = Format("%d", ARRAYOFCONST(((int)(JvAppInstances->AppInstances->InstanceCount)))); }
void __fastcall TFlyingSeatCalcForm::meLsPrimeExit(TObject *Sender) { String fLeftForm, fRightForm, fFormula; // The left, Right and complete formulas if(ResultInKgs) // If we want the total result converted to Kgs { fLeftForm = GetFormula(efLsPrime, efLsLbs, rbLsKgs, rbLsLbs, "", " / 2" + (String)dxFormatSettings->DecimalSeparator + "2"); // Get the Left hand seat formula fRightForm = GetFormula(efRsPrime, efRsLbs, rbRsKgs, rbRsLbs, "", " / 2" + (String)dxFormatSettings->DecimalSeparator + "2"); // Get the right hand seta formula } else { // Result in Lbs fLeftForm = GetFormula(efLsPrime, efLsLbs, rbLsKgs, rbLsLbs, " * 2" + (String)dxFormatSettings->DecimalSeparator + "2", ""); // Get Left seat fRightForm = GetFormula(efRsPrime, efRsLbs, rbRsKgs, rbRsLbs, " * 2" + (String)dxFormatSettings->DecimalSeparator + "2", ""); // Get right seat } if ((fLeftForm.Length() > 0) && (fRightForm.Length() > 0)) // If both seats return a formula fFormula = Format(String("(%s) + %s"), ARRAYOFCONST((fLeftForm, fRightForm))); // weld them together else if (fLeftForm.Length() > 0) // If left has the result fFormula = fLeftForm; // Copy to the forlula else fFormula = fRightForm; // Right has the result, copy btnOk->Enabled = fFormula.Length() > 0; // enable the OK button if we have a result to return if (btnOk->Enabled) // We have a result efFormula->Text = Format(String("= %s"), ARRAYOFCONST((fFormula))); // Ensure sheet knows it's a formula else efFormula->Text = ""; // Nothing ! }
/* Format and display all of the students in the student list. */ void TfrmObjAllocMain::DumpStudents(void) { lstStudents->Items->BeginUpdate(); lstStudents->Clear(); // empty the list // Format each student record and display it in the list for (int i = 0; i < FStudents->Count; i++) { PStudent student = reinterpret_cast<PStudent>( FStudents->Items[i]); AnsiString s; if (chkShowAddresses->Checked) { if (chkMemoryDump->Checked) s = Format("(%p) %.8X %.8X %.8X %.8X", ARRAYOFCONST((student, student->Age, student->Year, *(int *)(&student->GPA), student->ID))); else s = Format("(%p) Age: %d, Year=%d, GPA=%1.2f, ID: %.3d", ARRAYOFCONST((student, student->Age, student->Year, student->GPA, student->ID))); } else { if (chkMemoryDump->Checked) s = Format("%.8X %.8X %.8X %.8X", ARRAYOFCONST((student->Age, student->Year, *(int *)(&student->GPA), student->ID))); else s = Format("Age: %d, Year=%d, GPA=%1.2f, ID: %.3d", ARRAYOFCONST((student->Age, student->Year, student->GPA, student->ID))); } lstStudents->Items->Add(s); } lblAllocated->Caption = IntToStr(FStudents->Count); lstStudents->Items->EndUpdate(); AdjustStudentsScrollbar(); Application->ProcessMessages(); }
/* Format and display all of the free blocks on the free list. */ void TfrmObjAllocMain::DumpFreeList(void) { PStudent student; lstFreeList->Items->BeginUpdate(); lstFreeList->Clear(); lstFreeList->Items->EndUpdate(); if (!FStudentObjectMgr) return; PStudent head = const_cast<PStudent>(reinterpret_cast<const TStudent *>(FStudentObjectMgr->GetFreeList())); lstFreeList->Items->BeginUpdate(); // Format each node on the free list and display its contents while (head) { student = head; AnsiString s; if (chkShowAddresses->Checked) s = Format("(%p) %.8x %.8x %.8x %.8x", ARRAYOFCONST((student, student->Age, student->Year, *(int *)&student->GPA, student->ID))); else s = Format("%.8x %.8x %.8x %.8x", ARRAYOFCONST((student->Age, student->Year, *(int *)&student->GPA, student->ID))); lstFreeList->Items->Add(s); head = reinterpret_cast<PStudent>(head->Age); } lstFreeList->Items->EndUpdate(); Application->ProcessMessages(); }
void __fastcall TAcquireThread::Draw() { switch(mm) { case 0: // StatusRecForm->Label1->Caption = s; // StatusRecForm->Label2->Caption = s1; break; case 1: StatusRecForm->Close(); MainForm->StartMonitoring(); break; case 2: // StatusRecForm->Label2->Caption = "Количество блоков " + IntToStr // (num_blocks); break; case 3: // StatusRecForm->ProgressBar1->Position = pos; break; case 4: TFormatSettings FormatSettings; GetLocaleFormatSettings(GetSystemDefaultLCID(), FormatSettings); FormatSettings.ThousandSeparator = 160; FormatSettings.CurrencyString = ""; FormatSettings.CurrencyDecimals = 0; MainForm->ListView2->Items->Item[0]->SubItems[0].Text = FloatToStr(t) + " нс"; MainForm->ListView2->Items->Item[1]->SubItems[0].Text = FloatToStrF (AcfParams._time * 1e-6, ffFixed, 5, 2) + " с"; MainForm->ListView2->Items->Item[2]->SubItems[0].Text = Format ("%m", ARRAYOFCONST((double(AcfParams.vybr))), FormatSettings); MainForm->ListView2->Items->Item[3]->SubItems[0].Text = FloatToStr (AcfParams.zashk / n0 * 100) + "%"; MainForm->ListView2->Items->Item[4]->SubItems[0].Text = Format ("%m", ARRAYOFCONST((1e6 * n1 / AcfParams._time)), FormatSettings); MainForm->ListView2->Items->Item[5]->SubItems[0].Text = Format ("%m", ARRAYOFCONST((double(n1))), FormatSettings); int ind = 0; for (int i = 0; i < n1; i++) { if (RawData_t.a[i] > 1e6) { ind = i - 1; break; } } int m = Floor(ind / 1e3); MainForm->Series1->Clear(); for (int i = 0; i < 1e3; i++) { if (!(RawData.a[i * m] == 0)) { MainForm->Series1->AddXY(RawData_t.a[i * m] * 1e-6, 1e9 / (RawData.a[i * m] * t)); } else { MainForm->Series1->AddNullXY(RawData_t.a[i * m] * 1e-6, 0); } } break; } }
void __fastcall TForm7::TestCompress(TZCompressionLevel ACompressionLevel) { // Stream hodling the source data std::auto_ptr<TStringStream> LUncompressed(new TStringStream()); LUncompressed->WriteString(Memo1->Text); LUncompressed->Position = 0; // Stream to hold the compressed data std::auto_ptr<TMemoryStream> LCompressed(new TMemoryStream()); // Performming the compression ZCompressStream(LUncompressed.get(), LCompressed.get(), ACompressionLevel); //-------------- // Decompression //-------------- LCompressed->Position = 0; LUncompressed->Clear(); ZDecompressStream(LCompressed.get(), LUncompressed.get()); Memo2->Text = LUncompressed->DataString; //--------- // Logging //--------- ListBox1->Items->Add(Format("Sizes: %d / %d / %d", ARRAYOFCONST((Memo1->Text.Length(), LCompressed->Size, Memo2->Text.Length())))); ListBox1->Items->Add(Format("Ratio: %f", ARRAYOFCONST((LCompressed->Size / (double)Memo1->Text.Length())))); String UnHash = THashBobJenkins::GetHashString(Memo1->Text); String DeHash = THashBobJenkins::GetHashString(Memo2->Text); // Test the hashes if (UnHash == DeHash) ListBox1->Items->Add(Format("Hashes: %s / %s Match", ARRAYOFCONST((UnHash, DeHash)))); else ListBox1->Items->Add(Format("Hashes: %s / %s FAIL", ARRAYOFCONST((UnHash, DeHash)))); }
//--------------------------------------------------------------------------- void __fastcall TfrmMain::JvAppInstancesRejected(TObject *Sender) { ShowMessage("I was rejected (Pid: " + IntToStr(GetCurrentProcessId()) + ").\n" + "Now I call UserNotify(100)"); JvAppInstances->UserNotify(100); MaxInstances->Caption = Format("%d", ARRAYOFCONST(((int)(JvAppInstances->MaxInstances)))); RunningInstances->Caption = Format("%d", ARRAYOFCONST(((int)(JvAppInstances->AppInstances->InstanceCount)))); }
//--------------------------------------------------------------------------- void __fastcall TLifeForm::LifeEngineUpdate(TObject * Sender) { FLifeBoard = FLifeEngine->LifeBoard; FGensPerSecond = FLifeEngine->GensPerSecond; FMaxGensPerSecond = FLifeEngine->MaxGensPerSecond; Label2->Text = Format("%f Generations Per Second", ARRAYOFCONST((FGensPerSecond))); Label3->Text = Format("%f Max Generations Per Second", ARRAYOFCONST((FMaxGensPerSecond))); PaintBox1->InvalidateRect(PaintBox1->BoundsRect); }
//--------------------------------------------------------------------------- String BytesToString(const TBytes &B) { String StrReturn = ""; if (B.Length > 0) { StrReturn = Format("%0.2X", ARRAYOFCONST((B[0]))); for (int i = 0; i < B.High; i++) { StrReturn += Format(" %0.2X", ARRAYOFCONST((B[i]))); } } return StrReturn; }
//--------------------------------------------------------------------------- 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(); } }
void __fastcall TFlyingSeatCalcForm::SetInKgs(const bool Value) { fInKgs = Value; // Set var if (fInKgs) { // if we are working in Kgs lblFormula->Caption = "Formula for Kgs"; // Update the label Caption = Format(String("%s Seat Weights in Kgs"), ARRAYOFCONST((fCallSign))); // Set the form caption } else { lblFormula->Caption = "Formula for Lbs"; // Update the label Caption = Format(String("%s Seat Weights in Lbs"), ARRAYOFCONST((fCallSign))); // Set the form caption } }
//--------------------------------------------------------------------------- void __fastcall TPhoneDialerForm::btnGetCarrierInfoClick(TObject *Sender) { _di_IFMXPhoneDialerService PhoneDialerService; /* test whether the PhoneDialer services are supported */ if(TPlatformServices::Current->SupportsPlatformService(__uuidof(IFMXPhoneDialerService)) && (PhoneDialerService = TPlatformServices::Current->GetPlatformService(__uuidof(IFMXPhoneDialerService)))) { /* if yes, then update the labels with the retrieved information */ CarrierNameItem->ItemData->Detail = Format("Carrier Name: %s", ARRAYOFCONST((PhoneDialerService->GetCarrier()->GetCarrierName()))); CountryCodeItem->ItemData->Detail = Format("ISO Country Code: %s", ARRAYOFCONST((PhoneDialerService->GetCarrier()->GetIsoCountryCode()))); NetworkCodeItem->ItemData->Detail = Format("Network Code: %s", ARRAYOFCONST((PhoneDialerService->GetCarrier()->GetMobileCountryCode()))); MobileNetworkItem->ItemData->Detail = Format("Mobile Network: %s", ARRAYOFCONST((PhoneDialerService->GetCarrier()->GetMobileNetwork()))); } }
//--------------------------------------------------------------------------- void __fastcall TFrmAlterPwd::BtnOKClick(TObject *Sender) { AnsiString sqltxt = "update T_en_user set ur_Password=%s where ur_UserID=%s"; if (Lguser.sPwd !=EdtOldPwd->Text) { ShowDlg("原密码有误",DLG_ERROR); EdtOldPwd->SetFocus(); return ; } if (EdtNewPwd->Text!=EdtComfirPwd->Text) { ShowDlg("新密码与确认密码不一致!",DLG_ERROR); EdtNewPwd->SetFocus(); return ; } sqltxt = Format(sqltxt,ARRAYOFCONST((QuotedStr(EdtNewPwd->Text),QuotedStr(Lguser.sLoginNo)))); dmMain->FindBySql(sqltxt,false,NULL); Lguser.sPwd = EdtNewPwd->Text; ShowDlg("密码修改成功",DLG_INFORMATION); ModalResult =mrOk; }
int TMain::CheckPing() { int Result = ID_NO; String Host, Phone, S = ""; ShowWaitCursor(); TFileIni* FileIni = CreateINIFile(); for (int i = 1; i <= FileIni->ReadInteger("DB", "Count", 0); i++) { ProcMess(); Host = FileIni->ReadString("DB", "Ping" + IntToStr(i), ""); if (Host != "") if (!Ping(Host)) S = ConcatStrings(S, Format(IDS_PING_ERROR, ARRAYOFCONST((FileIni->ReadString("DB", "Name" + IntToStr(i), ""), FileIni->ReadString("DB", "Phone" + IntToStr(i), "")))), (String) sLineBreak + (String) sLineBreak); } FileIni->Free(); RestoreCursor(); if (S != "") Result = MsgBox(S + sLineBreak + sLineBreak + LoadStr(IDS_PING_RESULT), MB_YESNOCANCEL | MB_ICONQUESTION); return Result; }
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))); }
// Выход из чата. void OnUserDisconnect(BYTE *InBuffer) { String name; try { //name GetStreamString(&InBuffer, &name); RemoveUserFromChannels(name); // Проверяем, является ли пользователь виртуальным. Если да, то проверяем список отслеживаний каналов. LogicalConnections::iterator connection = FindConnectionByUser(name); if (ConnectionExists(connection)) { UnsetConnectionUser(connection); } RemoveOnlineUser(name); MapList params; params.insert(pair<String, String>("user", name)); String json_object = SetParametersObject(params); SendNotification("user_disconnect", json_object, GetConnectionsRef(true)); } catch (Exception *E) { throw(Format(e_user_disconnect, ARRAYOFCONST((E->Message)))); } }
//--------------------------------------------------------------------- __fastcall TAboutBox::TAboutBox(TComponent* AOwner) : TForm(AOwner) { Caption=Application->Title; VersionInfo *vi=new VersionInfo(AnsiString(Application->ExeName).c_str()); if(vi->hasInfo()) { Label3->Caption=Format(L"Version %d.%d (Build %d.%d)",ARRAYOFCONST(( vi->productMajorVersion(), vi->productMinorVersion(), vi->productBuild(), vi->productSubBuild()))); } delete vi; String s=ChangeFileExt(Application->ExeName,".bmp"); if(FileExists(s)) { logo->Picture->LoadFromFile(s); Label4->Caption="Copyright 2003-2004 ¹è¹È¿Æ¼¼ Corporation"; Label5->Caption=""; } Label1->Caption=Application->Title; Label2->Caption=Application->Title; logo->Active=true; }
void __fastcall TSectionInfoManageFRM::cxButton28Click(TObject *Sender) { if(!cxTextEdit5->Text.IsEmpty()) { STADOT->InsertRecord(ARRAYOFCONST((cxTextEdit5->Text))); } }
// Отключение от канала стороннего или виртуального пользователя. void OnUserChannelDisconnect(BYTE *InBuffer) { String bot, channel, name; try { // virtual user. GetStreamString(&InBuffer, &bot); // channel. GetStreamString(&InBuffer, &channel); if (UserIsMonitoring(bot, channel)) { // name. GetStreamString(&InBuffer, &name); MapList params; params.insert(pair<String, String>("user", name)); params.insert(pair<String, String>("channel", channel)); String json_object = SetParametersObject(params); SendNotification("user_channel_disconnect", json_object, GetChannelConnections(channel)); DeleteUserChannel(name, channel); // If channel watcher was disconnected, then find new watcher. if (name == bot) { ChangeChannelWatcher(channel); } } } catch (Exception *E) { throw(Format(e_user_channel_disconnect, ARRAYOFCONST((E->Message)))); } }
// Подключение к каналу стороннего пользователя. void OnUserChannelConnect(BYTE *InBuffer) { String bot, name, channel, ip, query; DWORD male; try { //virtual user GetStreamString (&InBuffer, &bot); //channel GetStreamString(&InBuffer, &channel); // If this user is channel watcher. if (UserIsMonitoring(bot, channel)) { //name GetStreamString(&InBuffer, &name); //ip GetStreamString(&InBuffer, &ip); //male GetStreamDword(&InBuffer, &male); AddUserChannel(name, channel); MapList params; params.insert(pair<String, String>("user", name)); params.insert(pair<String, String>("channel", channel)); String json_object = SetParametersObject(params); SendNotification("user_channel_connect", json_object, GetChannelConnections(channel)); } } catch (Exception *E) { throw(Format(e_user_channel_connect, ARRAYOFCONST((E->Message)))); } }
// Изменение иконки пользователя. void OnUserSexChanged(BYTE *InBuffer) { String name; DWORD sex; try { //name GetStreamString(&InBuffer, &name); //ip GetStreamString(&InBuffer, NULL); //male GetStreamDword(&InBuffer, NULL); //new male GetStreamDword(&InBuffer, &sex); UpdateOnlineUserSex(name, sex); MapList params; params.insert(pair<String, String>("user", name)); params.insert(pair<String, String>("sex", sex)); String json_object = SetParametersObject(params); SendNotification("user_sex_changed", json_object, GetConnectionsRef(true)); } catch (Exception *E) { throw(Format(e_user_sex_changed, ARRAYOFCONST((E->Message)))); } }
void SetJSONResponseObject(String &result_obj, String method, String id = "") { if (!id.IsEmpty()) { id = ",\"id\":" + SetJSONValue(id); } result_obj = Format("{\"jsonrpc\":\"%s\",\"method\":\"%s\",\"result\":%s%s}", ARRAYOFCONST((json_rpc_version, method, result_obj, id))); }
void CGeoSegment::CreateReportOtm(TStrings *Str) // Создание отчета отметок об участке { if (IsCalculated()) { Str->Add(Format("|%7s|",ARRAYOFCONST((Info.Name.c_str())))+Truba->CreateOtm()); Truba->CreateOtmSoor(Str); } }
void __fastcall TSectionInfoManageFRM::cxButton16Click(TObject *Sender) { if(!SectionNameComboBox1->Text.IsEmpty()&&!ClassNameComboBox->Text.IsEmpty()&&!cxTextEdit2->Text.IsEmpty()) { GroupInfoADOQ->InsertRecord(ARRAYOFCONST((SectionNameComboBox1->Text, ClassNameComboBox->Text, cxTextEdit2->Text))); cxTextEdit2->Text = ""; } }
void __fastcall TSectionInfoManageFRM::cxButton2Click(TObject *Sender) { if((!cxTextEdit6->Text.IsEmpty())&&(!cxTextEdit14->Text.IsEmpty())&&(-1 != cxComboBox1->ItemIndex)) { USERADOQ->Close(); String checksqlstr = "select * from SYSUSER where USERNAME='******'"; USERADOQ->SQL->Clear(); USERADOQ->SQL->Add(checksqlstr); USERADOQ->Open(); if(!USERADOQ->IsEmpty()) { ShowMessage("该用户名已经存在,请更换!"); USERADOQ->Close(); return; } USERADOQ->Close(); if(cxTextEdit14->Text.IsEmpty()||(8!=cxTextEdit14->Text.Length())) { ShowMessage("密码不能为空,且密码长度必须为8位!"); return; } char OLPW[8]; char ENPW[9]; ZeroMemory(OLPW, 8); ZeroMemory(ENPW, 9); String tmppwstr = cxTextEdit14->Text; for(int i=0; i<4; i++) { int tmpint = StrToInt("0x"+tmppwstr.SubString(i*2+1, 2)); IntToUChar(tmpint, &OLPW[i]); } EncrptyCardMMProc(0, OLPW, ENPW); char Inbasechar[17]; ZeroMemory(Inbasechar, 17); for(int t = 0; t<8; t++) { char tmp; tmp = ENPW[t]>>4; tmp = tmp&0x0f; if(tmp >= 10) Inbasechar[t*2] = tmp+55; if(tmp <10) Inbasechar[t*2] = tmp+48; tmp = ENPW[t]&0x0f; if(tmp >= 10) Inbasechar[t*2+1] = tmp+55; if(tmp <10) Inbasechar[t*2+1] = tmp+48; } String stortstr = Inbasechar; USERADOT->InsertRecord(ARRAYOFCONST((cxTextEdit6->Text, Inbasechar, cxComboBox1->ItemIndex+1, cxComboBox1->Text))); }
void TFileVersionInfo::ReadValues(String fname) { ResetValues(); DWORD zeroval; int size = GetFileVersionInfoSize(fname.c_str(), (LPDWORD)&zeroval); if (!size) { FError = true; FErrorMsg = "GetFileVersionInfoSize() failed. " + ECC_DEBUGINFO; return; } char* buf = new char[size+1]; try { if (GetFileVersionInfo(fname.c_str(), 0, size, (LPVOID)buf) == 0) ECC_THROW("GetFileVersionInfo() failed"); /* Get language/codepage: */ struct TeccLangAndCP { WORD wLanguage; WORD wCodePage; } *PeccLangAndCP; UINT LangLen; if (VerQueryValue(buf, "\\VarFileInfo\\Translation", (LPVOID*)&PeccLangAndCP, &LangLen) == 0) ECC_THROW("VerQueryValue() failed while retrieving language/codepage"); /* Get a value: */ String sub_blk = Format("\\StringFileInfo\\%.4x%.4x\\", ARRAYOFCONST((PeccLangAndCP->wLanguage, PeccLangAndCP->wCodePage))); void* val; unsigned int len; for (int i = 0; i < eccFVIKeyStringsCount; i++) { if (VerQueryValue(buf, String(sub_blk + TEccFVIKeyStrings[i]).c_str(), &val, &len)) Values[i] = String((char*)val, len).TrimRight(); //ECC_THROW("VerQueryValue() failed while retrieving value"); else Values[i] = "Error retrieving value of '" + TEccFVIKeyStrings[i] + "'"; } /* Ok: */ delete[] buf; SplitVersionNumber(); } catch(Exception &ex) { FError = true; FErrorMsg = ex.Message; delete[] buf; } }
__fastcall TAboutBox::TAboutBox(TComponent* Owner) : TForm(Owner) { char szVer[80] = {0}; GetFileInfo(szVer, Application->ExeName.c_str(), 0); lbVersion->Caption = lbVersion->Caption + StrPas(szVer); AnsiString sPlatform = ""; int iBuildNumber = 0; switch (Win32Platform) { case VER_PLATFORM_WIN32_WINDOWS: sPlatform = "Windows 95"; iBuildNumber = Win32BuildNumber & 0x0000FFFF; break; case VER_PLATFORM_WIN32_NT: sPlatform = "Windows NT"; iBuildNumber = Win32BuildNumber; break; default: AnsiString sPlatform = "Windows"; break; } if ((Win32Platform == VER_PLATFORM_WIN32_WINDOWS) || (Win32Platform == VER_PLATFORM_WIN32_NT)) { if (Win32CSDVersion == "") lbOS->Caption = Format("%s %d.%d (Build %d)", ARRAYOFCONST((sPlatform, Win32MajorVersion, Win32MinorVersion, iBuildNumber))); else lbOS->Caption = Format("%s %d.%d (Build %d: %s)", ARRAYOFCONST((sPlatform, Win32MajorVersion, Win32MinorVersion, iBuildNumber, Win32CSDVersion))); } else { lbOS->Caption = Format("%s %d.%d", ARRAYOFCONST((sPlatform, Win32MajorVersion, Win32MinorVersion))); } TMemoryStatus MS; GlobalMemoryStatus(&MS); AnsiString sMem = FormatFloat("#,### KB", MS.dwTotalPhys / 1024); while (sMem.Length() < 28) { sMem = " " + sMem; } lbMemory->Caption = "系统可用物理内存: " + sMem; }
void __fastcall TJvShellHookDemoMainForm::DoShellMessage(TObject * Sender, TMessage &Message) { AnsiString S; //begin // with Message do // begin switch(Message.WParam) { // case wParam of case HSHELL_WINDOWCREATED :{ S = "HSHELL_WINDOWCREATED";}break; case HSHELL_WINDOWDESTROYED :{ S = "HSHELL_WINDOWDESTROYED";}break; case HSHELL_ACTIVATESHELLWINDOW:{ S = "HSHELL_ACTIVATESHELLWINDOW";}break; case HSHELL_WINDOWACTIVATED : { S = "HSHELL_WINDOWACTIVATED"; if( reinterpret_cast<HWND >(Message.LParam) == Application->Handle ) { S = S + " (this)"; } }break; case HSHELL_GETMINRECT :{ S = "HSHELL_GETMINRECT";}break; case HSHELL_REDRAW: { if( chkNoRedraw->Checked ) { return; //Exit } else { S = "HSHELL_REDRAW"; } }break; case HSHELL_TASKMAN :{ S = "HSHELL_TASKMAN";}break; case HSHELL_LANGUAGE :{ S = "HSHELL_LANGUAGE";}break; case HSHELL_SYSMENU :{ S = "HSHELL_SYSMENU";}break; case HSHELL_ENDTASK :{ S = "HSHELL_ENDTASK";}break; case HSHELL_ACCESSIBILITYSTATE :{ S = "HSHELL_ACCESSIBILITYSTATE";}break; case HSHELL_WINDOWREPLACED :{ S = "HSHELL_WINDOWREPLACED";}break; case HSHELL_WINDOWREPLACING :{ S = "HSHELL_WINDOWREPLACING";}break; case HSHELL_FLASH :{ S = "HSHELL_FLASH";}break; case HSHELL_RUDEAPPACTIVATED :{ S = "HSHELL_RUDEAPPACTIVATED";}break; case HSHELL_APPCOMMAND :{ S = GetAppCommand(Message.LParam);}break; default: { S = Format("Unknown command ($%.8x)", ARRAYOFCONST( (Message.WParam) ) ); }break; } lvMessages->Items->Add()->Caption = S; int siRowNum = lvMessages->Items->Count - 1; lvMessages->Items->Item[siRowNum]->SubItems->Add(IntToStr(Message.WParam)); lvMessages->Items->Item[siRowNum]->SubItems->Add(IntToStr(Message.LParam)); lvMessages->Items->Item[siRowNum]->SubItems->Add(IntToStr(Message.Result)); lvMessages->Items->Item[siRowNum]->MakeVisible(false); lvMessages->Items->Item[siRowNum]->Selected = true; lvMessages->Items->Item[siRowNum]->Focused = true; }
void __fastcall TSectionInfoManageFRM::cxButton10Click(TObject *Sender) { if(!cxTextEdit3->Text.IsEmpty()) { if(SectionNameComboBox->ItemIndex != -1) { SubSectionInfoADOQ->InsertRecord(ARRAYOFCONST((SectionNameComboBox->Text, cxTextEdit3->Text))); cxTextEdit3->Text = ""; } } }