Keyboard and Mouse Cleaning

Shadow | Programming,Windows | Friday, April 16th, 2010

So you’re wondering what on earth Shadow Productions could do to help with your cleaning routine? Well, not much really — however I can at least appreciate the difficulty of cleaning a keyboard and mouse, especially that of a gamer…

The odd situation is, that I tend to clean my keyboard while having the computer on — while voice chatting or waiting for a new game to install, I subconsciously clean the keyboard, but also tend to write an essay of jargon at the same time from accidental key presses.

This application, “Keyboard and Mouse Disabler” has only one known purpose so far, and that is to make cleaning your keyboard and mouse peripherals easy. With a few clicks, your mouse and keyboard will be temporarily disabled, preventing accidental key presses and mouse clicks — then it’s cleaning time :)

There is no install required, it runs straight from the download. While this may seem to be a rather trivial application to release, I thought why not. If someone finds a use for it — great :)

Download Keyboard and Mouse Disabler!

Logging (My.Application.Log) in VB.NET

Shadow | Code Snippits,Programming | Sunday, February 21st, 2010
Logging during an application refers to the tracing of internal code actions and functions, user actions, as well as any errors or exceptions that may arise.

As I have learnt over the years, at a certain stage of application development logging becomes critical. It is imperative during testing (especially with multiple, external testers) that they can report any problems or issues in the most efficient manner; this usually entails sending  a log file which the developer can use to locate and debug the bug.

VB.NET comes with its own ‘logging’ sub-system integrated into the language. It allows the developer to place entries into the log file at specified points in the code. These entry points are usually placed at strategic points, such as in the catch statement of a Try… Catch or at the end of a long process to indicate completion.

The logging sub-system of VB.NET resides under the My.Application.Log namespace. Under this namespace are several functions and concepts, that I will detail below, which will let you start logging in your own applications.

Log Events

Several functions under this namespace allow you to write events to the log file. An ‘entry’ essentially, is composed of a string Message, a Severity Level and an Event ID.

The Message is a string that the developer specifies to appear in the log file. It should generally detail a stage in the code (e.g. “Starting update…”).

The Severity Level is used to determine how ‘critical’ the entry or exception is. This level is only used to help filter out critical events from the less critical ones. For example, an event of a failed update, “Update failed” should be classes at a error level, while an event such as “Starting update” should only be classed as an information level.

Other levels, such as a ‘critical’, are usually reserved for an error that causes the application to cease functioning.

The Event ID attribute is a way help index and identify the errors that may occur for correlation purposes. It is optional attribute when writing an event. It is usually reserved for error events as opposed to verbose events.

Writing Events to the Log

You can write events to the log by calling a function under the My.Application.Log namespace. The following code write an example event to the log;

My.Application.Log.WriteEntry("Starting to process function XYZ", TraceEventType.Verbose)

As noted above, the Event ID attribute is optional; it may be considered in-effective to index verbose level messages; reserving the event ID’s for error and critical level events.

Writing Errors to the Log

When writing Errors to the log a slightly different and specialized function may be used. The WriteError function will write details of an ‘exception’ caught during a Try… Catch statement. It is invoked similar to the code example below;

Try
    Throw New Exception("A sample error exception")
Catch ex As Exception
     My.Application.Log.WriteException(ex, TraceEventType.Error, "Additional information or details")
End Try

Once the error exception is raised within the Try block, the WriteException event will write the exception details (ex) to the log. The same severity level option can be applied, as well as some additional notes to make debugging easier.

So where does the log file end up?

When the application closes, and the log file has been flushed to disk the file can be retrieved for analysis. By default it is placed in the user’s Roaming profile under a subdirectory relevant to your application name. To save some time, you can find out the direct path, and for example, show it in a message box, while running the program by executing the following line of code;

MsgBox(My.Application.Log.DefaultFileLogWriter.FullLogFileName)

Level specific Logging

As with any logging sub-system, some performance overhead (while extremely minimal) may be invoked. To help reduce this, it is possible to only log events that may be considered more relevant than others.

As discussed above the Severity Level can help rank events on a scale of severity, from Verbose to Critical. Similarly we can choose to only log events that we deem important on a release application, for example only events higher than the Informational level. We can choose programmatically as to which events should be included and which should not. The code below sets this level to log events only Information and above.

