Windows 7 Logon Screen Changer

29. May 2010 22:42

C# Projects Utils Windows 

Recently I was reading an article on some Windows 7 forums on how to change Windows Logon Background. There are manual steps which helps me to change the longon background, but its tedious if I have to do it manually everytime. So I decided to make a tool which can do it for me. 

I start up a new project in Visual Studio 2010 and create a new windows application. I am not writing about how I did it, I am just giving away this tool for use. Just Browse and click Change Logon Screen and you are done.

Press WIN+L to lock your computer and check your new logon screen. There is only one limitation, you cannot select an image which is larger than 256KB.

I will be uploading the complete source code at codeplex shortly. So keep an eye on the update.

Download: Win7 LogonScreenChanger.zip (49.21 kb)

Source Code: Win7LogonScreenChanger.zip (139.44 kb)

Currently rated 1.0 by 2 people

How To Build UAC Compatible Application In .NET

23. May 2010 21:01

C# Utils Visual Studio Windows 

We all know about a feature called User Account Control (UAC) which introduced with the launch of Windows Vista. By default, UAC is enabled and provides users a better and safer computing experience, but most of the users find it irritating when the UAC prompts everytime they try to run a program. Disabling UAC is not recommended at all.

With UAC enabled programmers find it difficult to access some of the locations on the local drive. Programatically you cannot write or create a file or directory in root partition, inside Program Files, System32 folder and some other locations. Recently I ran into a same problem where I have to access System32 folder, create new folders and copy files from one location on my system to this folder. With UAC disabled this is pretty easy, no security settings and no runtime errors or exceptions. Usually you cannot ask the users to disable UAC and then use the application, so therefore I made my application compatible with UAC and YES!!! you will be prompted with the confirmation box to run the application with administrator privileges. In Windows Vista and Windows 7, even if you are an administrator of your machine you do not have the complete access to resources even if you are an administrator. So in order to make your application run with full administrator rights follow the steps below. This will work the same if you run your application with "Run as Administrator" option which you see when you right-click the application.

Create a new application in Visual Studio. Right-click project and add a new item.

From the Add New Item box select Application Manifest File.

In the manifest file un-comment the following line:

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

Build your applicaton....and when the build is complete you will see the security shield icon accompanying your application icon. A dialogue box appear in front of the user to run the application with full administrative privileges.

Currently rated 4.5 by 2 people

Windows 7 Development: Creating Jumplist In Windows 7

28. March 2010 02:08

API C# Windows 

I am quite fascinated with Windows 7 before even I get it started using it. Actually I have just started on a fun project for my personal use which includes jump list. Why I am doing this? To navigate and get access to the application and internet addresses I need anytime. I am tired of typing addresses and navigating to the programs I frequently use. I have just started so I thought I must blog about my jump list experience with you all. You won't believe but I am still using Visual Studio 2008 with .NETFX 3.5. Ok, Let's talk about some Windows development. In my last post on Windows 7 development I explain how can you have Aero effects for your Windows applications. If you haven't read my post on Aero effects in Windows Application then you should have a look at this.

Windows 7 API Code Pack comes packed up with some serious development stuff for Windows 7. If you don't have it yet then check my post for Windows 7 Development resources.

We all know and view the new taskbar in Windows 7 and when your program got pinned in the taskbar you can simply left click to run your program or right-click to view more options associated with your program. To make it more clear I give you an example. I use Winsnap (a tool to take screenshots with dropshadows) to take screenshots and yes I use it quite frequently, so I pinned it to my taskbar.

That's the third icon from the Windows start button. When I click it normally it opens up the Winsnap application and show me the panel from where I can take and make settings for my next screenshot. but when I right-click the pinned Winsnap icon on my taskbar it show me the same basic settings which I will be using if I would have launched the application.

Now when I have to take screenshots with my utility I just right-click Winsnap icon pinned to my taskbar and I am done. The items that you see under the heading Tasks is having all your jump list items. It is indeed possible to have some common functions from your application to be included in the jump list or can have some external links for applications like calculator, notepad, paint etc. If you don't know (just in case) if you can pin something on the taskbar then you can also unpin it.

I hope now I am quite clear with jump list in Windows 7. So lets gets our hands on developing an application with jump list.

 

Getting Started

Start it up creating a simple windows forms application with a name of your choice. As we are delaing with Windows 7 API we need to have it added in our project references. Files you need to add to references are:

  • Microsoft.WindowsAPICodePack.DLL
  • Microsoft.WindowsAPICodePack.Shell.DLL

