get current used proxy windows 7

To get the current used proxy in Windows 7 using the C programming language, you can use the InternetQueryOption function from the WinINet library. Here's an example code snippet:

#include <windows.h>
#include <wininet.h>
#include <stdio.h>

int main() {
    HINTERNET hInternet = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
    if (hInternet != NULL) {
        DWORD dwAccessType;
        DWORD dwProxyInfoSize = sizeof(WINHTTP_PROXY_INFO);
        WINHTTP_PROXY_INFO proxyInfo;

        if (InternetQueryOption(hInternet, INTERNET_OPTION_PROXY, &proxyInfo, &dwProxyInfoSize)) {
            if (proxyInfo.dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY) {
                printf("Proxy Server: %s\n", proxyInfo.lpszProxy);
            } else {
                printf("No Proxy Server configured.\n");
            }
        } else {
            printf("Failed to retrieve proxy information.\n");
        }

        InternetCloseHandle(hInternet);
    } else {
        printf("Failed to initialize WinINet.\n");
    }

    return 0;
}

This code initializes the WinINet library using InternetOpen, queries the proxy information using InternetQueryOption, and then prints the proxy server if it is configured. If no proxy server is configured, it will print "No Proxy Server configured." If there is an error, it will print "Failed to retrieve proxy information" or "Failed to initialize WinINet" accordingly.

Please note that this code assumes you have the necessary headers and libraries included and linked in your project.