Firefox keeps asking to set it as a default browser

Run the following command as normal user and as administrator.

firefox.exe -silent -setDefaultBrowser
uninstall\helper.exe /SetAsDefaultAppGlobal
uninstall\helper.exe /SetAsDefaultAppUser

warning LNK4075: ignoring ‘/EDITANDCONTINUE’ due to ‘/SAFESEH’ specification

When you upgraded your VC++ project to Visual Studio 2013 or later(?), this warning appears. It looks like VS failed to upgrade projects properly.

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <PlatformToolset>v120</PlatformToolset>
    <UseOfMfc>Dynamic</UseOfMfc>

    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>

It needs to add “<UseDebugLibraries>true</UseDebugLibraries>” to your *.vcxproj file. See the following fixed file. In a Release configuration, it needs to set false of this attribute.

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <PlatformToolset>v120</PlatformToolset>
    <UseOfMfc>Dynamic</UseOfMfc>
    <UseDebugLibraries>true</UseDebugLibraries>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>

BadImageFormatException not handled

This exception occurs when AnyCpu-C# app tries to load X86 assembly in 64bit environment. Change the app configuration to X86 or prepare X64 assembly to load.

Install of VS2017 broke VC#2008 coloader80.dll configuration

Open command prompt with Admin priviledge and do followings.

regsvr32 "%CommonProgramFiles%\Microsoft Shared\VS7Debug\coloader80.dll"

if it fails, do this.

regsvr32 "%CommonProgramFiles(x86)%\Microsoft Shared\VS7Debug\coloader80.dll"

CMake could not find boost

Create a new CMakeFiles.txt below in a new folder.

cmake_minimum_required(VERSION 3.7)

set(Boost_DEBUG 1)
set(Boost_DETAILED_FAILURE_MSG 1)

set(Boost_INCLUDE_DIR Y:/L/boost_1_53_0)
set(Boost_LIBRARY_DIR Y:/L/boost_1_53_0/lib)


set(Boost_USE_STATIC_LIBS        ON)
set(Boost_USE_MULTITHREADED      ON)

find_package(Boost 1.53 REQUIRED COMPONENTS
              date_time filesystem iostreams)

include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR})

Adjust Boost_INCLUDE_DIR and Boost_LIBRARY_DIR to your environment and try to switch ON and OFF for Boost_USE_STATIC_LIBS and Boost_USE_MULTITHREADED.

How to check Windows or process is 64bit

typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
bool Is64BitWindows()
{
#if defined(_WIN64)
	return true;  // 64-bit programs run only on Win64
#elif defined(_WIN32)
 
	// 32-bit programs run on both 32-bit and 64-bit Windows
	// so must sniff
	BOOL f64 = FALSE;
	LPFN_ISWOW64PROCESS fnIsWow64Process;
 
	fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
	if (NULL != fnIsWow64Process)
	{
		return !!(fnIsWow64Process(GetCurrentProcess(), &f64) && f64);
	}
 
	return false;
#else
	return false; // Win64 does not support Win16
#endif
}

http://stackoverflow.com/questions/336633/how-to-detect-windows-64-bit-platform-with-net

Other functions, for finding CPU and whether the process is 64bit.

typedef void(WINAPI *LPFN_GetNativeSystemInfo)(LPSYSTEM_INFO);
LPCWSTR GetPlatformW()
{
	static WCHAR sT[64];
	static bool done = false;
	if (done)
		return sT;
 
	LPFN_GetNativeSystemInfo fnGetNativeSystemInfo = (LPFN_GetNativeSystemInfo)GetProcAddress(
		GetModuleHandle(TEXT("kernel32")), "GetNativeSystemInfo");
 
	if (NULL == fnGetNativeSystemInfo)
	{
		lstrcpy(sT, L"Unknown");
	}
	else
	{
		SYSTEM_INFO si = { 0 };
		fnGetNativeSystemInfo(&si);
		switch (si.wProcessorArchitecture)
		{
		case PROCESSOR_ARCHITECTURE_AMD64:	lstrcpy(sT, L"AMD64");	break;
		case PROCESSOR_ARCHITECTURE_ARM:	lstrcpy(sT, L"ARM");	break;
		case PROCESSOR_ARCHITECTURE_IA64:	lstrcpy(sT, L"IA64");	break;
		case PROCESSOR_ARCHITECTURE_INTEL:	lstrcpy(sT, L"INTEL");	break;
		default:lstrcpy(sT, L"Unknown"); break;
		}
	}
	return sT;
}
 
bool Is64BitProcess()
{
#if defined(_WIN64)
	return true;
#else
	return false;
#endif
}

I tried to run this code only on AMD64. I don’t know what happens in ARM or IA64 platforms.

Visual Studio 2017 add a context menu item “Open With Visual Studio” on the shell extension of directory

Remove
HKEY_CLASSES_ROOT\Directory\Background\shell\AnyCode
and
HKEY_CLASSES_ROOT\Directory\shell\AnyCode
from Registry to delete it.

Refresh the taskbar of Windows 10

Sometimes windows 10 taskbar failed to draw the application icon. ie4uinit.exe can fix it. Create the following batch file and run it.

REM @echo off
set "UTIL=%SystemRoot%\System32\ie4uinit.exe"
 
IF NOT EXIST %UTIL% (
set "UTIL=%SystemRoot%\Sysnative\ie4uinit.exe"
)
 
%UTIL% -ClearIconCache
%UTIL% -show

Differences of Command prompt of Visual Studio

There are many kind of shortcuts of command prompt of Visual Studio. Basically the differences are the setting of Host and Target. Host refers to the compiler or linker of which 64bit or 32bit is chosen. Target refers to the resultant exe or dll which is targeted 64bit or 32bit.

Developer Command Prompt for VS 2017 (default)

Host:32bit
Target:32bit

x64 Native Tools Command Prompt for VS 2017

Host:64bit
Target:64bit

x64_x86 Cross Tools Command Prompt for VS 2017

Host:64bit
Target:32bit

x86 Native Tools Command Prompt for VS 2017

Same as the default.

x86_x64 Cross Tools Command Prompt for VS 2017

Host:32bit
Target:64bit

Build ffmpeg-debug with Windows10 64bit

Install msys2

Install the 64bit msys2. I downloaded msys2-x86_64-20161025.exe and installed it on C:\local\msys64.

Install necessary tools

Run msys2-64 and install tools as follows.

$ pacman -S make pkg-config diffutils
$ pacman -S mingw-w64-x86_64-yasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL

Install git and obtain source files

$ pacman -S git
$ git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

Build with debug option

$ cd ffmpeg
$ ./configure --enable-shared --disable-static --disable-optimizations --disable-mmx --disable-stripping
$ make
$ make install

debug with gdb

$ pacman -S gdb
$ gdb --tui ffmpeg_g.exe