Solved

Custom resources

Posted on 2004-09-01
9
200 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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 50 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 181
ODBC Connection Logging, ADO.NET 6 64
Updating statistics with error notification email in SQL server 4 94
Capture logon name 13 70
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

776 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