To get public IP address just make your web server respond with this information. From your application just connect to the web server and read the response using libcurl or sockets or whatever.
I too had this problem before but sadly that's the way it is. You can use this code snippet to find the Internel\IPv4 Address like IPCONFIG/ALL but not the public IP.
Apart from that you can go with what modoran said: "To get public IP address just make your web server respond with this information. From your application just connect to the web server and read the response using libcurl or sockets or whatever."
i have already have written coding for IPCONFIG/ALL , now i want PUBLIC IP address only BY CONNECTING THROUGH SERVER(Because i have already written the code to get PUBLIC IP through short cut process, but that is not Standard process).
and your suggestion for getting public ip is useful for me thq again.