How do I listen to windows messages in my Control?
In a derived class you should override WndProc as follows (listening to the WM_KEYUP message, for example): [C#] public class MyCombo : ComboBox { private const int WM_KEYUP = 0x101; protected override void WndProc(ref System.Windows.Forms.Message m) { if(m.Msg == WM_KEYUP) { return; //ignore the keyup } base.WndProc(ref m); } } [VB.NET] Public Class MyTextBox Inherits TextBox Private WM_KEYUP As Integer = &H101 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) If m.Msg = WM_KEYUP Then Return ’ignore the keyup End If MyBase.WndProc(m) End Sub ’WndProc End Class ’MyTextBox
How do I specify the path for the FolderBrowser instance when it opens the first time?
In the 1.1 framework there is a SelectedPath property that will let you do this.
Where are the getting started info. on Smart Client Deployment?
Here is some information (provided by Lubos in the newsgroups): http://www.fawcette.com/vsm/2002_09/magazine/columns/desktopdeveloper/ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet10142001.asp http://msdn.microsoft.com/msdnmag/issues/02/07/NetSmartClients/default.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms11122002.asp
How do I determine the current date/time?
Use the static properties in the DateTime class to get the current date (Today property) and also in terms of ticks (Ticks property).
How do I get the install directory for the version of the runtime that is loaded in the current process?
For example, the ‘C:\WINNT\Microsoft.NET\Framework\v1.0.3705’ dir for the 1.0 framework version. You can do so using PInvoke to call this native API method: [C#] [DllImport(‘mscoree.dll’)] // Declaration internal static extern void GetCORSystemDirectory([MarshalAs(UnmanagedType.LPTStr)]System.Text.StringBuilder Buffer, int BufferLength, ref int Length); // Gets the path to the Framework directory. System.Text.StringBuilder sb = new System.Text.StringBuilder(1024); int size; // returned value in size can be ignored GetCORSystemDirectory(sb, sb.Capacity, ref size); [VB.Net] ’ Declaration Private Declare Function GetCORSystemDirectory Lib ‘mscoree.dll’ ( ByVal Buffer As System.Text.StringBuilder, ByVal BufferLength As Integer, ByRef Length As Integer) As Integer ’ Gets the path to the Framework directory. Dim Path As New System.Text.StringBuilder(1024) Dim Size As Integer ’ returned value in Size can be ignored GetCORSystemDirectory(Path, Path.Capacity, Size)