环境:Windows XP SP3、Visual C++ 2010 Express、DLL 模板
我正在尝试将命令行参数传递给我的 dll 函数
示例:“c:\Development>rundll32,getpage.dll,GetPage http://www.google.ca ”
当我传递以下字符串“http://www.google.ca”时,我得到随机数(假设地址位置?)
#include "stdafx.h"
#include <string.h>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <urlmon.h>
#include <tchar.h>
#include <fstream>
using namespace std;
extern "C" __declspec(dllexport) LPCWSTR __cdecl GetPage(LPCWSTR URL);
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ){
return TRUE;
}
LPCWSTR GetPage(LPCWSTR URL){
LPCWSTR status;
HRESULT getpage_status = URLDownloadToFile ( NULL,URL, _TEXT("status.log"), 0, NULL );
/*** Do stuff is working if I pass a static string eg URL = "http://www.google.ca"; I need command line args sent to the function instead***/
return status;