Just to chime in, I'm having the same trouble, Windows 7 Ultimate 64-bit - Starcraft freezes within about 5-10 minutes of playing. I've tried the latest patches, latest drivers, processor affinity, in fact pretty much all the things Squall has listed, and I have the exact same trouble.
As I understand it, DirectDraw assumes it can lock the primary draw buffer, and Windows 7 itself draws to the buffer, since so much of the GUI is now done in 3D e.g. Aero. At some point they both try and draw to the buffer at the same time, resulting in a freeze of the display (both programs are waiting for the buffer to be released, neither lets go, and thus you get a classic deadlock due to the inter-process race condition).
XP Compatibility mode achieves nothing sadly - neither does XP Mode, as Squall mentions, the game can't switch display modes under XP Mode.
Having re-read the Windows 7 Compatibility guide that Squall mentions (which I'd read for work but had completely forgotten about), it strikes me that this freezing sounds more and more like a Windows 7 64-bit bug. The default behaviour for Windows 7 is supposed to be, and I quote 'Windows Vista (default): Applications will be able to acquire a lock on the primary video buffer as legacy applications depend on this behavior. Running the application turns off Desktop Window Manager.'
Going by Microsoft's own docs, older applications that lack the Windows 7 Compatibility manifest should be working in this manner, and yet clearly they are not in all cases.
I'll be fascinated to hear if a wrapper DLL can work around the issue.