Click here to Skip to main content
15,567,466 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Setting breakpoints in source code in manual compile Pin
Albert Holguin22-Feb-16 15:46
professionalAlbert Holguin22-Feb-16 15:46 
GeneralRe: Setting breakpoints in source code in manual compile Pin
jschell6-Mar-16 7:09
jschell6-Mar-16 7:09 
GeneralRe: Setting breakpoints in source code in manual compile Pin
Albert Holguin6-Mar-16 9:48
professionalAlbert Holguin6-Mar-16 9:48 
GeneralRe: Setting breakpoints in source code in manual compile Pin
jschell31-Mar-16 10:02
jschell31-Mar-16 10:02 
QuestionVS2008 Total bitching weirdness - ever seen a message about the compiler driver? Pin
charlieg2-Feb-16 9:30
charlieg2-Feb-16 9:30 
AnswerRe: VS2008 Total bitching weirdness - ever seen a message about the compiler driver? Pin
Jochen Arndt2-Feb-16 22:24
professionalJochen Arndt2-Feb-16 22:24 
GeneralRe: VS2008 Total bitching weirdness - ever seen a message about the compiler driver? Pin
charlieg3-Feb-16 6:18
charlieg3-Feb-16 6:18 
QuestionCreating a CListbox manually ends up with corrupted HWND. [FIXED] Pin
Maximilien1-Feb-16 4:49
Maximilien1-Feb-16 4:49 
I am creating a CListBox manually as part of a auto-complete editbox (CEdit) to display possible choices.

The complete UI is something like:
CDialog
  CMFCPropertyGridCtrl
    Subclassed CMFCPropertyGridProperty to use my own CEdit Class, AutoCompleteEditBox (override CreateInPlaceEdit).
       CEdit
          CListBox

I create my listbox in the AutoCompleteEditBox:
void AutoCompleteEditBox::ShowListBox()
{
    if ( !m_ListBox.GetSafeHwnd() )
    {
        UINT extendedStyle = WS_EX_CONTROLPARENT | WS_EX_TOOLWINDOW|WS_EX_WINDOWEDGE|WS_EX_TOPMOST;
        UINT style = LBS_NOTIFY|WS_POPUP|WS_BORDER|WS_VISIBLE|WS_VSCROLL;

/// I tried setting the parent to different CWnd (The dialog, the CMFCPropertyGridCtrl...) 
        CWnd* parent = nullptr;
        if ( m_ParentWindow )
        {
            parent = m_ParentWindow;
        }
        else
        {
            parent= GetParent();
        }

        BOOL ret = m_ListBox.CreateEx(extendedStyle, _TEXT("LISTBOX"),NULL,style, CRect( 0,0,0,0), parent, 0 , this);
//// At this point the HWND of the list box is 0xFEEEFEEE.

        ASSERT( ret);
    }
}

And this gets called
int SuggestionListBox::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
    if (CListBox::OnCreate(lpCreateStruct) == -1)
        return -1;

//// At this point the HWND of the listbox is valid.
    m_pEdit = (AutoCompleteEditBox*)lpCreateStruct->lpCreateParams; 
    return 0;
}

For testing purpose, I created the AutoCompleteEditBox as a child of the top level CDialog and everything works as expected.

Any ideas, suggestions or things I might have missed ?

Thanks,

Max.

=================

I finally fixed the creation issue.

The Edit box created was using the id AFX_PROPLIST_ID_INPLACE; I thought it was OK to continue use it, I replaced the id with a different one and now all is working nicely (well, it is not finished, but I can continue updating and upgrading the feature).
I'd rather be phishing!


modified 5-Feb-16 10:11am.

AnswerRe: Creating a CListbox manually ends up with corrupted HWND. Pin
Bram van Kampen1-Feb-16 15:55
Bram van Kampen1-Feb-16 15:55 
QuestionCatching User Activity Pin
Bram van Kampen30-Jan-16 16:10
Bram van Kampen30-Jan-16 16:10 
SuggestionRe: Catching User Activity Pin
Richard MacCutchan30-Jan-16 22:18
mveRichard MacCutchan30-Jan-16 22:18 
GeneralRe: Catching User Activity Pin
Bram van Kampen31-Jan-16 13:21
Bram van Kampen31-Jan-16 13:21 
GeneralRe: Catching User Activity Pin
Richard MacCutchan31-Jan-16 22:22
mveRichard MacCutchan31-Jan-16 22:22 
GeneralRe: Catching User Activity Pin
Bram van Kampen1-Feb-16 17:14
Bram van Kampen1-Feb-16 17:14 
GeneralRe: Catching User Activity Pin
Richard MacCutchan1-Feb-16 22:46
mveRichard MacCutchan1-Feb-16 22:46 
AnswerRe: Catching User Activity Pin
Jochen Arndt30-Jan-16 23:03
professionalJochen Arndt30-Jan-16 23:03 
GeneralRe: Catching User Activity Pin
Bram van Kampen31-Jan-16 13:44
Bram van Kampen31-Jan-16 13:44 
GeneralRe: Catching User Activity Pin
Jochen Arndt31-Jan-16 23:42
professionalJochen Arndt31-Jan-16 23:42 
PraiseRe: Catching User Activity Pin
Bram van Kampen1-Feb-16 16:28
Bram van Kampen1-Feb-16 16:28 
SuggestionRe: Catching User Activity Pin
David Crow31-Jan-16 16:48
David Crow31-Jan-16 16:48 
GeneralRe: Catching User Activity Pin
Bram van Kampen1-Feb-16 16:18
Bram van Kampen1-Feb-16 16:18 
QuestionDid some one use Eigen or Armadillo library to do calculation? Pin
smallkubi28-Jan-16 23:31
smallkubi28-Jan-16 23:31 
AnswerRe: Did some one use Eigen or Armadillo library to do calculation? Pin
Jochen Arndt29-Jan-16 0:18
professionalJochen Arndt29-Jan-16 0:18 
GeneralRe: Did some one use Eigen or Armadillo library to do calculation? Pin
smallkubi29-Jan-16 2:43
smallkubi29-Jan-16 2:43 
GeneralRe: Did some one use Eigen or Armadillo library to do calculation? Pin
Jochen Arndt29-Jan-16 3:00
professionalJochen Arndt29-Jan-16 3:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.