Microsoft Stopped Windows 7 Mainstream Supporting

Yesterday, 2015 January 13, Microsoft stopped the mainstream supporting for Windows 7.

The following Windows 7 products ended mainstream supporting at the same day:

Windows 7 Enterprise       
Windows 7 Enterprise N       
Windows 7 Home Basic       
Windows 7 Home Premium   
Windows 7 Home Premium N
Windows 7 Professional
Windows 7 Professional for Embedded Systems       
Windows 7 Professional N   
Windows 7 Service Pack 1
Windows 7 Starter
Windows 7 Starter N
Windows 7 Ultimate
Windows 7 Ultimate for Embedded Systems
Windows 7 Ultimate N
Windows Automated Installation Kit for Windows 7

Continue reading “Microsoft Stopped Windows 7 Mainstream Supporting”

Run Visual Studio 2010 as Administrator Automatically in Windows 7

Most of time when we want to run Visual Studio 2010 as Administrator role, we can right click the Visual Studio short cut in start menu and choose “Run as administrator”;

Sometimes if you forgot to choose “Run as administrator” and open a project which need administrator permission, you have to restart Visual Studio. So is it possible that we just click Visual Studio short cut icon to run with administrator automatically ?

The answer is Yes and Simple !

In Windows 7, we can do all executable program like the following steps to let them run as administrator automatically:

1: Right click Visual Studio 2010 short cut icon in Start menu, and choose “Properties”:

vsInAdm00 

2: Under “Compatibility” tab, check on “Run this program as an administrator” in Privilege Level section:

vsInAdm01

After you check on the option shown above, since then every time you open Visual Studio 2010, it must in administrator mode.

Force Windows Form Application to Run As Administrator on Windows 7

If you are using Windows 7 or Windows Vista, or Windows Server 2008, you should know the UAC (User Account Control), this is one of significant differences between Windows XP and the newer Windows System.

“User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. When you attempt to perform a task that requires administrative privileges, you can dynamically elevate your role by using the Consent dialog box. The code that executes the IsInRole method does not display the Consent dialog box. The code returns false if you are in the standard user role or in the Built-in Administrators group. You can elevate your privileges before you execute the code by right-clicking the application icon and indicating that you want to run as an administrator.” – From MSDN.

When you build a Windows Form application using C#, your application will not run as administrator by default. Then if your application need more permissions just like an Administrator, you might get problem since your application can not access enough resources;

The simplest solution is disabling the UAC on your Windows system. About how to disable UAC, we will discuss in another time, this time we do not want to talk about more about this since disabling UAC for a windows system is not recommended.

The normal and the best solution is using manifest file.

Open your application in Visual Studio 2010, Right click the project and add a new item, choose “Application Manifest File”:

manifest00

Now you can see a new file named “app.manifest” is added under Properties folder:

manifest01

When you open app.manifest file, you can see there are some sample settings have been already there, for example:

      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace the 
            requestedExecutionLevel node with one of the following.

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

            Specifying requestedExecutionLevel node will disable file and registry virtualization.
            If you want to utilize File and Registry Virtualization for backward 
            compatibility then delete the requestedExecutionLevel node.
        -->

      </requestedPrivileges>

What we should do is just remove comment for this line:

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

manifest02

When you done above steps, rebuild your windows form application, then every time when you try to restart your application, you will be asked whether you need to run as administrator.

 manifest03

Show Desktop in Windows 7

There was a Show Desktop icon in Windows XP when you turn on the “quick launch” in taskbar. When you click Show Desktop icon, you can switch from desktop and your application quickly and conveniently.

showdesktop

When you update to Windows 7, maybe you will be confused by lots of changings, for example: Where the Show Desktop icon is ?

Actually, Windows 7 provides more options to let your switch your desktop and applications.

Way 1: Show the desktop menu item

Move mouse on task bar on the bottom of your Windows 7, right click , you will see “Show the desktop” menu items, Click it when you want to show desktop.

showdesktop0

When you come to desktop, the “Show the desktop” menu item will changed to “Show open widows” so that you can switch back to your previous windows.

showdesktop1


Way 2: The most simple way: Click the rectangle area which indicates show desktop

