you should use InternetSetOption() to set proxy information.
INTERNET_PER_CONN_OPTION_LIST List;
INTERNET_PER_CONN_OPTION Option[1];
unsigned long nSize = sizeof(INTERNET_PER_CONN_OPTION_LIST);
Once again, the above sample will change the default (or LAN) settings (List.pszConnection == NULL). In the sample, the "static" proxy server information is changed to "http://myproxy" at port 8080. Similarly you can also change the auto configuration URL:
INTERNET_PER_CONN_OPTION_LIST List;
INTERNET_PER_CONN_OPTION Option[2];
unsigned long nSize = sizeof(INTERNET_PER_CONN_OPTION_LIST);
if(!InternetSetOption(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION, &List, nSize))
printf("InternetQueryOption failed! (%d)\n", GetLastError());
//more detail:
HOWTO: Programmatically Query and Set Proxy Settings Under Internet Explorer