Description
This example shows how to detect the event corresponding to the mouse
moving on the Form's caption bar.
WndProcMouseMoveOnCaptionBar.cpp
WndProcMouseMoveOnCaptionBar.h
Copyright © 1997-2002 Rodolfo A. Frino. All rights reserved.
#include <vcl.h>
#pragma hdrstop
#include "WndProcMouseMoveOnCaptionBar.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Color = clRed;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::WndProc( Messages::TMessage &Message )
{
//Detect when the mouse moves on the caption bar of Form1
//
if( (Message.Msg == WM_NCMOUSEMOVE) &&
(Message.WParam == HTCAPTION) )
{
ShowMessage("Windows Message: WM_NCMOUSEMOVE \n\
WParam: HTCAPTION");
}
else
{
TForm::WndProc( Message );
}
}
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <sForms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
void __fastcall WndProc( Messages::TMessage &Message );
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif