The other day I started to experience an issue where Visual Studio 2012 was crashing on startup. Even before the splash screen was displayed it would error out with a Win32 API error and the only successful option I could take was to close the program.
For the life of me I couldn't figure out what was causing the problem. I tried running the applicaiton as administrator but that didn't help. After uninstalling, I deleted as many Visual Studio 2012 related files and folders as I could find under my user account and then I reinstalled. Still no joy!
Finally I got smart nad downloaded the SysInternals ProcessMonitor app. After filtering the Process name to devenv.exe I fired up VS 2012 and watched the events tick off until the app crashed. One of the last couple of events logged was two registry queries. The first was HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe and the second was HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe. I started by opening the last registry key and that's when I found the problem and the resolution.
The Current User Application Compatibility flag was empty. I noticed that there was an entry for Visual Studio 2010 just above it which starts just fine. The value of the registry key for VS 2010 was "RUNASADMIN". So, I copied the value and placed it in the VS 2012 key and what do you know it fired right up without an issue!