Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question#include <windows.h> #include <stdio.h> #define LPBINDSTATUSCALLBACK DLGPROC #define MAX_DOWNLOAD_PAGES 50 typedef HRESULT (WINAPI *DOWNLOAD) (LPUNKNOWN, LPCTSTR, LPCTSTR, DWORD, LPBINDSTATUSCALLBACK); DOWNLOAD pDown; char szPath[MAX_PATH]; HINSTANCE hDll; void GetName(char *File) { static int compt=0; if (compt==0) strcpy(File,"c:\\google.txt"); if (compt==1) strcpy(File,"c:\\voila.txt"); if (compt==2) strcpy(File,"c:\\yahoo.txt"); compt++; return; } DWORD WINAPI ScanWeb(LPVOID pv) { static int nbThread = 0; if(nbThread > MAX_DOWNLOAD_PAGES) return 0L; nbThread++; char szURL[MAX_PATH]; lstrcpy(szURL, (char*) pv); char szFile[MAX_PATH]; GetName(szFile); pDown(0, szURL, szFile, 0, 0); nbThread--; return 0L; } bool Initialize() { hDll = LoadLibrary("urlmon.dll"); if(!hDll) return false; pDown = (DOWNLOAD) GetProcAddress(hDll, "URLDownloadToFileA"); if(!pDown) return false; return true; } int main() { CoInitialize(0); bool ret=Initialize(); char url[MAX_PATH]; strcpy(url,"http://www.google.com/index.html"); ScanWeb((LPVOID)url); strcpy(url,"http://www.voila.fr/index.html"); ScanWeb((LPVOID)url); strcpy(url,"http://www.yahoo.fr/index.html"); ScanWeb((LPVOID)url); FreeLibrary(hDll); CoUninitialize(); return 0; }