C++의 새로운 기능이므로 이것이 기본적인 질문이라면 유감입니다! 나는 자바에 익숙하다. (예, 너무 쉽다.)C++ Borland Builder 폼 - 함수 호출
addMessages 아래의 함수가 다른 파일에서 호출되면 실제적으로 __fastcall TfrmRunning::Add()
을 실행합니다. 나는 다른 파일에서이 작업을 할 수 없었기 때문에. add는 TdrmRunning
개체의 일부입니다)
추가 기능을 호출하는 메시지를 어떻게받을 수 있습니까?
이
은 에서 Running.cpp이다void __fastcall TfrmRunning::Add()
{
lbMessages->Items->Add("Application Started at ");
}
//This is called from another file as i could not get the above function working
void addMessages(){
TfrmRunning::Add(); // this does not work
}
내 헤더 파일 (Running.H)이
class TfrmRunning : public TForm
{
__published: // IDE-managed Components
TImage *imgLogo;
TLabel *lblCopyRight;
TLabel *lblTitle;
TButton *btnExit;
TButton *btnViewType;
TListBox *lbMessages;
void __fastcall btnExitClick(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
void __fastcall Add();
private: // User declarations
public: // User declarations
__fastcall TfrmRunning(TComponent* Owner);
};
void addMessages();
가 있습니다 .. _published 섹션에없는 추가 제작 해보십시오 헤더의 공용 부분에 넣어 사용해보십시오. –