Category Archives: Windows

Windows 7, 8, Phone and Mobile

Windows Phone 8 Features Announced

Lumia 920

  • Tile Resize – Can resize the home screen tile small, medium large.
  • Lock Screen – Can add a facebook album to the lock screen. Add any album to see picture changing. Redesigned Lock screen notification area.
  • Data sense – Browsing uses very less data. All data compressed. The map shows nearby Wifi to use it. Data sense app to show data usage. It can show each app data usage to find the most data used app.
  • Skype  – Always On without running code behind and use very less power.
  • Pandora  – Pandora app will be available for free unlimited music with Ad free. 46 out of 50 most wanted Apps will be available in WP8 like temple run, Angry bird star wars etc.
  • Daddy Can i play?  – Kids Corner separate space for Kids. Ability to choose app, game and music for kids. It will not affect the normal app and data and contacts in the phone. Safe to give it to kids.
  • Rooms – Now Rooms can have more private message, calendar, updates and more. Room calendars can be shared to iPhones. Family room will be default available in WP8.
  • Skydrive – New skydrive which can synch Music, Docs, Pics and Notes. Xbox Music can synch playlist and album. Office document can be opened where it was left before in any windows devices. Editing document in multiple device is easy. One Note will have Voice commands. Pictures can be saved auto to Skydrive.

Windows Phone 7 App Story

There are several features which makes windows Phone 7 to be my best smartphone. None of the smartphone has the features which i am going to discuss in the below blog.

 

1. Less touch more information – Live Tiles

2. People Hub

3. Message Hub

4. Deep Linking

 

Less Touch More Information – Live Tiles

With windows phone 7 accessing the calendar information, Facebook notifications, App notifications is much easier with the less touch. Just one click on the power button will show the calendar event on the wallpaper. Its easy to see the next meeting. No need to login to the phone with password and open the calendar.

 

The below shows the front wallpaper with Calendar event, Missed calls, Outlook and personal email notifications

Home 2 Calendar                      Home Calendar

 

Once login to the phone with passcode, the front screen has the live tiles. Each tile is a living and breathing tile. The tile will keep update the information at the background. Just login can see all information without opening any App.

Ex:

  • If you have pinned the SGTransport App to the start without opening the App can see the Next bus timing. The SGTransport app will allow to Pin the particular Bus number and the Bus stop. Without even opening the app the tile will update the Next bus timing.
  • Similarly Nokia App Highlight App will update the app list on the tile.
  • NDTV App will update the latest news to the Tile. Without opening the App we can see the latest news.
  • 4th & Mayor allows to pin a particular restaurant / place to start. Any new comments, photos or updates happens in that place will be updated in the Tile
  • Flixster app live tile will show the latest movie update on the tile.
  • Nokia Transport will have live tile support for the best route
  • Weather app can update the live tile with the latest weather for a particular city
  • Gold Price app can update the live tile with the latest price.
  • Custom Tiles Maker app can create fancy tiles on front and back. The tiles can also be used to launch custom application.

So if those apps are pinned to start just by login without touching anything all tiles will give every information we need. There is no need to open the App to see the info.

Fig – 1: The below tiles can update the information. Top is the 34 Bus Number which can update the bus arrival time. The first column in second row tile updates the latest NDTV news on tile. The second column Tile updates the Gold Rate on tile. The Third row tile update the Weather in Singapore. The second column on third row is the Place pinned from 4th & Mayor which can update My Office Information, details on Tips and photos. Can launch my place on Foursquare directly and check in easily. The fourth row first column is the Shopping App which can update the number of items to shop. The count decreases once i add the item. The second column fourth row is the exchange rate. It updates the currency rate on the Live tile.

Fig – 3: The live tiles shows the

  • Number of missed calls (1st row 1st col)
  • Shows the images of people who are active in FB (1st Row 2nd Col)
  • Number of un read Outlook and Hotmail Accounts.  (2nd Row )
  • Number of Facebook/linked in/twitter/Windows Live Updates (3rd Row 1st Col)
  • Number or SMS / Windows messenger / Facebook messages (3rd Row 2nd Col)

   Fig – 1                                                           Fig – 2                                                              Fig – 3

Live Tile 2            Live Tile                   Messaging

 

People Hub