You can have these API libraries once you donwlod the API code pack. After you are done adding the required references, you can switch to the code window and do the rest of the work.

Creating Jump List

Start up with adding the namespace:

using Microsoft.WindowsAPICodePack.Taskbar;
using Microsoft.WindowsAPICodePack.Shell;

Create a jump list by calling CreateJumpList method, which is a part of Microsoft.WindowsAPICodePack.Taskbar.JumpList namespace.

JumpList list = JumpList.CreateJumpList();

If you want to show the most recent files you have used, then you can do that by using this line of code:

list.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;

JumpListKnownCategoryType is an enumeration which will let you accomplish this. You can also have some other available options.

  • Frequent: Display the frequent known category.
  • Neither: Don't display either known category. You must have atleast one user task and or custom category link in order to not see the default 'Recent' known category.
  • Recent: Display the recent known category.

To add some commonly used applications to the jump list then you can have it with in less than a jiffy. Create a JumpListLink class object and associate it with the JumpList class object. I use notepad a lot to note down my work, now I want to add to the jump list and I code it this way:

JumpList list = JumpList.CreateJumpList();
string SysPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System),
"notepad.exe");
JumpListLink JLink = new JumpListLink(SysPath,"Notepad.exe");
list.AddUserTasks(JLink);
list.Refresh();

One line of code can be used to include icon for your program. The IconReference property will let you add the icon the jump list item. Set the default value to '0', if you want to use the default icon for the application.

JumpList list = JumpList.CreateJumpList();
string SysPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System),
"notepad.exe");
JumpListLink JLink = new JumpListLink(SysPath,"Notepad.exe");
JLink.IconReference = new IconReference(SysPath, 0);
list.AddUserTasks(JLink);

You will now have a new jump list item. If you want to have your applications and links to be categorised in the jump list, then you can have custom jump list catgory and categorize your jump list items accordingly.

JumpList list = JumpList.CreateJumpList();
string SysPath = System.IO.Path.Combine(Environment.GetFolderPath (Environment.SpecialFolder.System),"notepad.exe");
JumpListLink JLink = new JumpListLink(SysPath,"Notepad.exe");
list.AddUserTasks(JLink);
JumpListCustomCategory jcc = new JumpListCustomCategory("My Programs"); 
jcc.AddJumpListItems(new JumpListLink("http://www.microsoft.com", "Microsoft")); list.AddCustomCategories(jcc);
list.Refresh();

Categorizing programs is bit easy this way. I can categorize web URLs, my favourites programs and some other places/links on my computer. There is lot more you can do with Jump Lists. I hope the explaination above can let you create your own applications with jump lists.

 

 

 

Currently rated 5.0 by 2 people

Microsoft Showcase: The Making of Windows 7

4. March 2010 12:57

Microsoft Windows 

Get Microsoft Silverlight

 No Rating

Windows 7 Development: Aero Effects in .NET Applications

28. February 2010 13:22

API C# Windows 

With the launch of Windows Vista, Microsoft introduces brand new UI, eye-catching aero effects (glass effects) for their new Operating System. I have seen a lot of programmers who are much concerned about the looks of their applications. So this time with the launch of Windows 7, Microsoft provides the Windows 7 API Code Pack. The Windows 7 API Code Pack not only just allows incorporating the aero glass effect, but many other features which will let you to work more conveniently with Windows 7. I will cover more of the features of Windows 7 API in my later posts. So, I am starting with a first tutorial on how to enable aero effects for the applications running on Windows 7. Create a new windows form application in Visual Studio. Design the form as normally you do as per your requirements. Now to give your form aero glass effect, we first need to add reference for the Windows API. Windows API provides a class called “GlassForm” which we are going to use in this example. When you add a new form to your project you see the following line in your code window:

public partial class AeroForm : Form

When you execute the code you will see a normal windows form which is obviously not we wanted. Here the “GlassForm” class comes into play. As we know we have all are forms are partial class, we have to inherit it with Form class which in turn completes our form. Now instead of using Form class use the “GlassForm” and you will see the Aero Glass Effects on your form.

public partial class AeroForm : GlassForm

This is how you normal Windows form looks like:

And your Aero form look like this:

Download: WindowsAero.zip (790.00 kb)

Currently rated 5.0 by 2 people