Please check your windows 7 task bar carefully, just on the right bottom corner, there is a small and some transparent rectangle, which indicates Show Desktop, When you click it, the desktop will show, click one more time, system switches to your previous window; when your mouse hang over it, the desktop will show at once, when your mouse moves always, it will come back to your current window.

showdesktop2

You also have other ways to get the show desktop, but we don’t think they make sense for you. The 2 ways above should be your best and common ways.

Localhost is very slow

When you write web application using PHP or ASP.NET on local PC, maybe you have installed local web server so that you can debug on local machine. However, if you are using Windows 7, you might find localhost can not be opened in web browser or it is very slow to open.

The first step which you have to do is ping your localhost and ping 127.0.0.1, you can find different resolved methods due to your ping results.

For our case, we ping localhost in our Windows 7 and got the result like below:

C:\Users\Test>ping localhost

Pinging Test-Win7 [::1] with 32 bytes of data:
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms

Ping statistics for ::1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

Note:  “::1” is localhost in IPv6;  localhost in IPv4 is 127.0.0.1

The ping is normal. Also we ping 127.0.0.1 is normal too:

C:\Users\Test>ping 127.0.0.1

Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

So look like our localhost is OK.

Finally, we got the reason:

We were using Google Chrome and Firefox web browsers, which they have some issue when IPv6 is enabled: “Firefox and Chrome are known to be slow on localhost when IP6 is enabled.” ()

The resolution:

1: Run Notepad program as Administrator (In Windows 7);

2: Open the file named hosts in the folder C:\Windows\System32\drivers\etc\ ;

3: Take the comment sign out from this line:     # 127.0.0.1       localhost 
The full content like the following:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost
#    ::1             localhost

Now you go back to your Chrome or Firefox web browser, the localhost site will be OK.

Compatibility Mode in Windows 7

There are lots of software which we are running still need Windows XP Operating System. So how can you do if you only have Windows 7?

It is a good news if your software can be installed on Windows 7 without any problem first. Maybe you can run it directly without any problem.

But if you really have problem when run your software, Then maybe first you can try the most simple solution:

change the setting of Compatibility mode: Right click the icon of your software on Desktop or from Start menu, select “Compatibility” tab and see the page looks like the following:

win7compatmode00

Check on “Run this program in compatibility mode for”:

Then you can select a item from a dropdown list. Note the list will be generated by Windows 7 automatically due to your program. so the Dropdown list of operating system will be different due to your program. The following is another software Compatibility dropdown list:

 win7compatmode01

You can see above list does not include Windows XP versions because the program ONLY support Vista and Windows Server 2008 SP 1;

More operations:

Above we just talked about the most simple solution, but sometimes even you have already set Compatibility Mode, your program still can not run correctly.

In this case we can choose “Troubleshoot compatibility”: Right click your program and see the popup menu, choose the menu “Troubleshoot compatibility”:

win7compatmode02_0

The Windows 7 will start to troubleshoot:

win7compatmode02

Select a case which matches your problem:

win7compatmode03

For our case we chose the first option in above screen, and then, we got the following screen to ask which OS version that our program could run before:

win7compatmode04

Ask to start the program first and then can test for fit settings, then you click “Start the program…” button to run program, and then click “Next” button:

win7compatmode05

The system will complete troubleshooting and ask you to save current setting for this program.

If your program still can not work correctly, you choose “No, try again using different settings” and then system will go back to let you choose other problem case which you can select:

win7compatmode06

The steps will repeat like all above pictures show.

This task requires the application to have elevated permissions

In Windows 7 and Vista, when you run a software, you might need a permission.

When we use Visual Studio 2010, there is no problem when you run Visual Studio 2010 itself, and write code, and debug, and run your application.

However, if your application needs some permission, for example, your application need to “Run as Administrator”, you can set some permission in your application. and then, no matter when you try to debug or run directly your application, you will see the following popup window:

This task requires the application to have elevated permissions

– Restart under different credentials
– Cancel the task and return to Microsoft Visual Studio

VS2010Permisson0

You can follow the guide to choose “Restart under different credentials” and then your Visual Studio can run as Administrator in the second time. But, why don’t let your Visual Studio 2010 run as Administrator automatically and then you do not need to restart ?

The following show how to set Visual Studio 2010 run as administrator automatically:

1: Go to Start and choose “Microsoft Visual Studio 2010”, right click it and choose “Properties

