Solved

CDialogBar & CComboBox

Posted on 2002-03-27
6
310 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 96
sum13 challenge 24 107
JQuery serialize and unserialize 8 79
Problem to App 4 81
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 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