473,326 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

issue with edit boxes...

86
ok...i have am edit dialog box which is a child window to a parent window hWnd. Now since the child window is an edit dialog box by default when i right click my mouse in the child window a pop up menu shows up giving me options like undo....copy..paste...select all....now how to intercept that message from the parent window.....secondly i also have an issue of not able to send any message from the child window(edit box) to the parent window....
Sep 24 '07 #1
2 2036
I am assuming you are coding raw Win32 applications in either C or C++ ( no MFC).

For the first question, I am afraid you will have to "subclass" the Edit control.
(The "subclass" word is related to Win32 classes not to C++ classes)

I think you can not catch that menu event from the parent window ( but Im a bit rusty in Win32 so you might try catching the WM_INITMENU from your main window procedure ).

In order to subclass the Edit control, you will have to call GetWindowLongPtr() using the handle of the Edit control and the parameter GWL_WNDPROC to get the current pointer to the window procedure of the Edit control and save it for later use.

Also, you will have to code a custom Window Procedure for the Edit control, and catch the WM_INITMENU message.

Then use SetWindowLongPtr() using the handle of the edit control, the GWL_WNDPROC parameter and a pointer to your custom Window Procedure.

Your custom window procedure should call the original Edit Window Procedure using the CallWindowProcedure() API call for the messages you dont process; this is why you saved this pointer.

Now regarding the second question, you dont usually make the controls send messages to the parent Window, controls originate notifications theirselves automatically (look at the API documentation for the notifications that controls generate).

For instance, the Edit control generates the event EN_CHANGE when the user edits the text. All you have to do is catch the WM_COMMAND message and EN_CHANGE notification from your main window procedure.

If you ever want to generate notifications, you will have to subclass the control (as I just explained) and from the custom Window Procedure you can generate messages to the parent Window using PostMessage().
Sep 25 '07 #2
ayan4u
86
I am assuming you are coding raw Win32 applications in either C or C++ ( no MFC).

For the first question, I am afraid you will have to "subclass" the Edit control.
(The "subclass" word is related to Win32 classes not to C++ classes)

I think you can not catch that menu event from the parent window ( but Im a bit rusty in Win32 so you might try catching the WM_INITMENU from your main window procedure ).

In order to subclass the Edit control, you will have to call GetWindowLongPtr() using the handle of the Edit control and the parameter GWL_WNDPROC to get the current pointer to the window procedure of the Edit control and save it for later use.

Also, you will have to code a custom Window Procedure for the Edit control, and catch the WM_INITMENU message.

Then use SetWindowLongPtr() using the handle of the edit control, the GWL_WNDPROC parameter and a pointer to your custom Window Procedure.

Your custom window procedure should call the original Edit Window Procedure using the CallWindowProcedure() API call for the messages you dont process; this is why you saved this pointer.

Now regarding the second question, you dont usually make the controls send messages to the parent Window, controls originate notifications theirselves automatically (look at the API documentation for the notifications that controls generate).

For instance, the Edit control generates the event EN_CHANGE when the user edits the text. All you have to do is catch the WM_COMMAND message and EN_CHANGE notification from your main window procedure.

If you ever want to generate notifications, you will have to subclass the control (as I just explained) and from the custom Window Procedure you can generate messages to the parent Window using PostMessage().
thanks a zillion for your reply....i have been waiting for few weeks for someone to actually reply my post....yeah i can understand a bit what yor are suggesting....actually what i am after is that....in Edit window when i press the shortcut keys like ctrl+O..ctrl+N for open...new etc(using accelerator table) nothing happens but when my focus is on the parent window of which the edit window is a child the shortcut keys are actually working....
Sep 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Craig | last post by:
I have a page that has a few columns and totals. I've been asked to amke sure that not only is the totals boxes readonly, they must not accept focus from the cursor. However, setting the bo to...
3
by: sygsix | last post by:
Hello all. I am a Java programmer who sometimes dabbles in simple PHP stuff, and had a question that's way over my head, for you DHTML experts. I would like to know how to dynamically edit a...
3
by: Rameshika | last post by:
Hi All How can I select a particular row in a datagrid.Where when the user double clicks the data in that row should appear in the corresponding text boxes in runtime And how can the user...
0
by: qh0st | last post by:
Hi all. I have a frustrating issue that I can't seem to figure out. EXPERTS please help me~! Deadline is coming up soon~! My task is to localize a winform application. The .Net Designer...
4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
2
by: Gary | last post by:
Hello All, I have an editable data grid in my web form, this grid allows the user to add new records, edit existing records and also delete them. When a user adds a record the grid goes in to...
2
by: Vish | last post by:
Hi, I amplanning on having a rea-only and edit states for my form. But it do not want my form and its controls to look different or disabled. I am planning on having a edit button that brings...
4
by: tim.cavins | last post by:
I have a GridView populated by an ObjectDataSource. I am having issues passing the parameters to the objectdatasource. I have verified that the method is being called but none of the parameters...
3
klarae99
by: klarae99 | last post by:
Hello, I am using Access 2003 to design an inventory database. Please be pacient with this question, I am not sure how exactly to explain what is happening concisely but I will do my best. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.