Home > Back-end >  TEdit control how to receive the sendmessage send message?
TEdit control how to receive the sendmessage send message?

Time:10-13

Form A use sendmessage sends A string to the form B TEdit control, TEdit how to receive and display?
For example code!
Is best can have news from trigger receive events,

CodePudding user response:

Reply to eliminate 0

CodePudding user response:

AnsiString STR="aaaaaaa";
SendMessageA (edit handles, WM_SETTEXT, 0, (LPARAM) STR. C_str ());

CodePudding user response:

Take over the window of the Edit process, and then according to the specified message processing line,

In the Edit in the unit. H file:
 private: 
Void __fastcall NewWndProc (TMessage & amp; Msg);

In the Edit unit. CPP file:
 __fastcall TForm1: : TForm1 (TComponent * Owner) 
: TForm (the Owner)
{
Edit1 - & gt; WindowProc=NewWndProc;
}

//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : NewWndProc (TMessage & amp; Message)
{
If (Message. Msg==WM_USER + 100)
{
ShowMessage (" Edit1 hearing from WM_USER + 100 ");
}

Edit1 - & gt; Dispatch (& amp; Message);
}


And then in another program, or the form, after get the handle to Edit1:
 : : SendMessage (hEdit WM_USER + 100, 0, 0). 
  • Related