title: C++ Builder XE, Passing and handling user-defined messages
body: <p>I am trying to learn how to pass and handle messages in a VCL forms app.
  I've been digging the internet for some time and found <a href="http://bcbjournal.org/articles/vol1/9706/Incorporate_custom_message-handling_in_your_applications.htm?PHPSESSID=5a7b1eaeda695ce9443bf6f4383bb78c" rel="nofollow">this</a></p>
  
  <p>Suppose I have a progress bar I want to update using messages (btw if there's any other better way, I am eager to hear it)
  So I made a simple project to test the stuff and here's what I have (RECEIVER is a name of a form with progress bar, SENDER is a button used to send messages, updBar is a function to update progress bar, and 123456 is a message ID I want to use):
  Unit1.cpp:</p>
  
  <pre><code>#include &lt;vcl.h&gt;
  #pragma hdrstop
  
  #include "Unit1.h"
  //---------------------------------------------------------------------------
  #pragma package(smart_init)
  #pragma resource "*.dfm"
  TRECIEVER *RECIEVER;
  //---------------------------------------------------------------------------
  __fastcall TRECIEVER::TRECIEVER(TComponent* Owner)
      : TForm(Owner)
  {
  }
  void __fastcall TRECIEVER::barUPD(TMessage&amp; msg){
      BAR-&gt;StepIt();
  }
  //---------------------------------------------------------------------------
  void __fastcall TRECIEVER::SENDERClick(TObject *Sender)
  {
  //BAR-&gt;StepIt();
  PostMessage(FindWindow(0,(wchar_t*)"RECIEVER"),123456,0,0);
  }
  </code></pre>
  
  <p>Unit1.h:</p>
  
  <pre><code>#ifndef Unit1H
  #define Unit1H
  //---------------------------------------------------------------------------
  #include &lt;System.Classes.hpp&gt;
  #include &lt;Vcl.Controls.hpp&gt;
  #include &lt;Vcl.StdCtrls.hpp&gt;
  #include &lt;Vcl.Forms.hpp&gt;
  #include &lt;Vcl.ComCtrls.hpp&gt;
  //---------------------------------------------------------------------------
  class TRECIEVER : public TForm
  {
  __published:    // IDE-managed Components
      TButton *SENDER;
      TProgressBar *BAR;
      void __fastcall SENDERClick(TObject *Sender);
  private:    // User declarations
  public:     // User declarations
      void __fastcall barUPD(TMessage&amp; msg);
      __fastcall TRECIEVER(TComponent* Owner);
      BEGIN_MESSAGE_MAP
      MESSAGE_HANDLER(123456,TMessage,barUPD);
      END_MESSAGE_MAP(TForm)
  };
  //---------------------------------------------------------------------------
  extern PACKAGE TRECIEVER *RECIEVER;
  //---------------------------------------------------------------------------
  #endif
  </code></pre>
  
  <p>As you can see I have defined both the handling function and appropriate message handler for my message. But when I look it through via debugger (after sending the message using the button), the execution point never seems to go to neither my function nor the handler line.
  Thanks in advance</p>