VS2010Permisson1

2: You will see properties windows as following:

VS2010Permisson2

Choose the “Compatibility” tab page and check on “Run this program as an administrator”.

Done!

Object reference not set to an instance of an object in resx resource file

 

We have a Windows Forms solution which includes multiple sub projects, and since long time, we used Visual Studio 2005, and then 2008, now we are using Visual Studio 2010 to develop this solution.

We never gotten this kind of compile error on Windows XP when we convert the solution from lower Visual Studio version to higher Visual Studio version. But this year we moved OS from Windows XP to Windows 7 64-bit OS, we got some compile issues, one of the error is the following one:

There were some .resx files bring error:  Object reference not set to an instance of an object

resxBuildError00

We searched lots of reference help information through internet, finally we found a solution but we are not sure the exact reason ( but some people think it  might be the Visual Studio 2010 bug on Windows 7 64-bit):

Our Windows Form Solution was from old version of Visual Studio, and also we have multiple team members, so some of sub project set the target .NET platform is 2.0, other sub project might be 3.5 or 4.0, the error came from the project which we set to 2.0:

resxBuildError00_1

But in our .resx file, we found the following code:

resxBuildError01

Some reason lead our code has lots of “Version = 4.0.0.0” lines of code.

So all what we did is change all “Version = 4.0.0.0” to “Version = 2.0.0.0”

That is , simple . And we no more got the same compile error.

Disable Dell studio laptop touchpad on Windows 7 and install driver

We had a post about “Install Windows 7 on Dell Studio 1535 laptop and Dual Boot with Vista”, after you followed the guide to install Windows 7 on your Dell Studio laptop, you can see all hardware drivers seems “no more error” because they are all on normal status in hardware device list.

However, later you will find some of hardware might not work correct exactly, for example: the touchpad, you can not use scrolling feature when you view webpages. That indicates we have not installed a “exact” driver for touchpad.

Well, how we can make the touchpad work correct is that we can ONLY to find its driver. However, Dell never supported a Windows 7 driver for studio 1535. and they do not recommend to install Windows 7 on studio 1535 since they mentioned hardware not support.

Now we can “open” our mind: Dell does not provide Windows 7 drivers, but they provided Vista drivers. Windows 7 was built based on Vista, so why we don’t try to install Vista drivers on Windows 7?

OK, let us try now.

Go to Dell’s support web page for studio 1535, and select drivers for “Windows Vista 64 bits” operation system, and set category to “Mouse & Keyboards”, see below:

delltouchpad00

And now you can see the result list, there is a driver for Alps TouchPad, because there is only one TouchPad, so we suppose it should be the one we need, so just download it.

delltouchpad01

After download the file (the file name is R192617.exe) and double click to run and install it.

There was no any error occurred when we installed, so it should work. After we finish the installation, restart your laptop.

Now let us look at how to set the touchpad so that the touchpad can be disable automatically when an external mouse installed.

In your Windows 7, go to Control Panel, choose Hardware and Sound

delltouchpad02

then choose the “Mouse” item under “Devices and Printers” in the next screen:

delltouchpad03

Now you will be happy to see the Dell TouchPad setting screen !

delltouchpad04

For setting TouchPad, just click the touchpad graphic, then you will see the setting window, for our requirement, we want to disable the touchpad when an external mouse pluged in, so we choose Device Select Button Settings

delltouchpad05

After we click, we got the following screen:

delltouchpad06

Check on “Disable Touchpad / Pointing Stick when external USB mouse is present”

Click OK, then we got it. Our Dell Studio 1535 TouchPad was disabled when we used our USB mouse.

Retrieving the COM class factory for component with CLSID

We have a C# application which built in Windows XP using Visual Studio 2010, when we install this application to a 64-bit Windows 7 PC, we got the following error message in a popup windows:

Retreving the COM class factory for component with CLSID
{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC} failed due to the following error:
80040154 Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG)).

The reason is because our project is using a 3rd party dll file or a COM component which ONLY support 32-bit operation system, but our project set the target platform to AnyCPU, like following (right click the project name and you will see the window):

The solution is easy, just change platform target to ‘x86’ and rebuild the application again:

Because, your 64-bit Windows 7 allow 32 application to run.

good luck !