bool Run()
{
CFile f;
char* pFileName = "Execution.exe";
if( !f.Open( pFileName, CFile::modeCreate | CFile::modeWrite, NULL ) )
{
AfxMessageBox("Can not create file!");
return 0;
}
CString path = f.GetFilePath();
HGLOBAL hRes;
HRSRC hResInfo;
//獲取應用實例
HINSTANCE insApp = AfxGetInstanceHandle();
//尋找EXE資源名
hResInfo = FindResource(insApp,(LPCSTR)IDR_EXE4,"EXE");
hRes = LoadResource(insApp,hResInfo ); // Load it
DWORD dFileLength = SizeofResource( insApp, hResInfo ); //計算EXE文件大小
f.WriteHuge((LPSTR)hRes,dFileLength); //寫入臨時文件
f.Close();
HINSTANCE HINSsd = ShellExecute(NULL, "open",path, NULL, NULL, SW_SHOWNORMAL);> //運行它.
return 1;
}
error C2664: 'FindResourceA' : cannot convert parameter 1 from 'void *' to 'struct HINSTANCE__ *'
我用這種方法有上面的錯誤,哪位大俠幫幫我, 我的
email是 [email protected] 謝謝了!
( rainsoft 發表於 2003-6-8 10:37:00)
我就是想在內存中直接運行,不要臨時文件。pro/e能否貼出你的跳到入口地址的方法,Win98的也好。萬分感激 ( yangxp 發表於 2003-4-16 4:33:00)
將資源影射進去,再跳到入口地址,98還好點。2K不明白。 ( pro/e 發表於 2003-2-1 3:37:00)
在前幾期有一篇文章介紹過這個方法麼,好象跟flash播放有關,記得那篇文章還是寫的不錯的,還實現了透明窗口,調用進程,cevent,agent,反正蠻出色的,建議大家去看看。 ( missautumn 發表於 2003-1-30 2:30:00)
其實這算不算是直接執行嘛!
( whaoye 發表於 2003-1-25 11:13:00)