環境: 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;