I really don't think it's a zero sum trade and I think their contributions to society would be hard to compare. Microsoft although being a corporation, does facilitate a lot of communication and business processes and make a lot of things take less time than they once did. Also, I don't think the Foundation would be possible without MSFT's existence.
Either way Microsoft is a well oiled machine that can survive without Gates (at least for the next 10yrs or so). The charity is not a mature enterprise that can run itself.