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. Visual Basic
  4. XP Accelerators and Focus Rects

XP Accelerators and Focus Rects

Scheduled Pinned Locked Moved Visual Basic
question
7 Posts 3 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.
  • P Offline
    P Offline
    Punchinello
    wrote on last edited by
    #1

    I want to use SendMessage to send a WM_UPDATEUISTATE message that I hope will show the focus rectangle on option buttons but I cannot find the constant values for the expected wParam values: UIS_CLEAR, UIS_INITIALIZE, UIS_SET, UISF_HIDEACCEL, UISF_HIDEFOCUS, UISF_ACTIVE. I know that I can change a setting in the Control Panel (Display - Appearance - Effects) but I want to be able to control this programmatically. Any ideas?

    D 1 Reply Last reply
    0
    • P Punchinello

      I want to use SendMessage to send a WM_UPDATEUISTATE message that I hope will show the focus rectangle on option buttons but I cannot find the constant values for the expected wParam values: UIS_CLEAR, UIS_INITIALIZE, UIS_SET, UISF_HIDEACCEL, UISF_HIDEFOCUS, UISF_ACTIVE. I know that I can change a setting in the Control Panel (Display - Appearance - Effects) but I want to be able to control this programmatically. Any ideas?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      If I read this right, you just want to move the input focus to a button control. In VB.NET, that's easy:

      controlName.Focus()

      will set the focus to that control. BUT!! (There's always one of these!) Long version: A control cannot receive focus unless it is enabled, is visible, AND HAS A WINDOW HANDLE ASSIGNED TO IT! What this means is, you can only set the focus to the control AFTER it has actually been created and it's Message Loop is up and running. Short version: If you try and set the focus to a control in a Form's Load event, you must first Show() the form, THEN set the focus to the control. Otherwise it won't work. RageInTheMachine9532

      P 1 Reply Last reply
      0
      • D Dave Kreskowiak

        If I read this right, you just want to move the input focus to a button control. In VB.NET, that's easy:

        controlName.Focus()

        will set the focus to that control. BUT!! (There's always one of these!) Long version: A control cannot receive focus unless it is enabled, is visible, AND HAS A WINDOW HANDLE ASSIGNED TO IT! What this means is, you can only set the focus to the control AFTER it has actually been created and it's Message Loop is up and running. Short version: If you try and set the focus to a control in a Form's Load event, you must first Show() the form, THEN set the focus to the control. Otherwise it won't work. RageInTheMachine9532

        P Offline
        P Offline
        Punchinello
        wrote on last edited by
        #3

        RageInTheMachine9532 wrote: you just want to move the input focus to a button control Thanks for the reply, but no. What I want to do is tell Windows to show a focus rectangle around the text of a button that has input focus. By default in XP it does not. Also, I am using VB6, not .Net. If you search MSDN for the WM_CHANGEUISTATE Message you'll see exactly what I'm talking about. On the other hand, if you have .Net and you search your local help file for the UIS_ and UISF_ constants specified in this tread's header, might you be able to tell me the numeric value of these constants? For example, I know that... WM_CHANGEUISTATE = 295 (H&0127) WM_UPDATEUISTATE = 296 (H&0128) WM_QUERYUISTATE = 297 (H&0129) ...but I do not know the value for these other constants and they are not known by VB6 because it pre-dates their use in the operating system (beginning with Win2000).

        D 1 Reply Last reply
        0
        • P Punchinello

          RageInTheMachine9532 wrote: you just want to move the input focus to a button control Thanks for the reply, but no. What I want to do is tell Windows to show a focus rectangle around the text of a button that has input focus. By default in XP it does not. Also, I am using VB6, not .Net. If you search MSDN for the WM_CHANGEUISTATE Message you'll see exactly what I'm talking about. On the other hand, if you have .Net and you search your local help file for the UIS_ and UISF_ constants specified in this tread's header, might you be able to tell me the numeric value of these constants? For example, I know that... WM_CHANGEUISTATE = 295 (H&0127) WM_UPDATEUISTATE = 296 (H&0128) WM_QUERYUISTATE = 297 (H&0129) ...but I do not know the value for these other constants and they are not known by VB6 because it pre-dates their use in the operating system (beginning with Win2000).

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          OK. I think I understand what your trying to do now. I found the constants in WinUser.h in the VC98\Include folder. Here is the copy/paste:

          /*
          * LOWORD(wParam) values in WM_*UISTATE*
          */
          #define UIS_SET 1
          #define UIS_CLEAR 2
          #define UIS_INITIALIZE 3

          /*
          * HIWORD(wParam) values in WM_*UISTATE*
          */
          #define UISF_HIDEFOCUS 0x1
          #define UISF_HIDEACCEL 0x2
          #if(_WIN32_WINNT >= 0x0501)
          #define UISF_ACTIVE 0x4
          #endif /* _WIN32_WINNT >= 0x0501 */
          #endif /* _WIN32_WINNT >= 0x0500 */
          #endif

          RageInTheMachine9532

          P 1 Reply Last reply
          0
          • D Dave Kreskowiak

            OK. I think I understand what your trying to do now. I found the constants in WinUser.h in the VC98\Include folder. Here is the copy/paste:

            /*
            * LOWORD(wParam) values in WM_*UISTATE*
            */
            #define UIS_SET 1
            #define UIS_CLEAR 2
            #define UIS_INITIALIZE 3

            /*
            * HIWORD(wParam) values in WM_*UISTATE*
            */
            #define UISF_HIDEFOCUS 0x1
            #define UISF_HIDEACCEL 0x2
            #if(_WIN32_WINNT >= 0x0501)
            #define UISF_ACTIVE 0x4
            #endif /* _WIN32_WINNT >= 0x0501 */
            #endif /* _WIN32_WINNT >= 0x0500 */
            #endif

            RageInTheMachine9532

            P Offline
            P Offline
            Punchinello
            wrote on last edited by
            #5

            Rage, Thanks a bunch. That is exactly what I was looking for. Unfortunately, my winuser.h file does NOT include these constants and frankly I don't know why (VB6 Enterprise). I'll track that issue down next. :)

            J 1 Reply Last reply
            0
            • P Punchinello

              Rage, Thanks a bunch. That is exactly what I was looking for. Unfortunately, my winuser.h file does NOT include these constants and frankly I don't know why (VB6 Enterprise). I'll track that issue down next. :)

              J Offline
              J Offline
              J Dunlap
              wrote on last edited by
              #6

              Puchinello wrote: Unfortunately, my winuser.h file does NOT include these constants and frankly I don't know why Download the latest Platform SDK. ;)

              "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
              "You must be the change you wish to see in the world." - Mahatma Gandhi

              P 1 Reply Last reply
              0
              • J J Dunlap

                Puchinello wrote: Unfortunately, my winuser.h file does NOT include these constants and frankly I don't know why Download the latest Platform SDK. ;)

                "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
                "You must be the change you wish to see in the world." - Mahatma Gandhi

                P Offline
                P Offline
                Punchinello
                wrote on last edited by
                #7

                Good gumba gumba! The whole SDK will take over 10 hours to download on my 56K! I'll spring 10 bucks for the CD by mail. Thanks for the insight! :-D

                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