VisualCpp.org Collection of Visual C++ Stuffs

15Jun/090

Delete Temporary files from VC++

This tip allows you to delete all temporary file created by Visual Cpp Development Environment. You just need to configure temporary extension in the registry and to you it To use this tips, you will have to right click on a "folder" . It will delete all VC++ temporary files including sub directories.

Check out following registry location:-

REGEDIT4

[HKEY_CLASSES_ROOT\Folder\shell\Delete Temp VC++ files]

[HKEY_CLASSES_ROOT\Folder\shell\Delete Temp VC++ files\command]
@="\"cmd.exe\" \"/c del /s *.obj,*.res;*.pch;*.pdb;*.tlb;*.idb;*.ilk;
*.opt;*ncb;*.sbr;*.sup;*.bsc\""

___________________
Tip courtesy - Ernest Laurentin

6May/07Off

How to iterate through the subkeys in the registry location?

To enumerate the subkey of any given key you have RegEnumKey and RegEnumKeyEx function, the given use ATL::CRegKey which encapsulate basic registry window api.

This code that will enumerate all the key under HKEY_CURRENT_USER\Software, m_enumStrArray contain all enumerated keys

CRegKey m_hRegKey;
CStringArray m_enumStrArray;

if( m_hRegKey.Open(HKEY_CURRENT_USER,"Software")==ERROR_SUCCESS)
{
     DWORD dwSize=MAX_PATH,dwIndex=0;
     TCHAR tcsStringName[MAX_PATH];

    while(RegEnumKey( m_hRegKey.m_hKey,dwIndex,tcsStringName,dwSize)==ERROR_SUCCESS)
     {
       //sub key name
         m_enumStrArray.Add(tcsStringName);
         dwIndex++;
        dwSize=MAX_PATH;
      }
}

9Apr/07Off

How to get information about all installed software of my PC ?

 All the Information of Installed Software on local system can be find at HKEY_LOCAL_MACHINESOFTWARE\Microsoft\Windows\Current Version\Uninstall

you have to Enumerate the registry Key to know each installed Software and For Enumertaion of registry key you can use these API:

  •      RegEnumKey
  •      RegEnumKeyEx
4Mar/07Off

How do we run an EXE file at Windows startup?

There many Option to achieve same, some of them are :-
 
1. Make a shortcut in the Start >> Programs >> Startup
2. Add path (string value) of your EXE to following location in the registry:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
    HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run
3. These two are use rarely, just for reference
     HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
     (Running Only Once)
      HKEY_LOCAL_MACHINE\ Software\ Microsoft \ Windows \ CurrentVersion \  RunServices