C++ Builder/함수
-
AnsiReplaceStr()C++ Builder/함수 2019. 4. 10. 16:10
VCL함수에 보면 특정 문자열을 다른 문자열로 변환하는 함수가 있습니다. AnsiReplaceStr() 함수를 이용하면 특별한 구현 없이 바로 콤마(,)를 제거 할 수 있습니다. 예) void __fastcall TForm1::Edit1Change(TObject *Sender) { AnsiString TempStr = AnsiReplaceStr(Edit1->Text, ",", ""); //콤마(,)를 제거하는 부분 Edit1->Text = FormatFloat("###,###0", StrToFloatDef(TempStr, 0)); //문자열을 실수로 변환하되 변환 불가시 0로 만듬 Edit1->SelStart = Edit1->Text.Length() + 1; } 단, AnsiReplaceStr() 함수를..
-
-
MessageBoxC++ Builder/함수 2019. 3. 6. 10:55
음.. 어제 올라온 질문중에 메세지박스의 캡션을 설정할수 있냐는 질문이 있었죠? 답변중 하나는 Win32API MessageBox를 이용하는것이구 http://cbuilder.borlandforum.com/impboard/impboard.dll?action=read&db=bcb_qna&no=59516 (Application->MessageBox는 win32api MessageBox를 호출합니다.) 또다른 하나는 Application->Title을 변경한후에 ShowMessage를 하면된다고 했습니다. http://cbuilder.borlandforum.com/impboard/impboard.dll?action=read&db=bcb_qna&no=59518 둘다 맞는 말입니다. 첫번째 Win32API를 사용..
-
TIniFile ::ReadSectionValuesC++ Builder/함수 2019. 1. 25. 15:12
TIniFile * test = new TIniFile("C:\\My\\test.ini"); //ini파일 TStringList * SecList = new TStringList; //색션 리스트 TStringList * ValueList = new TStringList; //값 리스트 test->ReadSections(SecList); //test색션리스트 읽어오기 for(i = 0;i Count; i++){ test->ReadSectionValues(SecList->Strings[i], ValueList); } ex) 섹션에서 키값만 따로 리스트로 읽어오기 void __fastcall TMainF::fnLoadData(){TStringList *pList = new TStringL..
-
ForceDirectoriesC++ Builder/함수 2019. 1. 25. 13:51
: 보통 특정 폴더를 만들고 폴더에 파일 생성할 때 : : ForceDirectories()함수를 많이 사용합니다. : 이 함수는 폴더가 있으면 그냥 넘어가고 없으면 강제로 만듭니다. : : 특정 폴더에 파일이 없으면 만드는 예제 : :?1234567891011: void CreateCFG(UnicodeString FileName): { : // 파일이 없으면 만든다. 폴더가 없어도 파일이 없는 것으로 됨.: if(!FileExists(FileName)) {: // 폴더 강제 생성: ForceDirectories(ExtractFilePath(FileName));: // 파일 생성 처리...: // CFG->Save(FileName); // 이부분은 예를 든것이고 직접 만드셔야 합니다.: }: }: : :..