joi, 4 august 2011

Ignore Enter Key Press for .NET Button

According to the documentation found on MSDN, "A Button can be clicked by using the mouse, ENTER key, or SPACEBAR if the button has focus."
It took a while until I have found how to disable the Enter and Spacebar keys to produce the Click event for a form button that has focus. The solution is to override the ProcessCmdKey method in a derived class and catch the Enter key press in that method and return before it gets to be processed by the method in the Button base class. Here is the basic class I used to accomplish this.

/// <summary>
/// A class that inherits the System.Windows.Forms.Button class and ignores
/// the ENTER key press that also triggers the click event.
/// </summary>
internal class ButtonNoEnter : System.Windows.Forms.Button
{
    protected override bool ProcessCmdKey( ref Message msg, Keys keyData )
   {
       if( keyData == Keys.Enter || keyData == Keys.Space )
      {
            return true;
      }
      return base.ProcessCmdKey( ref msg, keyData );
    }
}

vineri, 27 mai 2011

Word 2007 Registry Policy Settings

Having to open older versions of Microsoft Word files is prevented by default in Microsoft Windows 2007 by means of registry settings. There is a support article published by Microsoft that describes how to disable this limitation. ( http://support.microsoft.com/kb/922849#w2007 ). The purpose is to add a new registry key with the name FileOpenBlock and then create a new entry under this key, named FilesBeforeVersion and assign it the value 0.

I wanted to fix the solution myself and tried to locate the registry key specified in the article, but was unable to locate it. Here is where they claim it would be:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Word\Security\FileOpenBlock
 
and here is where I actually found it:
HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\Security\FileOpenBlock.
 
Other than the minor error in the article, I was able of fixing the issue and of opening older file versions.
I am using Windows 7 Professional 32 bit.
 

duminică, 8 mai 2011

Accept this license agreement

Upon installing Visual Studio 2005 I was politely presented a license agreement, partly English, partly something else !?

joi, 14 aprilie 2011

Subversion: Get the modified files between two revisions

There is a simple command to get the modified files between two revisions in subversion. All you have to know are the two revision numbers and the path to the repository folder:

svn diff -r revision1:revision2 --summarize URL

or if you want to list the files modified between an older revision and the head revision, type:

svn diff -r revison:HEAD -- summarize URL

If you do not type summarize you will also get to the console output all the differences between the two revisions.
Example: I need to see which files have been modified since revision 3880:

svn diff -r 3880:HEAD --sumarize svn://mysvnserver/repository/somefolder
The svn diff command is more complex, so you can get more details here:
http://svnbook.red-bean.com/en/1.0/re09.html.