Posts

Monitor Window Registry Key value change ashynchronously Javascript

Here is sample code to monitor registry value change without hanging the thread. Its sample code so use properly. var g_DefaultTimeOutForRegMonitoring = 15000; MonitoRegistryValue: function (szRegKeyVal, val) { // Key value path and value to watch var intervalID; var regKey = szRegKeyVal; var value = val; intervalID = setInterval(function (regKey, value) { try { var ret; ret = g_objRegUtil.ReadValueFromRegistry(szRegKeyVal);                 if (ret == value)                 // Check ret value and make decision } } catch (err) { } }, 5); // We will wait for certain time else break the watch setTimeout(function () { clearInterval(intervalID); }, g_DefaultTimeOutForRegMonitoring); }

Get correct OS version on win 8.1 without using GetVesionEx API (deprecated )

NTSTATUS (WINAPI *RtlGetVersion)(LPOSVERSIONINFOEXW); OSVERSIONINFOEXW osInfo; *(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandleA( "ntdll" ), "RtlGetVersion" ); if (NULL != RtlGetVersion) {    osInfo.dwOSVersionInfoSize = sizeof (osInfo);    RtlGetVersion(&osInfo); } Use above method on all  platform and it will work fine. Where GetOSVersionEx API deprecated by MS and gives wrong result on WIN 8.1.   Tested above sample on XP to 8,1 and works for me. There is another  alternative of manifest to use GetOSversionEx. Source: CodeProject  

Using Java Script detect if OS is 64 bit version or 32 bit.

Use following html code to show OS version: <html> <script> function onload() { if (navigator.userAgent.indexOf("WOW64") != -1 || navigator.userAgent.indexOf("Win64") != -1 ) {    alert("64 bit"); } else {    alert("32 bit"); } } </script> <body> <body onload="onload()" scrolling="no"> </body> </html> Ref:  UserAgent  (http://msdn.microsoft.com/en-us/library/ms537503%28v=vs.85%29.aspx)

Hide poup when click outside.

Just set islightdismissenabled property true for control. If popup is enabled and user clicks any where else the popup will be automatically disappeared.

error MSB3271: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture, "x86", of the implementation file

The error comes when you include winrt component in your project. To remove the error open project file of both the components and change the value of $(Platform)'== to make common in both project. I came out with error after changing the value from AnyCPU to x86.

ESENT –JET APIs to create database in Metro Style App on Windows 8

ESENT –JET APIs to create database in Metro Style App on Windows 8- ESENT dll is a part of windows SDK and provides apis to create and manage database on metro style application there is two major choices that can be used to implement databse in metro style application: 1.        SqlLite v3 2.        ESENT – JET database model SQLLite3 is not officially annouced to be used as database engine on windows8. But winrt version is already available to play with database. ESENT is already the part of windows8 so winrt support is already their to link esentlib statically to use the application.  JET apis are much flexible to create indexed base database and can be used to create huge database with thousands of table and columns. JET apis introduced in different levels according to plateform like win2000, WINXP , VISTA and above. Most of structures changed due to unicode support and security enhancement. I have created database using esent  - JET apis to work on metro style app

C# - Programmatically Reset IP configuration to default

Following sample code will reset Internet Protocol version 4(Tcp/Ipv4) Properties to Obtain an IP address automatically and Obtain DNS server automatically private void RunCommand(String commandLineArgs) { System.Diagnostics.Process objProcess = new System.Diagnostics.Process(); objProcess.StartInfo.FileName = "C:\\Windows\\System32\\cmd.exe"; //objProcess.StartInfo.UseShellExecute = false; objProcess.StartInfo.Arguments = commandLineArgs; objProcess.StartInfo.CreateNoWindow = false; if (objProcess.StartInfo.Arguments.Length > 0) { objProcess.Start(); do { Thread.Sleep(100); } while (!objProcess.HasExited); } if (objProcess.ExitCode == 0) MessageBox.Show("Installed successfully....."); else MessageBox.Show("Oops smthng

Earn money Online free

Earn upto Rs. 9,000 pm checking Emails. Join now!