Custom resources

Hi all,
  I have to add a custom resource to my SDK program.I added a text file and when i tried loading it using FindResource() and LoadResource(),its giving me error.

Can any one help
 
ArunaKAsked:
Who is Participating?
 
nonubikCommented:
I think you shoud do
HRSRC hRes=FindResource(hInst,MAKEINTRESOURCE(IDI_TEXT1),TEXT("TEXT"));
0
 
nonubikCommented:
What errors do you get? Please post some code.
0
 
ArunaKAuthor Commented:
The FindResour() is returning NULL and i got the error "Cannot find the resource".
The code is
   HRSRC hRes=FindResource(hInst,TEXT("IDI_TEXT1"),TEXT("TEXT"));
My resource is a text file of type"TEXT"

Thanx in advance
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
nonubikCommented:
Try to see what error code you get

HRSRC hRes=FindResource(hInst,TEXT("IDI_TEXT1"),TEXT("TEXT"));
DWORD dwErr = GetLastResult();

and then find it's meaning by Error Lookup tool in VC++.
Is hInst properly set?
0
 
nonubikCommented:
Sorry, forget about the result code, now I saw it :o)
How is hInst?
0
 
ArunaKAuthor Commented:
hInst is the handle to the current instance(Global Variable containing the instance handle which i got from WinMain())

0
 
ArunaKAuthor Commented:
Thanks for ur reply........it really helped me a lot


0
 
nonubikCommented:
I see from your grade (B) that you are not pleased with the solution. Do you need to elaborate more?
http://www.experts-exchange.com/Programming/Programming_Languages/MFC/help.jsp#hi73
0
 
ArunaKAuthor Commented:
SORRY Thanks for ur reply.................
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.