Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Custom resources

Posted on 2004-09-01
9
Medium Priority
?
206 Views
Last Modified: 2013-11-20
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
Comment
Question by:ArunaK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 11949950
What errors do you get? Please post some code.
0
 

Author Comment

by:ArunaK
ID: 11950045
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
 
LVL 16

Expert Comment

by:nonubik
ID: 11950069
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
Technology Partners: 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!

 
LVL 16

Expert Comment

by:nonubik
ID: 11950075
Sorry, forget about the result code, now I saw it :o)
How is hInst?
0
 

Author Comment

by:ArunaK
ID: 11950219
hInst is the handle to the current instance(Global Variable containing the instance handle which i got from WinMain())

0
 
LVL 16

Accepted Solution

by:
nonubik earned 150 total points
ID: 11950280
I think you shoud do
HRSRC hRes=FindResource(hInst,MAKEINTRESOURCE(IDI_TEXT1),TEXT("TEXT"));
0
 

Author Comment

by:ArunaK
ID: 11950401
Thanks for ur reply........it really helped me a lot


0
 
LVL 16

Expert Comment

by:nonubik
ID: 11950423
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
 

Author Comment

by:ArunaK
ID: 12014454
SORRY Thanks for ur reply.................
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question