CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Jan 2008
    Location
    Earth
    Posts
    60

    Default Dialog Button not working

    I make a modeless dialog with this...
    CreateDialogParam

    my dialog has 2 richedit controls, and 1 button, I want the ENTER key to activate the button,
    I have the button set as default in the Resource style, and by code, and still it does not work, pressing enter makes a WANT RETURN on the rich edit control (even though I have WANT RETURN disabled in the style for it) The codes works in MFC but I cant get it working in win32api

    this is not working...

    case WM_INITDIALOG:
    {
    //set the default button
    ::SendMessage(hwnd,DM_SETDEFID,IDC_BTN1,0);
    HWND hButton = ::GetDlgItem(hwnd,IDC_BTN1);
    SendMessage(hButton,BM_SETSTYLE,BS_DEFPUSHBUTTON,TRUE);


    I cant get WM_KEYDOWN or WM_CHAR to work in the dialogProc eithor :-(



    //here is my message loop
    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    {
    if(!IsDialogMessage(Msg.hwnd, &Msg))//needed to handle modeless dlg messages
    {
    TranslateMessage(&Msg);
    DispatchMessage(&Msg);
    }
    }


    //according to msdn I am doing everything correctly :-( ??
    [ http://msdn.microsoft.com/en-us/libr...keyboard_iface ]
    Last edited by 12oclocker; October 31st, 2010 at 01:11 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured