2007-04-29

Char's pointer's pointer

This is a good example to know how to pass char's pointer to the function.

char *name[3];
name[0] = "a2n";
name[1] = "c9s";
name[2] = "ccn";

Known name at 0x1, and its content is:

{0x100, 0x101, 0x102}

Meaning indicates to "a2n", "c9s" and "ccn", respectively.


The array "name" saves the three string's address in its array space, hence, pass the array "name" to other function might via the address, and access the content of array "name" via address again. In the other word, I shall using "Pointer into Pointer" in the parameters field of array "name". :-)



Example:



void show(char **name)
{
for (int i = 0; i < 3; i++) cout << *name[i] << endl;
}

char *name[3];
name[0] = "a2n";
name[1] = "c9s";
name[2] = "ccn";
show(name);

2007-04-11

How can I create a program alias?

How can I create a program alias?

A. It is possible to create an alias for a program, for example to define johnword.exe to actually run winword.exe. To do this perform the following:

    *Start the registry editor (regedit.exe)
    *Move to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
    *From the Edit menu select New - Key
    *Enter the name of the alias, e.g. johnword.exe and press Enter
    *Move to the new key and double click on the (Default) value (it is blank by default)
    *Set to the fully qualified file name it should run, e.g. C:\Program *Files\Microsoft Office\Office\winword.exe. Click OK
    *Optionally you can create a new String called Path which is where the program will first start running (Edit - New - String Value - Path, double click and set to the starting path)
    *Close the registry editor

If you now select Run from the start menu and type johnword.exe it would start Microsoft Word, cool!

If you type your alias from the command prompt it will not find it, however if you type

C:\> start

it will work fine.

The actual program name does not have to be an .exe program -- it can be any file that has an association (such as "C:\temp\ntfaq.url"). The alias itself can remain as an .exe.

If the alias is an .exe, then the "run" or "start" command does not need to include the extension. If the alias is NOT an .exe, then you need to use the full name but then you are not limited to any extensions (but it must have some extension). Your alias can be John.Savill which you have aliased to "C:\ProgramYadaYadaYada\Winword.exe" and Word will start up just fine.