My.Application.Log.TraceSource.Switch.Level = SourceLevels.Information

The hierarchy of severity levels can be determined using the table below (source).

SourceLevels ValueMessage severity required for output
CriticalCritical
ErrorCritical or Error
WarningCritical, Error, or Warning
InformationCritical, Error, Warning, or Information
VerboseCritical, Error, Warning, Information, or Verbose
ActivityTracingStart, Stop, Suspend, Resume, or Transfer
AllAll messages are allowed.
OffAll messages are blocked.

In Conclusion

Logging becomes essential in larger, more complex programs with several teste. Hopefully the outline of the logging system above will make it simple to implement basic logging capabilities into your own application.

Skipping code during step-through debug Visual Basic, C# .NET

Shadow | Code Snippits,Programming | Saturday, February 13th, 2010

When developing certain types of programs, different methods of debugging may be required in order to effectively and efficiently debug.

For example, programs with a timer iterative functions with a small interval, programs intercepting Window (WndProc) messages, or even programs with multiple hooks to the keyboard or mouse. All these type of programs have something in common…. it’s a major pain in the backside to ‘step-through’ (by default F10 in Visual Studio) without it jumping to areas non-related to the area of interest.

It’s not until recently that I discovered the DebuggerStepThrough attribute as a question answer on Stack Overflow.

Essentially, the DebuggerStepThrough attribute belongs to the Systems.Diagnostics namespace, and can be placed before almost any block of code to indicate to the debugger that it should pass/skip the block in question.

Decleration of DebuggerStepThrough in C#;

[DebuggerStepThrough()]
private void AnExampleSub()
{
    // Annoying iterative code
}

Decleration of DebuggerStepThrough in VB.NET;

<DebuggerStepThrough()> _
Private Sub AnExampleSub()
      ' Annoying iterative code
End Sub()
During debugging step through, the debugger will not visit anywhere within the subs in the examples above.

Serial Manager Released!

Shadow | Ideas & News,Serial Manager | Saturday, November 15th, 2008

Serial Manager by Shadow Productions has been publicly released!

Designed with ease-of-use in mind, Serial Manager will be able to manage all your product serial numbers in a consolidated location. While being simple, it is also expansive in the range of options it provides to make managing those pesky long numbers easier!

Serial Manager contains many features to make managing your serials simply and securely. The following list represents some of the features Serial Manager has to offer:

  • Ability to secure your precious serials with password protection and file encryption.
  • Portable/Standalone ability for use over networks or on USB memory sticks.
  • Ability to find serial numbers already installed on your computer.
  • Ability to print a hard copy reference of all your important serial numbers.
  • Ability to export your serial numbers into various file formats.
  • Smart catagorisation system.
  • Customizable fonts and colours of various aspects of the program.
  • Fast, Automatic Updates.
  • Community/Web based serial serach database system.

Download Serial Manager!

Click the screen shots below to make yourself familiar with the program user interface.
Serial Manager: Main User Interface

Serial Manager: Add Product Serial

Serial Manager: Locate Serials

Serial Manager: Customization

Serial Manager: Categories

Custom Right Click (Context) Menu on the Taskbar for your Program

Shadow | Code Snippits | Thursday, November 13th, 2008

Sometimes it may be required in your program that you need to alter the right click menu, otherwise known as context menu. With this following code snippit, you can completley yet simply change the entire menu to your own liking…


The theroy behind this code is that when a user right clicks on the program item, a ‘message’ is sent by the Windows UI to your program. Normally your program handles this message itself however we can ‘override’ this, and place our own actions there instead.

Private Const WMessageRightClickTaskbar As Integer = &H313
 
Protected Overloads Overrides Sub WndProc(ByRef m As Message)
 
        ' Check if the intercepted 'message' is a 'right click on taskbar'
        If m.Msg = WMessageRightClickTaskbar Then
 
            ' It is possible to change the action that occurs.
            ' In this case, a context menu is shown at the cursor position
            ContextMenuStrip1.Show(Cursor.Position)
 
            ' If you change the above event to something other
            ' than a context menu, remove the 'Exit Sub' below
            ' to restore the context menu and make it appear also.
            Exit Sub
 
        End If
 
        ' If it isnt, then handle it normally
        MyBase.WndProc(m)
 
