I am just researched out in frustration.

No matter what I do I get an error trying to declare InternetOpen.

#include <WININET.h>
#include <windows.h>

int main()
{

/// Other includes were taken out to keep post small
HINTERNET hInternet = InternetOpen( "TestApp", INTERNET_OPEN_TYPE_PROXY, "www.oebelknives.com",0, INTERNET_FLAG_ASYNC );


//HINTERNET FTPOpen = InternetOpen("DRAXZ AUTH",INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
//IInternetOpen( "TestApp", INTERNET_OPEN_TYPE_PROXY, "prxy.server.com", 158.55.255.251, INTERNET_FLAG_ASYNC );





return 0;
};

No matter how I have changed this around I get a compiler error. I am using DEV-C++ and I couldnt find the WININET.h file so I copied it from my Visual Studio package to the lib directory for DEV. I have tried linking the library file, etc.. Maybe I am doing this wrong, but so far in three compilers this code fails to work the InternetOpen() is not recognized and generates a compile error every time.

Help would be very appreciated I'm burned out now as all my motivation in hopes to connect to my ftp server is blocked by this very problem, and I have searched this issue for hours and my eyes hurt from reading. So please if anyone can fill me that would be great.

1. Don't use that compiler because its too old and use obsolete version of MinGW. Replace it with Code::Blocks

2. You have to download and install the free Microsoft Windows SDK from here.

3. After you do the above, reverse lines 1 and 2 so that windows.h is included before winnet.h because there is stuff in winnet.h that requires stuff from windows.h

I will give this a shot and see how it goes.

Darn almost impossible for me to download since I am limited to an aircard and live in deep texas country LOL.

Any bypass on this at all AD?? I tried getting the files alone but that didnt seem to work either. What makes little since is I have the .lib file linked, I have multiple .dll files when I did a system search for the file. So I have the library already on my machine, but even when I use microsoft visual express 2010 the above code I gave does not work.

I tried using #pragma comment(lib,"wininet") but with no luck either.

any work around on this one you can think of without me DL 1.6gb which would after 5gb for the month throttle my aircard speed.

you can get the sdk on DVD for about $5.00 or so. The SDK doesn't come with VC++ 2010 express.

you can get the sdk on DVD for about $5.00 or so. The SDK doesn't come with VC++ 2010 express.

Yeah I'm going out of my way to a friends with faster bandwidth to download this onto my machine. I will give it a shot and let you know how it all goes.

OK I got it downloaded.
I also installed code blocks which detected the MinGNU compiler of my DEV-C++ compilers package and found nothing more. So I assume here it's using the same out of date compiler functionality as DEV-++ in which you spoke of above???

Anyways I will toy with this, and get back with you AD. Thanks for all the help you have provided.

Yes you are using the same outdated compiler. Uninstall Dev-C++ as well as its compiler, then re-install Code::Blocks and its new compiler.

ANCIENT DRAGON .. YOUR THE BOMB :). I was so frustrated with linker issues. LOL.. I hated code blocks... at first :), but how I ever so love the auto brackets and it's assistance I took so forgranted with DEV-c++. Now I have my game cheats I develop and am dying to share in control. I am using this feature as a simple basic but effective database to share the cheats I made for a game without worrying of my enemy players using them against me all in the while I learned more programming and became of greater market value in the world.

THANKS, you have solved many posts for me AD.

Now so what I have learned and how far I came in a few days time I am sharing in case someone else needs this useful example code.

///////////////////////////////////////////////////////////////////////////////////
///////////////////Developed By: Cody Oebel aka MANEGARD ////////////////////////////
//////////////////////////        A.k.a  DRAXZ       ////////////////////////////
   ///////////////////////////////////////////////////////////////////////////


#include <windows.h>
#include <WinInet.h>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>


using namespace std;
//HINTERNET hInternet;
string GetLocalComputerName();
ifstream in;
ofstream out;

