Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5935489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:15:43+00:00 2026-05-22T15:15:43+00:00

My resource file contains a DEFPUSHBUTTON for IDCANCEL, but for some reason, they Focus

  • 0

My resource file contains a DEFPUSHBUTTON for IDCANCEL, but for some reason, they Focus on the button is not changing from IDOK to IDCANCEL.

IDD_HEALTHCARDINFO DIALOGEX 0, 0, 256, 223
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Health Card Information"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
    PUSHBUTTON      "Yes",IDOK,67,202,50,14
    DEFPUSHBUTTON   "No",IDCANCEL,140,202,50,14

Inside my OnInitDialog() I’ve tried to force it by sending a DM_SETDEFID Message Also.

BOOL CHealthCardInfo::OnInitDialog() 
{
    CDialog::OnInitDialog();
    SetDefID(IDCANCEL);
    SendMessage(GetDlgCtrlID(),  DM_SETDEFID, IDCANCEL);
    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:15:43+00:00Added an answer on May 22, 2026 at 3:15 pm

    Default button doesn’t affect focus. It affects what button is activated by the ENTER key when some non-button control has focus.

    You can use SetFocus in OnInitDialog (and also return FALSE) to change which control has focus when the dialog opens. Or you can reorder the controls within the dialog resource.


    As a side note, a dialog box that asks a Yes/No question generally shouldn’t have a title of “Information”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to access a resource file from a servlet but getting HTTP
Some code I am unit testing needs to load a resource file. It contains
I have a resource file named filetypes.resx. Some how I figured out to bind
I've got a VB.NET module that reads from a resource file to display text
I had a resource file named Localize.resx, which contains English strings. I copied and
For some reason one of our forms reads all UI element data from its
Within a Visual Basic Project I have added a resource file (resx) that contains
I am using resource filtering to replace some ${values} in a property file. e.g.
I want to know that I have the string.xml Resource file which contains status
I have a file name foo. That file contains some text (shown below). Can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.