[推薦] How to create a DLL from a resource |
|
axsoft
版主 發表:681 回覆:1056 積分:969 註冊:2002-03-13 發送簡訊給我 |
How to create a DLL from a resourceThis code sample shows how to create a DLL from binary data stored in an .exe resources. Also, it shows a small bit on using STL. The .rc file has to be setup something like this: MYDLL DLL MyDll.dll Here is an example of instantiating and calling a function in a DLL created from a resource. alexb::TDllResource tmp = alexb::TDllResource::CreateDLL( HInstance, _T( "MYDLL" ) ); alexb::stdcallTDllProc5 tmp1( HInstance, _T( "MYDLL" ) ); tmp1( "FuncWith_5_Params", "", 1, 1, "", 1 ); If you need different functions ( different as in different number of parameters ), all you do is add more member template functions, using existing ones as an example. Please, send all/any bugs to alexb@jetsuite.com P.S. Originally I indended to delete the DLL file. But, alas, Windows doesn't let me. It keeps the .DLL file locked, event after FreeLibrary. So I changed the code a bit to check if the file exists already. It would be nicer if I could delete the file, but some may say it's better this way. If you find a way to delete a just unloaded DLL, drop me a line. 下載 : http://codecentral.borland.com/codecentral/ccweb.exe/download?id=13540 時間就是金錢---[ 發問前請先找找舊文章] |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |