MAC address of WLAN device (i.e. wifi NIC) on nokia phones can be reterived using *#62209526# i.e *#MAC0WLAN# code
Friday, February 11, 2011
Wednesday, February 9, 2011
Installing and Uninstalling ASP.NET on IIS
It often occurs that IIS ASP.NET gets misconfigured or gets corrupted in such cases we can uninstall and reinstall asp.net on IIS using command prompt utility aspnet_regiis.exe which comes with Microsoft Framework.
Below is the command install asp.net
C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -i
and to uninstall asp.net from IIS use
C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -u
Below is the command install asp.net
C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -i
and to uninstall asp.net from IIS use
C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -u
Tuesday, February 8, 2011
Sunday, February 6, 2011
Reload Group policy using gpupdate and WM_SETTINGCHANGE
When we change any of the group policy setting using registry then applications does not get notified about the change of policy and the effect take place only when the application gets restart or the user logs off and login again. To avoid restarting application and user logoff we have to notify all application about the change in group policy and so the application will reload the group policies. The applications can be notifiied about the change by using anyone of the below given approach
1. Using gpupdate.exe We can reload group policies by executing below command at command prompt.
gpupdate.exe /Force
2. Using WM_SETTINGCHANGE Message The group policies can be reloaded programatically by broadcasting WM_SETTINGCHANGE message using SendNotifyMessage. SendNotifyMessage take following paramters
hwnd: HWND_BROADCAST = 0xFFFF
msg: WM_SETTINGCHANGE = 0x001A
wParam: 0 when user group policies are applied and 1 when reload machie level group policies are applied.
lParam: pointer to string "Policy".
private void reloadPolicies()
{
IntPtr hwnd = new IntPtr(0xFFFF);
IntPtr wparam = new IntPtr(0);
IntPtr lparam = Marshal.StringToHGlobalUni("Policy");
SendNotifyMessage(hwnd, 0x1A, wparam, lparam);
System.Threading.Thread.Sleep(1500);
Marshal.FreeHGlobal(lparam);
}
1. Using gpupdate.exe We can reload group policies by executing below command at command prompt.
gpupdate.exe /Force
2. Using WM_SETTINGCHANGE Message The group policies can be reloaded programatically by broadcasting WM_SETTINGCHANGE message using SendNotifyMessage. SendNotifyMessage take following paramters
hwnd: HWND_BROADCAST = 0xFFFF
msg: WM_SETTINGCHANGE = 0x001A
wParam: 0 when user group policies are applied and 1 when reload machie level group policies are applied.
lParam: pointer to string "Policy".
Here is an implmentation of same using C#.NET
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern bool SendNotifyMessage(IntPtr hWnd, uint Msg, IntPtr wParam,private void reloadPolicies()
{
IntPtr hwnd = new IntPtr(0xFFFF);
IntPtr wparam = new IntPtr(0);
IntPtr lparam = Marshal.StringToHGlobalUni("Policy");
SendNotifyMessage(hwnd, 0x1A, wparam, lparam);
System.Threading.Thread.Sleep(1500);
Marshal.FreeHGlobal(lparam);
}
Saturday, February 5, 2011
C# .NET creating a IntPtr to a int
A IntPtr to int can be simply created using a constructor of IntPtr.
Example: In many windows message queue API function we need to send a brodacast message to all top level window using hwnd = 0xFFFF and for such cases we can get the IntPtr to 0xFFFF using
IntPtr hwnd = new IntPtr(0xFFFF);
Example: In many windows message queue API function we need to send a brodacast message to all top level window using hwnd = 0xFFFF and for such cases we can get the IntPtr to 0xFFFF using
IntPtr hwnd = new IntPtr(0xFFFF);
Subscribe to:
Posts (Atom)