int main()
{
string FoundID;
string AUTH = "5500";
string ALLOW = "1";
string BANNED = "2";
    int nAuth;
    int nComp;
    int nCode;



HINTERNET hInternet;
hInternet = InternetOpen("Testing",INTERNET_OPEN_TYPE_DIRECT,"www.oebelknives.com",0,INTERNET_FLAG_ASYNC);
if(!hInternet) { return 1; }


HINTERNET hFtpSession = InternetConnect(hInternet,"www.oebelknives.com",INTERNET_DEFAULT_FTP_PORT,"SERVERUSERID","MyFTPPassword", INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE,0);
if(!hFtpSession)
{
MessageBox(0,"FAILED TO MAKE INTERNET CONNECTION","Auth Check by Draxz",MB_OK);
}
FtpGetFile(hFtpSession, "BanPass.txt","C:/BanPass.txt",0,0,FTP_TRANSFER_TYPE_BINARY,0);
////Get the computer name//////


string HostName = GetLocalComputerName();
if(HostName == "FAILED2GET")
{
MessageBox(0,"FAILED TO GET COMPUTERS NAME CONTACT DRAXZ","AUTH CHECKER by: DRAXZ",MB_OK|MB_ICONERROR);
return 0;
};


//////Parse through downloaded authorization file////////
in.open("c:/BanPass.txt");
if(in.fail()){MessageBox(0,"Failed to open Authorization file. Program Terminating","AUTH CHECKER by: DRAXZ",MB_OK|MB_ICONERROR);}
string str[1000];
int counter = 0;
while(!in.eof())
{
getline(in,str[counter],'\0');
if(str[counter] == AUTH)
    {  ///////FOUND THE USER ALREADY DATABASED/////////
nAuth = counter;
nComp = nAuth+1;
nCode = nComp+1;
FoundID = str[counter];
    }
  counter++;

};
in.close();

if(FoundID != AUTH)
    {  ///////First Time User Run Code Update File and Upload to ftp site////////
   MessageBox(0,"FIRST TIME USER","AUTH CHECKER by: DRAXZ",MB_OK|MB_ICONERROR);
     out.open("C:/BanPass.txt",ios::app);
     out<<"\n"<<str[nAuth]<<" "<<str[nComp]<<" "<<ALLOW<<endl;
     out.close();
     FtpPutFile(hFtpSession, "C:/BanPass.txt","BanPass.txt", FTP_TRANSFER_TYPE_BINARY, 0);
     goto AUTHORIZED;
    }

///////////////USERS ID WAS FOUND NOW CHECK AUTH CODE////////////////////////////////////
if(str[nComp] != HostName || str[nCode] != ALLOW)
{ /////////YOU ARE BANNED/////////////
in.open("c:/BanPass.txt");
out.open("c:/BanPass2.txt");
if(in.fail())
{
MessageBox(0,"Failed to open Authorization file. Program Terminating","AUTH CHECKER by: DRAXZ",MB_OK|MB_ICONERROR);
return 0;  ////// No connection to the net\or possible attempt to bypass or reverse engineer offline
}

int counter = 0;
while(!in.eof())
{
getline(in,str[counter],'\0');
if(str[counter] == AUTH)
    {
         ///////FOUND THE USER ALREADY DATABASED//////
nAuth = counter;
nComp = nAuth+1;
nCode = nComp+1;
    }
if(counter == nCode)
{
out<<BANNED;
getline(in,str[counter],'\0');
}
else
{
out<<str[counter];
};
  counter++;

};
out.close();
in.close();
FtpPutFile(hFtpSession, "C:/BanPass2.txt","BanPass.txt", FTP_TRANSFER_TYPE_BINARY, 0);

MessageBox(0,"YOU ARE BANNED FOR GIVING OUT MY PROGRAM - Good Day !","AUTH CHECKER by: DRAXZ",MB_OK|MB_ICONERROR);
return 0;
};




AUTHORIZED:


InternetCloseHandle(hFtpSession); // Close hFtpSession
InternetCloseHandle(hInternet); // Close hInternet



    return 0;
}

WoW it's amazing to not program for about a year. Come back look at code you wrote and think "I Wrote That" .... Just to know this whole post was a just a peice of my program for checking users to ensure no one un-authorized was using my MMORPG game hack. I hope others find this code useful .... dont mind the additional code for reading and processing the text file. The meat of the code is how to connect to your ftp and get\put stuff from it, or onto it. I still come back to all my Daniweb posts to remember how I did things. Ancient Dragon you still around? I still remember you as Most Awesome in aiding my adventure to c++ my self learning!

and think "I Wrote That"

Yes, I know that feeling, which is one reason to comment the code. And welcome back :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.