|
임프랍니다.
오늘은 비슷한 실수를 하신 분을 또 보는군요. ^^
다른 분은 재귀호출을 만들어내셨는데..
메시지맵의 END_MESSAGE_MAP(TControl)에서 TControl을 TForm으로 바꾸세요.
그럼 이만..
이창환 님이 쓰신 글 :
: 메세지 맵을 사용하여 다른 폼에 메세지를 전송하는
:
: 일을 할 경우에 "Functions containing switch are not expanded line"이라는 메세지가 나타납니다.
:
: 메세지 맵을 쓸 경우 항상 이렇제 나타나는데여.
:
: (Command-line option to suppress warning: -w-inl)
:
: 도움말에는 이런 메세지가 나오는 것으로 봐서는 컴파일 옵션을 바꾸어 주어야 하는 것은데
:
: 자세한 것을 알고 싶습니다.
:
: 메세지 맵 사용한 소스는
:
: //////////////////////////////////////////////////////////////////////////////
: // Form1.h
: //////////////////////////////////////////////////////////////////////////////
:
: #define WM_MYMESSAGE (WM_APP + 400)
: //---------------------------------------------------------------------------
: class TForm1 : public TForm
: {
: __published: // IDE-managed Components
: TButton *Button1;
: TButton *Button2;
: void __fastcall Button1Click(TObject *Sender);
: void __fastcall Button2Click(TObject *Sender);
: private: // User declarations
: public: // User declarations
: __fastcall TForm1(TComponent* Owner);
:
: };
:
: //////////////////////////////////////////////////////////////////////////////
: // Form1.cpp
: //////////////////////////////////////////////////////////////////////////////
: void __fastcall TForm1::Button2Click(TObject *Sender)
: {
: PostMessage(Form2->Handle, WM_MYMESSAGE, 0,0);
: }
:
:
: //////////////////////////////////////////////////////////////////////////////
: // Form2.h
: //////////////////////////////////////////////////////////////////////////////
: #define WM_MYMESSAGE (WM_APP + 400)
: //---------------------------------------------------------------------------
: class TForm2 : public TForm
: {
: __published: // IDE-managed Components
: TEdit *Edit1;
: private: // User declarations
: public: // User declarations
: __fastcall TForm2(TComponent* Owner);
:
: protected:
: void __fastcall OnMyMessage(TMessage &Message);
: BEGIN_MESSAGE_MAP
: MESSAGE_HANDLER(WM_MYMESSAGE, TMessage, OnMyMessage)
: END_MESSAGE_MAP(TControl)
: };
:
: //////////////////////////////////////////////////////////////////////////////
: // Form2.cpp
: //////////////////////////////////////////////////////////////////////////////
: void __fastcall TForm2::OnMyMessage(TMessage &Message)
: {
: static int i = 0;
: Edit1->Text = IntToStr(i++);
: }
:
: 입니다.
:
:
|