Sunday, September 30, 2007

Autostarting an appliaction

You can add your appliaction to the system startup using the calss CRegKey
Here is the code snippet

#include "atlbase.h" //Required for CRegKey class

void RemAutoStart() // To remove old entry
{
CString strKeyName;
strKeyName = _T("myAppAutoStart");
CRegKey mKey;
mKey.Create(HKEY_CURRENT_USER,
_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
REG_NONE,REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL,NULL);
mKey.DeleteValue(strKeyName);
mKey.Close();
}

void AddAutoStart() // To add new entry
{
RemAutoStart();
CString strKeyName;
strKeyName = _T("myAppAutoStart");
TCHAR sExeFilePath[490];
DWORD length;
length = ::GetModuleFileName(NULL, sExeFilePath, 490);
if(!length)
return;
CString sFullExeCommand;
sFullExeCommand.Format(_T("%s -AutoStart"), sExeFilePath);
CRegKey mKey;
mKey.Create(HKEY_CURRENT_USER,
_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
REG_NONE,REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL,NULL);
mKey.SetStringValue(strKeyName, sFullExeCommand);
mKey.Close();
}

Open a working folder

C++ code snippet:

ShellExecute(NULL, NULL, L"C:\\Windows", NULL, NULL, SW_SHOWNORMAL);

C++ code snippet:

System.Diagnostics.Process prc = new System.Diagnostics.Process();
prc.StartInfo.FileName = "explorer.exe";
prc.StartInfo.Arguments = "C:\\Windows";

prc.Start();

Setup Package

If you are using .Net framework then the best and easiest choice for you is to make a Setup and Deployment project or Setup wizard.

Also you can use NSIS (Nullsoft Scriptable Install System), It is a professional open source system to create Windows installers. It is designed to be as small and flexible as possible and is therefore very suitable for internet distribution.

You can edit the script setup for the NSIS package using a simple editor like notepad or you can also use Mihov NSIS Helper, It is a program for graphical creating of script files for NSIS.

There another option for you InstallShield but this tool is not free.

Saturday, September 15, 2007

Recommended Article: Populating a DropDownList using AJAX and ASP.NET

On of my experienced friends when asked do you know Ajax? He replied with the following?

Ajax is single class ,

Ajax = No full post back = No page reload nor Refresh effect.

So here is that class example that I saw zillions in many sites check it.

AjaxWindows: All the benefits of a real OS, but a lot slower

AjaxWindows still don't fully get the whole Web operating system concept. Why run an OS inside a browser when your browser is running in an OS to begin with?

But AjaxWindows, a Web OS and application suite that makes a very good case for the Web OS. It's not ready yet for adoption by the world at large, but the idea behind it, and some of the features in it, are too interesting to write off as just yet another science project.

Ajax13, the company that makes AjaxWindows, was originally started to create Web-based applications. It made a word processor, sketching program, and a presentation application.

AjaxWindows stores its files in Google's Gmail. Considering Gmail's free storage (over 2.5 GB), that's clever, even if Google wasn't consulted for this application. AjaxWindows, and its native applications, store everything except music files in Gmail (Music is stored on MP3Tunes).

Source CNet

Sunday, September 9, 2007

Documentation Tools

This blog "Documentation Tools" contains cool tools for documenting ASP, .NET, SQL, VB, PHP projects.

Sunday, September 2, 2007

Compare Databases

To compare SQL Server databases you can refer to this post -SQL Server Database Comparison and Synchronization-.

However to compare mySql databases you can use EMS DB Comparer for MySQL , It a cool tool for that purpose.

Start and Stop Windows Service

You can check these two MSDN articles:

Starting a Service

Stopping a Service

Or download this code snippet - 3kb