Greatis Nostalgia .NET 1.0 » Developer.Team - Developers Paradise!

Greatis Nostalgia .NET 1.0

Greatis Nostalgia .NET 1.0
Greatis Nostalgia .NET 1.0 | 1 Mb


.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, components and controls that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.

Nostalgia .Net • Clipboard Monitor

Clipboard content changing watcher

Very simple in use component with the only ClipboardChanged event. Just activate ClipboardMonitor component from your code:

clipboardMonitor.Active = true;

and create handler for ClipboardChanged event:

private void clipboardMonitor_ClipboardChanged(object sender, EventArgs e)
{
IDataObject data = new DataObject();
data = Clipboard.GetDataObject();
if (data.GetDataPresent(DataFormats.Text))
textBoxText.Text = (string)data.GetData(DataFormats.Text);
if (data.GetDataPresent(DataFormats.Rtf))
richTextBox.Rtf = (string)data.GetData(DataFormats.Rtf);
if (data.GetDataPresent(DataFormats.Html))
textBoxHTML.Text = (string)data.GetData(DataFormats.Html);
if (data.GetDataPresent(DataFormats.Bitmap))
pictureBox.Image = (Image)data.GetData(DataFormats.Bitmap);
}


Demo project shows how the text, RTF, HTML and bitmap clipboard content can be tracked:



Nostalgia .Net • Hot Keys

System-Wide Hot Keys Component


This component supports system-wide hot keys and allow to register and unregister shortcuts and track hot key pressing. To use just register shortcut as new hot key:

RegisterKey(Keys Key, bool Control, bool Alt, bool Shift, bool Win)

This method returns new hot key identifier. If returned value is 0, registration is failed (usually this means that this shortcut is already registered in the system), otherwise returned value is new hot key identifier that can be used in HotKeyPressed event and must be passed into UnregisterKey method for unregistering.

When hot key is pressed, the HotKeyPressed event occurs, and this event's parameter contains hot key identifier, the key and boolean flags for each modifier (Ctrl, Alt, Shift and Win):

private string KeyString(Keys key, bool Control, bool Alt, bool Shift, bool Win)
{
string result = key.ToString();
if (Win) result = "Win+" + result;
if (Shift) result = "Shift+" + result;
if (Alt) result = "Alt+" + result;
if (Control) result = "Control+" + result;
return result;
}

private void hotKeys_HotKeyPressed(object sender, HotKeyEventArgs e)
{
MessageBox.Show(KeyString(e.Key, e.Control, e.Alt, e.Shift, e.Win));
}


Demo project shows everything about HotKey component:



Nostalgia .Net • Windows Shutdown
Find any window and any control on the system, analyze and change it


Simple and small static WindowsShutdown class has several useful methods:

TurnOffDialog Shows turn off dialog.
Sleep Turns computer into sleep mode.
Hibernate Turns computer into hibernate mode.
LogOff Logs off current user.
PowerOff Turns off the computer.
Reboot Restarts the computer.
Shutdown Shutdowns the computer.

All the methods except TurnOffDialog receive the force boolean parameter. When force is true, the action is executed immediately, so user can lost some unsaved documents, please be careful with this flag.

Demo project shows all the methods:



Home:
http://www.greatis.com/dotnet/nostalgia/


[/b]

[b] Only for V.I.P
Warning! You are not allowed to view this text.