// --------------------------------------------------------------------------- __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); } }
wxVariant &wxActiveXEvent::operator [](size_t idx) { wxASSERT(idx < ParamCount()); wxActiveXEventNativeMSW *native=GetNativeParameters(); // 'native' will always be != if the event has been created // for an actual active X event. // But it may be zero if the event has been created by wx program code. if (native) { while ( m_params.GetCount()<=idx ) { m_params.Append(wxActiveXEvents::ms_invalidEntryMarker); } wxVariant& vx = m_params[idx]; if ( vx.IsType(wxActiveXEvents::ms_invalidEntryMarker.GetType()) && vx == wxActiveXEvents::ms_invalidEntryMarker) { // copy the _real_ parameter into this one // NOTE: m_params stores the parameters in *reverse* order. // Whyever, but this was the case in the original implementation of // wxActiveXEvents::Invoke // Keep this convention. VARIANTARG& va = native->pDispParams->rgvarg[ native->pDispParams->cArgs - idx - 1 ]; wxConvertOleToVariant(va, vx); } return vx; } return m_params[idx]; }
//--------------------------------------------------------------------------- // 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 }
// новая игра 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(); // отобразить игровое поле }
int ParamVector::SetMutatableParameter(int i,float val) { if(m_binitialized) { if(i < ParamCount() && val < GetUpperBounds(i) && val > GetLowerBounds(i)) { data_params.at(i) = val; if(i < length) gnome.at(i+1) = val; return 0; } else if( i < ParamCount() && val > GetUpperBounds(i)) { data_params.at(i) = GetUpperBounds(i); if(i < length) gnome.at(i+1) = GetUpperBounds(i); return 0; } else if( i < ParamCount() && val < GetLowerBounds(i)) { data_params.at(i) = GetLowerBounds(i); if(i < length) gnome.at(i+1) = GetLowerBounds(i); return 0; } else return -1; } else return -1; }
//--------------------------------------------------------------------------- __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); }
//--------------------------------------------------------------------------- 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(); } }
// --------------------------------------------------------------------------- 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; } }
bool ParamVector::CopyArraytoGene(double* myarray) { bool succeeded = true; if(m_binitialized) { for(int i = 0; i < ParamCount(); i++) { if(SetMutatableParameter(i, myarray[i]) == -1) succeeded = false; } if(succeeded) return true; else return false; } return false; }
// ===================================================================== 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; }
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; }