//---------------------------------------------------------------------------

#ifndef MessagesExampleH
#define MessagesExampleH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Messages.hpp>
//---------------------------------------------------------------------------

#define WM_INTMESSAGE (WM_USER + 100)
#define WM_GETSTRUCTMESSAGE (WM_USER + 101)
#define WM_STRUCTMESSAGE (WM_USER + 102)
#define WM_TEXTMESSAGE (WM_USER + 103)

struct TMyIntMessage {
	Cardinal Msg;
	int* wparam;
	int* lparam;
	LRESULT Result;
};
struct TMyTextMessage {
	Cardinal Msg;
	int wparam;
	String lparam;
	LRESULT Result;
};

struct MStruct {
	int m_a;
	int m_b;
};

struct TMyStruct {
	Cardinal Msg;
	int wparam;
	MStruct* lparam;
	LRESULT Result;
};

class TForm4 : public TForm
{
__published:	// IDE-managed Components
	TButton *Button1;
	TEdit *IntEdit;
	TButton *Button2;
	TEdit *TextEdit;
	TButton *Button3;
	TEdit *StructEdit1;
	TEdit *StructEdit2;
	TButton *Button4;
	TEdit *GetStructEdit1;
	TEdit *GetStructEdit2;
	void __fastcall Button1Click(TObject *Sender);
	void __fastcall Button2Click(TObject *Sender);
	void __fastcall Button3Click(TObject *Sender);
	void __fastcall Button4Click(TObject *Sender);
private:	// User declarations
	MESSAGE void __fastcall UserIntHandler(TMyIntMessage &msg);
	MESSAGE void __fastcall UserStructHandler(TMyStruct &msg);
	MESSAGE void __fastcall UserGetStructHandler(TMyStruct &msg);
	MESSAGE void __fastcall UserTextHandler(TMyTextMessage &msg);

	BEGIN_MESSAGE_MAP
		MESSAGE_HANDLER(WM_INTMESSAGE, TMyIntMessage, UserIntHandler);
		MESSAGE_HANDLER(WM_GETSTRUCTMESSAGE, TMyStruct, UserGetStructHandler);
		MESSAGE_HANDLER(WM_STRUCTMESSAGE, TMyStruct, UserStructHandler);
		MESSAGE_HANDLER(WM_TEXTMESSAGE, TMyTextMessage, UserTextHandler);
	END_MESSAGE_MAP(TComponent)
public:		// User declarations
	__fastcall TForm4(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm4 *Form4;
//---------------------------------------------------------------------------
#endif