Windows Phone 7 is resource hungry and the data craving smartphone. It grabs every information from all sources like Facebook, Twitter, Linked In, Yahoo, Windows Live and Gmail. The People tile will update live active people picture in the start. When a people hub is open it gets every information like email, address, phone, city, country, notes whichever available from different source. Just one slide on people hub it takes you to Facebook Wall, Linked In, Windows Live updates aggregated in a single view.

Without using any App it has aggregated information of all data in a single place

 

Message Hub

Windows Phone 7 allows to chat in Facebook, Windows Live and SMS text in a single place. The user can switch between these in just one touch and keep chatting with them in the same conversation thread. It is one of the best feature i like. I can just be online in Facebook, Yahoo, Windows Live without even launching any App. Chatting with friends is never been very easy as in WP7.

 

Deep Linking for an App

Depends on the App, a particular page in an app can be pinned to the start screen. For example the SGTransport app allows us to pin a particular bust stop to the start. Further deeper it also allows to pin a particular Bus in the bus stop. This is one of the best feature i have not seen in any smartphones.

Similarly 4 & Mayor app allows to pin a particular place to track the activities.

The below Tiles are custom tiles which can be created by Custom Tile Maker, the front and back tiles changes.

                       Animals                 Start Tile

 

Get Logged In User while Impersonate or Run as Admin

Sometimes when a program is run as Administrator, using the System.Security.Principal.WindowsIdentity.GetCurrent().Name will return always System or NT Authority\System. This happens while running the exe under windows service or by Installer class in the windows application.

The below code will solve this issue.

Code Snippet
  1. public static string GetParentUser(int pid)
  2.         {
  3.             string parentUserAccount = null;
  4.             string queryString = String.Format("select ParentProcessId from win32_process where ProcessId={0}", pid);
  5.             using (ManagementObjectSearcher query = new ManagementObjectSearcher(new
  6.             SelectQuery(queryString)))
  7.             {
  8.                 foreach (ManagementObject mo in query.Get())
  9.                 {
  10.                     uint parentPid = (uint)mo.Properties["ParentProcessId"].Value;
  11.                     queryString = String.Format("select Handle from win32_process where ParentProcessId = {0}", parentPid);
  12.                     using (ManagementObjectSearcher subQuery = new ManagementObjectSearcher(new
  13.                     SelectQuery(queryString)))
  14.                     {
  15.                         foreach (ManagementObject mo1 in subQuery.Get())
  16.                         {
  17.                             string handle = (string)mo1.Properties["Handle"].Value;
  18.                             RelatedObjectQuery relatedQuery =
  19.                             new RelatedObjectQuery("associators of {Win32_Process.Handle=\"" + handle + "\"}");
  20.                             relatedQuery.RelatedClass = "Win32_LogonSession";
  21.                             using (ManagementObjectSearcher relQuery = new ManagementObjectSearcher(relatedQuery))
  22.                             {
  23.                                 foreach (ManagementObject mo2 in relQuery.Get())
  24.                                 {
  25.                                     RelatedObjectQuery relQuery2 =
  26.                                     new RelatedObjectQuery("associators of {Win32_LogonSession.LogonId='" +
  27.                                     mo2["LogonId"] + "'}");
  28.                                     relQuery2.RelationshipClass = "win32_LoggedonUser";
  29.                                     using (ManagementObjectSearcher searcher2 = new ManagementObjectSearcher(relQuery2))
  30.                                     {
  31.                                         foreach (ManagementObject mo3 in searcher2.Get())
  32.                                         {
  33.                                             parentUserAccount = String.Format(@"{0}\{1}", mo3["Domain"], mo3["Name"]);
  34.                                         }
  35.                                     }
  36.                                 }
  37.                             }
  38.                         }
  39.                     }
  40.                 }
  41.             }
  42.             return parentUserAccount;
  43.         }

 

You can download the code here

 

Hope the above code works. It works for me.

Thanks to the original post

http://bytes.com/topic/c-sharp/answers/631036-getting-currently-logged-user

How to create bootable VHD – Windows 7 or Windows 2008 R2

 

The below steps shows how to create a bootable VHD install for Windows 7 or Windows 2008 R2. With this step x64 OS can be installed, but requires a VT enabled machine in the BIOS.

1. Insert the Bootable Install DVD to the drive[Windows 7 or Windows 2008 R2]

