What's This button

B

brett

I am using forms with no borders so the standard "What's This" button
is not an option for me. Apparently this code should make the cursor
behave the same way as clicking the "What's This" button. It is close
but not quite right. Can anyone expand on it please?
It is attached to a button on a form.

Private Declare Function PostMessage Lib "user32" Alias
"PostMessageA"
_
(ByVal hWnd As Integer, _
ByVal wMsg As Integer, _
ByVal wParam As Integer, _
ByVal lParam As Integer) _
As Integer

Private Declare Function GetActiveWindow Lib "user32" () As Integer

Private Const WM_SYSCOMMAND = &H112
Private Const SC_CONTEXTHELP = &HF180

Public Sub WhatsThisMode()
If Not PostMessage(GetActiveWindow(), WM_SYSCOMMAND,
SC_CONTEXTHELP, 0) Then
MsgBox "This is not good!" 'Put actual error message here
End If
End Sub


Regards Brett
 
Top