std::string DownloadBytes(const char* const szUrl)
{
HINTERNET hOpen = NULL;
HINTERNET hFile = NULL;
char* lpBuffer = NULL;
DWORD dwBytesRead = 0;
char* data = 0;
DWORD dataSize = 0;
hOpen = InternetOpenA("Majdev&Lov3yp", NULL, NULL, NULL, NULL);
if (!hOpen) return "";
hFile = InternetOpenUrlA(hOpen, szUrl, NULL, NULL, INTERNET_FLAG_RELOAD, NULL);
if (!hFile) {
InternetCloseHandle(hOpen);
return "";
}
std::string output;
do {
char buffer[2000];
InternetReadFile(hFile, (LPVOID)buffer, _countof(buffer), &dwBytesRead);
output.append(buffer, dwBytesRead);
} while (dwBytesRead);
InternetCloseHandle(hFile);
InternetCloseHandle(hOpen);
return output;
}
}
std::string imData;
std::string resimbaglantısıurl = "";
void downloadImage()
{
imData = Preview::DownloadBytes(resimbaglantısıurl .c_str());
D3DXCreateTextureFromFileInMemoryEx(g_D3DDevice9, imData.data(), imData.length(), 50, 31, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &resmadı);
}