2. Restart the machine, make sure the boot order is to DVD first in the BIOS to boot in DVD.

3. Once the windows is loaded, Select next in the Language selection screen

4. In the Install Now screen, Press Shift+F10 to enter into the command prompt

5. Type Diskpart and Enter

6. Type Create vdisk file=”c:\vhd\win7x64.vhd” type=expandable maximum=<vhd size in MB>

7. For differencing vhd shd add the parent=”VHD path” in the above command (optional)

8. Press Enter and Type Select vdisk file=”c:\vhd\win7x64.vhd”

9. Type attach vdisk

10. Press Alt+Tab

11. Now click on the Install Now Button

12. In the Drives windows select the virtual disk which we created, usually will be at the last. Ignore the warning which appears at the bottom.

13. Done, then follow the wizard to finish installation.

How to create Win 7 Themes

Creating themes in Windows 7 is much easier. Earlier version of windows don’t have this options. We can even export the theme and send to other people for sharing. In this blog i will explain first how to create a theme from Win 7 and later will explain how to share with other people.

Part – 1: How to create Theme in windows 7

Creating theme in Windows 7 is nothing but personalization of existing theme and save it with full name. Then later can export the theme to share with the people. To do that first go to the Desktop. Right click on the desktop and select “Personalize”. The Personalization window will appear to customize the theme. If any changes made to any of the existing theme(like changing wallpaper, transparency color, screen saver etc..) then Unsaved Theme will be selected and will appear as the first item. If nothing is customized will have default theme selected.

image

Under My Themes there are many themes installed. These are external themes i downloaded and installed it. I have made few modification in the screens so Unsaved Theme is present in the My Themes.

Initially when a Windows 7 is installed the default Win7 Theme will be selected as shown in the below screen

image

Now we will start creating the New Theme using the existing Win 7 Theme selected.

To create a new theme of our own we need to first select the existing theme. Modify the changes you want to do to the existing theme by changing the color, Wallpaper, screen saver etc. In my scenario i am going to change the Window Back color first. So click on the Window Color in the personalization page and a Windows Color Screen will appear. Select the desired color you want and save changes. I have selected Green and the color changes to Lime in the personalization window.

image

Now select the Desktop Background in the Personalization page, this will bring a wallpaper page. Browse the custom folder or select the wallpaper settings. Also you can select the Slideshow time picture settings etc and save the changes. Here in my window i selected Nature picture and opt not to use slideshow.

image

Now select the screensaver option from the Personalization page. Select the screensaver and save changes.

After doing all those changes now you can see Unsaved Theme in the My Themes Section of the Personalization page.

image

Now done!!! you new theme is ready almost. Now Right Click on the Unsaved Theme and select Save Theme. Enter a name and will be saved.

image

image

Now the theme creation is done. You can now share with anyone.

Part – 2 Sharing the Theme

Right click on the Renamed Theme and select Save Theme For Sharing menu, and provide the path to save the theme.

image

Then now the theme can be shared with anyone

WSS Explorer for Windows Mobile

MOSS 2007 server has several WebServices to connect to the server and get the data. Using the webservice i have developed a simple Mobile application to explore the Sites within the Sharepoint. This application will connect using the provided authentication and get the sites and list details. The application has a connection profile xml file in the same directory. The sample xml file is shown below

<profiles>
  <profile name="Local">
    <domain value="domain"/>
    <user value="UID"/>
    <server value="192.168.30.1"/>
  </profile>
  <profile name="Internet">
    <domain value="mydomain"/>
    <user value="senthamil"/>
    <server value="203.99.99.0"/>
  </profile>
</profiles>

Currently there is no UI to manage the XML, need to manually add the entry in the xml. So before running the application please modify the xml from the computer and copy back to the mobile.

Once the application is connected to sharepoint, it retrieves the site information including the lists in the tree structure. Use the context menu in the tree to open the list or site. The opened sites and lists will be added to the Top Combobox.

ScreenShots

Login Home Page Users 

Context MenuList Details ListViews

Currently the application is in the Beta stage soon new features will be added to the application. This application is targeted to SharePoint Admin to do primitive admin tasks. Now its just a explorer to show the data.

You can download the application in the below Link

Senthamil.WSSExplorer.Cab

Updated : 19 Nov 2009

