added DetectForeground.cpp