Actually microsoft is probably a bad example as it's retail consumer based and there's no recurring income - so although gross profit margins may be in the order of 75% for microsoft - it probably only comes out with 30% of revenue actually converting to a net profit.
Business software on the other hand - which sells to corporations has a recurring income stream, which can potentially take care of all the advertising and sales expenses.