johnsmithz
asked on
how to create resource in dll and use the resource in app?
hi guys:
i am coding a small app,and write a dll (with mfc support) with a lot of text file in it.
i edit thedll.rc with notepad,add all text file in the rc file,such as
10002 TEXTS DISCARDABLE "texts\\10002-first.txt"
in reource.h file,i do nothing.
the resource id is from 10002 to 30002(a huge one :));
my text file is acsii file and not more than 10kb.
in app,i use these code to load resource text:
hRsrc=FindResource(hInstan ce,MAKEINT RESOURCE(1 0002),"TEX TS");
hGlobal = LoadResource(hInstance, hRsrc);
LPVOID pdata = LockResource(hGlobal);
LPBYTE sData = (LPBYTE)pdata;
CString strTemp=(CString)(sData);
FreeResource(hRsrc);
then compiled dll project and app project,all seems ok.
when the app running and load reosurce,sometimes it works fine,but sometimes it loads 2 or more text resources.(it loads 2 or three text files)
why? what's wrong with it?
can anyone tell me?
thank you guys ahead
johns
i am coding a small app,and write a dll (with mfc support) with a lot of text file in it.
i edit thedll.rc with notepad,add all text file in the rc file,such as
10002 TEXTS DISCARDABLE "texts\\10002-first.txt"
in reource.h file,i do nothing.
the resource id is from 10002 to 30002(a huge one :));
my text file is acsii file and not more than 10kb.
in app,i use these code to load resource text:
hRsrc=FindResource(hInstan
hGlobal = LoadResource(hInstance, hRsrc);
LPVOID pdata = LockResource(hGlobal);
LPBYTE sData = (LPBYTE)pdata;
CString strTemp=(CString)(sData);
FreeResource(hRsrc);
then compiled dll project and app project,all seems ok.
when the app running and load reosurce,sometimes it works fine,but sometimes it loads 2 or more text resources.(it loads 2 or three text files)
why? what's wrong with it?
can anyone tell me?
thank you guys ahead
johns
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.