WMI Provider in Hyper V

Windows 2008 server has a Hyper V to manage the Multiple Virtual Machines. The Hyper V manager helps to create Virtual machine and manage them. We can change the VHD and update the path using the Hyper V Manager. There are situation we need to write a program to do those tasks. Example when we do the DR using multiple Virtual Machines, some of the VM VHD path was not mapped exacted to the correct path. The VHD path was still pointing to old server while exporting the VM. So to update the VHD path programmatically i started looking to scripts and programs.

There are several options to write a program for Hyper V.

  • PowerShell Script
  • VBScript
  • WMI Provider Object using C#/VB.NET

PowerShell Script

PowerShell script is the most widely used approach to program any OS related operation. For Hyper V updating the VHD Path using PowerShell is a straight forward process. Just need to get the VM and the relevant Connections(vhd) and update the path property.

VBScript

Scripting through VB is similar to WMI programming. VBscript will createObject of WMIProvider dll and call the relevant method.

WMI Provider

I need to have UI to update the VHD path so i opted to use WMI Provider. System.Management namespace provides the whole new set of namespaces to manage the OS. Most of the operation which can be done by PowerShell can be done by WMI provider. The details of the provider can be found here http://msdn.microsoft.com/en-us/library/ms751442.aspx.

WMI Arch

Basically there is a COM/DCOM based WMI provider and the .NET Based WMI Provider. Depends on the client the WMI provider can be used. In my case my client program will be .NET windows Application so i opted to use .NET WMI provider. WMI provider consist of many namespaces to manage the OS operation. Below are few list of Namespaces taken from my Win 7.

image

To work with the Hyper V API, there is a separate namespace called root/Virtualization. This namespace provides all function to manage the VM operations. Each namespace has classess. These classes defines the specific operation to the namespace. Ex root/virtualization has classes below. Each class has properties and methods.

image

To explore the WMI namespaces and classes in the system please use the below tools. This WMI Tool allows the user to explorer all the namespaces available in the system.

http://www.microsoft.com/downloads/details.aspx?FamilyID=6430f853-1120-48db-8cc5-f2abdc3ed314&displaylang=en

To get any information from WMI objects we need to instantiate the WMI object and use the relevant namespace. Also WMI provide the Query provider which can be used to write a SQL kind of query to get the objects using the property. The WMI objects can be compared to a relational DB where we can query the object using a query provider and keys.

  WMIvsRelational DB

Microsoft has a tool to generate a c#, VB or VBScript code. WMI Code Creator lists down all the namespace available in the machine and generates the code based on the selection of operation. Using this tool i have generated the basic code to get the relevant device information.

image

using this we can create a windows application to update the VHD Path which will be published in the next blog.

Windows Mobile Client for TFS WebService

I am so curious to write some windows mobile application for my HTC mobile. Recently i attended the TFS server 2008 training conducted by Microsoft at NTUC building. Once i finish the training i was eager to know whether any Mobile Application to update my task easily. I was searching for Internet but could not find any Mobile application which does that. So it had initiated me to try my own Windows Mobile application for TFS.

Once i decided to write the Mobile Application i need to decide either to use TFS SDK or the webservice. Of course WebService is the light weight approach for a Mobile application because i don’t have to add any reference to any assembly. Only web reference needs to be created which creates only the Proxy classes.

TFS Server has several webservice to manage the WorkItem tracking. Below are the services

http://localhost:8080/WorkItemTracking/v1.0/ClientService.asmx

http://localhost:8080/WorkItemTracking/v1.0/ConfigurationSettingsService.asmx

http://localhost:8080/WorkItemTracking/v1.0/ExternalServices.asmx

http://localhost:8080/WorkItemTracking/v1.0/Integration.asmx

http://localhost:8080/WorkItemTracking/v1.0/SyncEventsListener.asmx

Before starting the Windows Mobile Application we need to identify the platform to develop the application. So i read the below documentation to install the Development tools. http://msdn.microsoft.com/en-us/library/bb158496.aspx. My HTC mobile has Windows Mobile 6.5 professional edition. So i had to download the WM 6.0 emulator for VS 2008. http://www.microsoft.com/downloads/details.aspx?FamilyID=06111a3a-a651-4745-88ef-3d48091a390b&DisplayLang=en. I downloaded the SDK for WM 6.0 for VS 2008.

