Tuesday, October 30, 2007

Thursday, October 25, 2007

Congratulations for all of my colleagues and myself for the promotions
Go Worx Go …




Microsoft UI Automation Library

As part of Windows Vista, Microsoft has released the new GUI automation library available through the .NET Framework 3.0, so it works on Windows Vista, Windows XP and Windows Server® 2003. Moreover, it works seamlessly with both Windows Presentation Foundation UIs and HWND-based applications.

For more information:

http://msdn2.microsoft.com/en-us/library/ms747327.aspx

http://msdn.microsoft.com/msdnmag/issues/07/03/Bugslayer/default.aspx

http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=352&SiteID=1




Monday, October 22, 2007

Spy ++, # and other Windows Debugging tools

Remember the Spy++ tool shipped with Visual Studio long ago?

I was a fan of this tool, as it tells me the internals of any windows application and the controls that compose its GUI.

Trying to use this tool with .net application will tell you no useful information, because it examines the Win32 structures inside the application which is not the same thing from a .net developer point of view.

A bunch of tools will provide the same features but for .net world, here are some links:


 

.NET Object Spy and InvokeRemote

Runtime Object Editor

http://www.codeproject.com/csharp/RuntimeObjectEditor.asp

http://www.acorns.com.au/Projects/Hawkeye/


 

A simple Windows forms properties spy

Managed Spy

Dynamic Event Hooks for Object Debugging

Automate applications using VBScript

I have just discovered a nice feature in Windows Script Host; which is the SendKeys method in the WScript.Shell class.

Using this method to send a stream of key strokes to another application would allow for remote automation or (for example) creating application tutorials.

Cut the following code, paste in a text file and give it .vbs extension, double click the file to run it and watch J


 

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "notepad"

WScript.Sleep 100

WshShell.AppActivate "Untitled - Notepad"

WScript.Sleep 100

WshShell.SendKeys "Hello"

How to set the value of a DataGridView cell programmatically

The new DataGridView control doesn't have a Cells collection, but it has Rows,Columns and a default indexer.

To set the value of a certain cell in the DataGridView, it is easy to use the indexer like this:

dataGridView1[1,1].Value = "New Value";

Or, we can do that using the Rows collection:

Rows[1].Cells[1].Value = "New Value";

For more information about the DataGridView see those links:

A New Grid Control in Windows Forms

http://www.windowsclient.net/Samples/Go%20To%20Market/DataGridView/DataGridView%20FAQ.doc