End Sub
private const int WMessageRightClickTaskbar = 0x313;
 
protected override void WndProc(ref Message m)
{
 
    // Check if the intercepted 'message' is a 'right click on taskbar'
    if (m.Msg == WMessageRightClickTaskbar) {
 
        // It is possible to change the action that occurs.
        // In this case, a context menu is shown at the cursor position
        ContextMenuStrip1.Show(Cursor.Position);
 
        // If you change the above event to something other
        // than a context menu, remove the 'return' below
        // to restore the context menu and make it appear also.
        return;
 
       }
 
// If it isnt, then handle it normally
base.WndProc(m);
 
}

VNC Password Decryptor

Shadow | Programming,Security | Sunday, June 29th, 2008

This utility will allow you to fetch and decrypt VNC passwords on a local computer system with VNC Server configured with a password.

It works by fetching the encrypted password in the registry then decrypting it using the DES algorithm.

The utlity has two sections, Automatic Password Decrpytion and Custom Password Decryption. The automatic section will retrieve the encrypted password from the registry and decrypt it, the custom section will allow you to decrypt an encrypted password found on another computer through accesing the registry keys.

Download the VNC Password Decryptor

Royal TS – Password Encryptor and Decryptor

Shadow | Projects & Development,Security | Friday, June 20th, 2008

This utility created by Shadow Productions will encrypt or decrypt a password key that is found within RoyalTS. The default encryption key and algorithm will provide you with instant access to any lost Royal TS passwords.

Decrypting RoyalTS Passwords
If you, for example forget your Royal TS password, simply open the configuration file in notepad and look for the password ‘hash’ within the relevant nodes. It should appear to be a jumble of letters and numbers however this will soon change. Place the found string in the ‘Decrypt’ section of the Shadow Productions: Royal TS Password Encryptor and Decryptor then simply press ‘Go’.

Shadow Productions: Royal TS Password Encryptor and Decryptor

Encrypting RoyalTS Passwords
Open the program to the ‘Encrypt’ section. Place the plain text string into the text box then press ‘Go’. Using the default algorithm and key a what appears to be a jumble of letters and numbers will now uniqluly represent the original plain text. Be careful! Placing the encrypted string into the decryptor will immediatley reveal the RoyalTS password!

Download the RoyalTS Password Encryptor and Decryptor

PostIt

Shadow | PostIt | Saturday, May 3rd, 2008

PostIt is a simple, instant messaging solution for small companies.

It allows for instant message style PostIt Notes to be sent to a list of contacts – determined by who is connected and who has connected in the past. It also allows for offline messages to be send to users who have their computer turned off. The server will hold the message and send it when they next come online. User’s accounts are password protected so only until they logon using the correct credentials can the offline messages be recieved.

The PostIt client runs in the system tray, a message can be easily sent my double clicking the icon then selecting the user you wish to contact. Multiple users can be selected for a single message. The user interface is very friendly and should be easy to use for all levels of user computer knowlege.

Download PostIt – Client
http://files.shadowsplace.net/postit/

Download PostIt – Server
http://files.shadowsplace.net/postit/server/

PostIt - Client Configuration

Configuration

PostItServer - Configuration

Rune Messenger

Shadow | Programming | Sunday, November 11th, 2007

Typing the same message to sell your ‘rune full helm’ can be really tiering especially when if you don’t vary you’re messages and you get stung for bots!

This program takes care of all those issues, you are able to preset up to 10 messages with unlimited variations, each being assigned to <hk> + 1 – 10. <hk> represents Ctrl (default) and Alt which can be chosen from in the options section of the application.

When setting the messages, tags such as red: or blue: will change the text accordingly, and is compatible with the text colours used within Runescape.

Note: As Runescape has been updated since the release of this program, I cannot guarentee compatability. It does not ‘inject’ or ‘modify’ the game in anyway, just sends keystrokes which should maintain through Runescape updates.

Download Rune Messenger
http://files.shadowsplace.net/runemessenger/

Powered by WordPress
Theme by Roy Tanck, Modified by Shadow
Posts (RSS) and Comments (RSS) | Nearly Valid XHTML
18 queries. 0.768 seconds.