Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. SetFocus API in MFC

SetFocus API in MFC

Scheduled Pinned Locked Moved ATL / WTL / STL
c++helpjsonquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vikram attiganal
    wrote on last edited by
    #1

    I have the following piece of code which returns the handle to the window which should receive the focus, CWnd* pWndNewFocus = GetNextTabStopWnd(pWndCurrentFocus->;GetSafeHwnd(), iDirection); For setting the focus to the new window, i've written the following code, pWndNewFocus->SetFocus(); Incidentally the window that is set to receive the focus is a CButton. I have an OK button which is default button and a Cancel button. OK button is dithered. So the pWndNewFocus will be my Cancel button. When SetFocus is getting called on that, i'm not able to see the focus [dotten line around the caption] on the button. Could you let me know the reason for this error? The same code when I execute it from VC++ 6.0, the focus is correctly getting set to the button. But when i execute the code in VC++ 10, i'm getting this issue.

    B 1 Reply Last reply
    0
    • V vikram attiganal

      I have the following piece of code which returns the handle to the window which should receive the focus, CWnd* pWndNewFocus = GetNextTabStopWnd(pWndCurrentFocus->;GetSafeHwnd(), iDirection); For setting the focus to the new window, i've written the following code, pWndNewFocus->SetFocus(); Incidentally the window that is set to receive the focus is a CButton. I have an OK button which is default button and a Cancel button. OK button is dithered. So the pWndNewFocus will be my Cancel button. When SetFocus is getting called on that, i'm not able to see the focus [dotten line around the caption] on the button. Could you let me know the reason for this error? The same code when I execute it from VC++ 6.0, the focus is correctly getting set to the button. But when i execute the code in VC++ 10, i'm getting this issue.

      B Offline
      B Offline
      barneyman
      wrote on last edited by
      #2

      http://www.codeproject.com/Questions/203548/Get-focus-to-a-button.aspx[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups