Solved

CDialogBar & CComboBox

Posted on 2002-03-27
6
307 Views
Last Modified: 2013-11-20
hi

I have a DialogBar with a combo box (dropdown) ... I want to catch Ctrl+C(copy) and Ctrl+V(paste) events for the combo's inner edit control .. to copy content and to paste content in combo when the focus is there

how can I do that ??

rgds
0
Comment
Question by:dragosh
  • 3
  • 3
6 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 50 total points
ID: 6898857
// The following code shows how to subclass the edit control and list box
// controls inside a combo box. It uses WM_CTLCOLOR for subclassing.
// CSuperComboBox represents the combo box.
HBRUSH CSuperComboBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
   if (nCtlColor == CTLCOLOR_EDIT)
   {
      //Edit control
      if (m_edit.GetSafeHwnd() == NULL)
         m_edit.SubclassWindow(pWnd->GetSafeHwnd());
   }
   else if (nCtlColor == CTLCOLOR_LISTBOX)
   {
      //ListBox control
      if (m_listbox.GetSafeHwnd() == NULL)
         m_listbox.SubclassWindow(pWnd->GetSafeHwnd());
   }
   HBRUSH hbr = CComboBox::OnCtlColor(pDC, pWnd, nCtlColor);
   return hbr;
}
0
 
LVL 3

Author Comment

by:dragosh
ID: 6898871
hi roshmon

i don't think i understand .. how this will help me to copy/paste text from combo box ??

10x
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 6898879
derive a class from CEdit.
declare the object of CEdit derived class in the dialog class.
subclass as per the above code

In ur derived class map the onKey down , syskey down etc,

from there u can check the key strokes

GOOD LUCK
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Author Comment

by:dragosh
ID: 6898884
hi

i got it .. let me try it and i'll come back later

10x again
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 6898888
Okay
Try it

GOOD LUCK
0
 
LVL 3

Author Comment

by:dragosh
ID: 6902070
hi

10x for your tips .. the points are yours

rgds
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Installing Microsoft R server on REDHAT or SUSE Linux 4 131
How to determine file rename from EventLog ? 2 41
wordappend challenge 8 143
unix example issues 18 73
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short film showing how OnPage and Connectwise integration works.

919 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

16 Experts available now in Live!

Get 1:1 Help Now