Home » Listing Details
Top Websites
  1. Mark Polino's DynamicAccounting.net
    Over 5100 resources listed.
  2. Dynamics GP Help
    Over 1700 resources listed.
  3. Developing for Dynamics GP - By David Musgrave and the MS GP Dev Support Team
    Over 900 resources listed.
  4. Mariano Gomez at The Dynamics GP Blogster
    Over 700 resources listed.
  5. Microsoft Dynamics Partner Community Blog
    Over 700 resources listed.
  6. Mohammad Daoud's Dynamics GP Blog
    Over 500 resources listed.
  7. Vaidy Mohan at Dynamics GP - Learn & Discuss
    Over 400 resources listed.
  8. Inside Microsoft Dynamics GP Official Blog
    Over 400 resources listed.
  9. Christina Phillips, Steve Endow & Lorren Zemke at Dynamics GP Land
    Over 400 resources listed.
  10. eOne Business Solutions Blog
    Over 300 resources listed.
  11. Frank Hamelly at GP2theMax
    Over 300 resources listed.
  12. About Dynamics, Development and Life
    Over 300 resources listed.
  13. Rose Business Solutions Blog New
    Over 200 resources listed.
  14. Dynamics CPM
    Over 200 resources listed.
  15. Janakiram M.P. at DynamicsBlogger
    Over 100 resources listed.
  16. Victoria Yudin's Dynamics GP Website
    Over 100 resources listed.
    Victoria Yudin
  17. VS Tools Forum
    Over 100 resources listed.
    Your Resource for Visual Studio Tools for Dynamics GP
  18. Inside Microsoft Dynamics GP Official Blog
    Over 100 resources listed.
  19. Leslie Vail at Dynamics Confessor Blogspot
    Over 100 resources listed.
  20. BKD Dynamics GP Insights Blog
    Over 100 resources listed.
  21. US Dynamics GP Field Team Blog
    Over 100 resources listed.
  22. Catherine Eibner MBS Developer Evangelist
    Over 100 resources listed.
  23. Sivakumar Venkataraman at Interesting Findings & Knowledge Sharing
    Over 100 resources listed.
  24. Dynamics Small Business
    Over 100 resources listed.
  25. Belinda, The GP CSI
    Over 100 resources listed.

ID:8767
Title:VBA - Determine if the Caps Lock button is enabled on Password entry
URL:http://blogs.msdn.com/developingfordynamicsgp/archive/2009/07/22/determine-if-the-caps-lock-button-is-enabled-on-password-entry.aspx
Description:

Patrick Roth - Click for blog homepageWith password policies in place in Dynamics 10.0 RTM, it was easy to be able for your user to 'lock themselves out' after a mistyped password or two. 

Because Dynamics GP doesn't give you any kind of warning that the Caps Lock key is enabled, the user wouldn't necessarily notice this is the real issue and not a typo and all of a sudden you are locked out. 

With 10.0 SP2 and the change on how Dexterity/GP tries to login; this is less of a challenge but it still is possible for the user to lock themselves out of Dynamics GP because they left the Caps Lock key on. 

To solve this, I wrote some VBA code that works on the Login window in Dynamics GP.  It is somewhat advanced in that it uses the Win32 API to get the status of the keyboard buffer and then specifically checks to see if the Caps Lock key is enabled or not.  If it is, a message box warns the user that has happened and suggests turning it off.  It would be a lot cooler to get a balloontip to point to the password field (as Windows does) but I'm not sure that is possible in VBA and while pretty to see, it doesn't give any advantages to just using a simple message box.

In the code sample below, both the Win32 API declaration and the VBA code is shown for this project.  The package file that I created for my 10.0 installation is also attached to this post.  I didn't test this one other Dynamics GP versions but I would suspect that it should work at least back to 8.0.  This code should also work on any password (or otherwise) field that you choose to add it to with just minor tweaks.

Login Window Code ExamplePrivate Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long Const VK_CAPITAL = &H14 Private Sub Password_AfterGotFocus() Dim CapsLockState As Boolean Dim error_message As String Dim keys(0 To 255) As Byte GetKeyboardState keys(0) CapsLockState = keys(VK_CAPITAL) If CapsLockState = True Then error_message = "Having Caps Lock on may cause you to enter your password incorrectly." + Chr(13) + Chr(13) + "You should press the Caps Lock key to turn it off before entering your password." MsgBox error_message, vbOKOnly + vbQuestion End If End Sub

Patrick
Developer Support

Category:DEVELOPMENT: VBA
Link Owner:
Date Added:June 17, 2010 02:10:39 AM
Number Hits:5
RatingsAverage rating: (0 votes)
Reviews

No Reviews Yet.

 
GPWindow.com

Developed and presented by
Smith & Allen Consulting, Inc.,
GP specialists since 1991.