One approach is to use IVI drivers. If you're not familiar with IVI, you might want to go
here for more details, but basically IVI is based on the concept that certain classes of instruments, while having different command sets, have a common set of functions. For example, a DMM from Fluke or one from Agilent would be programmed differently but they both do essentially the same thing. The IVI driver puts those common functions into a high level application layer. With IVI drivers, your program doesn't change at all for different instruments being selected.