Ejemplo simple reescribiendo la función virtual WndProc de un formulario:
Código PHP:
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
private: // User declarations
protected:
virtual void __fastcall WndProc(TMessage& msg);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
Código PHP:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::WndProc(TMessage& msg)
{
if(msg.Msg == WM_MOVING){
TRect *R = (TRect*)msg.LParam;
if(R->Left < 50){
R->Left = 50;
R->Right = Left + Width;
}
}
TForm::WndProc(msg);
}
Este ejemplo impide desplazar el formulario a la izquierda más allá del valor 50.
Saludos.