How to find out if the left shift or right shift key has been pressed down …

Add this declaration.

[DllImport("user32")]
public static extern short GetKeyState (Keys VirtKey);

On your KeyDown event, you can check which shift key has been pressed down in this way:

bool LShiftPressed = ((GetKeyState(Keys.LShiftKey) & 256)==256);
bool RShiftPressed = ((GetKeyState(Keys.RShiftKey) & 256)==256);

How to delete file on reboot.

This code snippet forces windows to delete the file on reboot.

[System.Runtime.InteropServices.DllImport("kernel32.dll")]
private static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, int dwFlags);
const int MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004;
 
static void MarkFileToDeleteOnReboot(string fileName)
{
    MoveFileEx(fileName, null, MOVEFILE_DELAY_UNTIL_REBOOT);
} 
 
 

Creating and managing multiple sites on the Windows XP IIS.

This article presents an approach of creating and managing multiple sites on the Windows XP IIS.

Use BackgroundWorker with any class

BackgroundWorker works only with the classes that implements interface ISynchronizeInvoke – in order to use BackgroundWorker with any class necessary to make the following changes in the code.

The code after the changes ( BackgroundWorker.cs ):

private void InvokeDelegate(Delegate del, params object[] args)
{
    ISynchronizeInvoke synchronizer = del.Target as ISynchronizeInvoke;
    try
    {
        if(synchronizer != null) //A Windows Forms object
        {
            if (synchronizer.InvokeRequired == false)
            {
                del.DynamicInvoke(args);
                return;
            }
            synchronizer.Invoke(del, args);
        }
        else //Not a Windows Forms object
        {
            del.DynamicInvoke(args);
        }
    }
    catch (Exception e)
    {
        Trace.WriteLine(e.Message);
    }
}

 

 

Thanks to Roy Osherove for help in the solution of this problem

Report design in a nutshell

Defining report data sources.
Using object data sources in Windows applications and Web sites.
Using Lists.
Using report parameters in local mode.
Designing master-detail reports.

[Via http://www.gotreportviewer.com]


Page 2 of 212