I installed the SDK and started creating the WM application.

image

image

I added a webservice reference to the http://localhost:8080/WorkItemTracking/v1.0/ClientService.asmx through VS 2008.

image

I designed the form for my mobile to connect to the TFS server.

image

I manage to write a code to consume the webservice for the TFS server. I added the below code to consume the service.

            Dim myTfsClient As TFS.ClientService = New TFS.ClientService()
            myTfsClient.Url = txtURL.Text
            Dim mySortOrderEntry As TFS.QuerySortOrderEntry = New TFS.QuerySortOrderEntry()
            mySortOrderEntry.Ascending = True
            mySortOrderEntry.ColumnName = "WorkItem"
            Dim sort(1) As TFS.QuerySortOrderEntry
            sort(0) = mySortOrderEntry
            Dim metaTableEntry As TFS.MetadataTableHaveEntry = New TFS.MetadataTableHaveEntry
            Dim metaDataHave(1) As TFS.MetadataTableHaveEntry
            metaDataHave(0) = metaTableEntry
            Dim asOfDate As DateTime = DateTime.Now
            Dim dbStamp As String = ""
            Dim metaData As DataSet = New DataSet("metadata")
            Dim myQuery As Xml.XmlDocument = New Xml.XmlDocument()
            myQuery.LoadXml("<?xml version=’1.0′ encoding=’utf-8′?><WorkItemQuery Version=’1′><TeamFoundationServer>http://senwin2003:8080/</TeamFoundationServer><TeamProject>Sample</TeamProject><Wiql>SELECT [System.Id], [System.WorkItemType], [System.State], [System.AssignedTo], [System.Title] FROM WorkItems WHERE [System.TeamProject] = @project ORDER BY [System.WorkItemType], [System.Id]</Wiql></WorkItemQuery>")
            Dim xmlNode As Xml.XmlElement
            xmlNode = myQuery.SelectSingleNode("WorkItemQuery/Wiql")

            Dim workItemsXml As Xml.XmlElement = myTfsClient.QueryWorkitems(xmlNode, sort, True, metaDataHave, asOfDate, dbStamp, metaData)
            Dim nodeReader As Xml.XmlNodeReader = New Xml.XmlNodeReader(workItemsXml)
            Dim returnXML As SqlXml = New SqlXml(nodeReader)
            MessageBox.Show(returnXML.Value)

But unfortunately the code didnt work it gave the security exception. Its correct i was running the code outside of my TFS server so it requires domain, username and pwd authentication. So i added the below code to supply the credential

            ”””” credential
            Dim cache As CredentialCache = New CredentialCache()
            cache.Add(New Uri(myTfsClient.Url), "Negotiate", New NetworkCredential(txtUser.Text, txtPwd.Text, txtDomain.Text))
            myTfsClient.Credentials = cache
            ”””
Now the security error is gone. But guess what i got following error “TF51313: The request ID is incorrect or not recognized”. I tried the other TFS Service http://localhost:8080/WorkItemTracking/v1.0/ExternalServices.asmx. It works without any error.

When i checked the SOAP message, the ClientService requires a RequestHeader in the SOAP header. The request header requires a valid id to be passed to call the clientservice methods. But the externalservices methods dont have such header info in the SOAP header so only this service works.

I posted in the forums hoping to get some clue http://social.expression.microsoft.com/Forums/en-US/tfsgeneral/thread/8d2b9618-1e83-4eee-ad87-e882977b7ec7?prof=required&wa=wsignin1.0 but no reply yet.

Hoping to crack down the issue soon…..

Network Profile for XP

 

Currently switching between different Networks in XP is difficult. Unless we buy a thirty party tool it’s difficult to switch the profile. Here is the very simple solution to switch the profile in XP machine.

Save the Network Profile to a Text File

  • Open a DOS shell with start -> run; then type cmd
  • On shell use the following command netsh -c interface dump > c:\MyNetwork.txt
  • Using the above method any number of profile can be created and saved to the local machine

Creating a Desktop Shortcut for the Created Profile

  • On the Desktop Right Click New -> Shortcut.
  • Enter "%windir%\system32\netsh.exe -f c:\mynetwork.txt" in the location.

  • Enter a name for the shortcut. If want to change the icon, use the properties of the shortcut.