While still a student, options for working are pretty limited. You could apply for what USICE calls "Curricular Practical Training" (CPT) or "Optional Practical Training" (OPT) -- you can read more here http://en.wikipedia.org/wiki/Optional_Practical_Training or on the USICE website. Success of this route all depends on the approval of your Designated School Official and compliance with the details of the law.
Further complicating matters (even if you consider applying for an H-1B after you're done) is the issue of control of employment. Lawyers I've talked to suggest that the immigration officers look to see that you don't have control over your own employment. While this isn't a problem when you work for a big company, it's definitely a problem if you're a sole founder/self-employed. I guess if you take this literally, then you can legally own at most 50%-1 shares of the company you work for.
In the end, this is all about convincing your school officials and/or US immigration officers that you meet the letter and the spirit of the law. Sadly, good immigration lawyers are probably the best equipped to help you make the case for yourself. I agree that this isn't an ideal state of affairs, which has prompted efforts such as http://startupvisa.com/.