Developing for Dynamics GP

by David Musgrave (Perth, WA, Australia) and the Microsoft Dynamics GP Developer Support Team (Fargo, ND, USA)

VBA - Determine if the Caps Lock button is enabled on Password entry

VBA - Determine if the Caps Lock button is enabled on Password entry

Rate This
  • Comments 4

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 on 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 Example

Patrick
Developer Support

// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)

Attachment: Login_Password_Warning.zip
  • Dear Patrick,

    What's your email address????

    Thanks

    Abbas

  • Hi Abbas

    We don't normally post our email addresses publically as this encourages them to be picked up and used by spammers.

    If you have a question relating to this blog post you can ask it here as a comment.

    If you have a comment regarding the blog in general, use the Blog Feedback? - Contact Us link at the top of the blog.

    For a support issue, you can post to the newsgroups or log a support incident.

    Patrick and I both monitor the newsgroups and so will respond there as well.

    Thanks

    David

  • I'm not a programmer please give some guide on how to add this script thanks.

  • Jovy,

    Download the attached zip file.  Import the package using Customization Maintenance.

    Patrick,

    Thanks!  Great peice of code to include on my installs.

    Perry Smith

Page 1 of 1 (4 items)
Comments Information

PLEASE READ BEFORE POSTING

Please only post comments relating to the topic of this page.

If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.

Leave a Comment
  • Please add 3 and 6 and type the answer here:
  • Post