Focus rectangle in a command button

Is there a simple way to eliminate the focus rectangle from appearing when you select a command button?

I do realize that I can move focus from the command button, but the rectangle will still show when you press down on the button, and it messes up what I am trying to do.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

use another control.
..a click is a click...
by any other name...
Add the MS Forms 2.0 Object Library control ToggleButton to the form.  Warning: the DLL is pretty large.

Private Sub ToggleButton1_Click()
    If ToggleButton1.Value Then
        ToggleButton1.Value = False
        'Click event code here
        Debug.Print "Click"
    End If
End Sub
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Actually, the ToggleButton does not solve the problem...
There is no focus rect until you add a Caption, then it appears... duh.
Ok, another try.
You can use the DrawEdge API to create your own command button from a picture box.

" HOWTO: Perform 3-D Line Drawing in Win32 with DrawEdge"
You can even use SSPanel control of Sheridian 3D controls
check out
Option Explicit
Private Declare Function DrawFocusRect Lib "user32" (ByVal hdc As Long, lpRect As RECT) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type
Private a As RECT

Private Sub Command1_Click()
With a
    .Top = 4
    .Left = 4
    .Bottom = Command1.Height - 4
    .Right = Command1.Width - 4
End With
DrawFocusRect GetDC(Command1.hwnd), a
End Sub
taplinAuthor Commented:
VBGuru, I do thank you for your answer, but unfortunately, it does not seem to do what I was aiming for.  When I click the button, the focus rectangle is redrawn on top of the other, but it is not completely XORed (or whatever method they use).  It leaves a light gray line around the outside now.

I've played around for a few minutes, but can't seem to get it to work.

Thank you, though.
It works
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Sub Command1_Click()
SendMessage Command1.hwnd, 7, 0&, 0&
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
taplinAuthor Commented:
I knew I had seen an API call before that did this, yet I couldn't find it, or even a constant that looked like it would do it.

I really appreciate it.

welcome. Happy to see your comment.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.