Select Device Based on IP Address?

Hello,
First, let me apologize "if" this is in the wrong forum! I am trying to figure out how to write an application that will compare IP Addresses (on Windows systems), and select an appropriate device based on this.

For example, if the IP Address starts out with 192.168.100 then set printer1 as the default...else if the IP Address starts out with 192.168.200 set printer2 as the default printer...else set printer3 as the default.

I have found some windows commands to change the default printer:
RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "Adobe PDF"

Which I could probably pass through as follows:
system("RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n \"Adobe PDF\"");

However, I cannot figure out for the life of me how to grab the IP Address and change it into a string. If I was to do an "IPCONFIG" I am not sure how to pull just the IP Address information into a string to be compared? Any thoughts - either a gentle nudge or an all out push would be appreciated at this point! Thanks in advance for any help or pointers you can give me!
Topic archived. No new replies allowed.