Monday, August 30, 2010

Failed to install Visual Studio 2008 SP1

If your system has Microsoft Office installed, you may encounter problem when installing Visual Studio 2008 SP1.

The log shows the "Visual Web Developer" is causing the error.

Here is a solution that works for me. You can give it a try.

=======

Rename (or Delete) these two registry keys:

HKEY_CLASSES_ROOT\Installer\Products\00002109120000000000000000F01FEC

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00002109120000000000000000F01FEC

Renaming the directory

C:\Program Files (x86)\Microsoft Web Designer Tools\VWD

To

C:\Program Files (x86)\Microsoft Web Designer Tools\Junk



(source : http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/315c7885-e680-4a83-b6a5-8a2795f596ea )

Tuesday, August 24, 2010

WinMobile - How to receive SMS

Windows Mobile, C#

Using MessageInterceptor object to receive SMS.
This is not able to read SMS already in the Inbox.


using Microsoft.WindowsMobile.PocketOutlook;
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception;

MessageInterceptor _interceptor = null;

private void Form_OnLoad(object sender, EventArgs e)
{
_interceptor = new MessageInterceptor();
_interceptor.MessageReceived += new MessageInterceptorEventHandler(Interceptor_MessageReceived);
}

void Interceptor_MessageReceived(object sender, MessageInterceptorEventArgs e)
{
SmsMessage msg = e.Message as SmsMessage;
if (msg != null)
{
System.Diagnostics.Debug.WriteLine("From: " + msg.From.Address);
System.Diagnostics.Debug.WriteLine("Body: " + msg.Body);
}
}

WinMobile - How to retrieve a web page

Windows Mobile, C#

The following function is for retrieving a web page from given URL.

bool RetrieveWebPage(String strUrl, ref String strReturn)
{
bool results = true;

try
{
HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(strUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
StringBuilder strbuilder = new StringBuilder();

while (readStream.EndOfStream == false)
{
strbuilder.Append(readStream.ReadLine());
}
response.Close();
readStream.Close();
strReturn = strbuilder.ToString();
}
catch (Exception e)
{
strReturn = "";
results = false;
}

return results;
}