Solved

borland builder MDI modal window key down event

Posted on 2002-06-27
6
743 Views
Last Modified: 2008-01-09
In Borland Builder an MDI application has a Modal window which is not a Child window.  For non-child modal windows, how does one get the OnKeyDown event?


0
Comment
Question by:lirtua
6 Comments
 
LVL 6

Accepted Solution

by:
DrDelphi earned 50 total points
Comment Utility
You could send a user defined message back to the mainform:

MODAL form's OnKeyDown event handler:

{
  SendMessage(FindWindow('TMyMainForm',null),WM_USER+100,0,0);
}  



MainForm:

class TMyMainForm : public TForm
{
__published:     // IDE-managed Components
private:     // User declarations
public:          // User declarations
       __fastcall TMyMainForm(TComponent* Owner);
       void __fastcall ProcessMyMessage(TMessage &msg);
       BEGIN_MESSAGE_MAP
       MESSAGE_HANDLER(WM_USER+100, TMessage, ProcessMyMessage)
       END_MESSAGE_MAP(TForm)
};


//MyMainform cpp


void __fastcall TMyMainForm::ProcessMyMessage(TMessage &msg)
{
 if (msg.Msg=WM_USER+100) ShowMessage("Modal form keydown event fired");
}




Good luck!!



0
 

Author Comment

by:lirtua
Comment Utility
ok - this looks cool - i'll give it a try sometime this week - have a couple other issues that need fixing first - i'll let you know how it goes in a few days
0
 

Author Comment

by:lirtua
Comment Utility
Ok DrDelphi - heres the deal - it works almost all the time - it doesnt work the first time, ie if you start the app, open a modal non-child window, and then hit the MODAL form's OnKeyDown event - once you close the modal window, and reopen it, the code you gave works great - so im stumped

the solution looks pretty good - just needs small fix
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 6

Expert Comment

by:DrDelphi
Comment Utility
Hmmm.. sounds like a timing issue. I'd check the return of FindWindow to make sure that the "Main" form is being hit.

Good luck!!
0
 
LVL 11

Expert Comment

by:griessh
Comment Utility
Dear lirtua

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "DrDelphi"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
Comment Utility
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now