Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

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
 
0
ArunaK
Asked:
ArunaK
  • 5
  • 4
1 Solution
 
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
 
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
nonubikCommented:
I think you shoud do
HRSRC hRes=FindResource(hInst,MAKEINTRESOURCE(IDI_TEXT1),TEXT("TEXT"));
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

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now