C++builder Heavy-duty WindowProc, WndProc

Source: Internet
Author: User

Method One WindowProc

void __fastcall Mywindowproc (messages::tmessage &message); Increase
Classes::twndmethod Oldwindowproc; Increase

void __fastcall Tform1::mywindowproc (messages::tmessage &message)
{
if (message.msg = = WM_MouseWheel)
{
:: MessageBox (NULL, "OK", "Message", 0); Test
Caption = Now ();
}

Else
Oldwindowproc (Message);
}

void __fastcall tform1::formcreate (tobject *sender)
{

oldwindowproc=edit1->windowproc;
edit1->windowproc=mywindowproc;
}

Method two Message_map

Class Tform1:public Tform
{
__published://Ide-managed components
Tedit *edit1;
Private://User declarations
void __fastcall Oneditmousewell (tmessage &message);
Begin_message_map

Message_handler (WM_MouseWheel, Tmessage, Oneditmousewell)

End_message_map (tform)//tform change to Tedit

Public://User declarations
__fastcall TForm1 (tcomponent* Owner);
};

void __fastcall Tform1::oneditmousewell (tmessage &message)
{
if (String (Activecontrol->classname ()) = = "Tedit")//All Edit
Caption = Now (); Test


Tform::D ispatch (&msg);

}

Method three-load WndProc

Private://User declarations
void __fastcall WndProc (messages::tmessage &message);

void __fastcall Tform1::wndproc (messages::tmessage &message)
{
if (message.msg = = WM_MouseWheel && message.wparam)
{
Caption = Now ();
}
Tform::wndproc (Message);
}

C++builder Heavy-duty WindowProc, WndProc

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.