BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How use WndProc inside an application?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Tomas Vercetti
Guest





PostPosted: Tue Jul 26, 2005 1:34 pm    Post subject: How use WndProc inside an application? Reply with quote




1. I created a new standart application. Is there any way to use WndProc of Form1 to handle messages inside this application itself.
I want to use case statement inside that function to react on messages.
2. Is that way common to other vcl components?
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Jul 26, 2005 4:29 pm    Post subject: Re: How use WndProc inside an application? Reply with quote




"Tomas Vercetti" <tomasvercetti (AT) r66 (DOT) ru> wrote


Quote:
1. I created a new standart application. Is there any way to
use WndProc of Form1 to handle messages inside this
application itself.

Please elaborate.


Gambit



Back to top
Tomas Vercetti
Guest





PostPosted: Tue Jul 26, 2005 6:49 pm    Post subject: Re: How use WndProc inside an application? Reply with quote




"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote:
Quote:

Please elaborate.

I created new BCPP application. Then I created TreeView using CreateWindowEx() and set Form1 as parent for TreeView. A tree-view control sends notification messages to its parent window. So I need to handle those messages.

When I created windows applications "from a blank page", I used WINAPI MainWndProc to react on messages.
So I want to use WndProc (or WindowProc?) the same way in my BCPP application.
Thank you for your attention.


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Jul 26, 2005 6:51 pm    Post subject: Re: How use WndProc inside an application? Reply with quote


"Tomas Vercetti" <tomasvercetti (AT) r66 (DOT) ru> wrote


Quote:
I created new BCPP application. Then I created TreeView using
CreateWindowEx() and set Form1 as parent for TreeView.

Since you are using the VCL anyway, why not use the TTreeView component
instead of making one manually?

Quote:
A tree-view control sends notification messages to its parent window. So
I need to handle those messages.

If you use the TTreeView component instead, all of that is handled for you
automatically.

Otherwise, TForm does have a virtual WndProc() method that you can override
to handle the messages.


Gambit



Back to top
Vladimir Stefanovic
Guest





PostPosted: Tue Jul 26, 2005 7:08 pm    Post subject: Re: How use WndProc inside an application? Reply with quote

Hi,

As Remy said, if you want to overide WndProc(), this is one
way /UNTESTED!!!/:

--- Form1 ( Unit1.h ) ---

// ...
protected: // User declarations
virtual void __fastcall WndProc( TMessage &Message )
// ...

--- Form1 ( Unit1.cpp ) ---

// ...
#define MY_CUSTOM_MESSAGE (WM_USER + 1000)
// ...

void __fastcall TForm1::WndProc( TMessage &Message )
{
switch ( Message.Msg )
{
case MY_CUSTOM_MESSAGE:
// Your custom code here ...
break;
// ...
}
TForm::WndProc( Message );
}

--- Usage (Send a message) ---

// ...
SendMessage( Form1->Handle, MY_CUSTOM_MESSAGE, 0, 0 );
// ...



--
Best regards,
Vladimir Stefanovic
"Tomas Vercetti" <tomasvercetti (AT) r66 (DOT) ru> wrote

Quote:

"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote:

Please elaborate.

I created new BCPP application. Then I created TreeView using
CreateWindowEx() and set Form1 as parent for TreeView. A tree-view control
sends notification messages to its parent window. So I need to handle
those messages.
When I created windows applications "from a blank page", I used WINAPI
MainWndProc to react on messages.
So I want to use WndProc (or WindowProc?) the same way in my BCPP
application.
Thank you for your attention.




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.