关于dll的小问题
// dll例子.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include <stdio.h>
#include<URLMON.H>
#pragma comment(lib,"URLMON.lib")
int file();
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch ( ul_reason_for_call )
{
case DLL_PROCESS_ATTACH:
{
MessageBox(NULL,"In the Dll", "OK", MB_OK);
file();
}
default:
return TRUE;
}
return TRUE;
}
__declspec(dllexport) int dll()
{
return 1;
}
int file()
{
URLDownloadToFile(NULL,"http://www.baidu.com/img/logo.gif","c:\\1.gif",0,NULL);
return 0;
}
以上的代码编译成功了...但运行了出现了消息框了但是下载不了!!
#include<windows.h>
#include<URLMON.H>
#pragma comment(lib,"URLMON.lib")
int main()
{
URLDownloadToFile(NULL,"http://www.doujindoujin.com/doujin/1216/1216-015/1216-15047.jpg","c:\\2.jpg",0,NULL);
return 0;
}
还有这样编译成EXE就可以运行下载了
请问高手告诉我这是这么回事???